-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
[Geolocation] Provide option to request specific location permissions #15067
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Libraries/Geolocation/Geolocation.js
Outdated
@@ -186,4 +187,8 @@ var Geolocation = { | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null: Parsing error: Unexpected token, expected ;
189 |
190 | Geolocation.IOS_AUTHORIZATIONS = {};
191 | Geolocation.IOS_AUTHORIZATIONS.WHEN_IN_USE: "locationAuthorizationWhenInUse";
| ^
192 | Geolocation.IOS_AUTHORIZATIONS.ALWAYS: "locationAuthorizationAlways";
193 |
194 | module.exports = Geolocation;
Libraries/Geolocation/Geolocation.js
Outdated
@@ -186,4 +187,8 @@ var Geolocation = { | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected token :
Fix options Spacing [Geolocation] Fix build [Geolocation] Fix npm flow error [Geolocation] Fix lint
939afdc
to
0d424a4
Compare
Libraries/Geolocation/Geolocation.js
Outdated
@@ -186,4 +187,8 @@ var Geolocation = { | |||
} | |||
}; | |||
|
|||
Geolocation.IOS_AUTHORIZATIONS = {}; | |||
Geolocation.IOS_AUTHORIZATIONS.WHEN_IN_USE = "locationAuthorizationWhenInUse"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quotes: Strings must use singlequote.
Libraries/Geolocation/Geolocation.js
Outdated
@@ -186,4 +187,8 @@ var Geolocation = { | |||
} | |||
}; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
property IOS_AUTHORIZATIONS
Property not found in object literal
Libraries/Geolocation/Geolocation.js
Outdated
@@ -186,4 +187,8 @@ var Geolocation = { | |||
} | |||
}; | |||
|
|||
Geolocation.IOS_AUTHORIZATIONS = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quotes: Strings must use singlequote.
@@ -31,6 +31,7 @@ type GeoOptions = { | |||
maximumAge: number, | |||
enableHighAccuracy: bool, | |||
distanceFilter: number, | |||
locationAuthorizationIOS: string, | |||
} | |||
|
|||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null: Parsing error: Unexpected token, expected ;
188 | };
189 |
190 | Geolocation.IOS_AUTHORIZATIONS: Object = {};
| ^
191 | Geolocation.IOS_AUTHORIZATIONS.WHEN_IN_USE = 'locationAuthorizationWhenInUse';
192 | Geolocation.IOS_AUTHORIZATIONS.ALWAYS = 'locationAuthorizationAlways';
193 |
@@ -31,6 +31,7 @@ type GeoOptions = { | |||
maximumAge: number, | |||
enableHighAccuracy: bool, | |||
distanceFilter: number, | |||
locationAuthorizationIOS: string, | |||
} | |||
|
|||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected token :
[Geolocation] Fix linter issues
7dfe30e
to
92f4db7
Compare
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
There's a second PR for fixing this problem (#15096). We should figure out which one to take. I believe the primary difference between these PRs is:
I prefer the solution used in my PR (#15096). It's consistent with the Android implementation of @yatchoi do you have any thoughts on this? Adam Comella |
@yatchoi I tried to find reviewers for this pull request and wanted to ping them to take another look. However, based on the blame information for the files in this pull request I couldn't find any reviewers. This sometimes happens when the files in the pull request are new or don't exist on master anymore. Is this pull request still relevant? If yes could you please rebase? In case you know who has context on this code feel free to mention them in a comment (one person is fine). Thanks for reading and hope you will continue contributing to the project. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions. |
Context
On IOS, the React Native Geolocation library will make system permission requests based on the capability of the app as defined in
Info.plist
.This PR allows the option for feature developers to specify the exact level of location permission request to make, by passing an argument in as part of the options parameter. This is important in scenarios where user privacy and permission regarding location-based features needs to be specifically scoped.
This will prevent situations where apps will ask users for background location permission, even though certain features may only require location in the foreground.
Changes
locationAuthorizationIOS
as an option inGeoOptions
Geolocation.IOS_AUTHORIZATIONS
as a String enumlocationAuthorization
as an argument forbeginLocationUpdatesWithDesiredAccuracy
Test Plan
Tested in simulator, using an app with Background Location capability, called
beginLocationUpdatesWithDesiredAccuracy
with various authorizations requested.