From c29c515ab57f87ef6c2c06761fc7702c0b92cf23 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Tue, 11 Feb 2025 11:52:37 -0800 Subject: [PATCH] Hide json setting from proxy --- .../Views/Settings/Config/Module/MQTTConfig.swift | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift b/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift index 796a7ce0..d840d1e1 100644 --- a/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift +++ b/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift @@ -82,11 +82,13 @@ struct MQTTConfig: View { } .toggleStyle(SwitchToggleStyle(tint: .accentColor)) - Toggle(isOn: $jsonEnabled) { - Label("JSON Enabled", systemImage: "ellipsis.curlybraces") - Text("JSON mode is a limited, unencrypted MQTT output for locally integrating with home assistant") + if !proxyToClientEnabled { + Toggle(isOn: $jsonEnabled) { + Label("JSON Enabled", systemImage: "ellipsis.curlybraces") + Text("JSON mode is a limited, unencrypted MQTT output for locally integrating with home assistant") + } + .toggleStyle(SwitchToggleStyle(tint: .accentColor)) } - .toggleStyle(SwitchToggleStyle(tint: .accentColor)) } Section(header: Text("Map Report")) { @@ -276,7 +278,7 @@ struct MQTTConfig: View { } if newProxyToClientEnabled != node?.mqttConfig?.proxyToClientEnabled { hasChanges = true } } - .onChange(of: address) { _, newAddress in + .onChange(of: address) { newAddress in if newAddress != node?.mqttConfig?.address ?? "" { hasChanges = true } } .onChange(of: username) { newUsername in @@ -285,7 +287,7 @@ struct MQTTConfig: View { .onChange(of: password) { newPassword in if newPassword != node?.mqttConfig?.password ?? "" { hasChanges = true } } - .onChange(of: root) { newRoot in + .onChange(of: root) { _, newRoot in if newRoot != node?.mqttConfig?.root ?? "" { hasChanges = true } } .onChange(of: selectedTopic) { _, newSelectedTopic in