mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
feat: Add notification for new node seen (#1316)
* Add notification for new node seen This change adds a new notification that is displayed when a new node is seen. The notification includes the node's name. It also updates the message notification to include the node name. * Show individual notification for each new node * Add new nodes notifications Adds a new notification channel for new nodes seen. This channel is set to high importance with sound and light.
This commit is contained in:
parent
af56fff216
commit
f6ec3e8bab
3 changed files with 68 additions and 0 deletions
|
|
@ -803,6 +803,8 @@ class MeshService : Service(), Logging {
|
|||
// Update our DB of users based on someone sending out a User subpacket
|
||||
private fun handleReceivedUser(fromNum: Int, p: MeshProtos.User, channel: Int = 0) {
|
||||
updateNodeInfo(fromNum) {
|
||||
val newNode = (it.isUnknownUser && p.hwModel != MeshProtos.HardwareModel.UNSET)
|
||||
|
||||
val keyMatch = !it.hasPKC || it.user.publicKey == p.publicKey
|
||||
it.user = if (keyMatch) p else p.copy {
|
||||
warn("Public key mismatch from $longName ($shortName)")
|
||||
|
|
@ -811,6 +813,9 @@ class MeshService : Service(), Logging {
|
|||
it.longName = p.longName
|
||||
it.shortName = p.shortName
|
||||
it.channel = channel
|
||||
if (newNode) {
|
||||
serviceNotifications.showNewNodeSeenNotification(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue