diff --git a/Meshtastic/Helpers/MeshPackets.swift b/Meshtastic/Helpers/MeshPackets.swift index d436aef7..d79bc87e 100644 --- a/Meshtastic/Helpers/MeshPackets.swift +++ b/Meshtastic/Helpers/MeshPackets.swift @@ -871,8 +871,8 @@ func textMessageAppPacket(packet: MeshPacket, wantRangeTestPackets: Bool, connec title: "\(newMessage.fromUser?.longName ?? "unknown".localized)", subtitle: "AKA \(newMessage.fromUser?.shortName ?? "?")", content: messageText!, - target: "message", - path: "meshtastic://open-dm?userid=\(newMessage.fromUser?.num ?? 0)&id=\(newMessage.messageId)" + target: "messages", + path: "meshtastic://messages?userNum=\(newMessage.fromUser?.num ?? 0)&messageId=\(newMessage.messageId)" ) ] manager.schedule() @@ -904,7 +904,7 @@ func textMessageAppPacket(packet: MeshPacket, wantRangeTestPackets: Bool, connec title: "\(newMessage.fromUser?.longName ?? "unknown".localized)", subtitle: "AKA \(newMessage.fromUser?.shortName ?? "?")", content: messageText!, - target: "message", + target: "messages", path: "meshtastic://messages?channel=\(newMessage.channel)&messageId=\(newMessage.messageId)") ] manager.schedule() diff --git a/Meshtastic/MeshtasticAppDelegate.swift b/Meshtastic/MeshtasticAppDelegate.swift index ea3f6a49..c44a7f7d 100644 --- a/Meshtastic/MeshtasticAppDelegate.swift +++ b/Meshtastic/MeshtasticAppDelegate.swift @@ -11,7 +11,6 @@ class MeshtasticAppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificat func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { print("🚀 Meshtstic Apple App launched!") // Default User Default Values - UserDefaults.standard.register(defaults: ["blockRangeTest" : true]) UserDefaults.standard.register(defaults: ["meshMapRecentering" : true]) UserDefaults.standard.register(defaults: ["meshMapShowNodeHistory" : true]) UserDefaults.standard.register(defaults: ["meshMapShowRouteLines" : true]) @@ -27,10 +26,11 @@ class MeshtasticAppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificat } return true } + // Lets us show the notification in the app in the foreground func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { - completionHandler(.banner) + completionHandler([.list, .banner, .sound]) } - // This method is called when user clicked on the notification + // This method is called when a user clicks on the notification func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) { let userInfo = response.notification.request.content.userInfo let targetValue = userInfo["target"] as? String diff --git a/Meshtastic/Views/Messages/UserList.swift b/Meshtastic/Views/Messages/UserList.swift index 03dcf882..2d13d28f 100644 --- a/Meshtastic/Views/Messages/UserList.swift +++ b/Meshtastic/Views/Messages/UserList.swift @@ -35,6 +35,7 @@ struct UserList: View { private var users: FetchedResults @State var node: NodeInfoEntity? + @State var selectedUserNum: Int64? @State private var userSelection: UserEntity? // Nothing selected by default. @State private var isPresentingDeleteUserMessagesConfirm: Bool = false @@ -203,6 +204,10 @@ struct UserList: View { .onChange(of: distanceFilter) { _ in searchUserList() } + .onChange(of: selectedUserNum) { newUserNum in + userSelection = users.first(where: { $0.num == newUserNum }) + print(userSelection) + } .onAppear { if self.bleManager.context == nil { self.bleManager.context = context diff --git a/Meshtastic/Views/Nodes/Helpers/Map/MapContent/MeshMapContent.swift b/Meshtastic/Views/Nodes/Helpers/Map/MapContent/MeshMapContent.swift index 79b88081..4270343c 100644 --- a/Meshtastic/Views/Nodes/Helpers/Map/MapContent/MeshMapContent.swift +++ b/Meshtastic/Views/Nodes/Helpers/Map/MapContent/MeshMapContent.swift @@ -40,13 +40,14 @@ struct MeshMapContent: MapContent { @MapContentBuilder var meshMap: some MapContent { - let lineCoords = Array(positions).compactMap({(position) -> CLLocationCoordinate2D in - return position.nodeCoordinate ?? LocationsHandler.DefaultLocation + let loraNodes = positions.filter { $0.nodePosition?.viaMqtt ?? true == false } + let loraCoords = Array(loraNodes).compactMap({(position) -> CLLocationCoordinate2D in + return position.nodeCoordinate ?? LocationsHandler.DefaultLocation }) /// Convex Hull if showConvexHull { - if lineCoords.count > 0 { - let hull = lineCoords.getConvexHull() + if loraCoords.count > 0 { + let hull = loraCoords.getConvexHull() MapPolygon(coordinates: hull) .stroke(.blue, lineWidth: 3) .foregroundStyle(.indigo.opacity(0.4)) diff --git a/Meshtastic/Views/Nodes/Helpers/Map/MapContent/NodeMapContent.swift b/Meshtastic/Views/Nodes/Helpers/Map/MapContent/NodeMapContent.swift index 64cc43a8..78d20407 100644 --- a/Meshtastic/Views/Nodes/Helpers/Map/MapContent/NodeMapContent.swift +++ b/Meshtastic/Views/Nodes/Helpers/Map/MapContent/NodeMapContent.swift @@ -40,6 +40,7 @@ struct NodeMapContent: MapContent { let lineCoords = positionArray.compactMap({(position) -> CLLocationCoordinate2D in return position.nodeCoordinate ?? LocationsHandler.DefaultLocation }) + /// Node Color from node.num let nodeColor = UIColor(hex: UInt32(node.num)) @@ -58,13 +59,17 @@ struct NodeMapContent: MapContent { .stroke(.white, lineWidth: 2) } } + let loraNodes = positions.filter { $0.nodePosition?.viaMqtt ?? true == false } + let loraCoords = Array(loraNodes).compactMap({(position) -> CLLocationCoordinate2D in + return position.nodeCoordinate ?? LocationsHandler.DefaultLocation + }) /// Convex Hull if showConvexHull { - if lineCoords.count > 0 { - let hull = lineCoords.getConvexHull() + if loraCoords.count > 0 { + let hull = loraCoords.getConvexHull() MapPolygon(coordinates: hull) - .stroke(Color(nodeColor.darker()), lineWidth: 3) - .foregroundStyle(Color(nodeColor).opacity(0.4)) + .stroke(.blue, lineWidth: 3) + .foregroundStyle(.indigo.opacity(0.4)) } } /// Route Lines diff --git a/Meshtastic/Views/Nodes/Helpers/Map/NodeMapSwiftUI.swift b/Meshtastic/Views/Nodes/Helpers/Map/NodeMapSwiftUI.swift index cf983edb..bab5aa81 100644 --- a/Meshtastic/Views/Nodes/Helpers/Map/NodeMapSwiftUI.swift +++ b/Meshtastic/Views/Nodes/Helpers/Map/NodeMapSwiftUI.swift @@ -87,13 +87,13 @@ struct NodeMapSwiftUI: View { switch selectedMapLayer { case .standard: UserDefaults.mapLayer = newMapLayer - mapStyle = MapStyle.standard(elevation: .realistic, pointsOfInterest: showPointsOfInterest ? .all : .excludingAll, showsTraffic: showTraffic) + mapStyle = MapStyle.standard(elevation: .flat, pointsOfInterest: showPointsOfInterest ? .all : .excludingAll, showsTraffic: showTraffic) case .hybrid: UserDefaults.mapLayer = newMapLayer - mapStyle = MapStyle.hybrid(elevation: .realistic, pointsOfInterest: showPointsOfInterest ? .all : .excludingAll, showsTraffic: showTraffic) + mapStyle = MapStyle.hybrid(elevation: .flat, pointsOfInterest: showPointsOfInterest ? .all : .excludingAll, showsTraffic: showTraffic) case .satellite: UserDefaults.mapLayer = newMapLayer - mapStyle = MapStyle.imagery(elevation: .realistic) + mapStyle = MapStyle.imagery(elevation: .flat) case .offline: return } @@ -118,13 +118,13 @@ struct NodeMapSwiftUI: View { UIApplication.shared.isIdleTimerDisabled = true switch selectedMapLayer { case .standard: - mapStyle = MapStyle.standard(elevation: .realistic, pointsOfInterest: showPointsOfInterest ? .all : .excludingAll, showsTraffic: showTraffic) + mapStyle = MapStyle.standard(elevation: .flat, pointsOfInterest: showPointsOfInterest ? .all : .excludingAll, showsTraffic: showTraffic) case .hybrid: - mapStyle = MapStyle.hybrid(elevation: .realistic, pointsOfInterest: showPointsOfInterest ? .all : .excludingAll, showsTraffic: showTraffic) + mapStyle = MapStyle.hybrid(elevation: .flat, pointsOfInterest: showPointsOfInterest ? .all : .excludingAll, showsTraffic: showTraffic) case .satellite: - mapStyle = MapStyle.imagery(elevation: .realistic) + mapStyle = MapStyle.imagery(elevation: .flat) case .offline: - mapStyle = MapStyle.hybrid(elevation: .realistic, pointsOfInterest: showPointsOfInterest ? .all : .excludingAll, showsTraffic: showTraffic) + mapStyle = MapStyle.hybrid(elevation: .flat, pointsOfInterest: showPointsOfInterest ? .all : .excludingAll, showsTraffic: showTraffic) } mostRecent = node.positions?.lastObject as? PositionEntity if node.positions?.count ?? 0 > 1 { diff --git a/Meshtastic/Views/Nodes/Helpers/NodeDetail.swift b/Meshtastic/Views/Nodes/Helpers/NodeDetail.swift index e4c4886e..d93a6ab2 100644 --- a/Meshtastic/Views/Nodes/Helpers/NodeDetail.swift +++ b/Meshtastic/Views/Nodes/Helpers/NodeDetail.swift @@ -35,7 +35,7 @@ struct NodeDetail: View { Label( title: { Text("\("uptime".localized)") - .font(.title2)+Text(": \(components)") + .font(.title3)+Text(": \(components)") .font(.title3) .foregroundColor(Color.gray) }, diff --git a/Meshtastic/Views/Nodes/NodeList.swift b/Meshtastic/Views/Nodes/NodeList.swift index 90c3d37b..a6e1368d 100644 --- a/Meshtastic/Views/Nodes/NodeList.swift +++ b/Meshtastic/Views/Nodes/NodeList.swift @@ -316,9 +316,12 @@ struct NodeList: View { } .onChange(of: (appState.navigationPath)) { newPath in - if ((newPath?.hasPrefix("meshtastic://nodes")) != nil) { + guard let deepLink = newPath else { + return + } + if deepLink.hasPrefix("meshtastic://nodes") { - if let urlComponent = URLComponents(string: newPath ?? "") { + if let urlComponent = URLComponents(string: deepLink) { let queryItems = urlComponent.queryItems let nodeNum = queryItems?.first(where: { $0.name == "nodenum" })?.value if nodeNum == nil {