mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Use title and content for notifications, remove extra )
This commit is contained in:
parent
ad59d90e18
commit
2214e01666
4 changed files with 16 additions and 11 deletions
|
|
@ -315,9 +315,8 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
|
|||
|
||||
if decodedInfo.myInfo.myNodeNum != 0
|
||||
{
|
||||
print("Save a myInfo")
|
||||
print("Save myInfo for \(decodedInfo.myInfo.myNodeNum)")
|
||||
do {
|
||||
// print(try decodedInfo.myInfo.jsonString())
|
||||
|
||||
// Create a MyInfoModel
|
||||
let myInfoModel = MyInfoModel(
|
||||
|
|
@ -425,7 +424,11 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
|
|||
let manager = LocalNotificationManager()
|
||||
|
||||
manager.notifications = [
|
||||
Notification(id: ("notifiction.id.\(decodedInfo.packet.id)"), title: ("\(fromUser?.user.shortName ?? "???") says \(messageText))"))]
|
||||
Notification(
|
||||
id: ("notification.id.\(decodedInfo.packet.id)"),
|
||||
title: "\(fromUser?.user.longName ?? "???") AKA \(fromUser?.user.shortName ?? "") says ",
|
||||
content: messageText)
|
||||
]
|
||||
manager.schedule()
|
||||
manager.listScheduledNotifications()
|
||||
|
||||
|
|
@ -436,15 +439,15 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
|
|||
}
|
||||
else if decodedInfo.packet.decoded.portnum == PortNum.nodeinfoApp {
|
||||
|
||||
var updatedNode = meshData.nodes.first(where: {$0.id == decodedInfo.packet.from})
|
||||
var updatedNode = meshData.nodes.first(where: {$0.id == decodedInfo.packet.from })
|
||||
updatedNode!.snr = decodedInfo.packet.rxSnr
|
||||
updatedNode!.lastHeard = decodedInfo.packet.rxTime
|
||||
// updatedNode!.user.longName = "Node Info updated longname"
|
||||
// updatedNode!.update(from: updatedNode!.data)
|
||||
// updatedNode!.user.longName = "Node Info updated longname"
|
||||
updatedNode!.update(from: updatedNode!.data)
|
||||
|
||||
let nodeIndex = meshData.nodes.firstIndex(where: { $0.id == decodedInfo.packet.from })
|
||||
meshData.nodes.remove(at: nodeIndex!)
|
||||
meshData.nodes.append(updatedNode!)
|
||||
//let nodeIndex = meshData.nodes.firstIndex(where: { $0.id == decodedInfo.packet.from })
|
||||
//meshData.nodes.remove(at: nodeIndex!)
|
||||
//meshData.nodes.append(updatedNode!)
|
||||
meshData.save()
|
||||
print("Updated NodeInfo SNR and Time from Packet For: \(updatedNode!.user.longName)")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ class LocalNotificationManager {
|
|||
{
|
||||
let content = UNMutableNotificationContent()
|
||||
content.title = notification.title
|
||||
content.body = notification.content
|
||||
content.sound = .default
|
||||
|
||||
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 1, repeats: false)
|
||||
|
|
@ -70,4 +71,5 @@ class LocalNotificationManager {
|
|||
struct Notification {
|
||||
var id: String
|
||||
var title: String
|
||||
var content: String
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ struct NodeMap: View {
|
|||
|
||||
var body: some View {
|
||||
let location = LocationHelper.currentLocation
|
||||
let currentCoordinatePosition = CLLocationCoordinate2D(latitude: location.latitude, longitude: location.longitude)
|
||||
let currentCoordinatePosition = CLLocationCoordinate2D(latitude: locationNodes[0].position.latitude ?? location.latitude, longitude: locationNodes[0].position.latitude ?? location.longitude)
|
||||
let regionBinding = Binding<MKCoordinateRegion>(
|
||||
get: {
|
||||
MKCoordinateRegion(center: currentCoordinatePosition, span: MKCoordinateSpan(latitudeDelta: 0.0359, longitudeDelta: 0.0359))
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ struct NodeRow: View {
|
|||
|
||||
HStack (alignment: .bottom){
|
||||
|
||||
Image(systemName: "timer").font(.headline).foregroundColor(.blue).symbolRenderingMode(.hierarchical)
|
||||
Image(systemName: "timer.square").font(.headline).foregroundColor(.blue).symbolRenderingMode(.hierarchical)
|
||||
|
||||
if connected {
|
||||
Text("Currently Connected").font(.subheadline).foregroundColor(Color.accentColor)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue