-
Notifications
You must be signed in to change notification settings - Fork 9
chore: added permission setup #642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Shahroz16
wants to merge
4
commits into
feat/real-time-location
Choose a base branch
from
feature/location-permissions
base: feat/real-time-location
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
location/src/main/kotlin/io/customer/location/consent/LocationTrackingEligibility.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| package io.customer.location.consent | ||
|
|
||
| /** | ||
| * Represents the current eligibility status for location tracking. | ||
| * | ||
| * This sealed class provides a unified way to understand why location | ||
| * tracking may or may not be available, enabling wrapper SDKs to | ||
| * provide appropriate user feedback. | ||
| */ | ||
| sealed class LocationTrackingEligibility { | ||
| /** | ||
| * Location tracking is eligible - tracking enabled, permission granted, services enabled. | ||
| */ | ||
| object Eligible : LocationTrackingEligibility() | ||
|
|
||
| /** | ||
| * Location tracking has not been enabled via [ModuleLocation.setLocationTrackingEnabled]. | ||
| * The app needs to call setTrackingEnabled(true) to enable tracking. | ||
| */ | ||
| object NotEnabled : LocationTrackingEligibility() | ||
|
|
||
| /** | ||
| * Location permission has not been granted by the user. | ||
| * The app needs to request location permission from the user. | ||
| */ | ||
| object PermissionRequired : LocationTrackingEligibility() | ||
|
|
||
| /** | ||
| * Device location services are disabled in system settings. | ||
| * The user needs to enable location services in their device settings. | ||
| */ | ||
| object LocationServicesDisabled : LocationTrackingEligibility() | ||
| } |
49 changes: 49 additions & 0 deletions
49
location/src/main/kotlin/io/customer/location/di/LocationComponent.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| package io.customer.location.di | ||
|
|
||
| import io.customer.location.permission.LocationPermissionsHelper | ||
| import io.customer.location.store.LocationPreferenceStore | ||
| import io.customer.location.tracking.TrackingEligibilityChecker | ||
| import io.customer.sdk.core.di.DiGraph | ||
| import io.customer.sdk.core.di.SDKComponent | ||
|
|
||
| /** | ||
| * Dependency injection component for the Location module. | ||
| * | ||
| * Provides singleton instances of location-related dependencies | ||
| * that can be accessed throughout the module. | ||
| */ | ||
| internal object LocationComponent : DiGraph() { | ||
|
|
||
| private val androidComponent | ||
| get() = SDKComponent.android() | ||
|
|
||
| private val applicationContext | ||
| get() = androidComponent.applicationContext | ||
|
|
||
| /** | ||
| * Preference store for location module settings. | ||
| */ | ||
| val preferenceStore: LocationPreferenceStore | ||
| get() = singleton { LocationPreferenceStore(applicationContext) } | ||
|
|
||
| /** | ||
| * Permission helper for checking location permission status. | ||
| */ | ||
| val permissionsHelper: LocationPermissionsHelper | ||
| get() = singleton { LocationPermissionsHelper(preferenceStore) } | ||
|
|
||
| /** | ||
| * Checker for determining if location tracking is eligible. | ||
| */ | ||
| val trackingEligibilityChecker: TrackingEligibilityChecker | ||
| get() = singleton { TrackingEligibilityChecker(applicationContext, preferenceStore, permissionsHelper) } | ||
|
|
||
| /** | ||
| * Resets all location component dependencies. | ||
| * Called when the SDK is reset. | ||
| */ | ||
| override fun reset() { | ||
| preferenceStore.clearAll() | ||
| super.reset() | ||
| } | ||
cursor[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.