now that we ignore duplicated invite joined events at the source we can avoid eager notification cancels and rely on the main notification refresh flow

This commit is contained in:
Adam Brown 2021-10-08 17:02:59 +01:00
parent e95d49a3ae
commit 0c809b5ed1

View file

@ -212,12 +212,16 @@ class NotificationDrawerManager @Inject constructor(private val context: Context
}
fun clearMemberShipNotificationForRoom(roomId: String) {
synchronized(eventList) {
eventList.removeAll { e ->
e is InviteNotifiableEvent && e.roomId == roomId
}
val shouldUpdate = removeAll { it is InviteNotifiableEvent && it.roomId == roomId }
if (shouldUpdate) {
refreshNotificationDrawerBg()
}
}
private fun removeAll(predicate: (NotifiableEvent) -> Boolean): Boolean {
return synchronized(eventList) {
eventList.removeAll(predicate)
}
notificationUtils.cancelNotificationMessage(roomId, ROOM_INVITATION_NOTIFICATION_ID)
}
private var firstThrottler = FirstThrottler(200)