mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 06:55:41 +00:00
Dismiss fallback notification when the room list is rendered.
This commit is contained in:
committed by
Benoit Marty
parent
6ec35db9d4
commit
b604b062b4
+15
-1
@@ -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.
|
||||||
|
|||||||
+5
-1
@@ -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(
|
||||||
|
|||||||
Reference in New Issue
Block a user