Fix / SyncThread was started in background

Upon reception of a push, is the session is instantiated the sync thread was starting to loop
This commit is contained in:
Valere
2019-07-16 15:44:08 +02:00
parent 42584fc55a
commit 63d2861bc8
4 changed files with 18 additions and 5 deletions

View File

@ -16,14 +16,20 @@
package im.vector.riotx.core.extensions
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.ProcessLifecycleOwner
import im.vector.matrix.android.api.session.Session
import im.vector.matrix.android.api.session.sync.FilterService
import im.vector.riotx.features.notifications.PushRuleTriggerListener
import timber.log.Timber
fun Session.configureAndStart(pushRuleTriggerListener: PushRuleTriggerListener) {
open()
setFilter(FilterService.FilterPreset.RiotFilter)
startSync()
Timber.i("Configure and start session for ${this.myUserId}")
val isAtLeastStarted = ProcessLifecycleOwner.get().lifecycle.currentState.isAtLeast(Lifecycle.State.STARTED)
Timber.v("--> is at least started? $isAtLeastStarted")
startSync(isAtLeastStarted)
refreshPushers()
pushRuleTriggerListener.startWithSession(this)
fetchPushRules()