From 3482452011a5cee9f907b53aabc04c39430380b7 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 27 Oct 2023 14:41:39 +0200 Subject: [PATCH] Notification: fix issue: clear event only for the matching session. We do not have multi session so the bug is not visible yet. --- .../impl/notifications/DefaultNotificationDrawerManager.kt | 4 ++-- .../push/impl/notifications/NotificationBroadcastReceiver.kt | 2 +- .../push/impl/notifications/NotificationEventQueue.kt | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/DefaultNotificationDrawerManager.kt b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/DefaultNotificationDrawerManager.kt index 318b7cbd49..f2e3240203 100644 --- a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/DefaultNotificationDrawerManager.kt +++ b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/DefaultNotificationDrawerManager.kt @@ -195,9 +195,9 @@ class DefaultNotificationDrawerManager @Inject constructor( /** * Clear the notifications for a single event. */ - fun clearEvent(eventId: EventId, doRender: Boolean) { + fun clearEvent(sessionId: SessionId, eventId: EventId, doRender: Boolean) { updateEvents(doRender = doRender) { - it.clearEvent(eventId) + it.clearEvent(sessionId, eventId) } } diff --git a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/NotificationBroadcastReceiver.kt b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/NotificationBroadcastReceiver.kt index 8f27d8692c..0fdef871a1 100644 --- a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/NotificationBroadcastReceiver.kt +++ b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/NotificationBroadcastReceiver.kt @@ -56,7 +56,7 @@ class NotificationBroadcastReceiver : BroadcastReceiver() { defaultNotificationDrawerManager.clearMembershipNotificationForRoom(sessionId, roomId, doRender = false) } actionIds.dismissEvent -> if (eventId != null) { - defaultNotificationDrawerManager.clearEvent(eventId, doRender = false) + defaultNotificationDrawerManager.clearEvent(sessionId, eventId, doRender = false) } actionIds.markRoomRead -> if (roomId != null) { defaultNotificationDrawerManager.clearMessagesForRoom(sessionId, roomId, doRender = true) diff --git a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/NotificationEventQueue.kt b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/NotificationEventQueue.kt index 6b6730c904..b838f53d6f 100644 --- a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/NotificationEventQueue.kt +++ b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/NotificationEventQueue.kt @@ -135,8 +135,8 @@ data class NotificationEventQueue constructor( ) } - fun clearEvent(eventId: EventId) { - queue.removeAll { it.eventId == eventId } + fun clearEvent(sessionId: SessionId, eventId: EventId) { + queue.removeAll { it.sessionId == sessionId && it.eventId == eventId } } fun clearMembershipNotificationForSession(sessionId: SessionId) {