Feature/fix notification clearing (#1707)

Updating notification when entering a room
This commit is contained in:
ganfra 2020-07-17 13:31:36 +02:00 committed by GitHub
parent 44fb53ce6b
commit 6e0095edb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -9,6 +9,7 @@ Improvements 🙌:
Bugfix 🐛:
- Fix theme issue on Room directory screen (#1613)
- Fix notification not dismissing when entering a room
Translations 🗣:
-

View File

@ -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()
}
}
}