wordpress-mobile / WordPress-Android

WordPress for Android
http://android.wordpress.org
GNU General Public License v2.0
2.92k stars 1.3k forks source link

[Reader Customization] Allow dragging to close Preferences bottom sheet #20640

Closed thomashorta closed 3 weeks ago

thomashorta commented 1 month ago

Improvement suggested by @notandyvee here: pcdRpT-6gD-p2#comment-9800

Allow dragging to hide and close the Reading Preferences bottom sheet, saving the latest user selection.

The main caveat is that dragging down conflicts with preview content scroll when the font is too large and/or the screen size is too small, which has the potential to be more annoying than dragging being disabled, so it would be great to have feedback from the Reviewers here and maybe merging this change and keeping an eye out for user complaints/reviews.

If anyone knows if there's some sort of way of providing some "scroll preference order" to the gesture system so it first scrolls the content and only scrolls the sheet when content is at the top, that would be ideal, but I couldn't find something like that. 😞


To Test:

  1. Open the Reader
  2. Open any post
  3. Go to Reading Preferences
  4. Change some preferences
  5. Drag down to close the Preferences sheet

Make sure to also test using large font sizes and trying to drag the preview content.

Note: It's possible to drag the content consistently if the user starts by dragging the finger UP before trying to drag it down.


Regression Notes

  1. Potential unintended areas of impact

    • Not saving properly the Reading Preferences
    • Not sending the correct analytics events
  2. What I did to test those areas of impact (or what existing automated tests I relied on)

    • Manual testing
    • Unit Testing
  3. What automated tests I added (or what prevented me from doing so)

    • Unit tests for the new scenarios

PR Submission Checklist:


Testing Checklist (strike-out the not-applying and unnecessary ones):

N/A

wpmobilebot commented 1 month ago
JetpackπŸ“² You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr20640-18a893e
Commit18a893ee565ba7d38ae5e4f67e9ef1f4c982db5a
Direct Downloadjetpack-prototype-build-pr20640-18a893e.apk
Note: Google Login is not supported on these builds.
wpmobilebot commented 1 month ago
WordPressπŸ“² You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr20640-18a893e
Commit18a893ee565ba7d38ae5e4f67e9ef1f4c982db5a
Direct Downloadwordpress-prototype-build-pr20640-18a893e.apk
Note: Google Login is not supported on these builds.
codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 40.49%. Comparing base (42220a6) to head (18a893e). Report is 166 commits behind head on trunk.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## trunk #20640 +/- ## ======================================= Coverage 40.48% 40.49% ======================================= Files 1479 1479 Lines 68342 68349 +7 Branches 11290 11290 ======================================= + Hits 27669 27676 +7 Misses 38173 38173 Partials 2500 2500 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

osullivanchris commented 1 month ago

I installed the build to test this but I cant see the behaviour, sorry. In theory scrolling to close screens is something I'm generally in favour of. Though I am interested in how it affects or doesn't the presentation of the screen. Should a screen come from above rather than from the left if it can be dragged down. And similarly should it have an X icon like a modal view rather than a back arrow.

thomashorta commented 1 month ago

I installed the build to test this but I cant see the behaviour, sorry.

Could you share the device and Android version you tried? I used an emulator with Android 14 while developing and it works as expected.

https://github.com/wordpress-mobile/WordPress-Android/assets/5091503/036000b0-d855-4cf3-a192-4409c7f36a11

osullivanchris commented 1 month ago

Looks pretty good in the video. To add to my other question, I wonder should we be doing this in many places, not just one

thomashorta commented 3 weeks ago

This nestedScroll will tell the bottom sheet's coordinatorlayout to work with nested scrollable containers. Works for me. I can't guarantee this is the best approach though since I havent dealt with compose much yet. Hopefully this helps.

Nice! I will try it and apply the other suggestion you commented and push the changes soon! Thanks for the Review!

sonarcloud[bot] commented 3 weeks ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

thomashorta commented 3 weeks ago

Jetpack Pre-Alpha vpr2051-4cd9168 (1418)

@osullivanchris this looks to be the problem. You are not using the build generated by this PR (which should have pr20640 in the filename). A second confirmation is that the version you're using is based on 1418 while the version in this PR is based on 1421.

Download and install the build for this PR here: https://github.com/wordpress-mobile/WordPress-Android/pull/20640#issuecomment-2057916200

I suggest waiting a few minutes though since I just pushed the changes fixing the nested scroll that @notandyvee suggested (thanks again btw!), so a new build should be up soon.