Simplify & fix from_server_id usage

This commit is contained in:
Niels Andriesse
2021-05-24 13:48:01 +10:00
parent 716e768dac
commit 639146cc0a
4 changed files with 26 additions and 35 deletions

View File

@@ -205,11 +205,11 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
contactDB.setContact(contact);
}
}
if (poller != null) {
poller.setCaughtUp(false);
}
startPollingIfNeeded();
OpenGroupManager.INSTANCE.setAllCaughtUp(false);
OpenGroupManager.INSTANCE.startPolling();
}

View File

@@ -66,8 +66,6 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
// region Lifecycle
override fun onCreate(savedInstanceState: Bundle?, isReady: Boolean) {
super.onCreate(savedInstanceState, isReady)
// Check when Session was last opened
setPollingLimit();
// Double check that the long poller is up
(applicationContext as ApplicationContext).startPollingIfNeeded()
// Set content view
@@ -192,15 +190,6 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
super.onDestroy()
EventBus.getDefault().unregister(this)
}
fun setPollingLimit() {
val lastTimeSessionOpened = TextSecurePreferences.getLastTimeSessionOpened(this)
val timeSinceLastTimeOpen = System.currentTimeMillis() - lastTimeSessionOpened
// activate polling limit on open groups if the app hasn't been opened for more than the duration set in MAX_INACTIVITY_PERIOD
TextSecurePreferences.setOpenGroupPollingLimit(this, timeSinceLastTimeOpen > OpenGroupPollerV2.maxInactivityPeriod)
TextSecurePreferences.setLastTimeSessionOpened(this)
}
// endregion
// region Updating