MQTT interval default, remove orphaned code

This commit is contained in:
Garth Vander Houwen 2025-05-22 08:19:19 -07:00
parent b962c68ac2
commit 9ecfe6a3e7
2 changed files with 7 additions and 46 deletions

View file

@ -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)")
}

View file

@ -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