mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
fix: hidden latency value when network is down (#1950)
This commit is contained in:
@@ -468,13 +468,15 @@ internal class Popup: PopupWrapper {
|
||||
DispatchQueue.main.async(execute: {
|
||||
if (self.window?.isVisible ?? false) || !self.connectionInitialized {
|
||||
var text = "Unknown"
|
||||
var latency = localizedString("Unknown")
|
||||
if let v = value {
|
||||
text = v.status ? "UP" : "DOWN"
|
||||
if v.status && !self.latency.isEmpty {
|
||||
latency = "\((self.latency.reduce(0, +) / Double(self.latency.count)).rounded(toPlaces: 2)) ms"
|
||||
}
|
||||
}
|
||||
self.connectivityField?.stringValue = localizedString(text)
|
||||
if !self.latency.isEmpty {
|
||||
self.latencyField?.stringValue = "\((self.latency.reduce(0, +) / Double(self.latency.count)).rounded(toPlaces: 2)) ms"
|
||||
}
|
||||
self.latencyField?.stringValue = latency
|
||||
self.connectionInitialized = true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user