Split notifications for messages in threads (#5595)
* Separate thread notifications into their own notifications when the feature flag is enabled. Otherwise, set the `threadId` to null so it'll behave as usual. It's done this way to avoid having to inject `FeatureFlagService` in several places. * Add permalink navigation to threads from notifications, focusing on the latest event in the list of messages of the notification tapped * Fix redactions in threads * Clear notifications for a thread when visiting it * Fix opening a thread happening twice, first because of the `openThreadId` value, then because of the `focusedEventId` one * Make opening a room through a notification also focus on the latest event * Add helper `NotificationCreator.messageTag` function * Remove unused `ROOM_CALL_NOTIFICATION_ID`: `FOREGROUND_SERVICE_NOTIFICATION_ID`+ `ForegroundServiceType` is used instead * Simplify `DefaultDeepLinkCreator` * Make sure the main timeline focuses on the thread root id too when navigating to a thread * Handle "Mark as read" action for thread notification, using `timeline.markAsRead` * Log failures to mark rooms as read using the notification action --------- Co-authored-by: Benoit Marty <benoit@matrix.org>
This commit is contained in:
parent
e8b7db22cd
commit
7facc40771
55 changed files with 702 additions and 284 deletions
|
|
@ -10,12 +10,14 @@ package io.element.android.libraries.push.test.notifications
|
|||
import io.element.android.libraries.matrix.api.core.EventId
|
||||
import io.element.android.libraries.matrix.api.core.RoomId
|
||||
import io.element.android.libraries.matrix.api.core.SessionId
|
||||
import io.element.android.libraries.matrix.api.core.ThreadId
|
||||
import io.element.android.libraries.push.api.notifications.NotificationCleaner
|
||||
import io.element.android.tests.testutils.lambda.lambdaError
|
||||
|
||||
class FakeNotificationCleaner(
|
||||
private val clearAllMessagesEventsLambda: (SessionId) -> Unit = { lambdaError() },
|
||||
private val clearMessagesForRoomLambda: (SessionId, RoomId) -> Unit = { _, _ -> lambdaError() },
|
||||
private val clearMessagesForThreadLambda: (SessionId, RoomId, ThreadId) -> Unit = { _, _, _ -> lambdaError() },
|
||||
private val clearEventLambda: (SessionId, EventId) -> Unit = { _, _ -> lambdaError() },
|
||||
private val clearMembershipNotificationForSessionLambda: (SessionId) -> Unit = { lambdaError() },
|
||||
private val clearMembershipNotificationForRoomLambda: (SessionId, RoomId) -> Unit = { _, _ -> lambdaError() }
|
||||
|
|
@ -28,6 +30,10 @@ class FakeNotificationCleaner(
|
|||
clearMessagesForRoomLambda(sessionId, roomId)
|
||||
}
|
||||
|
||||
override fun clearMessagesForThread(sessionId: SessionId, roomId: RoomId, threadId: ThreadId) {
|
||||
clearMessagesForThreadLambda(sessionId, roomId, threadId)
|
||||
}
|
||||
|
||||
override fun clearEvent(sessionId: SessionId, eventId: EventId) {
|
||||
clearEventLambda(sessionId, eventId)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue