-
Notifications
You must be signed in to change notification settings - Fork 742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/fga/experiment await room #6543
Conversation
SonarCloud Quality Gate failed. |
timelineFactory: TimelineFactory, | ||
appStateHandler: AppStateHandler, | ||
) : VectorViewModel<RoomDetailViewState, RoomDetailAction, RoomDetailViewEvents>(initialState), | ||
Timeline.Listener, ChatEffectManager.Delegate, CallProtocolsChecker.Listener, LocationSharingServiceConnection.Callback { | ||
|
||
private val room = session.getRoom(initialState.roomId)!! | ||
private val room = viewModelScope.async(start = CoroutineStart.LAZY) { | ||
session.roomService().awaitRoom(initialState.roomId)!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not for this PR, with this async I'm hoping it'll be easier to gracefully handle when the room is null 🤞
#5611
viewModelScope.launch { | ||
timeline.await().also { | ||
it.start(initialState.rootThreadEventId) | ||
it.addListener(this@TimelineViewModel) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible for start to trigger the listener before it's finished being added?
A PR will have to be re-open if we want this change to land. |
This is an experiment for using suspending function over the db queries.
Offer
awaitRoom
andawaitRoomSummary
methods just wrappinggetRoom
andgetRoomSummary
withwithContext
.Might be interesting to try realm-kotlin before moving to #5842.