From beb0bff3cca91f56890c770dda09ecbb411bc799 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 17 Sep 2024 10:21:27 +0200 Subject: [PATCH] Use new API `awaitRoomRemoteEcho` to wait for the created room to be available. --- .../android/libraries/matrix/impl/RustMatrixClient.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt index 1112fde2f5..ff43659b40 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt @@ -311,14 +311,16 @@ class RustMatrixClient( avatar = createRoomParams.avatar, powerLevelContentOverride = defaultRoomCreationPowerLevels, ) - val roomId = RoomId(client.createRoom(rustParams)) + val roomId = client.createRoom(rustParams) // Wait to receive the room back from the sync but do not returns failure if it fails. try { - awaitJoinedRoom(roomId.toRoomIdOrAlias(), 30.seconds) + withTimeout(30.seconds) { + client.awaitRoomRemoteEcho(roomId) + } } catch (e: Exception) { Timber.e(e, "Timeout waiting for the room to be available in the room list") } - roomId + RoomId(roomId) } }