|
@@ -99,6 +99,7 @@ import Cocoa
|
|
|
|
|
|
var currentController: NSWindowController?
|
|
|
deinit {
|
|
|
+ NotificationCenter.default.removeObserver(self)
|
|
|
}
|
|
|
|
|
|
override func viewWillAppear() {
|
|
@@ -138,9 +139,10 @@ import Cocoa
|
|
|
self.setup()
|
|
|
// refreshUI()
|
|
|
self.updateUI()
|
|
|
+ self.changeEffectiveAppearance()
|
|
|
|
|
|
NotificationCenter.default.addObserver(self, selector: #selector(homeFileRectChange(_:)), name: Notification.Name("KMHomeFileRectChange"), object: nil)
|
|
|
-
|
|
|
+ NotificationCenter.default.addObserver(self, selector: #selector(changeEffectiveAppearance), name: NSNotification.Name(rawValue: "kEffectiveAppearance"), object: nil)
|
|
|
// setAppearance(isDarkMode: KMAdvertisementConfig.isDarkModel())
|
|
|
// NotificationCenter.default.addObserver(self, selector: #selector(appearanceChanged), name: NSNotification.Name(NSApplication.didUpdateNotification.rawValue), object: nil)
|
|
|
// NotificationCenter.default.addObserver(self, selector: #selector(appearanceChanged), name: NSNotification.Name(NSWindow.didBecomeMainNotification.rawValue), object: nil)
|
|
@@ -380,6 +382,17 @@ import Cocoa
|
|
|
self.homeSplitView.backgroundColor(KMAppearance.Layout.l0Color())
|
|
|
}
|
|
|
|
|
|
+ @objc func changeEffectiveAppearance() {
|
|
|
+ let isDarkModel = KMAdvertisementConfig.isDarkModel()
|
|
|
+ if isDarkModel {
|
|
|
+ self.view.appearance = NSAppearance(named: .darkAqua)
|
|
|
+ } else {
|
|
|
+ self.view.appearance = NSAppearance(named: .aqua)
|
|
|
+ }
|
|
|
+ self.updateUI()
|
|
|
+ self.advertisementTableView.reloadData()
|
|
|
+ }
|
|
|
+
|
|
|
// MARK: Public Methods
|
|
|
|
|
|
func savePDFDocument(_ pdf: CPDFDocument, password: String) -> Void {
|