Use SDK API to build room and event permalinks.

This commit is contained in:
Benoit Marty 2024-04-09 11:45:43 +02:00 committed by Benoit Marty
parent 7b14a0e4c8
commit 294f1f2d96
9 changed files with 37 additions and 109 deletions

View file

@ -16,17 +16,12 @@
package io.element.android.libraries.matrix.api.permalink
import io.element.android.libraries.matrix.api.core.RoomId
import io.element.android.libraries.matrix.api.core.UserId
interface PermalinkBuilder {
fun permalinkForUser(userId: UserId): Result<String>
fun permalinkForRoomAlias(roomAlias: String): Result<String>
fun permalinkForRoomId(roomId: RoomId): Result<String>
}
sealed class PermalinkBuilderError : Throwable() {
data object InvalidRoomAlias : PermalinkBuilderError()
data object InvalidRoomId : PermalinkBuilderError()
data object InvalidUserId : PermalinkBuilderError()
}

View file

@ -317,6 +317,11 @@ interface MatrixRoom : Closeable {
*/
fun getWidgetDriver(widgetSettings: MatrixWidgetSettings): Result<MatrixWidgetDriver>
/**
* Get the permalink for the room.
*/
suspend fun getPermalink(): Result<String>
/**
* Get the permalink for the provided [eventId].
* @param eventId The event id to get the permalink for.