Skip to content
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

re #17486 - set _locationManager if auth skipped #17487

Closed
wants to merge 2 commits into from
Closed

re #17486 - set _locationManager if auth skipped #17487

wants to merge 2 commits into from

Conversation

ngandhy
Copy link
Contributor

@ngandhy ngandhy commented Jan 8, 2018

This fixes #17486

make sure locationManager is being set before continuing.

Used if !locationManager vs else on previous statement as we should NEVER enter this code without _locationManager set. Also the else version might experience issues if someone touches the auth code and doesn't check this case, so seems more "long term stable".

Motivation

This fixes #17486

Test Plan

  1. Have a working geolocation demo
  2. Add navigator.geolocation.setRNConfiguration({'skipPermissionRequests':true}); to your code. I added it to the constructor or componentWillMount for the app.
  3. Observe that geolocation no longer works (times out)
  4. Apply patch
  5. Observe that geolocation works again

Related PRs

re #15096

Release Notes

[IOS] [BUGFIX] [GeoLocation] - Fix skipPermissionRequests by setting _locationManager

make sure locationManager is being set before continuing. 

Used if !locationManager vs else on previous statement as we should NEVER enter this code without _locationManager set. Also the else version might experience issues if someone touches the auth code and doesn't check this case, so seems more "long term stable".
@pull-bot
Copy link

pull-bot commented Jan 8, 2018

@facebook-github-bot label Android

Generated by 🚫 dangerJS

@facebook-github-bot
Copy link
Contributor

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!

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. cla signed labels Jan 9, 2018
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@ngandhy
Copy link
Contributor Author

ngandhy commented Jan 12, 2018

@rigdern - please do lmk if you have any feedback on the change. I thought this was the lowest touch way to address it.

Copy link
Contributor

@rigdern rigdern left a comment

Choose a reason for hiding this comment

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

@ngandhy Thanks for sending this PR! Sorry I didn't see it sooner. I didn't get any notifications when you opened the PR because I wasn't at-mentioned in it.

This looks to me like it'll fix the issue you hit.

@@ -158,6 +158,12 @@ - (void)beginLocationUpdatesWithDesiredAccuracy:(CLLocationAccuracy)desiredAccur
if (!_locationConfiguration.skipPermissionRequests) {
[self requestAuthorization];
}

//re #17486 - If someone skips permissions, location manager is not being set. so lets make sure its set before continuing
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this comment is necessary. The code is clear enough without it.

removed unnecessary comment - see #17487 (review)
@ngandhy
Copy link
Contributor Author

ngandhy commented Jan 13, 2018

@rigdern - my bad! I could swear I tagged you but must have done something wrong. I'll make sure to do that next time.

Great! I made the change you suggested as well :)

Copy link
Contributor

@rigdern rigdern left a comment

Choose a reason for hiding this comment

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

Looks good :shipit:

@ide
Copy link
Contributor

ide commented Jan 13, 2018

@facebook-github-bot shipit

@facebook-github-bot facebook-github-bot added the Import Started This pull request has been imported. This does not imply the PR has been approved. label Jan 13, 2018
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@ide is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Import Started This pull request has been imported. This does not imply the PR has been approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Geolocation times out when using "skipPermissionRequests"
5 participants