fix: added additional listener for Dashboard uptime to handle updates when open from the Combined view (#2569)

This commit is contained in:
Serhiy Mytrovtsiy
2025-06-06 18:23:18 +02:00
parent 1c8383d129
commit 34dc9cf2be

View File

@@ -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
}
}