mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Add criticial alerts functionality to textMessageAppPacket
This commit is contained in:
parent
4062c677ab
commit
e1f2e34c2e
3 changed files with 13 additions and 2 deletions
|
|
@ -758,7 +758,6 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate
|
|||
// Log any other unknownApp calls
|
||||
if !nowKnown { MeshLogger.log("🕸️ MESH PACKET received for Unknown App UNHANDLED \((try? decodedInfo.packet.jsonString()) ?? "JSON Decode Failure")") }
|
||||
case .textMessageApp, .detectionSensorApp:
|
||||
// TODO: Critical alert for alertApp payloads
|
||||
textMessageAppPacket(
|
||||
packet: decodedInfo.packet,
|
||||
wantRangeTestPackets: wantRangeTestPackets,
|
||||
|
|
@ -767,7 +766,14 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate
|
|||
appState: appState
|
||||
)
|
||||
case .alertApp:
|
||||
MeshLogger.log("🕸️ MESH PACKET received for Alert App UNHANDLED \((try? decodedInfo.packet.jsonString()) ?? "JSON Decode Failure")")
|
||||
textMessageAppPacket(
|
||||
packet: decodedInfo.packet,
|
||||
wantRangeTestPackets: wantRangeTestPackets,
|
||||
critical: true,
|
||||
connectedNode: (self.connectedPeripheral != nil ? connectedPeripheral.num : 0),
|
||||
context: context,
|
||||
appState: appState
|
||||
)
|
||||
case .remoteHardwareApp:
|
||||
MeshLogger.log("🕸️ MESH PACKET received for Remote Hardware App UNHANDLED \((try? decodedInfo.packet.jsonString()) ?? "JSON Decode Failure")")
|
||||
case .positionApp:
|
||||
|
|
|
|||
|
|
@ -67,6 +67,9 @@ class LocalNotificationManager {
|
|||
if notification.userNum != nil {
|
||||
content.userInfo["userNum"] = notification.userNum
|
||||
}
|
||||
if notification.critical {
|
||||
content.sound = UNNotificationSound.defaultCritical
|
||||
}
|
||||
|
||||
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 1, repeats: false)
|
||||
let request = UNNotificationRequest(identifier: notification.id, content: content, trigger: trigger)
|
||||
|
|
@ -101,4 +104,5 @@ struct Notification {
|
|||
var messageId: Int64?
|
||||
var channel: Int32?
|
||||
var userNum: Int64?
|
||||
var critical: Bool = false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -820,6 +820,7 @@ func telemetryPacket(packet: MeshPacket, connectedNode: Int64, context: NSManage
|
|||
func textMessageAppPacket(
|
||||
packet: MeshPacket,
|
||||
wantRangeTestPackets: Bool,
|
||||
critical: Bool = false,
|
||||
connectedNode: Int64,
|
||||
storeForward: Bool = false,
|
||||
context: NSManagedObjectContext,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue