Dismiss fallback notification when the room list is rendered.

This commit is contained in:
Benoit Marty 2026-02-12 09:57:50 +01:00 committed by Benoit Marty
parent b9d5645853
commit 00fb4498f4
2 changed files with 20 additions and 2 deletions

View file

@ -71,7 +71,10 @@ class DefaultNotificationDrawerManager(
private fun onAppNavigationStateChange(navigationState: NavigationState) { private fun onAppNavigationStateChange(navigationState: NavigationState) {
when (navigationState) { when (navigationState) {
NavigationState.Root -> {} NavigationState.Root -> {}
is NavigationState.Session -> {} is NavigationState.Session -> {
// Cleanup the fallback notification
clearFallbackForSession(navigationState.sessionId)
}
is NavigationState.Room -> { is NavigationState.Room -> {
// Cleanup notification for current room // Cleanup notification for current room
clearMessagesForRoom( clearMessagesForRoom(
@ -121,6 +124,17 @@ class DefaultNotificationDrawerManager(
.forEach { notificationDisplayer.cancelNotification(it.tag, it.id) } .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]. * 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. * Used to ignore events related to that room (no need to display notification) and clean any existing notification on this room.

View file

@ -149,7 +149,7 @@ class DefaultNotificationDataFactory(
fallback, fallback,
) )
return OneShotNotification( return OneShotNotification(
tag = "FALLBACK", tag = FALLBACK_NOTIFICATION_TAG,
notification = notification, notification = notification,
isNoisy = false, isNoisy = false,
timestamp = fallback.first().timestamp timestamp = fallback.first().timestamp
@ -174,6 +174,10 @@ class DefaultNotificationDataFactory(
) )
} }
} }
companion object {
const val FALLBACK_NOTIFICATION_TAG = "FALLBACK"
}
} }
data class RoomNotification( data class RoomNotification(