mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
feat: initialized a new State widget for the Network module (#1082)
This commit is contained in:
@@ -151,7 +151,7 @@ public class Network: Module {
|
||||
}
|
||||
|
||||
self.connectivityReader?.callbackHandler = { [unowned self] value in
|
||||
self.popupView.connectivityCallback(value)
|
||||
self.connectivityCallback(value)
|
||||
}
|
||||
|
||||
self.settingsView.callback = { [unowned self] in
|
||||
@@ -211,6 +211,19 @@ public class Network: Module {
|
||||
}
|
||||
}
|
||||
|
||||
private func connectivityCallback(_ raw: Bool?) {
|
||||
guard let value = raw, self.enabled else { return }
|
||||
|
||||
self.popupView.connectivityCallback(value)
|
||||
|
||||
self.menuBar.widgets.filter{ $0.isActive }.forEach { (w: Widget) in
|
||||
switch w.item {
|
||||
case let widget as StateWidget: widget.setValue(value)
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func setIPUpdater() {
|
||||
self.ipUpdater.interval = 60 * 60
|
||||
self.ipUpdater.repeats = true
|
||||
|
||||
Reference in New Issue
Block a user