matrix-rust-sdk
matrix-rust-sdk copied to clipboard
RoomListService never says "running" if you're joined to 0 rooms
In a Complement test I have a user who is invited to a single room only, and joined to none. Using syncService.RoomListService().State(callback)
and syncService.State(callback)
the following states are emitted in order:
- sync service =>
SyncServiceStateRunning
(this is done prior to the room list service getting rooms, so things likeclient.Rooms()
will have 0 rooms). - room list service =>
RoomListServiceStateSettingUp
If a user has >0 joined rooms, we then get this afterwards:
- room list service =>
RoomListServiceStateRunning
How am I supposed to wait until the first sync is done using the FFI bindings?
Listening for the all rooms list is what I ended up doing, which seems to work. I think it still is probably a bug that the main room list service isn't emitting running though.
@kegsay
How am I supposed to wait until the first sync is done using the FFI bindings?
Why do you want to wait? The room list service sync will not wait for a user input. It will continuously sync until it's stopped or an error happens.
Consider the case where the UI shows a spinner when you open the app, and then if there are 0 rooms it says "you're not in any rooms yet". This requires some kind of callback to say "I've synced and here's your room list".
As I said, I can work around this by looking at the AllRooms list, but this is surprising behaviour API wise.
Maybe RoomListLoadingState
is what you’re looking for.