mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
fix: added additional listener for Dashboard uptime to handle updates when open from the Combined view (#2569)
This commit is contained in:
@@ -193,6 +193,7 @@ class Dashboard: NSStackView {
|
||||
self.addArrangedSubview(scrollView)
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(windowOpens), name: .openModuleSettings, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(windowOpens), name: .toggleSettings, object: nil)
|
||||
}
|
||||
|
||||
required public init?(coder: NSCoder) {
|
||||
@@ -201,6 +202,7 @@ class Dashboard: NSStackView {
|
||||
|
||||
deinit {
|
||||
NotificationCenter.default.removeObserver(self, name: .openModuleSettings, object: nil)
|
||||
NotificationCenter.default.removeObserver(self, name: .toggleSettings, object: nil)
|
||||
}
|
||||
|
||||
private func deviceView() -> NSView {
|
||||
@@ -238,7 +240,7 @@ class Dashboard: NSStackView {
|
||||
}
|
||||
|
||||
@objc private func windowOpens(_ notification: Notification) {
|
||||
guard notification.userInfo?["module"] as? String == "Dashboard" else { return }
|
||||
guard let moduleName = notification.userInfo?["module"] as? String, moduleName == "Dashboard" || moduleName == "Combined modules" else { return }
|
||||
self.uptimeField?.stringValue = self.uptimeValue
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user