diff --git a/src/org/thoughtcrime/securesms/ApplicationContext.java b/src/org/thoughtcrime/securesms/ApplicationContext.java index 3121f02dd5..c4552ca719 100644 --- a/src/org/thoughtcrime/securesms/ApplicationContext.java +++ b/src/org/thoughtcrime/securesms/ApplicationContext.java @@ -484,9 +484,12 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc } private void setUpPollingIfNeeded() { - if (lokiPoller != null) return; String userPublicKey = TextSecurePreferences.getLocalNumber(this); if (userPublicKey == null) return; + if (lokiPoller != null) { + lokiPoller.updateUserHexEncodedPublicKey(userPublicKey); + return; + } LokiAPIDatabase apiDB = DatabaseFactory.getLokiAPIDatabase(this); Context context = this; LokiSwarmAPI.Companion.configureIfNeeded(apiDB); @@ -504,6 +507,10 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc if (lokiPoller != null) { lokiPoller.startIfNeeded(); } } + public void stopPollingIfNeeded() { + if (lokiPoller != null) { lokiPoller.stopIfNeeded(); } + } + private void resubmitProfilePictureIfNeeded() { String userPublicKey = TextSecurePreferences.getLocalNumber(this); if (userPublicKey == null) return; diff --git a/src/org/thoughtcrime/securesms/loki/activities/LandingActivity.kt b/src/org/thoughtcrime/securesms/loki/activities/LandingActivity.kt index 4d08c6725b..0e0a4d96ab 100644 --- a/src/org/thoughtcrime/securesms/loki/activities/LandingActivity.kt +++ b/src/org/thoughtcrime/securesms/loki/activities/LandingActivity.kt @@ -145,5 +145,7 @@ class LandingActivity : BaseActionBarActivity(), LinkDeviceSlaveModeDialogDelega TextSecurePreferences.removeLocalNumber(this) TextSecurePreferences.setHasSeenWelcomeScreen(this, false) TextSecurePreferences.setPromptedPushRegistration(this, false) + val application = ApplicationContext.getInstance(this) + application.stopPollingIfNeeded() } } \ No newline at end of file