-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Labels
Description
Description
The Problem
- Currently, the
ContributionControllercontains aTODOto move its location service handling logic into the sharedLocationPermissionsHelper. The controller is manually building ashowLocationOffDialogbecause the existingLocationPermissionCallbackinterface does not have a way to notify the caller when a user declines to turn on system GPS/Location services. This leads to redundant UI code and inconsistent logic across different parts of the app like Nearby, Explore, and the In-app camera.
Proposed Changes
I have refactored the location flow to centralize this behavior:
- Enhanced Callback: Added
onLocationServiceUnAvailable()to theLocationPermissionCallbackinterface inLocationPermissionsHelper.kt. - Helper Logic: Updated
LocationPermissionsHelper.showLocationOffDialogto trigger this new callback when the user selects "Cancel" on the system settings prompt. - Controller Cleanup: Removed the redundant dialog logic from
ContributionController.ktand utilized the new callback to handle the camera upload fallback. - App-wide Consistency: Implemented the required callback method in
ExploreMapFragment,LocationPickerActivity, andNearbyParentFragmentto ensure a unified response when location services are unavailable.
Impact
- Resolves long-standing technical debt in the contribution flow.
- Ensures that if a user cancels a location prompt, the app reacts predictably (showing a toast and allowing manual override) instead of potentially hanging or requiring custom logic in every fragment.
Steps to Reproduce
- Turn off system Location/GPS on the device.
- Open the app and attempt to take a photo via the in-app camera.
- When prompted to turn on location, tap "Cancel".
- Current result (Technical Debt): The controller has to manually handle this to open the camera.
- Expected result (Post-refactor): The Helper manages the dialog and tells the controller to open the camera via the new callback signal.
Part of #6508