Update dependency org.matrix.rustcomponents:sdk-android to v25.7.7 (#4989)
Make sure we distinguish between notification events that were filtered out and those that couldn't be resolved. --- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jorge Martín <jorgem@element.io>
This commit is contained in:
parent
f4032e291b
commit
4b10920507
18 changed files with 313 additions and 200 deletions
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright 2025 New Vector Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.matrix.api.exception
|
||||
|
||||
/**
|
||||
* Exceptions that can occur while resolving the events associated to push notifications.
|
||||
*/
|
||||
sealed class NotificationResolverException : Exception() {
|
||||
/**
|
||||
* The event was not found by the notification service.
|
||||
*/
|
||||
data object EventNotFound : NotificationResolverException()
|
||||
|
||||
/**
|
||||
* The event was found but it was filtered out by the notification service.
|
||||
*/
|
||||
data object EventFilteredOut : NotificationResolverException()
|
||||
|
||||
/**
|
||||
* An unexpected error occurred while trying to resolve the event.
|
||||
*/
|
||||
data class UnknownError(override val message: String) : NotificationResolverException()
|
||||
}
|
||||
|
|
@ -68,7 +68,6 @@ sealed interface NotificationContent {
|
|||
) : MessageLike
|
||||
|
||||
data object RoomEncrypted : MessageLike
|
||||
data object UnableToResolve : MessageLike
|
||||
data class RoomMessage(
|
||||
val senderId: UserId,
|
||||
val messageType: MessageType
|
||||
|
|
|
|||
|
|
@ -10,6 +10,19 @@ package io.element.android.libraries.matrix.api.notification
|
|||
import io.element.android.libraries.matrix.api.core.EventId
|
||||
import io.element.android.libraries.matrix.api.core.RoomId
|
||||
|
||||
/**
|
||||
* Represents the resolution state of an attempt to retrieve notification data for a set of event ids.
|
||||
* The outer [Result] indicates the success or failure of the setup to retrieve notifications.
|
||||
* The inner [Result] for each [EventId] in the map indicates whether the notification data was successfully retrieved or if there was an error.
|
||||
*/
|
||||
typealias GetNotificationDataResult = Result<Map<EventId, Result<NotificationData>>>
|
||||
|
||||
/**
|
||||
* Service to retrieve notifications for a given set of event ids in specific rooms.
|
||||
*/
|
||||
interface NotificationService {
|
||||
suspend fun getNotifications(ids: Map<RoomId, List<EventId>>): Result<Map<EventId, NotificationData>>
|
||||
/**
|
||||
* Fetch notifications for the specified event ids in the given rooms.
|
||||
*/
|
||||
suspend fun getNotifications(ids: Map<RoomId, List<EventId>>): GetNotificationDataResult
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue