From 3a0e182ba9f2412e5eba45bc62fa283c6e6b9d3c Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 17 Sep 2024 10:59:26 +0200 Subject: [PATCH] Use new API `awaitRoomRemoteEcho` to ensure that the room is ready SDK side. --- .../android/libraries/matrix/impl/RustMatrixClient.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 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 ff43659b40..9e77dcff4c 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 @@ -272,6 +272,8 @@ class RustMatrixClient( .filter(predicate) .first() .first() + // Ensure that the room is ready + .also { client.awaitRoomRemoteEcho(it.roomId.value) } } } @@ -311,16 +313,14 @@ class RustMatrixClient( avatar = createRoomParams.avatar, powerLevelContentOverride = defaultRoomCreationPowerLevels, ) - val roomId = client.createRoom(rustParams) + val roomId = RoomId(client.createRoom(rustParams)) // Wait to receive the room back from the sync but do not returns failure if it fails. try { - withTimeout(30.seconds) { - client.awaitRoomRemoteEcho(roomId) - } + awaitJoinedRoom(roomId.toRoomIdOrAlias(), 30.seconds) } catch (e: Exception) { Timber.e(e, "Timeout waiting for the room to be available in the room list") } - RoomId(roomId) + roomId } }