From 0cba8f3aa14b29059c9d21458cd9f7b7812beed1 Mon Sep 17 00:00:00 2001 From: Onuray Sahin Date: Thu, 10 Sep 2020 12:08:05 +0300 Subject: [PATCH] Start background sync even if the eventId or roomId is null. --- CHANGES.md | 2 +- .../gplay/push/fcm/VectorFirebaseMessagingService.kt | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index b1a93209bc..f34a32d06b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,7 +8,7 @@ Improvements 🙌: - Bugfix 🐛: - - + - Clear the notification when the event is read elsewhere (#1822) Translations 🗣: - diff --git a/vector/src/gplay/java/im/vector/app/gplay/push/fcm/VectorFirebaseMessagingService.kt b/vector/src/gplay/java/im/vector/app/gplay/push/fcm/VectorFirebaseMessagingService.kt index be0ce86326..8fdb65c8d0 100755 --- a/vector/src/gplay/java/im/vector/app/gplay/push/fcm/VectorFirebaseMessagingService.kt +++ b/vector/src/gplay/java/im/vector/app/gplay/push/fcm/VectorFirebaseMessagingService.kt @@ -130,14 +130,9 @@ class VectorFirebaseMessagingService : FirebaseMessagingService() { if (BuildConfig.LOW_PRIVACY_LOG_ENABLE) { Timber.i("## onMessageReceivedInternal() : $data") } - val eventId = data["event_id"] - val roomId = data["room_id"] - if (eventId == null || roomId == null) { - Timber.e("## onMessageReceivedInternal() missing eventId and/or roomId") - return - } + // update the badge counter - val unreadCount = data.get("unread")?.let { Integer.parseInt(it) } ?: 0 + val unreadCount = data["unread"]?.let { Integer.parseInt(it) } ?: 0 BadgeProxy.updateBadgeCount(applicationContext, unreadCount) val session = activeSessionHolder.getSafeActiveSession() @@ -145,6 +140,9 @@ class VectorFirebaseMessagingService : FirebaseMessagingService() { if (session == null) { Timber.w("## Can't sync from push, no current session") } else { + val eventId = data["event_id"] + val roomId = data["room_id"] + if (isEventAlreadyKnown(eventId, roomId)) { Timber.i("Ignoring push, event already known") } else {