feat: add SNR/RSSI/Hops Away metrics and timestamp to the reaction dialog (#3964)

Co-authored-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
Eugene 2025-12-16 18:56:30 +03:00 committed by GitHub
parent 8d858de00a
commit 24f40b2005
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 847 additions and 20 deletions

View file

@ -78,8 +78,9 @@ import org.meshtastic.core.database.entity.ReactionEntity
AutoMigration(from = 20, to = 21),
AutoMigration(from = 21, to = 22),
AutoMigration(from = 22, to = 23),
AutoMigration(from = 23, to = 24),
],
version = 23,
version = 24,
exportSchema = true,
)
@TypeConverters(Converters::class)

View file

@ -108,7 +108,15 @@ data class ContactSettings(
get() = System.currentTimeMillis() <= muteUntil
}
data class Reaction(val replyId: Int, val user: User, val emoji: String, val timestamp: Long)
data class Reaction(
val replyId: Int,
val user: User,
val emoji: String,
val timestamp: Long,
val snr: Float,
val rssi: Int,
val hopsAway: Int,
)
@Entity(
tableName = "reactions",
@ -120,10 +128,20 @@ data class ReactionEntity(
@ColumnInfo(name = "user_id") val userId: String,
val emoji: String,
val timestamp: Long,
@ColumnInfo(name = "snr", defaultValue = "0") val snr: Float = 0f,
@ColumnInfo(name = "rssi", defaultValue = "0") val rssi: Int = 0,
@ColumnInfo(name = "hopsAway", defaultValue = "-1") val hopsAway: Int = -1,
)
private suspend fun ReactionEntity.toReaction(getNode: suspend (userId: String?) -> Node) =
Reaction(replyId = replyId, user = getNode(userId).user, emoji = emoji, timestamp = timestamp)
private suspend fun ReactionEntity.toReaction(getNode: suspend (userId: String?) -> Node) = Reaction(
replyId = replyId,
user = getNode(userId).user,
emoji = emoji,
timestamp = timestamp,
snr = snr,
rssi = rssi,
hopsAway = hopsAway,
)
private suspend fun List<ReactionEntity>.toReaction(getNode: suspend (userId: String?) -> Node) =
this.map { it.toReaction(getNode) }