mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-21 17:08:28 +00:00
only handle the first configuration message
This commit is contained in:
parent
c2836cc654
commit
9cf292589b
@ -111,8 +111,6 @@ class CreateClosedGroupActivity : PassphraseRequiredActionBarActivity(), LoaderM
|
|||||||
isLoading = true
|
isLoading = true
|
||||||
loaderContainer.fadeIn()
|
loaderContainer.fadeIn()
|
||||||
ClosedGroupsProtocolV2.createClosedGroup(this, name.toString(), selectedMembers + setOf( userPublicKey )).successUi { groupID ->
|
ClosedGroupsProtocolV2.createClosedGroup(this, name.toString(), selectedMembers + setOf( userPublicKey )).successUi { groupID ->
|
||||||
// Force sync configuration message
|
|
||||||
MultiDeviceProtocol.forceSyncConfigurationNowIfNeeded(this)
|
|
||||||
loaderContainer.fadeOut()
|
loaderContainer.fadeOut()
|
||||||
isLoading = false
|
isLoading = false
|
||||||
val threadID = DatabaseFactory.getThreadDatabase(this).getOrCreateThreadIdFor(Recipient.from(this, Address.fromSerialized(groupID), false))
|
val threadID = DatabaseFactory.getThreadDatabase(this).getOrCreateThreadIdFor(Recipient.from(this, Address.fromSerialized(groupID), false))
|
||||||
|
@ -59,6 +59,7 @@ object MultiDeviceProtocol {
|
|||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun handleConfigurationMessage(context: Context, content: SignalServiceProtos.Content, senderPublicKey: String) {
|
fun handleConfigurationMessage(context: Context, content: SignalServiceProtos.Content, senderPublicKey: String) {
|
||||||
|
if (TextSecurePreferences.getConfigurationMessageSynced(context)) return
|
||||||
val configurationMessage = ConfigurationMessage.fromProto(content) ?: return
|
val configurationMessage = ConfigurationMessage.fromProto(content) ?: return
|
||||||
val userPublicKey = TextSecurePreferences.getLocalNumber(context) ?: return
|
val userPublicKey = TextSecurePreferences.getLocalNumber(context) ?: return
|
||||||
if (senderPublicKey != userPublicKey) return
|
if (senderPublicKey != userPublicKey) return
|
||||||
@ -85,5 +86,6 @@ object MultiDeviceProtocol {
|
|||||||
if (allOpenGroups.contains(openGroup)) continue
|
if (allOpenGroups.contains(openGroup)) continue
|
||||||
OpenGroupUtilities.addGroup(context, openGroup, 1)
|
OpenGroupUtilities.addGroup(context, openGroup, 1)
|
||||||
}
|
}
|
||||||
|
TextSecurePreferences.setConfigurationMessageSynced(context, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -131,6 +131,7 @@ object TextSecurePreferences {
|
|||||||
// region Multi Device
|
// region Multi Device
|
||||||
private const val IS_USING_MULTI_DEVICE = "pref_is_using_multi_device"
|
private const val IS_USING_MULTI_DEVICE = "pref_is_using_multi_device"
|
||||||
private const val LAST_CONFIGURATION_SYNC_TIME = "pref_last_configuration_sync_time"
|
private const val LAST_CONFIGURATION_SYNC_TIME = "pref_last_configuration_sync_time"
|
||||||
|
private const val CONFIGURATION_SYNCED = "pref_configuration_synced"
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun isUsingMultiDevice(context: Context): Boolean {
|
fun isUsingMultiDevice(context: Context): Boolean {
|
||||||
@ -152,6 +153,16 @@ object TextSecurePreferences {
|
|||||||
setLongPreference(context, LAST_CONFIGURATION_SYNC_TIME, value)
|
setLongPreference(context, LAST_CONFIGURATION_SYNC_TIME, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun getConfigurationMessageSynced(context: Context): Boolean {
|
||||||
|
return getBooleanPreference(context, CONFIGURATION_SYNCED, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun setConfigurationMessageSynced(context: Context, value: Boolean) {
|
||||||
|
setBooleanPreference(context, CONFIGURATION_SYNCED, value)
|
||||||
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun isUsingFCM(context: Context): Boolean {
|
fun isUsingFCM(context: Context): Boolean {
|
||||||
return getBooleanPreference(context, IS_USING_FCM, false)
|
return getBooleanPreference(context, IS_USING_FCM, false)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user