mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
feat: Add node to favorites when sending a direct message (#1899)
This commit is contained in:
parent
e99c31d418
commit
76cdb83406
1 changed files with 8 additions and 0 deletions
|
|
@ -440,6 +440,14 @@ class UIViewModel @Inject constructor(
|
|||
val channel = contactKey[0].digitToIntOrNull()
|
||||
val dest = if (channel != null) contactKey.substring(1) else contactKey
|
||||
|
||||
// if the destination is a node, we need to ensure it's a
|
||||
// favorite so it does not get removed from the on-device node database.
|
||||
if (channel == null) { // no channel specified, so we assume it's a direct message
|
||||
val node = nodeDB.getNode(dest)
|
||||
if (!node.isFavorite) {
|
||||
favoriteNode(nodeDB.getNode(dest))
|
||||
}
|
||||
}
|
||||
val p = DataPacket(dest, channel ?: 0, str)
|
||||
sendDataPacket(p)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue