Notification events resolving and rendering in batches (#4722)
- Use `NotiticationService.getNotifications()` function so we resolve the events in bulk. - Added `NotifierResolverQueue` to group the notifications to resolve based on a debounce strategy. - Batch rendering of these events as notifications.
This commit is contained in:
parent
f0c9f8294a
commit
f455085e08
30 changed files with 882 additions and 523 deletions
|
|
@ -13,16 +13,13 @@ import io.element.android.libraries.matrix.api.notification.NotificationData
|
|||
import io.element.android.libraries.matrix.api.notification.NotificationService
|
||||
|
||||
class FakeNotificationService : NotificationService {
|
||||
private var getNotificationResult: Result<NotificationData?> = Result.success(null)
|
||||
private var getNotificationsResult: Result<Map<EventId, NotificationData>> = Result.success(emptyMap())
|
||||
|
||||
fun givenGetNotificationResult(result: Result<NotificationData?>) {
|
||||
getNotificationResult = result
|
||||
fun givenGetNotificationsResult(result: Result<Map<EventId, NotificationData>>) {
|
||||
getNotificationsResult = result
|
||||
}
|
||||
|
||||
override suspend fun getNotification(
|
||||
roomId: RoomId,
|
||||
eventId: EventId,
|
||||
): Result<NotificationData?> {
|
||||
return getNotificationResult
|
||||
override suspend fun getNotifications(ids: Map<RoomId, List<EventId>>): Result<Map<EventId, NotificationData>> {
|
||||
return getNotificationsResult
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import io.element.android.libraries.matrix.api.notification.NotificationData
|
|||
import io.element.android.libraries.matrix.test.AN_EVENT_ID
|
||||
import io.element.android.libraries.matrix.test.A_ROOM_ID
|
||||
import io.element.android.libraries.matrix.test.A_ROOM_NAME
|
||||
import io.element.android.libraries.matrix.test.A_SESSION_ID
|
||||
import io.element.android.libraries.matrix.test.A_TIMESTAMP
|
||||
import io.element.android.libraries.matrix.test.A_USER_NAME_2
|
||||
|
||||
|
|
@ -27,6 +28,7 @@ fun aNotificationData(
|
|||
roomDisplayName: String? = A_ROOM_NAME
|
||||
): NotificationData {
|
||||
return NotificationData(
|
||||
sessionId = A_SESSION_ID,
|
||||
eventId = AN_EVENT_ID,
|
||||
threadId = threadId,
|
||||
roomId = A_ROOM_ID,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue