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) {
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.

View File

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