From d07da6298bd03ad1ca608b4f7fd2a57231e44c91 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Tue, 3 Oct 2023 08:41:44 -0700 Subject: [PATCH] New smaller style for node history pins --- .../Views/Nodes/Helpers/NodeMapSwiftUI.swift | 16 +++++------ .../Settings/Config/Module/MQTTConfig.swift | 28 +++++++++++++------ .../Settings/Config/Module/StoreForward.swift | 2 +- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/Meshtastic/Views/Nodes/Helpers/NodeMapSwiftUI.swift b/Meshtastic/Views/Nodes/Helpers/NodeMapSwiftUI.swift index d3186df8..c46bf16b 100644 --- a/Meshtastic/Views/Nodes/Helpers/NodeMapSwiftUI.swift +++ b/Meshtastic/Views/Nodes/Helpers/NodeMapSwiftUI.swift @@ -156,17 +156,18 @@ struct NodeMapSwiftUI: View { if showNodeHistory { if pf.contains(.Heading) { Image(systemName: pf.contains(.Speed) && position.speed > 1 ? "location.north.circle" : "hexagon") - .padding(2) - .foregroundStyle(Color(UIColor(hex: UInt32(node.num)).lighter()).isLight() ? .black : .white) + .foregroundStyle(Color(UIColor(hex: UInt32(node.num))).isLight() ? .black : .white) .background(Color(UIColor(hex: UInt32(node.num)).lighter())) .clipShape(Circle()) .rotationEffect(headingDegrees) + .resizable() + .scaledToFit() + .frame(width: 16, height: 16) } else { - Image(systemName: "mappin.circle") - .padding(2) - .foregroundStyle(Color(UIColor(hex: UInt32(node.num)).lighter()).isLight() ? .black : .white) - .background(Color(UIColor(hex: UInt32(node.num)).lighter())) - .clipShape(Circle()) + Circle() + .fill(Color(UIColor(hex: UInt32(node.num)).lighter())) + .strokeBorder(Color(UIColor(hex: UInt32(node.num))).isLight() ? .black : .white ,lineWidth: 2) + .frame(width: 12, height: 12) } } } @@ -201,7 +202,6 @@ struct NodeMapSwiftUI: View { } } .popover(item: $selectedWaypoint, attachmentAnchor: .rect(.rect(selectedWaypointRect)), arrowEdge: .bottom) { selection in - //.popover(isPresented: $showingWaypointPopover, arrowEdge: .bottom) { WaypointPopover(waypoint: selection) .padding() .opacity(0.8) diff --git a/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift b/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift index b9d9a190..4dc48c27 100644 --- a/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift +++ b/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift @@ -19,7 +19,7 @@ struct MQTTConfig: View { @State var address = "" @State var username = "" @State var password = "" - @State var encryptionEnabled = false + @State var encryptionEnabled = true @State var jsonEnabled = false @State var tlsEnabled = true @State var root = "msh" @@ -63,7 +63,7 @@ struct MQTTConfig: View { Label("mqtt.clientproxy", systemImage: "iphone.radiowaves.left.and.right") } .toggleStyle(SwitchToggleStyle(tint: .accentColor)) - Text("If both MQTT and the client proxy are enabled your device will utalize an available network connection to connect to the specified MQTT server.") + Text("If both MQTT and the client proxy are enabled your mobile device will utalize an available network connection to connect to the specified MQTT server.") .font(.caption2) Toggle(isOn: $encryptionEnabled) { @@ -71,17 +71,22 @@ struct MQTTConfig: View { Label("Encryption Enabled", systemImage: "lock.icloud") } .toggleStyle(SwitchToggleStyle(tint: .accentColor)) - - Toggle(isOn: $tlsEnabled) { - - Label("TLS Enabled", systemImage: "checkmark.shield.fill") - } - .toggleStyle(SwitchToggleStyle(tint: .accentColor)) + Toggle(isOn: $jsonEnabled) { Label("JSON Enabled", systemImage: "ellipsis.curlybraces") } .toggleStyle(SwitchToggleStyle(tint: .accentColor)) + Text("JSON mode is a limited, unencrypted MQTT output.") + .font(.caption2) + + Toggle(isOn: $tlsEnabled) { + + Label("TLS Enabled", systemImage: "checkmark.shield.fill") + } + .toggleStyle(SwitchToggleStyle(tint: .accentColor)) + Text("Your MQTT Server must support TLS.") + .font(.caption2) } Section(header: Text("Custom Server")) { HStack { @@ -284,11 +289,18 @@ struct MQTTConfig: View { .onChange(of: encryptionEnabled) { newEncryptionEnabled in if node != nil && node?.mqttConfig != nil { if newEncryptionEnabled != node!.mqttConfig!.encryptionEnabled { hasChanges = true } + if newEncryptionEnabled { + jsonEnabled = false + } } } .onChange(of: jsonEnabled) { newJsonEnabled in if node != nil && node?.mqttConfig != nil { if newJsonEnabled != node!.mqttConfig!.jsonEnabled { hasChanges = true } + + if newJsonEnabled { + encryptionEnabled = false + } } } .onChange(of: tlsEnabled) { newTlsEnabled in diff --git a/Meshtastic/Views/Settings/Config/Module/StoreForward.swift b/Meshtastic/Views/Settings/Config/Module/StoreForward.swift index fe28c841..d1b22798 100644 --- a/Meshtastic/Views/Settings/Config/Module/StoreForward.swift +++ b/Meshtastic/Views/Settings/Config/Module/StoreForward.swift @@ -91,7 +91,7 @@ struct StoreForwardConfig: View { } } .scrollDismissesKeyboard(.interactively) - .disabled(self.bleManager.connectedPeripheral == nil || node?.detectionSensorConfig == nil) + .disabled(self.bleManager.connectedPeripheral == nil || node?.storeForwardConfig == nil) Button { isPresentingSaveConfirm = true