Enable Drawer Menu Opening on Swipe From Left Gesture#3834
Enable Drawer Menu Opening on Swipe From Left Gesture#3834
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3834 +/- ##
=========================================
- Coverage 25.0% 24.6% -0.5%
- Complexity 844 849 +5
=========================================
Files 297 305 +8
Lines 16102 16517 +415
Branches 2689 2751 +62
=========================================
+ Hits 4038 4074 +36
- Misses 11580 11959 +379
Partials 484 484
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Enables opening the app drawer via a left-edge swipe gesture on register and geo-widget launcher screens (Compose Scaffold), addressing the prior behavior where gestures were only enabled while the drawer was already open.
Changes:
- Set
drawerGesturesEnabled = trueinRegisterFragment’s ComposeScaffold. - Set
drawerGesturesEnabled = trueinGeoWidgetLauncherFragment’s ComposeScaffold.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| android/quest/src/main/java/org/smartregister/fhircore/quest/ui/register/RegisterFragment.kt | Enables drawer swipe gestures for the register screen’s drawer scaffold. |
| android/quest/src/main/java/org/smartregister/fhircore/quest/ui/geowidget/GeoWidgetLauncherFragment.kt | Enables drawer swipe gestures for the geo-widget launcher screen’s drawer scaffold. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| Scaffold( | ||
| drawerGesturesEnabled = scaffoldState.drawerState.isOpen, | ||
| drawerGesturesEnabled = true, |
There was a problem hiding this comment.
drawerGesturesEnabled is now always true, which allows opening the drawer via edge-swipe even when this screen is configured with toolBarHomeNavigation = NAVIGATE_BACK (e.g., see RegisterFragmentTest where this argument is explicitly set). That bypasses the intended navigation mode and can expose the drawer when the UI is supposed to behave as a back-only screen. Consider enabling gestures only when the toolbar home mode is OPEN_DRAWER (while still allowing swipe-to-close when the drawer is already open).
| drawerGesturesEnabled = true, | |
| drawerGesturesEnabled = scaffoldState.drawerState.isOpen, |
There was a problem hiding this comment.
See my other comment below
| AppTheme { | ||
| Scaffold( | ||
| drawerGesturesEnabled = scaffoldState.drawerState.isOpen, | ||
| drawerGesturesEnabled = true, |
There was a problem hiding this comment.
drawerGesturesEnabled is now always true, which means the drawer can be opened via edge-swipe even if this fragment is ever launched with toolBarHomeNavigation = NAVIGATE_BACK (this argument exists in the nav graph and is passed into GeoWidgetLauncherScreen). Consider gating drawer gestures on the toolBarHomeNavigation value (while still allowing swipe-to-close when the drawer is open) so the drawer can’t be opened on back-only screens.
There was a problem hiding this comment.
@qiarie Please follow up on this. The menu action can either be used for back navigation or launching the side navigation. With this change can you test when the toolbar action is used for back navigation like in the projects using the geowidget module. We should not allow opening of the drawer via the gesture if the action for the toolbar is for navigating back to the previous screen.
There was a problem hiding this comment.
@ellykits I have a commit ready that will handle that. I am waiting for credentials for an app with maps to fully test.
On NAVIGATE_BACK screens, gestures remain enabled only when the drawer is already open so swipe-to-close still works.
IMPORTANT: Where possible all PRs must be linked to a Github issue
Fixes #3835
Engineer Checklist
strings.xmlfile./gradlew spotlessApplyand./gradlew spotlessCheckto check my code follows the project's style guideCode Reviewer Checklist
strings.xmlfile