|
|
@ -67,7 +67,11 @@ class ConfigurationMessage(val closedGroups: List<ClosedGroup>, val openGroups:
|
|
|
|
fun toProto(): SignalServiceProtos.ConfigurationMessage.Contact? {
|
|
|
|
fun toProto(): SignalServiceProtos.ConfigurationMessage.Contact? {
|
|
|
|
val result = SignalServiceProtos.ConfigurationMessage.Contact.newBuilder()
|
|
|
|
val result = SignalServiceProtos.ConfigurationMessage.Contact.newBuilder()
|
|
|
|
result.name = this.name
|
|
|
|
result.name = this.name
|
|
|
|
|
|
|
|
try {
|
|
|
|
result.publicKey = ByteString.copyFrom(Hex.fromStringCondensed(publicKey))
|
|
|
|
result.publicKey = ByteString.copyFrom(Hex.fromStringCondensed(publicKey))
|
|
|
|
|
|
|
|
} catch (e: Exception) {
|
|
|
|
|
|
|
|
return null
|
|
|
|
|
|
|
|
}
|
|
|
|
if (!this.profilePicture.isNullOrEmpty()) {
|
|
|
|
if (!this.profilePicture.isNullOrEmpty()) {
|
|
|
|
result.profilePicture = this.profilePicture
|
|
|
|
result.profilePicture = this.profilePicture
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -83,13 +87,13 @@ class ConfigurationMessage(val closedGroups: List<ClosedGroup>, val openGroups:
|
|
|
|
|
|
|
|
|
|
|
|
companion object {
|
|
|
|
companion object {
|
|
|
|
|
|
|
|
|
|
|
|
fun getCurrent(contacts: List<Contact>): ConfigurationMessage {
|
|
|
|
fun getCurrent(contacts: List<Contact>): ConfigurationMessage? {
|
|
|
|
val closedGroups = mutableListOf<ClosedGroup>()
|
|
|
|
val closedGroups = mutableListOf<ClosedGroup>()
|
|
|
|
val openGroups = mutableListOf<String>()
|
|
|
|
val openGroups = mutableListOf<String>()
|
|
|
|
val sharedConfig = MessagingConfiguration.shared
|
|
|
|
val sharedConfig = MessagingConfiguration.shared
|
|
|
|
val storage = sharedConfig.storage
|
|
|
|
val storage = sharedConfig.storage
|
|
|
|
val context = sharedConfig.context
|
|
|
|
val context = sharedConfig.context
|
|
|
|
val displayName = TextSecurePreferences.getProfileName(context)!!
|
|
|
|
val displayName = TextSecurePreferences.getProfileName(context) ?: return null
|
|
|
|
val profilePicture = TextSecurePreferences.getProfilePictureURL(context)
|
|
|
|
val profilePicture = TextSecurePreferences.getProfilePictureURL(context)
|
|
|
|
val profileKey = ProfileKeyUtil.getProfileKey(context)
|
|
|
|
val profileKey = ProfileKeyUtil.getProfileKey(context)
|
|
|
|
val groups = storage.getAllGroups()
|
|
|
|
val groups = storage.getAllGroups()
|
|
|
|