Fix status refresh
This commit is contained in:
@@ -273,11 +273,16 @@ public class CommandClient: ObservableObject {
|
|||||||
func writeStatus(_ message: LibboxStatusMessage?) {
|
func writeStatus(_ message: LibboxStatusMessage?) {
|
||||||
DispatchQueue.main.async { [self] in
|
DispatchQueue.main.async { [self] in
|
||||||
commandClient.status = message
|
commandClient.status = message
|
||||||
if let message = message, message.trafficAvailable {
|
if let message, message.trafficAvailable {
|
||||||
commandClient.uplinkHistory.removeFirst()
|
var newUplink = commandClient.uplinkHistory
|
||||||
commandClient.uplinkHistory.append(CGFloat(message.uplink))
|
newUplink.removeFirst()
|
||||||
commandClient.downlinkHistory.removeFirst()
|
newUplink.append(CGFloat(message.uplink))
|
||||||
commandClient.downlinkHistory.append(CGFloat(message.downlink))
|
commandClient.uplinkHistory = newUplink
|
||||||
|
|
||||||
|
var newDownlink = commandClient.downlinkHistory
|
||||||
|
newDownlink.removeFirst()
|
||||||
|
newDownlink.append(CGFloat(message.downlink))
|
||||||
|
commandClient.downlinkHistory = newDownlink
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user