feat: Add node to favorites when sending a direct message (#1899)

This commit is contained in:
James Rich 2025-05-21 12:48:02 -05:00 committed by GitHub
parent e99c31d418
commit 76cdb83406
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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