From f3ab29cda756c811ce8cd69879c50764fe263eb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sat, 6 Dec 2025 22:01:44 +0800 Subject: [PATCH] Fix status refresh --- Library/Network/CommandClient.swift | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Library/Network/CommandClient.swift b/Library/Network/CommandClient.swift index 4fe0427..52ee192 100644 --- a/Library/Network/CommandClient.swift +++ b/Library/Network/CommandClient.swift @@ -273,11 +273,16 @@ public class CommandClient: ObservableObject { func writeStatus(_ message: LibboxStatusMessage?) { DispatchQueue.main.async { [self] in commandClient.status = message - if let message = message, message.trafficAvailable { - commandClient.uplinkHistory.removeFirst() - commandClient.uplinkHistory.append(CGFloat(message.uplink)) - commandClient.downlinkHistory.removeFirst() - commandClient.downlinkHistory.append(CGFloat(message.downlink)) + if let message, message.trafficAvailable { + var newUplink = commandClient.uplinkHistory + newUplink.removeFirst() + newUplink.append(CGFloat(message.uplink)) + commandClient.uplinkHistory = newUplink + + var newDownlink = commandClient.downlinkHistory + newDownlink.removeFirst() + newDownlink.append(CGFloat(message.downlink)) + commandClient.downlinkHistory = newDownlink } } }