From 769a35c485ff605cd528a9bfa6eebc07f12da9e2 Mon Sep 17 00:00:00 2001 From: Matthew Davies Date: Fri, 29 Mar 2024 15:04:00 -0700 Subject: [PATCH] Add mqtt status icon in channels with uplink/downlink enabled --- Meshtastic/Views/Helpers/ConnectedDevice.swift | 7 ++++--- Meshtastic/Views/Messages/ChannelMessageList.swift | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Meshtastic/Views/Helpers/ConnectedDevice.swift b/Meshtastic/Views/Helpers/ConnectedDevice.swift index 3a3b6d2a..7e9d1852 100644 --- a/Meshtastic/Views/Helpers/ConnectedDevice.swift +++ b/Meshtastic/Views/Helpers/ConnectedDevice.swift @@ -9,6 +9,7 @@ struct ConnectedDevice: View { var bluetoothOn: Bool var deviceConnected: Bool var name: String + var mqttProxyEnabled: Bool = false var mqttProxyConnected: Bool = false var phoneOnly: Bool = false @@ -18,11 +19,11 @@ struct ConnectedDevice: View { if (phoneOnly && UIDevice.current.userInterfaceIdiom == .phone) || !phoneOnly { if bluetoothOn { - if deviceConnected && mqttProxyConnected { - if mqttProxyConnected { + if deviceConnected && (mqttProxyEnabled || mqttProxyConnected) { + if (mqttProxyConnected || mqttProxyEnabled) { Image(systemName: "iphone.gen3.radiowaves.left.and.right.circle.fill") .imageScale(.large) - .foregroundColor(.green) + .foregroundColor(mqttProxyConnected ? .green : .gray) .symbolRenderingMode(.hierarchical) } } diff --git a/Meshtastic/Views/Messages/ChannelMessageList.swift b/Meshtastic/Views/Messages/ChannelMessageList.swift index 22438b6c..234d705a 100644 --- a/Meshtastic/Views/Messages/ChannelMessageList.swift +++ b/Meshtastic/Views/Messages/ChannelMessageList.swift @@ -156,7 +156,10 @@ struct ChannelMessageList: View { ConnectedDevice( bluetoothOn: bleManager.isSwitchedOn, deviceConnected: bleManager.connectedPeripheral != nil, - name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.shortName : "?") + name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.shortName : "?", + mqttProxyEnabled: channel.uplinkEnabled || channel.downlinkEnabled, + mqttProxyConnected: channel.uplinkEnabled || channel.downlinkEnabled ? bleManager.mqttProxyConnected : false + ) } } }