move forceSyncConfigurationNowIfNeeded

This commit is contained in:
Ryan ZHAO 2021-02-09 15:02:30 +11:00
parent fb2757588d
commit 61a3cea895
2 changed files with 3 additions and 2 deletions

View File

@ -24,6 +24,7 @@ import org.thoughtcrime.securesms.mms.GlideApp
import org.session.libsession.messaging.threads.recipients.Recipient
import org.session.libsession.utilities.TextSecurePreferences
import org.thoughtcrime.securesms.loki.protocol.ClosedGroupsProtocolV2
import org.thoughtcrime.securesms.loki.protocol.MultiDeviceProtocol
//TODO Refactor to avoid using kotlinx.android.synthetic
class CreateClosedGroupActivity : PassphraseRequiredActionBarActivity(), LoaderManager.LoaderCallbacks<List<String>> {
@ -110,6 +111,8 @@ class CreateClosedGroupActivity : PassphraseRequiredActionBarActivity(), LoaderM
isLoading = true
loaderContainer.fadeIn()
ClosedGroupsProtocolV2.createClosedGroup(this, name.toString(), selectedMembers + setOf( userPublicKey )).successUi { groupID ->
// Force sync configuration message
MultiDeviceProtocol.forceSyncConfigurationNowIfNeeded(this)
loaderContainer.fadeOut()
isLoading = false
val threadID = DatabaseFactory.getThreadDatabase(this).getOrCreateThreadIdFor(Recipient.from(this, Address.fromSerialized(groupID), false))

View File

@ -84,8 +84,6 @@ object ClosedGroupsProtocolV2 {
insertOutgoingInfoMessage(context, groupID, GroupContext.Type.UPDATE, name, members, admins, threadID)
// Notify the PN server
LokiPushNotificationManager.performOperation(context, ClosedGroupOperation.Subscribe, groupPublicKey, userPublicKey)
// Force sync configuration message
MultiDeviceProtocol.forceSyncConfigurationNowIfNeeded(context)
// Fulfill the promise
deferred.resolve(groupID)
}