From 7e429b79eb49ac27f0619b65d837a9853e506ca1 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 26 Mar 2023 09:46:51 -0700 Subject: [PATCH] Ringtone cleanup, translation strings --- Meshtastic/Persistence/UpdateCoreData.swift | 2 +- Meshtastic/Views/Bluetooth/Connect.swift | 2 +- .../Views/Settings/Config/Module/RtttlConfig.swift | 9 ++++----- de.lproj/Localizable.strings | 4 ++++ en.lproj/Localizable.strings | 6 +++++- zh-Hans.lproj/Localizable.strings | 4 ++++ 6 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Meshtastic/Persistence/UpdateCoreData.swift b/Meshtastic/Persistence/UpdateCoreData.swift index 1b8789a9..e4d33347 100644 --- a/Meshtastic/Persistence/UpdateCoreData.swift +++ b/Meshtastic/Persistence/UpdateCoreData.swift @@ -701,7 +701,7 @@ func upsertExternalNotificationModuleConfigPacket(config: Meshtastic.ModuleConfi func upsertRtttlConfigPacket(ringtone: String, nodeNum: Int64, context: NSManagedObjectContext) { - let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.rangetest.config %@", comment: "Range Test module config received: %@"), String(nodeNum)) + let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.ringtone.config %@", comment: "RTTTL Ringtone config received: %@"), String(nodeNum)) MeshLogger.log("⛰️ \(logString)") let fetchNodeInfoRequest: NSFetchRequest = NSFetchRequest.init(entityName: "NodeInfoEntity") diff --git a/Meshtastic/Views/Bluetooth/Connect.swift b/Meshtastic/Views/Bluetooth/Connect.swift index 6ee95a32..57594b2f 100644 --- a/Meshtastic/Views/Bluetooth/Connect.swift +++ b/Meshtastic/Views/Bluetooth/Connect.swift @@ -104,7 +104,7 @@ struct Connect: View { #endif } } label: { - Label("Mesh Live Activity", systemImage: liveActivityStarted ? "stop" : "play") + Label("mesh.live.activity", systemImage: liveActivityStarted ? "stop" : "play") } } #endif diff --git a/Meshtastic/Views/Settings/Config/Module/RtttlConfig.swift b/Meshtastic/Views/Settings/Config/Module/RtttlConfig.swift index 1f91c257..cd056ada 100644 --- a/Meshtastic/Views/Settings/Config/Module/RtttlConfig.swift +++ b/Meshtastic/Views/Settings/Config/Module/RtttlConfig.swift @@ -29,7 +29,7 @@ struct RtttlConfig: View { } else if node != nil && node?.num ?? 0 != bleManager.connectedPeripheral?.num ?? 0 { // Let users know what is going on if they are using remote admin and don't have the config yet - if node?.rangeTestConfig == nil { + if node?.rtttlConfig == nil { Text("RTTTL Ringtone config data was requested over the admin channel but no response has been returned from the remote node. You can check the status of admin message requests in the admin message log.") .font(.callout) .foregroundColor(.orange) @@ -82,7 +82,7 @@ struct RtttlConfig: View { } label: { Label("save", systemImage: "square.and.arrow.down") } - .disabled(bleManager.connectedPeripheral == nil || !hasChanges || !(node?.myInfo?.hasWifi ?? false)) + .disabled(bleManager.connectedPeripheral == nil || !hasChanges) .buttonStyle(.bordered) .buttonBorderShape(.capsule) .controlSize(.large) @@ -111,7 +111,7 @@ struct RtttlConfig: View { message: { Text("config.save.confirm") } - .navigationTitle("rtttl.config") + .navigationTitle("ringtone.config") .navigationBarItems(trailing: ZStack { ConnectedDevice(bluetoothOn: bleManager.isSwitchedOn, deviceConnected: bleManager.connectedPeripheral != nil, name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.shortName : "????") @@ -119,9 +119,8 @@ struct RtttlConfig: View { .onAppear { self.bleManager.context = context setRtttLConfigValue() - // Need to request a Rtttl Config from the remote node before allowing changes - if bleManager.connectedPeripheral != nil && node?.rtttlConfig == nil { + if bleManager.connectedPeripheral != nil && (node?.rtttlConfig == nil || node?.rtttlConfig?.ringtone?.count ?? 0 == 0) { let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral.num, context: context) if node != nil && connectedNode != nil { _ = bleManager.requestRtttlConfig(fromUser: connectedNode!.user!, toUser: node!.user!, adminIndex: connectedNode?.myInfo?.adminIndex ?? 0) diff --git a/de.lproj/Localizable.strings b/de.lproj/Localizable.strings index c535db76..d42c9caa 100644 --- a/de.lproj/Localizable.strings +++ b/de.lproj/Localizable.strings @@ -144,6 +144,7 @@ "map.usertrackingmode.none"="None"; "map.usertrackingmode.follow"="Follow"; "map.usertrackingmode.followwithheading"="Follow with heading"; +"mesh.live.activity"="Mesh Live Activity"; "mesh.log"="Mesh Log"; "mesh.log.bluetooth.config %@"="Bluetooth Konfiguration empfangen: %@"; "mesh.log.cannedmessage.config %@"="Canned Message module config received: %@"; @@ -165,6 +166,7 @@ "mesh.log.position.config %@"="Positions Konfiguration empfangen: %@"; "mesh.log.position.received %@"="Positionspaket empfangen von Node: %@"; "mesh.log.rangetest.config %@"="Range Test Modul konfiguration empfangen: %@"; +"mesh.log.ringtone.config %@"="RTTTL Ringtone config received: %@"; "mesh.log.routing.message %@ %@"="Routing empfangen für RequestID: %@ Ack Status: %@"; "mesh.log.serial.config %@"="Serial Modul Konfiguration empfangen: %@"; "mesh.log.sharelocation %@"="Sent a Position Packet from the Apple device GPS to node: %@"; @@ -212,6 +214,8 @@ "reply"="Antworten"; "received.ack"="Empfangsbestätigung"; "received.ack.real"="Recipient Ack"; +"ringtone"="Ringtone"; +"ringtone.config"="Ringtone Config"; "routing.acknowledged"="Bestätigt"; "routing.noroute"="Keine Route"; "routing.gotnak"="Negative Empfangsbestätigung empfangen"; diff --git a/en.lproj/Localizable.strings b/en.lproj/Localizable.strings index df67d0e9..8183f1cf 100644 --- a/en.lproj/Localizable.strings +++ b/en.lproj/Localizable.strings @@ -49,8 +49,8 @@ "clear.log"="Clear Log"; "close"="Close"; "config.save.confirm"="After config values save the node will reboot."; -"connected.radio"="Connected Radio"; "communicating"="Communicating with device. ."; +"connected.radio"="Connected Radio"; "connected"="Currently Connected"; "connecting"="Connecting . ."; "contacts"="Contacts"; @@ -144,6 +144,7 @@ "map.usertrackingmode.follow"="Follow"; "map.usertrackingmode.followwithheading"="Follow with heading"; "map.usertrackingmode.none"="None"; +"mesh.live.activity"="Mesh Live Activity"; "mesh.log"="Mesh Log"; "mesh.log.bluetooth.config %@"="Bluetooth config received: %@"; "mesh.log.cannedmessage.config %@"="Canned Message module config received: %@"; @@ -165,6 +166,7 @@ "mesh.log.position.config %@"="Positon config received: %@"; "mesh.log.position.received %@"="Position Packet received from node: %@"; "mesh.log.rangetest.config %@"="Range Test module config received: %@"; +"mesh.log.ringtone.config %@"="RTTTL Ringtone config received: %@"; "mesh.log.routing.message %@ %@"="Routing received for RequestID: %@ Ack Status: %@"; "mesh.log.serial.config %@"="Serial module config received: %@"; "mesh.log.sharelocation %@"="Sent a Position Packet from the Apple device GPS to node: %@"; @@ -212,6 +214,8 @@ "reboot.node"="Reboot node?"; "received.ack"="Received Ack"; "received.ack.real"="Recipient Ack"; +"ringtone"="Ringtone"; +"ringtone.config"="Ringtone Config"; "routing.acknowledged"="Acknowledged"; "routing.noroute"="No Route"; "routing.gotnak"="Received a negative acknowledgment"; diff --git a/zh-Hans.lproj/Localizable.strings b/zh-Hans.lproj/Localizable.strings index e2f07a11..f0f54149 100644 --- a/zh-Hans.lproj/Localizable.strings +++ b/zh-Hans.lproj/Localizable.strings @@ -144,6 +144,7 @@ "map.usertrackingmode.none"="None"; "map.usertrackingmode.follow"="Follow"; "map.usertrackingmode.followwithheading"="Follow with heading"; +"mesh.live.activity"="Mesh Live Activity"; "mesh.log"="Mesh 日志"; "mesh.log.bluetooth.config %@"="Bluetooth config received: %@"; "mesh.log.cannedmessage.config %@"="Canned Message module config received: %@"; @@ -165,6 +166,7 @@ "mesh.log.position.config %@"="Positon config received: %@"; "mesh.log.position.received %@"="Position Packet received from node: %@"; "mesh.log.rangetest.config %@"="Range Test module config received: %@"; +"mesh.log.ringtone.config %@"="RTTTL Ringtone config received: %@"; "mesh.log.routing.message %@ %@"="Routing received for RequestID: %@ Ack Status: %@"; "mesh.log.serial.config %@"="Serial module config received: %@"; "mesh.log.sharelocation %@"="Sent a Position Packet from the Apple device GPS to node: %@"; @@ -212,6 +214,8 @@ "reboot.node"="重启节点?"; "received.ack"="收到确认"; "received.ack.real"="收件人确认"; +"ringtone"="Ringtone"; +"ringtone.config"="Ringtone Config"; "routing.acknowledged"="确认"; "routing.noroute"="找不到目标"; "routing.gotnak"="收到否认";