From 75c90e35e7c54d8601c7a9e35c11323d7bcc7d4d Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Mon, 23 Sep 2024 11:07:50 -0700 Subject: [PATCH 1/4] Show lock for incoming encrypted messages --- Localizable.xcstrings | 18 +++--------------- Meshtastic/Views/Messages/MessageText.swift | 3 ++- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/Localizable.xcstrings b/Localizable.xcstrings index 9650f2ca..58f780d0 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -21,21 +21,6 @@ }, ": %d" : { - }, - ".dot" : { - - }, - ".gauge" : { - - }, - ".gradient" : { - - }, - ".pill" : { - - }, - ".text" : { - }, "(Re)define PIN_GPS_EN for your board." : { @@ -19139,6 +19124,9 @@ }, "Send" : { + }, + "Send ${messageContent} to ${channelNumber}" : { + }, "Send a Group Message" : { diff --git a/Meshtastic/Views/Messages/MessageText.swift b/Meshtastic/Views/Messages/MessageText.swift index 1f2cc017..411511fd 100644 --- a/Meshtastic/Views/Messages/MessageText.swift +++ b/Meshtastic/Views/Messages/MessageText.swift @@ -30,7 +30,8 @@ struct MessageText: View { .background(isCurrentUser ? .accentColor : Color(.gray)) .cornerRadius(15) .overlay { - if message.pkiEncrypted && message.ackError == 0 && message.realACK { + /// Show the lock if the message is pki encrypted and has a real ack if sent by the current user, or is pki encrypted for incoming messages + if message.pkiEncrypted && message.realACK || !isCurrentUser && message.pkiEncrypted { VStack(alignment: .trailing) { Spacer() HStack { From 22c27ce27c6d9a9f282beadc2571d9197be81433 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Mon, 23 Sep 2024 11:40:56 -0700 Subject: [PATCH 2/4] Bump version, remove unnessary myinfo query --- Meshtastic.xcodeproj/project.pbxproj | 8 ++++---- Meshtastic/Helpers/BLEManager.swift | 3 --- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Meshtastic.xcodeproj/project.pbxproj b/Meshtastic.xcodeproj/project.pbxproj index 353226be..d13cc990 100644 --- a/Meshtastic.xcodeproj/project.pbxproj +++ b/Meshtastic.xcodeproj/project.pbxproj @@ -1687,7 +1687,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.5.6; + MARKETING_VERSION = 2.5.7; PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTS_MACCATALYST = YES; @@ -1722,7 +1722,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.5.6; + MARKETING_VERSION = 2.5.7; PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTS_MACCATALYST = YES; @@ -1754,7 +1754,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 2.5.6; + MARKETING_VERSION = 2.5.7; PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient.Widgets; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -1787,7 +1787,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 2.5.6; + MARKETING_VERSION = 2.5.7; PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient.Widgets; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index aae1a8ab..fc3b4dcf 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -680,9 +680,6 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate do { disconnectPeripheral(reconnect: false) try container.restorePersistentStore(from: databasePath) - context.refreshAllObjects() - let request = MyInfoEntity.fetchRequest() - try context.fetch(request) UserDefaults.preferredPeripheralNum = Int(myInfo?.myNodeNum ?? 0) connectTo(peripheral: peripheral) Logger.data.notice("🗂️ Restored Core data for /\(UserDefaults.preferredPeripheralNum, privacy: .public)") From 60873ec647e29d799b4bf41995c25ea4fd937066 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Mon, 23 Sep 2024 12:58:22 -0700 Subject: [PATCH 3/4] Logging for client notification --- Meshtastic/Helpers/BLEManager.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index fc3b4dcf..e62093e9 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -652,6 +652,8 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate retained: decodedInfo.mqttClientProxyMessage.retained ) mqttManager.mqttClientProxy?.publish(message) + } else if decodedInfo.payloadVariant == FromRadio.OneOf_PayloadVariant.clientNotification(decodedInfo.clientNotification) { + Logger.data.error("⚠️ Client Notification") } switch decodedInfo.packet.decoded.portnum { @@ -942,7 +944,8 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate // Use a RunLoop to prevent the timer from running on the main UI thread if UserDefaults.provideLocation { let interval = UserDefaults.provideLocationInterval >= 10 ? UserDefaults.provideLocationInterval : 30 - positionTimer = Timer.scheduledTimer(timeInterval: TimeInterval(interval), target: self, selector: #selector(positionTimerFired), userInfo: context, repeats: true) + positionTimer = Timer.scheduledTimer(timeInterval: TimeInterval(3.0), target: self, selector: #selector(positionTimerFired), userInfo: context, repeats: true) + positionTimer = Timer.scheduledTimer(timeInterval: TimeInterval(3.0), target: self, selector: #selector(positionTimerFired), userInfo: context, repeats: true) if positionTimer != nil { RunLoop.current.add(positionTimer!, forMode: .common) } From 506772bf619940f222315133ef8f4d1e9fa469c4 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Mon, 23 Sep 2024 16:38:18 -0700 Subject: [PATCH 4/4] Client notifications --- Meshtastic/Helpers/BLEManager.swift | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index e62093e9..894401c7 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -653,7 +653,19 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate ) mqttManager.mqttClientProxy?.publish(message) } else if decodedInfo.payloadVariant == FromRadio.OneOf_PayloadVariant.clientNotification(decodedInfo.clientNotification) { - Logger.data.error("⚠️ Client Notification") + let manager = LocalNotificationManager() + manager.notifications = [ + Notification( + id: UUID().uuidString, + title: "Firmware Notification", + subtitle: "\(decodedInfo.clientNotification.level)".capitalized, + content: decodedInfo.clientNotification.message, + target: "settings", + path: "meshtastic:///settings/debugLogs" + ) + ] + manager.schedule() + Logger.data.error("⚠️ Client Notification \((try? decodedInfo.clientNotification.jsonString()) ?? "JSON Decode Failure")") } switch decodedInfo.packet.decoded.portnum { @@ -944,8 +956,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate // Use a RunLoop to prevent the timer from running on the main UI thread if UserDefaults.provideLocation { let interval = UserDefaults.provideLocationInterval >= 10 ? UserDefaults.provideLocationInterval : 30 - positionTimer = Timer.scheduledTimer(timeInterval: TimeInterval(3.0), target: self, selector: #selector(positionTimerFired), userInfo: context, repeats: true) - positionTimer = Timer.scheduledTimer(timeInterval: TimeInterval(3.0), target: self, selector: #selector(positionTimerFired), userInfo: context, repeats: true) + positionTimer = Timer.scheduledTimer(timeInterval: TimeInterval(interval), target: self, selector: #selector(positionTimerFired), userInfo: context, repeats: true) if positionTimer != nil { RunLoop.current.add(positionTimer!, forMode: .common) }