Add MatrixClient.resolveRoomAlias method.
This commit is contained in:
parent
bbb92bcc87
commit
0550da3e3b
3 changed files with 12 additions and 0 deletions
|
|
@ -98,4 +98,5 @@ interface MatrixClient : Closeable {
|
||||||
|
|
||||||
suspend fun trackRecentlyVisitedRoom(roomId: RoomId): Result<Unit>
|
suspend fun trackRecentlyVisitedRoom(roomId: RoomId): Result<Unit>
|
||||||
suspend fun getRecentlyVisitedRooms(): Result<List<RoomId>>
|
suspend fun getRecentlyVisitedRooms(): Result<List<RoomId>>
|
||||||
|
suspend fun resolveRoomAlias(roomAlias: String): Result<RoomId>
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -460,6 +460,12 @@ class RustMatrixClient(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override suspend fun resolveRoomAlias(roomAlias: String): Result<RoomId> = withContext(sessionDispatcher) {
|
||||||
|
runCatching {
|
||||||
|
client.resolveRoomAlias(roomAlias).let(::RoomId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun syncService(): SyncService = rustSyncService
|
override fun syncService(): SyncService = rustSyncService
|
||||||
|
|
||||||
override fun sessionVerificationService(): SessionVerificationService = verificationService
|
override fun sessionVerificationService(): SessionVerificationService = verificationService
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,7 @@ class FakeMatrixClient(
|
||||||
private val encryptionService: FakeEncryptionService = FakeEncryptionService(),
|
private val encryptionService: FakeEncryptionService = FakeEncryptionService(),
|
||||||
private val roomDirectoryService: RoomDirectoryService = FakeRoomDirectoryService(),
|
private val roomDirectoryService: RoomDirectoryService = FakeRoomDirectoryService(),
|
||||||
private val accountManagementUrlString: Result<String?> = Result.success(null),
|
private val accountManagementUrlString: Result<String?> = Result.success(null),
|
||||||
|
private val resolveRoomAliasResult: (String) -> Result<RoomId> = { Result.success(A_ROOM_ID) },
|
||||||
) : MatrixClient {
|
) : MatrixClient {
|
||||||
var setDisplayNameCalled: Boolean = false
|
var setDisplayNameCalled: Boolean = false
|
||||||
private set
|
private set
|
||||||
|
|
@ -276,6 +277,10 @@ class FakeMatrixClient(
|
||||||
return Result.success(Unit)
|
return Result.success(Unit)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override suspend fun resolveRoomAlias(roomAlias: String): Result<RoomId> {
|
||||||
|
return resolveRoomAliasResult(roomAlias)
|
||||||
|
}
|
||||||
|
|
||||||
override suspend fun getRecentlyVisitedRooms(): Result<List<RoomId>> {
|
override suspend fun getRecentlyVisitedRooms(): Result<List<RoomId>> {
|
||||||
return Result.success(visitedRoomsId)
|
return Result.success(visitedRoomsId)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue