Dismiss fallback notification when the room list is rendered.
This commit is contained in:
parent
6ec35db9d4
commit
b604b062b4
2 changed files with 20 additions and 2 deletions
|
|
@ -71,7 +71,10 @@ class DefaultNotificationDrawerManager(
|
|||
private fun onAppNavigationStateChange(navigationState: NavigationState) {
|
||||
when (navigationState) {
|
||||
NavigationState.Root -> {}
|
||||
is NavigationState.Session -> {}
|
||||
is NavigationState.Session -> {
|
||||
// Cleanup the fallback notification
|
||||
clearFallbackForSession(navigationState.sessionId)
|
||||
}
|
||||
is NavigationState.Room -> {
|
||||
// Cleanup notification for current room
|
||||
clearMessagesForRoom(
|
||||
|
|
@ -121,6 +124,17 @@ class DefaultNotificationDrawerManager(
|
|||
.forEach { notificationDisplayer.cancelNotification(it.tag, it.id) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the fallback notification for the session.
|
||||
*/
|
||||
fun clearFallbackForSession(sessionId: SessionId) {
|
||||
notificationDisplayer.cancelNotification(
|
||||
DefaultNotificationDataFactory.FALLBACK_NOTIFICATION_TAG,
|
||||
NotificationIdProvider.getFallbackNotificationId(sessionId),
|
||||
)
|
||||
clearSummaryNotificationIfNeeded(sessionId)
|
||||
}
|
||||
|
||||
/**
|
||||
* Should be called when the application is currently opened and showing timeline for the given [roomId].
|
||||
* Used to ignore events related to that room (no need to display notification) and clean any existing notification on this room.
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ class DefaultNotificationDataFactory(
|
|||
fallback,
|
||||
)
|
||||
return OneShotNotification(
|
||||
tag = "FALLBACK",
|
||||
tag = FALLBACK_NOTIFICATION_TAG,
|
||||
notification = notification,
|
||||
isNoisy = false,
|
||||
timestamp = fallback.first().timestamp
|
||||
|
|
@ -174,6 +174,10 @@ class DefaultNotificationDataFactory(
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val FALLBACK_NOTIFICATION_TAG = "FALLBACK"
|
||||
}
|
||||
}
|
||||
|
||||
data class RoomNotification(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue