-
Notifications
You must be signed in to change notification settings - Fork 782
Deferred DM - Add a loading wheel while creating the DM #7125
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
Conversation
|
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.
Nice work, (didn't test it).
One small remark
private suspend fun createRoom(localRoomSummary: LocalRoomSummary): String { | ||
updateCreationState(localRoomSummary.roomId, LocalRoomCreationState.CREATING) | ||
val replacementRoomId = runCatching { | ||
createRoomTask.execute(localRoomSummary.createRoomParams!!) |
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.
Maybe check if createRoomParams is not null? Not sure it's possible
And throw a specific error if any?
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.
this is checked at line 60, no?
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.
I improved the code to avoid the use of !!
eac74bd
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.
Thanks, small remarks, else LGTM!
private suspend fun createRoom(localRoomSummary: LocalRoomSummary): String { | ||
updateCreationState(localRoomSummary.roomId, LocalRoomCreationState.CREATING) | ||
val replacementRoomId = runCatching { | ||
createRoomTask.execute(localRoomSummary.createRoomParams!!) |
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.
this is checked at line 60, no?
?.replacementRoomId | ||
val localRoomSummary = roomSummaryDataSource.getLocalRoomSummary(params.localRoomId) | ||
?.takeIf { it.createRoomParams != null && it.roomSummary != null } | ||
?: error("Invalid LocalRoomSummary for ${params.localRoomId}") |
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.
Thanks for the rework :)
LocalRoomCreationState.CREATING -> | ||
_viewEvents.post(RoomDetailViewEvents.ShowWaitingView(stringProvider.getString(R.string.creating_direct_room))) | ||
LocalRoomCreationState.FAILURE -> { | ||
_viewEvents.post(RoomDetailViewEvents.HideWaitingView) |
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.
Can we provide some detail of the failure to the user? (maybe not blocking).
Also, not tested, but maybe try to create a DM in airplane mode to ensure that there is no crash.
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.
I tried, sometimes the loading wheel is shown before being hidden, sometimes not, depending on the event position in the events queue. There is no crash
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.
821292a
to
eac74bd
Compare
SonarCloud Quality Gate failed. |
Type of change
Content
While creating the DM (ie. after sending the first message), a loading wheel is now displayed until switching to the created room.
In case of failure, the loading wheel is hidden to unblock the UI.
Motivation and context
close #6970
Screenshots / GIFs
Tests
Tested devices
Checklist