diff --git a/Meshtastic Client.xcodeproj/project.pbxproj b/Meshtastic Client.xcodeproj/project.pbxproj index e697d7cb..807ac4e8 100644 --- a/Meshtastic Client.xcodeproj/project.pbxproj +++ b/Meshtastic Client.xcodeproj/project.pbxproj @@ -738,7 +738,7 @@ CODE_SIGN_ENTITLEMENTS = MeshtasticClient/MeshtasticClient.entitlements; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_ASSET_PATHS = "\"MeshtasticClient/Preview Content\""; DEVELOPMENT_TEAM = GCH7VS5Y9R; ENABLE_PREVIEWS = YES; @@ -769,7 +769,7 @@ CODE_SIGN_ENTITLEMENTS = MeshtasticClient/MeshtasticClient.entitlements; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_ASSET_PATHS = "\"MeshtasticClient/Preview Content\""; DEVELOPMENT_TEAM = GCH7VS5Y9R; ENABLE_PREVIEWS = YES; diff --git a/MeshtasticClient/Helpers/BLEManager.swift b/MeshtasticClient/Helpers/BLEManager.swift index fc6643e0..338e9de3 100644 --- a/MeshtasticClient/Helpers/BLEManager.swift +++ b/MeshtasticClient/Helpers/BLEManager.swift @@ -723,7 +723,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph try context!.save() print("💾 Saved a new message for \(decodedInfo.packet.id)") - if meshLoggingEnabled { MeshLogger.log("💾 Saved a new message for \(decodedInfo.packet.id)") } + if meshLoggingEnabled { MeshLogger.log("💾 Saved a new message for \(newMessage.messageId)") } if newMessage.toUser!.num == self.broadcastNodeNum || self.connectedPeripheral != nil && self.connectedPeripheral.num == newMessage.toUser!.num { @@ -732,7 +732,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph manager.notifications = [ Notification( - id: ("notification.id.\(decodedInfo.packet.id)"), + id: ("notification.id.\(newMessage.messageId)"), title: "\(newMessage.fromUser?.longName ?? "Unknown")", subtitle: "AKA \(newMessage.fromUser?.shortName ?? "???")", content: messageText) @@ -875,8 +875,6 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph let currentNodeNum = self.connectedPeripheral.num - - if let routingMessage = try? Routing(serializedData: decodedInfo.packet.decoded.payload) { print(decodedInfo.packet.decoded.requestID) print(routingMessage) @@ -888,8 +886,6 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph if decodedInfo.packet.priority == MeshPacket.Priority.ack { - - let fetchMessageRequest: NSFetchRequest = NSFetchRequest.init(entityName: "MessageEntity") fetchMessageRequest.predicate = NSPredicate(format: "messageId == %lld", Int64(decodedInfo.packet.decoded.requestID)) @@ -905,7 +901,6 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph } - } @@ -1107,7 +1102,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph positionPacket.batteryLevel = mostRecentPosition.batteryLevel var meshPacket = MeshPacket() - meshPacket.to = UInt32(broadcastNodeNum) + meshPacket.to = UInt32(destNum) meshPacket.from = UInt32(connectedPeripheral.num) meshPacket.wantAck = wantResponse diff --git a/MeshtasticClient/Info.plist b/MeshtasticClient/Info.plist index 1a7b3ab5..fce20574 100644 --- a/MeshtasticClient/Info.plist +++ b/MeshtasticClient/Info.plist @@ -2,6 +2,8 @@ + BGTaskSchedulerPermittedIdentifiers + CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleDisplayName @@ -61,7 +63,9 @@ UIBackgroundModes bluetooth-central + fetch location + processing UILaunchScreen diff --git a/MeshtasticClient/Views/Messages/UserMessageList.swift b/MeshtasticClient/Views/Messages/UserMessageList.swift index 4ba8b7ee..8bc44d0c 100644 --- a/MeshtasticClient/Views/Messages/UserMessageList.swift +++ b/MeshtasticClient/Views/Messages/UserMessageList.swift @@ -35,7 +35,7 @@ struct UserMessageList: View { var body: some View { let firmwareVersion = bleManager.lastConnnectionVersion - let minimumVersion = "1.2.60" + let minimumVersion = "1.2.54" let hasTapbackSupport = minimumVersion.compare(firmwareVersion, options: .numeric) == .orderedAscending || minimumVersion.compare(firmwareVersion, options: .numeric) == .orderedSame VStack { @@ -346,7 +346,7 @@ struct UserMessageList: View { }) .onChange(of: allMessages.count, perform: { count in - //self.context.refresh(user, mergeChanges: true) + self.context.refresh(user, mergeChanges: true) let index = count - 1 @@ -390,10 +390,18 @@ struct UserMessageList: View { Button { let userLongName = bleManager.connectedPeripheral != nil ? bleManager.connectedPeripheral.longName : "Unknown" sendPositionWithMessage = true - typingMessage = "📍 " + userLongName + " Has shared their position with the mesh." - + if user.num == bleManager.broadcastNodeNum { + + typingMessage = "📍 " + userLongName + " Has shared their position with the mesh." + + } else { + + typingMessage = "📍 " + userLongName + " Has shared their position with you." + } } label: { - Image(systemName: "mappin") + Image(systemName: "mappin.and.ellipse") + .symbolRenderingMode(.hierarchical) + .imageScale(.large).foregroundColor(.accentColor) } ProgressView("Bytes: \(totalBytes) / \(maxbytes)", value: Double(totalBytes), total: Double(maxbytes)) diff --git a/MeshtasticClient/Views/Settings/AppSettings.swift b/MeshtasticClient/Views/Settings/AppSettings.swift index 686a333d..2978d565 100644 --- a/MeshtasticClient/Views/Settings/AppSettings.swift +++ b/MeshtasticClient/Views/Settings/AppSettings.swift @@ -69,11 +69,11 @@ class UserSettings: ObservableObject { UserDefaults.standard.set(preferredPeripheralId, forKey: "preferredPeripheralId") } } -// @Published var provideLocation: Bool { -// didSet { -// UserDefaults.standard.set(provideLocation, forKey: "provideLocation") -// } -// } + @Published var provideLocation: Bool { + didSet { + UserDefaults.standard.set(provideLocation, forKey: "provideLocation") + } + } @Published var keyboardType: Int { didSet { UserDefaults.standard.set(keyboardType, forKey: "keyboardType") @@ -102,7 +102,7 @@ class UserSettings: ObservableObject { // self.meshtasticUsername = UserDefaults.standard.object(forKey: "meshtasticusername") as? String ?? "" self.preferredPeripheralName = UserDefaults.standard.object(forKey: "preferredPeripheralName") as? String ?? "" self.preferredPeripheralId = UserDefaults.standard.object(forKey: "preferredPeripheralId") as? String ?? "" - // self.provideLocation = UserDefaults.standard.object(forKey: "provideLocation") as? Bool ?? false + self.provideLocation = UserDefaults.standard.object(forKey: "provideLocation") as? Bool ?? false self.keyboardType = UserDefaults.standard.object(forKey: "keyboardType") as? Int ?? 0 self.meshActivityLog = UserDefaults.standard.object(forKey: "meshActivityLog") as? Bool ?? false self.meshMapType = UserDefaults.standard.string(forKey: "meshMapType") ?? "hybrid" @@ -137,12 +137,12 @@ struct AppSettings: View { // .foregroundColor(.gray) // } // .listRowSeparator(.visible) -// Toggle(isOn: $userSettings.provideLocation) { -// -// Label("Provide location to mesh", systemImage: "location.circle.fill") -// } -// .toggleStyle(SwitchToggleStyle(tint: .accentColor)) -// .listRowSeparator(.visible) + Toggle(isOn: $userSettings.provideLocation) { + + Label("Provide location to mesh", systemImage: "location.circle.fill") + } + .toggleStyle(SwitchToggleStyle(tint: .accentColor)) + .listRowSeparator(.visible) Label("Preferred Radio", systemImage: "flipphone") .listRowSeparator(.hidden) Text(userSettings.preferredPeripheralName)