mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
fix network reader after reconnection to the network
This commit is contained in:
@@ -147,7 +147,7 @@ internal class Popup: NSView {
|
||||
|
||||
public func usageCallback(_ value: Usage) {
|
||||
DispatchQueue.main.async(execute: {
|
||||
if !self.window!.isVisible && self.initialized {
|
||||
if !self.window!.isVisible && self.initialized && value.active {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -32,12 +32,10 @@ internal class UsageReader: Reader<Usage> {
|
||||
|
||||
self.reachability!.whenReachable = { _ in
|
||||
self.readInformation()
|
||||
self.start()
|
||||
}
|
||||
self.reachability!.whenUnreachable = { _ in
|
||||
self.usage.reset()
|
||||
self.callback(self.usage)
|
||||
self.stop()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user