From e95ccee52eabe0c4edbcbf7ec780bcce0358e0b9 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Mon, 2 Jan 2023 01:27:57 -0800 Subject: [PATCH] A couple more localized strings, filter out default location for distance text on node list --- Meshtastic/Helpers/BLEManager.swift | 2 +- Meshtastic/Views/Bluetooth/Connect.swift | 2 +- Meshtastic/Views/Helpers/ConnectedDevice.swift | 2 +- Meshtastic/Views/Nodes/DeviceMetricsLog.swift | 12 ++++++------ Meshtastic/Views/Nodes/NodeList.swift | 2 +- Meshtastic/Views/Settings/Settings.swift | 7 ------- de.lproj/Localizable.strings | 4 ++++ en.lproj/Localizable.strings | 4 ++++ 8 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index 0369d2a4..e1cbaec9 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -93,7 +93,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject { self.timeoutTimerCount += 1 self.lastConnectionError = "" - if timeoutTimerCount == 2 { + if timeoutTimerCount == 10 { if connectedPeripheral != nil { self.centralManager?.cancelPeripheralConnection(connectedPeripheral.peripheral) } diff --git a/Meshtastic/Views/Bluetooth/Connect.swift b/Meshtastic/Views/Bluetooth/Connect.swift index 87655736..7094441d 100644 --- a/Meshtastic/Views/Bluetooth/Connect.swift +++ b/Meshtastic/Views/Bluetooth/Connect.swift @@ -194,7 +194,7 @@ struct Connect: View { } } else { - Text("Bluetooth: OFF") + Text("bluetooth.off") .foregroundColor(.red) .font(.title) } diff --git a/Meshtastic/Views/Helpers/ConnectedDevice.swift b/Meshtastic/Views/Helpers/ConnectedDevice.swift index e3552229..ce0f5e66 100644 --- a/Meshtastic/Views/Helpers/ConnectedDevice.swift +++ b/Meshtastic/Views/Helpers/ConnectedDevice.swift @@ -30,7 +30,7 @@ struct ConnectedDevice: View { } } else { - Text("Bluetooth Off").font(.subheadline).foregroundColor(.red) + Text("bluetooth.off").font(.subheadline).foregroundColor(.red) } } } diff --git a/Meshtastic/Views/Nodes/DeviceMetricsLog.swift b/Meshtastic/Views/Nodes/DeviceMetricsLog.swift index a6ac960b..0925335d 100644 --- a/Meshtastic/Views/Nodes/DeviceMetricsLog.swift +++ b/Meshtastic/Views/Nodes/DeviceMetricsLog.swift @@ -134,7 +134,7 @@ struct DeviceMetricsLog: View { Button(role: .destructive) { isPresentingClearLogConfirm = true } label: { - Label("Clear Log", systemImage: "trash.fill") + Label("clear.log", systemImage: "trash.fill") } .buttonStyle(.bordered) .buttonBorderShape(.capsule) @@ -145,7 +145,7 @@ struct DeviceMetricsLog: View { isPresented: $isPresentingClearLogConfirm, titleVisibility: .visible ) { - Button("Delete all device metrics?", role: .destructive) { + Button("device.metrics.delete", role: .destructive) { if clearTelemetry(destNum: node.num, metricsType: 0, context: context) { print("Cleared Device Metrics for \(node.num)") } else { @@ -164,7 +164,7 @@ struct DeviceMetricsLog: View { .controlSize(.large) .padding() } - .navigationTitle("Device Metrics Log") + .navigationTitle("device.metrics.log") .navigationBarTitleDisplayMode(.inline) .navigationBarItems(trailing: ZStack { @@ -177,14 +177,14 @@ struct DeviceMetricsLog: View { isPresented: $isExporting, document: CsvDocument(emptyCsv: exportString), contentType: .commaSeparatedText, - defaultFilename: String("\(node.user!.longName ?? "Node") Device Telemetry Log"), + defaultFilename: String("\(node.user!.longName ?? "Node") \(NSLocalizedString("device.metrics.log", comment: "Device Metrics Log"))"), onCompletion: { result in if case .success = result { - print("Device Telemetry log download succeeded.") + print("Device metrics log download succeeded.") self.isExporting = false } else { - print("Device Telemetry log download failed: \(result).") + print("Device metrics log download failed: \(result).") } } ) diff --git a/Meshtastic/Views/Nodes/NodeList.swift b/Meshtastic/Views/Nodes/NodeList.swift index d8c16f25..1925c767 100644 --- a/Meshtastic/Views/Nodes/NodeList.swift +++ b/Meshtastic/Views/Nodes/NodeList.swift @@ -53,7 +53,7 @@ struct NodeList: View { HStack(alignment: .bottom) { let lastPostion = node.positions!.reversed()[0] as! PositionEntity let myCoord = CLLocation(latitude: LocationHelper.currentLocation.latitude, longitude: LocationHelper.currentLocation.longitude) - if lastPostion.coordinate != nil { + if lastPostion.coordinate != nil && myCoord.coordinate.longitude != LocationHelper.DefaultLocation.longitude && myCoord.coordinate.latitude != LocationHelper.DefaultLocation.latitude { let nodeCoord = CLLocation(latitude: lastPostion.coordinate!.latitude, longitude: lastPostion.coordinate!.longitude) let metersAway = nodeCoord.distance(from: myCoord) Image(systemName: "lines.measurement.horizontal") diff --git a/Meshtastic/Views/Settings/Settings.swift b/Meshtastic/Views/Settings/Settings.swift index b48411ea..d4728fc1 100644 --- a/Meshtastic/Views/Settings/Settings.swift +++ b/Meshtastic/Views/Settings/Settings.swift @@ -177,15 +177,10 @@ struct Settings: View { Text("admin.log") } } - Section(header: Text("about")) { - NavigationLink { - AboutMeshtastic() - } label: { - Image(systemName: "questionmark.app") .symbolRenderingMode(.hierarchical) @@ -194,10 +189,8 @@ struct Settings: View { } } .onAppear { - self.bleManager.context = context self.bleManager.userSettings = userSettings - } .listStyle(GroupedListStyle()) .navigationTitle("settings") diff --git a/de.lproj/Localizable.strings b/de.lproj/Localizable.strings index 07a91d39..e96c869b 100644 --- a/de.lproj/Localizable.strings +++ b/de.lproj/Localizable.strings @@ -25,6 +25,7 @@ "ble.errorcode.14 %@"="%@ This error usually cannot be fixed without forgetting the device unders Settings > Bluetooth and re-connecting to the radio."; "ble.errorcode.pin %@"="%@ Please try connecting again and check the PIN carefully."; "bluetooth"="Bluetooth"; +"bluetooth.off"="Bluetooth is off"; "bluetooth.config"="Bluetooth Konfiguration"; "bluetooth.mode.randompin"="Zufällige PIN"; "bluetooth.mode.fixedpin"="Feste PIN"; @@ -45,6 +46,7 @@ "channel.utilization"="Channel Utilization"; "channels"="Kanäle"; "clear.app.data"="App Daten löschen"; +"clear.log"="Clear Log"; "close"="Close"; "config.save.confirm"="After config values save the node will reboot."; "connected.radio"="Verbundenes Gerät"; @@ -58,6 +60,8 @@ "delete"="Löschen"; "device"="Gerät"; "device.config"="Gerätekonfiguration"; +"device.metrics.delete"="Delete all device metrics?"; +"device.metrics.log"="Device Metrics Log"; "device.role.client"="Client (Standard) - Mit App verbundener Client."; "device.role.clientmute"="Client Leise - Das selbe wie Client, außer das die Pakete nicht über diesen Node weitergeleitet werden. Nimmt nicht am Mesh-Routing teil."; "device.role.router"="Router - Mesh Pakete werden bevorzugt über diesen Node gerouted. Dieser Node wird nicht von einer Client App benutzt. WLAN, Bluetooth und Display sind aus."; diff --git a/en.lproj/Localizable.strings b/en.lproj/Localizable.strings index a2c58ba0..26240362 100644 --- a/en.lproj/Localizable.strings +++ b/en.lproj/Localizable.strings @@ -25,6 +25,7 @@ "ble.errorcode.14 %@"="%@ This error usually cannot be fixed without forgetting the device unders Settings > Bluetooth and re-connecting to the radio."; "ble.errorcode.pin %@"="%@ Please try connecting again and check the PIN carefully."; "bluetooth"="Bluetooth"; +"bluetooth.off"="Bluetooth is off"; "bluetooth.config"="Bluetooth Config"; "bluetooth.mode.randompin"="Random PIN"; "bluetooth.mode.fixedpin"="Fixed PIN"; @@ -45,6 +46,7 @@ "channel.utilization"="Channel Utilization"; "channels"="Channels"; "clear.app.data"="Clear App Data"; +"clear.log"="Clear Log"; "close"="Close"; "config.save.confirm"="After config values save the node will reboot."; "connected.radio"="Connected Radio"; @@ -58,6 +60,8 @@ "delete"="Delete"; "device"="Device"; "device.config"="Device Config"; +"device.metrics.delete"="Delete all device metrics?"; +"device.metrics.log"="Device Metrics Log"; "device.role.client"="Client (default) - App connected client."; "device.role.clientmute"="Client Mute - Same as a client except packets will not hop over this node, does not contribute to routing packets for mesh."; "device.role.router"="Router - Mesh packets will prefer to be routed over this node. This node will not be used by client apps. The wifi/ble radios and the oled screen will be put to sleep.";