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 the logic of the room list banner state #3615

Merged

Conversation

jmartinesp
Copy link
Member

@jmartinesp jmartinesp commented Oct 7, 2024

Content

  • Make sure needsSlidingSyncMigration also generates a state for derivedStateOf.
  • Fix the logic in the derivedStateOf block: it fixes an issue that hid the migration banner, gets rid of the syncState and can now be extended with more cases that fallthrough to the next ones.

Motivation and context

Fix the migration banner not being displayed in some cases that @pixlwave reported. To be honest I have no idea why this issue appeared now, since it was tested several times before and it worked as expected. Maybe an update of the compose compiler broke it?

Tests

  • Log into a HS with both SS and SSS support, with sliding sync disabled in the app (I used riot.grin.hu).
  • Check the upgrade banner appears.
  • It can be dismissed.
  • When restarting the app, the banner is displayed again.

Tested devices

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

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

@jmartinesp jmartinesp added the PR-Bugfix For bug fix label Oct 7, 2024
@jmartinesp jmartinesp requested a review from a team as a code owner October 7, 2024 14:30
@jmartinesp jmartinesp requested review from ganfra and removed request for a team October 7, 2024 14:31
@jmartinesp jmartinesp force-pushed the fix/jme/make-sure-the-migration-banner-is-displayed branch from 112b742 to 27e087b Compare October 7, 2024 14:33
Copy link
Contributor

github-actions bot commented Oct 7, 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/NV4aLD

@jmartinesp jmartinesp force-pushed the fix/jme/make-sure-the-migration-banner-is-displayed branch from 27e087b to 0b2ae98 Compare October 7, 2024 14:39
Copy link

codecov bot commented Oct 7, 2024

Codecov Report

Attention: Patch coverage is 86.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 82.65%. Comparing base (409564a) to head (230abd3).
Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
...ndroid/features/roomlist/impl/RoomListPresenter.kt 86.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3615   +/-   ##
========================================
  Coverage    82.65%   82.65%           
========================================
  Files         1735     1735           
  Lines        41187    41191    +4     
  Branches      5000     4999    -1     
========================================
+ Hits         34043    34047    +4     
- Misses        5380     5381    +1     
+ Partials      1764     1763    -1     

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

@@ -176,27 +175,23 @@ class RoomListPresenter @Inject constructor(
private fun securityBannerState(
securityBannerDismissed: Boolean,
needsSlidingSyncMigration: Boolean,
Copy link
Member

Choose a reason for hiding this comment

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

Is it not because needsSlidingSyncMigration needs to be wrapped in a state like securityBannerDismissed, with rememberUpdatedState?

@jmartinesp jmartinesp changed the title Remove deriveStateOf preventing the banner state from updating Fix the logic of the room list banner state Oct 8, 2024
@jmartinesp jmartinesp force-pushed the fix/jme/make-sure-the-migration-banner-is-displayed branch from 0ee4b83 to 230abd3 Compare October 8, 2024 08:59
@jmartinesp jmartinesp requested a review from ganfra October 8, 2024 09:00
Copy link

sonarcloud bot commented Oct 8, 2024

Copy link
Member

@ganfra ganfra left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@jmartinesp jmartinesp added the Run-Maestro Starts a Maestro Cloud session to run integration tests label Oct 8, 2024
@github-actions github-actions bot removed the Run-Maestro Starts a Maestro Cloud session to run integration tests label Oct 8, 2024
@jmartinesp jmartinesp enabled auto-merge (squash) October 8, 2024 09:45
}

return SecurityBannerState.None
}
Copy link
Member

@bmarty bmarty Oct 8, 2024

Choose a reason for hiding this comment

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

(For later) RoomListPresenter is quite a large file, so maybe this logic could be extracted and covered by a few unit tests?

Edit: we can see that a case is missing in the coverage, and unit test will also check the "priority" of the parameters:

image

@jmartinesp jmartinesp merged commit 5a4e5d0 into develop Oct 8, 2024
30 checks passed
@jmartinesp jmartinesp deleted the fix/jme/make-sure-the-migration-banner-is-displayed branch October 8, 2024 10:13
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.

3 participants