From e32fbef859989af5554a48df5552f46a85dcc723 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 14 Aug 2022 22:42:26 -0700 Subject: [PATCH] Fix notification crash, update versions to require 1.3.38 --- Meshtastic.xcodeproj/project.pbxproj | 4 ++-- Meshtastic/Helpers/MeshPackets.swift | 30 ++++++++++++++---------- Meshtastic/Views/Bluetooth/Connect.swift | 2 +- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Meshtastic.xcodeproj/project.pbxproj b/Meshtastic.xcodeproj/project.pbxproj index 80f324a7..f8cf8487 100644 --- a/Meshtastic.xcodeproj/project.pbxproj +++ b/Meshtastic.xcodeproj/project.pbxproj @@ -897,7 +897,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.3.36; + MARKETING_VERSION = 1.3.38; PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTS_MACCATALYST = YES; @@ -929,7 +929,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.3.36; + MARKETING_VERSION = 1.3.38; PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTS_MACCATALYST = YES; diff --git a/Meshtastic/Helpers/MeshPackets.swift b/Meshtastic/Helpers/MeshPackets.swift index 56c29885..dbc7eb0c 100644 --- a/Meshtastic/Helpers/MeshPackets.swift +++ b/Meshtastic/Helpers/MeshPackets.swift @@ -1542,20 +1542,24 @@ func textMessageAppPacket(packet: MeshPacket, connectedNode: Int64, meshLogging: if messageSaved { //&& (newMessage.toUser != nil && newMessage.toUser!.num == broadcastNodeNum || connectedNode == newMessage.toUser!.num) { - // Create an iOS Notification for the received message and schedule it immediately - let manager = LocalNotificationManager() - - manager.notifications = [ - Notification( - id: ("notification.id.\(newMessage.messageId)"), - title: "\(newMessage.fromUser?.longName ?? "Unknown")", - subtitle: "AKA \(newMessage.fromUser?.shortName ?? "???")", - content: messageText) - ] - - manager.schedule() - if meshLogging { MeshLogger.log("💬 iOS Notification Scheduled for text message from \(newMessage.fromUser?.longName ?? "Unknown")") } + if newMessage.fromUser != nil { + + // Create an iOS Notification for the received message and schedule it immediately + let manager = LocalNotificationManager() + + manager.notifications = [ + Notification( + id: ("notification.id.\(newMessage.messageId)"), + title: "\(newMessage.fromUser?.longName ?? "Unknown")", + subtitle: "AKA \(newMessage.fromUser?.shortName ?? "???")", + content: messageText) + ] + + manager.schedule() + + if meshLogging { MeshLogger.log("💬 iOS Notification Scheduled for text message from \(newMessage.fromUser?.longName ?? "Unknown")") } + } } } catch { diff --git a/Meshtastic/Views/Bluetooth/Connect.swift b/Meshtastic/Views/Bluetooth/Connect.swift index 41161dc1..07ceaffd 100644 --- a/Meshtastic/Views/Bluetooth/Connect.swift +++ b/Meshtastic/Views/Bluetooth/Connect.swift @@ -20,7 +20,7 @@ struct Connect: View { @State var isPreferredRadio: Bool = false @State var firmwareVersion = "0.0.0" - @State var minimumVersion = "1.3.36" + @State var minimumVersion = "1.3.38" @State var invalidVersion = false var body: some View {