Improve API, to avoid ignoring errors

This commit is contained in:
Benoit Marty 2024-05-06 23:06:25 +02:00 committed by Benoit Marty
parent 591df14450
commit 4bd01b6f4f
18 changed files with 143 additions and 107 deletions

View file

@ -42,7 +42,7 @@ interface PushProvider {
/**
* Register the pusher to the homeserver.
*/
suspend fun registerWith(matrixClient: MatrixClient, distributor: Distributor)
suspend fun registerWith(matrixClient: MatrixClient, distributor: Distributor): Result<Unit>
/**
* Return the current distributor, or null if none.
@ -52,7 +52,7 @@ interface PushProvider {
/**
* Unregister the pusher.
*/
suspend fun unregister(matrixClient: MatrixClient)
suspend fun unregister(matrixClient: MatrixClient): Result<Unit>
suspend fun getCurrentUserPushConfig(): CurrentUserPushConfig?
}

View file

@ -19,6 +19,6 @@ package io.element.android.libraries.pushproviders.api
import io.element.android.libraries.matrix.api.MatrixClient
interface PusherSubscriber {
suspend fun registerPusher(matrixClient: MatrixClient, pushKey: String, gateway: String)
suspend fun unregisterPusher(matrixClient: MatrixClient, pushKey: String, gateway: String)
suspend fun registerPusher(matrixClient: MatrixClient, pushKey: String, gateway: String): Result<Unit>
suspend fun unregisterPusher(matrixClient: MatrixClient, pushKey: String, gateway: String): Result<Unit>
}