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

This commit is contained in:
ryanzhao 2020-06-25 09:33:44 +10:00
parent 106c22d9d2
commit 6fcc26cc22
2 changed files with 10 additions and 1 deletions

View File

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

View File

@ -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()
}
}