From 78095caf08cfe185524ba7b1c2f5656e600c7f0b Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Tue, 26 Mar 2024 19:49:30 -0700 Subject: [PATCH] Fix firmware version comparison, filter the node list when it appears --- Meshtastic/Helpers/Mqtt/MqttClientProxyManager.swift | 7 ++++--- Meshtastic/Views/Nodes/NodeList.swift | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Meshtastic/Helpers/Mqtt/MqttClientProxyManager.swift b/Meshtastic/Helpers/Mqtt/MqttClientProxyManager.swift index 5a1a33d4..80555aea 100644 --- a/Meshtastic/Helpers/Mqtt/MqttClientProxyManager.swift +++ b/Meshtastic/Helpers/Mqtt/MqttClientProxyManager.swift @@ -36,8 +36,9 @@ class MqttClientProxyManager { defaultServerPort = Int(fullHost.components(separatedBy: ":")[1]) ?? (useSsl ? 8883 : 1883) } } - let minimumVersion = "2.3.0" - let latestVersion = minimumVersion.compare(UserDefaults.firmwareVersion, options: .numeric) == .orderedSame + let minimumVersion = "2.3.3" + let currentVersion = UserDefaults.firmwareVersion + let supportedVersion = minimumVersion.compare(currentVersion, options: .numeric) == .orderedAscending || minimumVersion.compare(currentVersion, options: .numeric) == .orderedSame if let host = host { let port = defaultServerPort @@ -45,7 +46,7 @@ class MqttClientProxyManager { let password = node.mqttConfig?.password let root = node.mqttConfig?.root?.count ?? 0 > 0 ? node.mqttConfig?.root : "msh" let prefix = root! - topic = prefix + (latestVersion ? "/2/e" : "/2/c") + "/#" + topic = prefix + (supportedVersion ? "/2/e" : "/2/c") + "/#" let qos = CocoaMQTTQoS(rawValue: UInt8(1))! connect(host: host, port: port, useSsl: useSsl, username: username, password: password, topic: topic, qos: qos, cleanSession: true) } diff --git a/Meshtastic/Views/Nodes/NodeList.swift b/Meshtastic/Views/Nodes/NodeList.swift index a750658b..8a63d2a9 100644 --- a/Meshtastic/Views/Nodes/NodeList.swift +++ b/Meshtastic/Views/Nodes/NodeList.swift @@ -267,6 +267,7 @@ struct NodeList: View { if self.bleManager.context == nil { self.bleManager.context = context } + searchNodeList() } }