Skip to content

Conversation

@jmartinesp
Copy link
Member

Content

Makes sure the BackHandler can only navigate up once in the RoomSelectView component.

This screen is a good candidate for the SafeBackHandler we previously talked about @bmarty .

Motivation and context

Fixes #5688.

Tests

  • From another app, share some file or media.
  • When cancelling or actually sending the file, you should navigate to the room and see the file being sent.

Previously, this would get in a stack overflow where navigateUp triggered a back event that got caught by BackHandler, which in turn navigated up, and ended up looping in that logic.

Tested devices

  • Physical
  • Emulator
  • OS version(s): 16

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

@jmartinesp jmartinesp requested a review from a team as a code owner November 13, 2025 07:03
@jmartinesp jmartinesp added the PR-Bugfix For bug fix label Nov 13, 2025
@jmartinesp jmartinesp requested review from bmarty and removed request for a team November 13, 2025 07:03
@github-actions
Copy link
Contributor

github-actions bot commented Nov 13, 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/UfDU2f

@codecov
Copy link

codecov bot commented Nov 13, 2025

Codecov Report

❌ Patch coverage is 66.66667% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.63%. Comparing base (7b7c429) to head (53d100e).
⚠️ Report is 3 commits behind head on develop.

Files with missing lines Patch % Lines
...ndroid/libraries/roomselect/impl/RoomSelectView.kt 66.66% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5724      +/-   ##
===========================================
- Coverage    79.63%   79.63%   -0.01%     
===========================================
  Files         2431     2431              
  Lines        65261    65268       +7     
  Branches      8332     8333       +1     
===========================================
+ Hits         51972    51977       +5     
- Misses       10308    10310       +2     
  Partials      2981     2981              

☔ 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

@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! Why not creating a SafeBackHandler in a shared module so that we can start using it?

if (state.isSearchActive) {
state.eventSink(RoomSelectEvents.ToggleSearchActive)
} else {
canHandleBack = false
Copy link
Member

Choose a reason for hiding this comment

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

I think this is OK, but we do not check the value of canHandleBack before setting it and invoking onDismiss? Asking because navigationIcon click also invokes the fun onBackButton.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, calling onBackButton from the back navigation icon could cause a different issue (2 or more back paginations if called quickly?), but it wouldn't interfere with the BackHandler here AFAICT.

@jmartinesp
Copy link
Member Author

Thanks! Why not creating a SafeBackHandler in a shared module so that we can start using it?

I thought you wanted to do that, so I was just adding this as a workaround in the meantime 😅 .

@sonarqubecloud
Copy link

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.

EXA 25.11.02 crash when opening after sharing a video

3 participants