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 {