update local session id and stop polling if local session id has changed

pull/242/head
ryanzhao 5 years ago
parent 106c22d9d2
commit 6fcc26cc22

@ -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;

@ -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()
}
}
Loading…
Cancel
Save