Skip to content

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Sep 15, 2025

Content

Add ability to leave space. For now we are using the leave room endpoint and no rooms are left when a space is left. We may have a new C api or expect new Rust SDK api to get the list of rooms to left when leaving the space.

Motivation and context

Closes #5300
Partially implement #5301

Screenshots / GIFs

See recorded ones

Tests

  • Open a Space
  • From the three dot menu, leave the space.

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

  • Changes have been tested on an Android device or Android emulator with API 24
  • 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
  • You've made a self review of your PR

@bmarty bmarty requested a review from a team as a code owner September 15, 2025 14:25
@bmarty bmarty added the PR-Wip For anything that isn't ready to ship and will be enabled at a later date label Sep 15, 2025
@bmarty bmarty requested review from jmartinesp and removed request for a team September 15, 2025 14:25
Copy link
Contributor

github-actions bot commented Sep 15, 2025

📱 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/J66G92

Copy link

codecov bot commented Sep 15, 2025

Codecov Report

❌ Patch coverage is 86.93467% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.77%. Comparing base (9f59db8) to head (951f57b).

Files with missing lines Patch % Lines
...features/space/impl/leave/LeaveSpaceBottomSheet.kt 90.35% 3 Missing and 8 partials ⚠️
...o/element/android/features/space/impl/SpaceView.kt 63.63% 6 Missing and 2 partials ⚠️
...o/element/android/appnav/LoggedInEventProcessor.kt 0.00% 6 Missing ⚠️
...ment/android/features/space/impl/SpacePresenter.kt 94.11% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5354      +/-   ##
===========================================
+ Coverage    79.75%   79.77%   +0.02%     
===========================================
  Files         2273     2276       +3     
  Lines        62817    63010     +193     
  Branches      7863     7887      +24     
===========================================
+ Hits         50098    50268     +170     
- Misses        9826     9838      +12     
- Partials      2893     2904      +11     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@jmartinesp jmartinesp left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM in general, a couple of comments but nothing blocking.

Comment on lines 12 to 13
data object StartLeaveSpace : SpaceEvents
data object LeaveSpace : SpaceEvents
Copy link
Member

Choose a reason for hiding this comment

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

Do we have some naming/structure we usually follow for these cases?

I think we'd usually have something like data class LeaveSpace(val needsConfirmation: Boolean) and use tell apart the 2 states. Or we'd also sometimes have LeaveSpace and some DoLeaveSpace events, if I'm not mistaken.

Copy link
Member Author

Choose a reason for hiding this comment

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

True, we also have AsyncAction with a confirmation state, which is maybe better here. I'll give it a try

Copy link
Member Author

Choose a reason for hiding this comment

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

import io.element.android.libraries.matrix.api.timeline.item.event.MembershipChange
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.asSharedFlow

class RoomMembershipObserver {
data class RoomMembershipUpdate(
val roomId: RoomId,
val roomInfo: RoomInfo,
Copy link
Member

Choose a reason for hiding this comment

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

It seems a bit weird to bundle the whole RoomInfo here, is it just to have access to the isSpace property?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Nit: the phrasing here seems a bit odd, I'd expect something like "You'll be leaving all your rooms in this space too", which seems simpler. But if it was designed like this 🤷 .

Copy link
Member Author

@bmarty bmarty Sep 15, 2025

Choose a reason for hiding this comment

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

The wording will probably get updated, I'll move this PR to draft.

@bmarty bmarty marked this pull request as draft September 15, 2025 15:53
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Wip For anything that isn't ready to ship and will be enabled at a later date
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task] Add a More menu to the SpaceScreen.
3 participants