mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-05-06 13:45:06 -04:00
feat: create NodeEntity.isUnknownUser property
This commit is contained in:
@@ -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) }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user