From e8387945872ebd8af1b1c8d091992aa1c61bddfd Mon Sep 17 00:00:00 2001 From: Valere Date: Mon, 1 Jul 2019 13:08:16 +0200 Subject: [PATCH] Do not check push rule on initial sync --- .../android/internal/session/notification/BingRuleWatcher.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/notification/BingRuleWatcher.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/notification/BingRuleWatcher.kt index e07af970..e2c299be 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/notification/BingRuleWatcher.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/notification/BingRuleWatcher.kt @@ -22,6 +22,7 @@ import im.vector.matrix.android.internal.database.RealmLiveEntityObserver import im.vector.matrix.android.internal.database.mapper.asDomain import im.vector.matrix.android.internal.database.model.EventEntity import im.vector.matrix.android.internal.database.query.types +import im.vector.matrix.android.internal.session.sync.SyncTokenStore import im.vector.matrix.android.internal.task.TaskExecutor import im.vector.matrix.android.internal.task.configureWith import javax.inject.Inject @@ -31,6 +32,7 @@ internal class BingRuleWatcher @Inject constructor(monarchy: Monarchy, private val task: ProcessEventForPushTask, private val defaultPushRuleService: DefaultPushRuleService, private val sessionParams: SessionParams, + private val tokenStore: SyncTokenStore, private val taskExecutor: TaskExecutor) : RealmLiveEntityObserver(monarchy) { @@ -45,6 +47,7 @@ internal class BingRuleWatcher @Inject constructor(monarchy: Monarchy, } override fun processChanges(inserted: List, updated: List, deleted: List) { + if (tokenStore.getLastToken() == null) return //no notif on initial sync // TODO Use const for "global" val rules = defaultPushRuleService.getPushRules("global") inserted.map { it.asDomain() }