Feat/2061 public ind (#2284)

This commit is contained in:
DaneEvans 2025-06-29 12:45:12 +10:00 committed by GitHub
parent 80723c59cc
commit 3d9b69eda5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 92 additions and 14 deletions

View file

@ -177,6 +177,7 @@ data class Contact(
val isMuted: Boolean,
val isUnmessageable: Boolean,
val nodeColors: Pair<Int, Int>? = null,
val isDefaultPSK: Boolean? = false
)
@Suppress("LongParameterList", "LargeClass")
@ -519,6 +520,15 @@ class UIViewModel @Inject constructor(
} else {
user.longName
}
val isDefaultPSK = if (toBroadcast) {
val _channel = channelSet.getChannel(data.channel)
val isDefaultPSK = (_channel?.settings?.psk?.size() == 1 &&
_channel.settings.psk.byteAt(0) == 1.toByte()) ||
_channel?.settings?.psk?.toByteArray()?.isEmpty() == true
isDefaultPSK
} else {
false
}
Contact(
contactKey = contactKey,
@ -535,6 +545,7 @@ class UIViewModel @Inject constructor(
} else {
null
},
isDefaultPSK = isDefaultPSK
)
}
}.stateIn(