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:
James Rich 2024-10-15 04:07:22 -05:00 committed by GitHub
parent af56fff216
commit f6ec3e8bab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 68 additions and 0 deletions

View file

@ -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)
}
}
}