Skip to content

Add location permission UX to onboarding and settings - #586

Open
temcguir wants to merge 14 commits into
mainfrom
temcguir/location-permissions-and-settings-ui
Open

temcguir wants to merge 14 commits into
mainfrom
temcguir/location-permissions-and-settings-ui

Conversation

@temcguir

@temcguir temcguir commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds an optional location permission request step to the onboarding flow and introduces a "Save Location" toggle switch in the in-app Settings screen.

This builds on the location settings persistence and decoupled LocationProvider contract introduced in #575.

Key Changes

  • :feature:permissions:
    • Adds PermissionEnum.LOCATION as an optional permission card.
    • Implements PermissionsRepository to track dismissed and requested permissions across sessions.
    • Adds PermissionsScreenComponents for location permission rationale alert dialog and app-settings deep-linking.
    • Automatically updates SettingsRepository.updateLocationEnabled(true) when granted during onboarding.
    • Records an optional permission as dismissed when its request ends without a grant. Mandatory permissions are requested again until granted.
  • :feature:settings:
    • Adds LocationSettingComponent ("Save Location" toggle) to the Settings screen.
    • Adds LocationUiState (hidden when LocationProvider is absent, Enabled.On/Off when present).
    • Handles runtime permission requesting when toggled on, and displays a rationale dialog directing users to system app settings if permanently denied, including on the first toggle when the request ends without a prompt.
    • Reports location grants from the settings section to SettingsViewModel through updateGrantedPermissions, which updates only the given permissions.
  • :app:
    • Binds DataStorePermissionsRepository via PermissionsModule.
    • Passes onOpenAppSettings from MainActivity / JcaApp to SettingsScreen.
    • Does not yet add the location permissions to the app's startup permission list or manifest. That happens in the follow-up change that binds a LocationProvider, so the onboarding location page and the Settings row stay hidden in the app until then.
  • Testing:
    • Adds unit and Compose UI tests for onboarding and settings screens and ViewModels (PermissionsScreenTest, PermissionsViewModelTest, SettingsScreenTest, CameraAppSettingsViewModelTest).

Adds an optional location permission request step to the onboarding flow and introduces a "Save Location" toggle switch in the in-app Settings screen.

Key changes:
- In `:feature:permissions`:
  - Adds `PermissionEnum.LOCATION` as an optional permission card.
  - Implements `PermissionsRepository` to track dismissed/requested permissions across sessions.
  - Adds `PermissionsScreenComponents` for location permission rationale dialog and settings deep-linking.
  - When granted during onboarding, updates `SettingsRepository.updateLocationEnabled(true)` automatically.
- In `:feature:settings`:
  - Adds `LocationSettingComponent` ("Save Location" toggle) to the Settings screen.
  - Adds `LocationUiState` (Hidden when no LocationProvider is available, Enabled.On/Off when present).
  - Handles runtime permission requesting when toggled on, and displays a rationale dialog directing users to system app settings if permanently denied.
- In `:app`:
  - Binds `PermissionsRepositoryImpl` via `PermissionsModule`.
  - Passes `onOpenAppSettings` from `MainActivity` / `JcaApp` to `SettingsScreen`.
- Adds unit and Compose UI tests for onboarding and settings screens and ViewModels.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces location geotagging support, including a new optional location permission onboarding flow and a "Save Location" toggle in the settings screen. The implementation uses a DataStore-backed repository to persist permission request states and includes comprehensive unit and UI tests. The feedback focuses on adhering to the repository's style guide regarding test tag naming conventions, adding KDoc to internal composables, removing a debug log, and optimizing the permission filtering logic to better handle composite permissions.

- Document PermissionTemplate.
- Evaluate each PermissionEnum once in getRequestablePermissions while
  preserving the requested order.
Reverts an unintended edit to a line that is unrelated to this change,
so the file matches main outside of the location additions.
The location permission request is added to the app's startup list in
the follow-up change that also binds a LocationProvider and declares the
location permissions in the manifest. Until then, the onboarding flow
does not show the location page.
Rename the constants so they follow the element_purpose naming used by
the other test tags (BTN_..., DIALOG_...). Tag string values are unchanged.
- Only optional permissions are recorded as dismissed. A mandatory
  permission that is not granted is requested again.
- The permission screen records an optional permission as dismissed when
  its request ends without a grant, instead of relying on the rationale
  state changing. Clicking the request button again relaunches the
  request.
- The location section of app settings reports its own grants to the
  view model through a merge update, so the toggle does not depend on
  the screen-level permission state refreshing.
- If a location request from settings ends without a grant and no
  rationale was available before or after it, the rationale dialog with
  the link to app settings is shown on the first toggle.
…r idle before asserting the merged permission state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants