mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 20:15:21 +00:00
fix: use a when to make logic more readable
This commit is contained in:
parent
7e86343efe
commit
c740963fe2
@ -616,10 +616,12 @@ object ClosedGroupsProtocolV2 {
|
||||
val userKeyPair = apiDB.getUserX25519KeyPair()
|
||||
// Unwrap the message
|
||||
val groupDB = DatabaseFactory.getGroupDatabase(context)
|
||||
val groupID = if (groupPublicKey.isEmpty() && !closedGroupUpdate.publicKey.isEmpty) {
|
||||
doubleEncodeGroupID(closedGroupUpdate.publicKey.toStringUtf8())
|
||||
} else {
|
||||
doubleEncodeGroupID(groupPublicKey)
|
||||
val groupID = when {
|
||||
groupPublicKey.isNotEmpty() -> groupPublicKey
|
||||
!closedGroupUpdate.publicKey.isEmpty -> closedGroupUpdate.publicKey.toStringUtf8()
|
||||
else -> ""
|
||||
}.let {
|
||||
doubleEncodeGroupID(it)
|
||||
}
|
||||
val group = groupDB.getGroup(groupID).orNull()
|
||||
if (group == null) {
|
||||
|
Loading…
Reference in New Issue
Block a user