Added functionality to determine geolocation coordinates #782
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.
Description
This ticket introduces actions which simplify access to geolocation coordinates.
grantGeolocationPermissions
can be used to grant the appropriate app permissions.getGeolocation
retrieves the current position of the user. When no permissions where granted yet, it will also prompt the user to enable location services.Both actions can be imported from
@shopgate/engage/core
.Type of change
How to test it
Within the development environment you can't test everything all together, since the feature relies on the native browser geolocation functionality and needs an
https
connection. Since the development apps are served viahttp
, you can only test the code which triggers the permission granting process. In chrome you can test the position determination when you opened Engage viahttp://localhost
Add this import e.g. to a subscription
import { getGeolocation } from '@shopgate/engage/core';
and dispatch the action.