mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
feat: create NodeEntity.isUnknownUser property
This commit is contained in:
parent
2050cd0b4b
commit
eacf3a87a0
3 changed files with 3 additions and 4 deletions
|
|
@ -161,9 +161,7 @@ class NodeInfoDaoTest {
|
|||
@Test
|
||||
fun testIncludeUnknownIsFalse() = runBlocking {
|
||||
val nodes = getNodes(includeUnknown = false)
|
||||
val containsUnsetNode = nodes.any { node ->
|
||||
node.user.hwModel == MeshProtos.HardwareModel.UNSET
|
||||
}
|
||||
val containsUnsetNode = nodes.any { it.isUnknownUser }
|
||||
assertFalse(containsUnsetNode)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ data class NodeEntity(
|
|||
return (if (brightness > 0.5) Color.BLACK else Color.WHITE) to Color.rgb(r, g, b)
|
||||
}
|
||||
|
||||
val isUnknownUser get() = user.hwModel == MeshProtos.HardwareModel.UNSET
|
||||
val hasPKC get() = !user.publicKey.isEmpty
|
||||
val errorByteString: ByteString get() = ByteString.copyFrom(ByteArray(32) { 0 })
|
||||
val mismatchKey get() = user.publicKey == errorByteString
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ fun NodeItem(
|
|||
expanded: Boolean = false,
|
||||
currentTimeMillis: Long,
|
||||
) {
|
||||
val isUnknownUser = thatNode.user.hwModel == MeshProtos.HardwareModel.UNSET
|
||||
val isUnknownUser = thatNode.isUnknownUser
|
||||
val unknownShortName = stringResource(id = R.string.unknown_node_short_name)
|
||||
val longName = thatNode.user.longName.ifEmpty { stringResource(id = R.string.unknown_username) }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue