Skip to content

chore: added permission setup#642

Draft
Shahroz16 wants to merge 4 commits intofeat/real-time-locationfrom
feature/location-permissions
Draft

chore: added permission setup#642
Shahroz16 wants to merge 4 commits intofeat/real-time-locationfrom
feature/location-permissions

Conversation

@Shahroz16
Copy link
Contributor

@Shahroz16 Shahroz16 commented Jan 22, 2026

Summary

This PR implements the permission checking and consent management layer for the Location module. It establishes the foundation for location tracking by providing:

  • Permission status checking - Query current location permission state without requesting
  • Tracking enablement - App-level opt-in/opt-out for location tracking
  • Eligibility checking - Unified API to determine if location tracking can proceed and why not

Cross-Platform Architecture

The public API is designed to be platform-agnostic, enabling wrapper SDKs (React Native, Flutter, Expo) to use a single interface without platform-specific branching.

┌──────────────
│ WRAPPER SDKs │
│ (React Native / Flutter / Expo) │
└───────────────

┌───────────▼
│ UNIFIED PUBLIC API │
│ │
│ • permissionStatus() │
│ • setTrackingEnabled()│
│ • canTrackLocation() │
│ • getTrackingEligibility() │
└───────────

┌─────────▼
│ ANDROID (internal)│
│ • FusedLocation │
│ • GMS checks │
│ • Permission APIs │
└─────────

Test Plan

  • Verify permissionStatus() returns NOT_DETERMINED on fresh install
  • Verify permissionStatus() returns AUTHORIZED after granting permission
  • Verify permissionStatus() returns DENIED after denying permission
  • Verify setLocationTrackingEnabled(true/false) persists across app restarts
  • Verify canTrackLocation() returns true only when all conditions met
  • Verify getTrackingEligibility() returns correct state for each scenario
  • Verify isLocationServicesEnabled() reflects device settings

Note

Establishes the location module’s permission/consent foundation and eligibility checks with a unified API for wrappers.

  • Expand ModuleLocation with permissionStatus(), isLocationServicesEnabled(), setLocationTrackingEnabled(), isLocationTrackingEnabled(), canTrackLocation(), getTrackingEligibility(), getRequiredPermissions(), and onPermissionResult(); wires init to SDK reset events
  • Add DI via LocationComponent providing LocationPreferenceStore, LocationPermissionsHelper, and TrackingEligibilityChecker; reset clears stored state
  • Implement permission/consent models: LocationPermissionStatus, LocationTrackingEligibility (Eligible/NotEnabled/PermissionRequired/LocationServicesDisabled)
  • Add cross-platform error model LocationError (PermissionDenied/TrackingDisabled/LocationServicesDisabled/ServiceUnavailable/Timeout/Unknown)
  • Persist opt-in and permission-request state in LocationPreferenceStore; evaluate tracking via TrackingEligibilityChecker

Written by Cursor Bugbot for commit 9d30604. This will update automatically on new commits. Configure here.

@Shahroz16 Shahroz16 requested a review from a team as a code owner January 22, 2026 13:14
@github-actions
Copy link

github-actions bot commented Jan 22, 2026

Sample app builds 📱

Below you will find the list of the latest versions of the sample apps. It's recommended to always download the latest builds of the sample apps to accurately test the pull request.


@codecov
Copy link

codecov bot commented Jan 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (feat/real-time-location@08d0c47). Learn more about missing BASE report.

Additional details and impacted files
@@                    Coverage Diff                     @@
##             feat/real-time-location     #642   +/-   ##
==========================================================
  Coverage                           ?   68.37%           
  Complexity                         ?      760           
==========================================================
  Files                              ?      142           
  Lines                              ?     4303           
  Branches                           ?      580           
==========================================================
  Hits                               ?     2942           
  Misses                             ?     1141           
  Partials                           ?      220           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

cursor[bot]

This comment was marked as outdated.

@github-actions
Copy link

  • java_layout: feature/location-permissions (1769087746)

@github-actions
Copy link

  • kotlin_compose: feature/location-permissions (1769087736)

@github-actions
Copy link

Build available to test
Version: feature-location-permissions-SNAPSHOT
Repository: https://s01.oss.sonatype.org/content/repositories/snapshots/

@github-actions
Copy link

github-actions bot commented Jan 22, 2026

📏 SDK Binary Size Comparison Report

No changes detected in SDK binary size ✅

@github-actions
Copy link

  • kotlin_compose: feature/location-permissions (1769088265)

@github-actions
Copy link

  • java_layout: feature/location-permissions (1769088264)

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

) : LocationError() {
override fun toString(): String = "LocationError.Unknown(message=$message, cause=$cause)"
}
}
Copy link

Choose a reason for hiding this comment

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

LocationError sealed class is unused dead code

Low Severity

The LocationError sealed class and all its subclasses (PermissionDenied, TrackingDisabled, LocationServicesDisabled, ServiceUnavailable, Timeout, Unknown) are defined and publicly exported in the API but are never used anywhere in the codebase. No method returns or throws these error types. This appears to be scaffolding for future features but currently adds unused public API surface.

Fix in Cursor Fix in Web

@github-actions
Copy link

  • java_layout: feature/location-permissions (1769109343)

@github-actions
Copy link

  • kotlin_compose: feature/location-permissions (1769109349)

@github-actions
Copy link

  • kotlin_compose: feature/location-permissions (1769113371)

@github-actions
Copy link

  • java_layout: feature/location-permissions (1769113363)

Copy link
Contributor

@mahmoud-elmorabea mahmoud-elmorabea left a comment

Choose a reason for hiding this comment

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

Shall we hold off a bit till we agree on set of behaviors and public API to avoid reworking some of those public types?

@mahmoud-elmorabea mahmoud-elmorabea requested a review from a team January 23, 2026 13:37
@Shahroz16 Shahroz16 marked this pull request as draft January 27, 2026 10:52
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