feat: initialized a new State widget for the Network module (#1082)

This commit is contained in:
Serhiy Mytrovtsiy
2022-09-19 17:15:21 +02:00
parent 58ed285d2d
commit 8524448192
5 changed files with 95 additions and 1 deletions

View File

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