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

fix : use RoomMembershipObserver to close room screen when leaving #3887

Merged
merged 1 commit into from
Nov 22, 2024

Conversation

ganfra
Copy link
Member

@ganfra ganfra commented Nov 18, 2024

Content

Close the room flow when leaving a room from the client.
If leaving, being banned from another client, the room screen will update but won't navigate up to the room list.

Motivation and context

Screenshots / GIFs

No ui change.

Tests

  • Step 1
  • Step 2
  • Step ...

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

  • Changes have been tested on an Android device or Android emulator with API 23
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly define what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • Pull request includes a sign off
  • You've made a self review of your PR

@ganfra ganfra added the PR-Bugfix For bug fix label Nov 18, 2024
@ganfra ganfra marked this pull request as ready for review November 18, 2024 15:17
@ganfra ganfra requested a review from a team as a code owner November 18, 2024 15:17
@ganfra ganfra requested review from bmarty and removed request for a team November 18, 2024 15:17
Copy link
Contributor

github-actions bot commented Nov 18, 2024

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/g3dQCC

Copy link

codecov bot commented Nov 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.85%. Comparing base (86a6244) to head (aa1a151).
Report is 83 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3887      +/-   ##
===========================================
- Coverage    82.87%   82.85%   -0.02%     
===========================================
  Files         1784     1784              
  Lines        45090    45088       -2     
  Branches      5324     5323       -1     
===========================================
- Hits         37368    37358      -10     
- Misses        5857     5865       +8     
  Partials      1865     1865              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, 2 small remarks.

// If the user leaves the room from this client, close the room flow.
membershipObserver.updates
.filter { it.roomId == roomId && !it.isUserInRoom }
.onEach {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add .take(1) to navigateUp only once?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we get two membership updates there is something wrong, but yeah sure, I can change

}
room.leave()
.onFailure {
Timber.e(it, "Error while leaving room ${room.displayName} - ${room.roomId}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not new but we should only log the roomId for privacy reason.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

@ganfra ganfra force-pushed the feature/fga/close_room_leave_action branch from e75d6fa to aa1a151 Compare November 21, 2024 20:37
@ganfra ganfra added the Run-Maestro Starts a Maestro Cloud session to run integration tests label Nov 21, 2024
@github-actions github-actions bot removed the Run-Maestro Starts a Maestro Cloud session to run integration tests label Nov 21, 2024
Copy link

sonarcloud bot commented Nov 21, 2024

Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update!

onCancelKnockSuccess = ::navigateUp,
onKnockSuccess = { },
onCancelKnockSuccess = {},
onKnockSuccess = {},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe for later, but I believe that the parameters onCancelKnockSuccess and onKnockSuccess could be removed.

@ganfra ganfra merged commit e76f7fb into develop Nov 22, 2024
28 of 29 checks passed
@ganfra ganfra deleted the feature/fga/close_room_leave_action branch November 22, 2024 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Bugfix For bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants