From 9ecfe6a3e7b249dc9248cd6a456d97079670cb0f Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Thu, 22 May 2025 08:19:19 -0700 Subject: [PATCH] MQTT interval default, remove orphaned code --- Meshtastic/Views/Bluetooth/Connect.swift | 45 +------------------ .../Settings/Config/Module/MQTTConfig.swift | 8 +++- 2 files changed, 7 insertions(+), 46 deletions(-) diff --git a/Meshtastic/Views/Bluetooth/Connect.swift b/Meshtastic/Views/Bluetooth/Connect.swift index 2ff00669..a804a77d 100644 --- a/Meshtastic/Views/Bluetooth/Connect.swift +++ b/Meshtastic/Views/Bluetooth/Connect.swift @@ -26,10 +26,6 @@ struct Connect: View { @State var liveActivityStarted = false @State var presentingSwitchPreferredPeripheral = false @State var selectedPeripherialId = "" - @State private var showSwipeDemo = false - @State private var swipeDemoOffset: CGFloat = 0 - @State private var showDeleteButton: Bool = false - @AppStorage("hasSeenSwipeDemo") private var hasSeenSwipeDemo = false init () { let notificationCenter = UNUserNotificationCenter.current() @@ -93,28 +89,6 @@ struct Connect: View { .font(.caption) .foregroundColor(Color.gray) .padding([.top]) - .offset(x: swipeDemoOffset) - .overlay( - GeometryReader { geometry in - ZStack { - Rectangle() - .foregroundColor(.red) - .frame(width: 80) - .offset(x: geometry.size.width - 80) - VStack { - Image(systemName: "antenna.radiowaves.left.and.right.slash") - .foregroundColor(.white) - .font(.title3) - Text("Disconnect") - .foregroundColor(.white) - .font(.caption) - } - } - .offset(x: geometry.size.width - 50) - - .opacity(showDeleteButton ? 1 : 0) - } - ) .swipeActions { Button(role: .destructive) { if let connectedPeripheral = bleManager.connectedPeripheral, @@ -149,7 +123,7 @@ struct Connect: View { Text("Short Name: \(node?.user?.shortName ?? "?")") Text("Long Name: \(node?.user?.longName?.addingVariationSelectors ?? "Unknown".localized)") Text("BLE RSSI: \(connectedPeripheral.rssi)") - + Button(role: .destructive) { if let connectedPeripheral = bleManager.connectedPeripheral, connectedPeripheral.peripheral.state == .connected { @@ -357,23 +331,6 @@ struct Connect: View { } else { isUnsetRegion = false } - // Show swipe demo if user hasn't seen it before and we're connected - if !hasSeenSwipeDemo && bleManager.isSubscribed && node != nil { - DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { - withAnimation(.easeInOut(duration: 0.6)) { - swipeDemoOffset = -80 - showDeleteButton = true - } - DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) { - withAnimation(.easeInOut(duration: 0.6)) { - swipeDemoOffset = 0 - showDeleteButton = false - } - // Mark as seen so it doesn't appear again - hasSeenSwipeDemo = true - } - } - } } catch { Logger.data.error("💥 Error fetching node info: \(error.localizedDescription, privacy: .public)") } diff --git a/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift b/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift index 5506dde3..f06cf45c 100644 --- a/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift +++ b/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift @@ -112,7 +112,6 @@ struct MQTTConfig: View { Label("I have read and understand the above. I voluntarily consent to the unencrypted transmission of my node data via MQTT.", systemImage: "hand.raised") .foregroundColor(.gray) .font(.callout) - } .toggleStyle(SwitchToggleStyle(tint: .accentColor)) } @@ -429,8 +428,13 @@ struct MQTTConfig: View { self.tlsEnabled = node?.mqttConfig?.tlsEnabled ?? false self.mqttConnected = bleManager.mqttProxyConnected self.mapReportingEnabled = node?.mqttConfig?.mapReportingEnabled ?? false - self.mapPublishIntervalSecs = Int(node?.mqttConfig?.mapPublishIntervalSecs ?? 3600) + if node?.mqttConfig?.mapPublishIntervalSecs ?? 0 < 3600 { + self.mapPublishIntervalSecs = 3600 + } else { + self.mapPublishIntervalSecs = Int(node?.mqttConfig?.mapPublishIntervalSecs ?? 3600) + } self.mapPositionPrecision = Double(node?.mqttConfig?.mapPositionPrecision ?? 14) + self.mapReportingOptIn = UserDefaults.mapReportingOptIn if mapPositionPrecision < 11 || mapPositionPrecision > 14 { self.mapPositionPrecision = 14 self.hasChanges = true