From b4f1640d0b1417d945f7abbe02eb654523ebd99b Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Mon, 25 May 2020 18:01:21 +1000 Subject: [PATCH] Potentially fix crash --- .../thoughtcrime/securesms/ApplicationContext.java | 4 ++-- .../securesms/loki/activities/HomeActivity.kt | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/org/thoughtcrime/securesms/ApplicationContext.java b/src/org/thoughtcrime/securesms/ApplicationContext.java index 688db294a0..3ca54518d4 100644 --- a/src/org/thoughtcrime/securesms/ApplicationContext.java +++ b/src/org/thoughtcrime/securesms/ApplicationContext.java @@ -194,10 +194,10 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc FriendRequestProtocol.Companion.configureIfNeeded(apiDB, userPublicKey); MentionsManager.Companion.configureIfNeeded(userPublicKey, threadDB, userDB); SessionMetaProtocol.Companion.configureIfNeeded(apiDB, userPublicKey); - MultiDeviceProtocol.Companion.configureIfNeeded(apiDB); - SessionManagementProtocol.Companion.configureIfNeeded(sessionResetImpl, threadDB, this); SyncMessagesProtocol.Companion.configureIfNeeded(apiDB, userPublicKey); } + MultiDeviceProtocol.Companion.configureIfNeeded(apiDB); + SessionManagementProtocol.Companion.configureIfNeeded(sessionResetImpl, threadDB, this); setUpP2PAPIIfNeeded(); LokiPushNotificationAcknowledgement.Companion.configureIfNeeded(BuildConfig.DEBUG); if (setUpStorageAPIIfNeeded()) { diff --git a/src/org/thoughtcrime/securesms/loki/activities/HomeActivity.kt b/src/org/thoughtcrime/securesms/loki/activities/HomeActivity.kt index 48d287280d..52c7b054f7 100644 --- a/src/org/thoughtcrime/securesms/loki/activities/HomeActivity.kt +++ b/src/org/thoughtcrime/securesms/loki/activities/HomeActivity.kt @@ -154,21 +154,21 @@ class HomeActivity : PassphraseRequiredActionBarActivity, ConversationClickListe adapter.typingThreadIDs = threadIDs ?: setOf() }) // Set up remaining components if needed + val application = ApplicationContext.getInstance(this)d + val apiDB = DatabaseFactory.getLokiAPIDatabase(this) + val threadDB = DatabaseFactory.getLokiThreadDatabase(this) + val userDB = DatabaseFactory.getLokiUserDatabase(this) val userPublicKey = TextSecurePreferences.getLocalNumber(this) + val sessionResetImpl = LokiSessionResetImplementation(this) if (userPublicKey != null) { - val application = ApplicationContext.getInstance(this) - val apiDB = DatabaseFactory.getLokiAPIDatabase(this) - val threadDB = DatabaseFactory.getLokiThreadDatabase(this) - val userDB = DatabaseFactory.getLokiUserDatabase(this) - val sessionResetImpl = LokiSessionResetImplementation(this) FriendRequestProtocol.configureIfNeeded(apiDB, userPublicKey) MentionsManager.configureIfNeeded(userPublicKey, threadDB, userDB) SessionMetaProtocol.configureIfNeeded(apiDB, userPublicKey) - MultiDeviceProtocol.configureIfNeeded(apiDB) - SessionManagementProtocol.configureIfNeeded(sessionResetImpl, threadDB, application) SyncMessagesProtocol.configureIfNeeded(apiDB, userPublicKey) application.lokiPublicChatManager.startPollersIfNeeded() } + SessionManagementProtocol.configureIfNeeded(sessionResetImpl, threadDB, application) + MultiDeviceProtocol.configureIfNeeded(apiDB) // TODO: Temporary hack to unbork existing clients val allContacts = DatabaseFactory.getRecipientDatabase(this).allAddresses.map { MultiDeviceProtocol.shared.getMasterDevice(it.serialize()) ?: it.serialize()