Skip to content

Commit 3a0e182

Browse files
committed
Use new API awaitRoomRemoteEcho to ensure that the room is ready SDK side.
1 parent beb0bff commit 3a0e182

File tree

1 file changed

+5
-5
lines changed
  • libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl

1 file changed

+5
-5
lines changed

libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@ class RustMatrixClient(
272272
.filter(predicate)
273273
.first()
274274
.first()
275+
// Ensure that the room is ready
276+
.also { client.awaitRoomRemoteEcho(it.roomId.value) }
275277
}
276278
}
277279

@@ -311,16 +313,14 @@ class RustMatrixClient(
311313
avatar = createRoomParams.avatar,
312314
powerLevelContentOverride = defaultRoomCreationPowerLevels,
313315
)
314-
val roomId = client.createRoom(rustParams)
316+
val roomId = RoomId(client.createRoom(rustParams))
315317
// Wait to receive the room back from the sync but do not returns failure if it fails.
316318
try {
317-
withTimeout(30.seconds) {
318-
client.awaitRoomRemoteEcho(roomId)
319-
}
319+
awaitJoinedRoom(roomId.toRoomIdOrAlias(), 30.seconds)
320320
} catch (e: Exception) {
321321
Timber.e(e, "Timeout waiting for the room to be available in the room list")
322322
}
323-
RoomId(roomId)
323+
roomId
324324
}
325325
}
326326

0 commit comments

Comments
 (0)