From 0755f0b953babeca7d4299736777e634a5044c5f Mon Sep 17 00:00:00 2001 From: Harris Date: Tue, 12 Oct 2021 14:32:06 +1100 Subject: [PATCH] fix: conversationListNotificationHandler initialized in getter if null and removed from onCreate --- .../org/thoughtcrime/securesms/ApplicationContext.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/ApplicationContext.java b/app/src/main/java/org/thoughtcrime/securesms/ApplicationContext.java index d0d7ba60d8..cfb7be88cb 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ApplicationContext.java +++ b/app/src/main/java/org/thoughtcrime/securesms/ApplicationContext.java @@ -54,13 +54,10 @@ import org.thoughtcrime.securesms.crypto.KeyPairUtilities; import org.thoughtcrime.securesms.database.JobDatabase; import org.thoughtcrime.securesms.database.LokiAPIDatabase; import org.thoughtcrime.securesms.database.Storage; -import org.thoughtcrime.securesms.database.LokiAPIDatabase; import org.thoughtcrime.securesms.dependencies.DatabaseComponent; import org.thoughtcrime.securesms.dependencies.DatabaseModule; import org.thoughtcrime.securesms.groups.OpenGroupManager; import org.thoughtcrime.securesms.home.HomeActivity; -import org.thoughtcrime.securesms.groups.OpenGroupManager; -import org.thoughtcrime.securesms.home.HomeActivity; import org.thoughtcrime.securesms.jobmanager.JobManager; import org.thoughtcrime.securesms.jobmanager.impl.JsonDataSerializer; import org.thoughtcrime.securesms.jobs.FastJobStorage; @@ -148,6 +145,9 @@ public class ApplicationContext extends Application implements DefaultLifecycleO } public Handler getConversationListNotificationHandler() { + if (this.conversationListNotificationHandler == null) { + conversationListNotificationHandler = new Handler(Looper.getMainLooper()); + } return this.conversationListNotificationHandler; } @@ -155,7 +155,7 @@ public class ApplicationContext extends Application implements DefaultLifecycleO return this.persistentLogger; } -@Override + @Override public void onCreate() { DatabaseModule.init(this); super.onCreate(); @@ -169,7 +169,6 @@ public class ApplicationContext extends Application implements DefaultLifecycleO AppContext.INSTANCE.configureKovenant(); messageNotifier = new OptimizedMessageNotifier(new DefaultMessageNotifier()); broadcaster = new Broadcaster(this); - conversationListNotificationHandler = new Handler(Looper.getMainLooper()); LokiAPIDatabase apiDB = getDatabaseComponent().lokiAPIDatabase(); MessagingModuleConfiguration.Companion.configure(this, storage,