Merge pull request #1073 from daviesgeek/add-traceroute-notification

send tr received notification
This commit is contained in:
Garth Vander Houwen 2025-01-27 13:34:33 -08:00 committed by GitHub
commit ed87b47a9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -960,6 +960,22 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate
}
traceRoute?.hops = NSOrderedSet(array: hopNodes)
traceRoute?.time = Date()
if let tr = traceRoute {
let manager = LocalNotificationManager()
manager.notifications = [
Notification(
id: (UUID().uuidString),
title: "Traceroute Complete",
subtitle: "TR received back from \(destinationHop.name ?? "unknown")",
content: "Hops from: \(tr.hopsTowards), Hops back: \(tr.hopsBack)\n\(tr.routeText ?? "unknown".localized)\n\(tr.routeBackText ?? "unknown".localized)",
target: "nodes",
path: "meshtastic:///nodes?nodenum=\(connectedNode.user?.num ?? 0)"
)
]
manager.schedule()
}
do {
try context.save()
Logger.data.info("💾 Saved Trace Route")