Use SDK API to build room and event permalinks.
This commit is contained in:
parent
7b14a0e4c8
commit
294f1f2d96
9 changed files with 37 additions and 109 deletions
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
package io.element.android.libraries.matrix.test.permalink
|
||||
|
||||
import io.element.android.libraries.matrix.api.core.RoomId
|
||||
import io.element.android.libraries.matrix.api.core.UserId
|
||||
import io.element.android.libraries.matrix.api.permalink.PermalinkBuilder
|
||||
|
||||
|
|
@ -26,12 +25,4 @@ class FakePermalinkBuilder(
|
|||
override fun permalinkForUser(userId: UserId): Result<String> {
|
||||
return result()
|
||||
}
|
||||
|
||||
override fun permalinkForRoomAlias(roomAlias: String): Result<String> {
|
||||
return result()
|
||||
}
|
||||
|
||||
override fun permalinkForRoomId(roomId: RoomId): Result<String> {
|
||||
return result()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,8 @@ class FakeMatrixRoom(
|
|||
override val activeMemberCount: Long = 234L,
|
||||
val notificationSettingsService: NotificationSettingsService = FakeNotificationSettingsService(),
|
||||
private val matrixTimeline: MatrixTimeline = FakeMatrixTimeline(),
|
||||
private var permalinkResult: () -> Result<String> = { Result.success("link") },
|
||||
private var roomPermalinkResult: () -> Result<String> = { Result.success("room link") },
|
||||
private var eventPermalinkResult: (EventId) -> Result<String> = { Result.success("event link") },
|
||||
canRedactOwn: Boolean = false,
|
||||
canRedactOther: Boolean = false,
|
||||
) : MatrixRoom {
|
||||
|
|
@ -278,8 +279,12 @@ class FakeMatrixRoom(
|
|||
return cancelSendResult
|
||||
}
|
||||
|
||||
override suspend fun getPermalink(): Result<String> {
|
||||
return roomPermalinkResult()
|
||||
}
|
||||
|
||||
override suspend fun getPermalinkFor(eventId: EventId): Result<String> {
|
||||
return permalinkResult()
|
||||
return eventPermalinkResult(eventId)
|
||||
}
|
||||
|
||||
override suspend fun editMessage(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue