Skip to content
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

Closed
wants to merge 3 commits into from

Conversation

ganfra
Copy link
Member

@ganfra ganfra commented Jul 13, 2022

This is an experiment for using suspending function over the db queries.
Offer awaitRoom and awaitRoomSummary methods just wrapping getRoom and getRoomSummary with withContext.
Might be interesting to try realm-kotlin before moving to #5842.

@ganfra ganfra requested review from ouchadam and bmarty July 13, 2022 14:40
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

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)!!
Copy link
Contributor

@ouchadam ouchadam Aug 22, 2022

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)
Copy link
Contributor

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?

@bmarty bmarty mentioned this pull request Aug 31, 2022
15 tasks
@bmarty
Copy link
Member

bmarty commented Jan 10, 2023

A PR will have to be re-open if we want this change to land.

@bmarty bmarty closed this Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants