mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
fix configuration message deserialising crash
This commit is contained in:
parent
4628f27d9f
commit
b786f5894c
@ -14,7 +14,7 @@ import org.session.libsignal.service.loki.utilities.removing05PrefixIfNeeded
|
||||
import org.session.libsignal.service.loki.utilities.toHexString
|
||||
import org.session.libsignal.utilities.Hex
|
||||
|
||||
class ConfigurationMessage(val closedGroups: List<ClosedGroup>, val openGroups: List<String>, val contacts: List<Contact>, val displayName: String, val profilePicture: String?, val profileKey: ByteArray): ControlMessage() {
|
||||
class ConfigurationMessage(): ControlMessage() {
|
||||
|
||||
class ClosedGroup(val publicKey: String, val name: String, val encryptionKeyPair: ECKeyPair, val members: List<String>, val admins: List<String>) {
|
||||
val isValid: Boolean get() = members.isNotEmpty() && admins.isNotEmpty()
|
||||
@ -85,6 +85,13 @@ class ConfigurationMessage(val closedGroups: List<ClosedGroup>, val openGroups:
|
||||
override val ttl: Long = 4 * 24 * 60 * 60 * 1000
|
||||
override val isSelfSendValid: Boolean = true
|
||||
|
||||
var closedGroups: List<ClosedGroup> = listOf()
|
||||
var openGroups: List<String> = listOf()
|
||||
var contacts: List<Contact> = listOf()
|
||||
var displayName: String = ""
|
||||
var profilePicture: String? = null
|
||||
var profileKey: ByteArray = byteArrayOf()
|
||||
|
||||
companion object {
|
||||
|
||||
fun getCurrent(contacts: List<Contact>): ConfigurationMessage? {
|
||||
@ -128,6 +135,15 @@ class ConfigurationMessage(val closedGroups: List<ClosedGroup>, val openGroups:
|
||||
}
|
||||
}
|
||||
|
||||
internal constructor(closedGroups: List<ClosedGroup>, openGroups: List<String>, contacts: List<Contact>, displayName: String, profilePicture: String?, profileKey: ByteArray): this() {
|
||||
this.closedGroups = closedGroups
|
||||
this.openGroups = openGroups
|
||||
this.contacts = contacts
|
||||
this.displayName = displayName
|
||||
this.profilePicture = profilePicture
|
||||
this.profileKey = profileKey
|
||||
}
|
||||
|
||||
override fun toProto(): SignalServiceProtos.Content? {
|
||||
val configurationProto = SignalServiceProtos.ConfigurationMessage.newBuilder()
|
||||
configurationProto.addAllClosedGroups(closedGroups.mapNotNull { it.toProto() })
|
||||
|
Loading…
Reference in New Issue
Block a user