From 6e0095edb080f0b5a6c382c6ce9f5d369e84b6b1 Mon Sep 17 00:00:00 2001 From: ganfra Date: Fri, 17 Jul 2020 13:31:36 +0200 Subject: [PATCH] Feature/fix notification clearing (#1707) Updating notification when entering a room --- CHANGES.md | 1 + .../features/notifications/NotificationDrawerManager.kt | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index b45ad9dff8..0099412196 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -9,6 +9,7 @@ Improvements 🙌: Bugfix 🐛: - Fix theme issue on Room directory screen (#1613) + - Fix notification not dismissing when entering a room Translations 🗣: - diff --git a/vector/src/main/java/im/vector/riotx/features/notifications/NotificationDrawerManager.kt b/vector/src/main/java/im/vector/riotx/features/notifications/NotificationDrawerManager.kt index d0839795dd..f7085a000e 100644 --- a/vector/src/main/java/im/vector/riotx/features/notifications/NotificationDrawerManager.kt +++ b/vector/src/main/java/im/vector/riotx/features/notifications/NotificationDrawerManager.kt @@ -155,14 +155,17 @@ class NotificationDrawerManager @Inject constructor(private val context: Context /** Clear all known message events for this room */ fun clearMessageEventOfRoom(roomId: String?) { Timber.v("clearMessageEventOfRoom $roomId") - if (roomId != null) { + var shouldUpdate = false synchronized(eventList) { - eventList.removeAll { e -> + shouldUpdate = eventList.removeAll { e -> e is NotifiableMessageEvent && e.roomId == roomId } } - refreshNotificationDrawer() + if (shouldUpdate) { + notificationUtils.cancelNotificationMessage(roomId, ROOM_MESSAGES_NOTIFICATION_ID) + refreshNotificationDrawer() + } } }