-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Fix distanceFilter caching for LocationObserver #6987
Conversation
By analyzing the blame information on this pull request, we identified @realaboo, @christopherdro and @nicklockwood to be potential reviewers. |
@jrichardlai updated the pull request. |
I added some tests not sure if that's the best way to do it. Both tests will fail before the fix. |
@christopherdro any thoughts on this branch ? |
@jrichardlai updated the pull request. |
@jrichardlai Looks great! I would suggest separating this into two different PR's since it's unlikely this will get merged if tests are failing. Can you update this PR to just include your changes to We can then follow up with your tests. Thanks again for the PR! |
@jrichardlai updated the pull request. |
dfbcade
to
bce30b9
Compare
@jrichardlai updated the pull request. |
26893cf
to
398b5e2
Compare
@jrichardlai updated the pull request. |
1 similar comment
@jrichardlai updated the pull request. |
@christopherdro tests don't seems to get green :(, are they intermittent or did I really broke something? |
@jrichardlai Just triggered the tests again. When's the last time you rebased this branch to master? |
Weeks ago, still not green retrying again. |
@jrichardlai updated the pull request. |
@jrichardlai The tests aren't failing with anything related to the code in your PR. I asked when was the last time you rebased because the errors from the circle ci tests appear to be something that was addressed a week or two ago. Let's hope these pass. |
@christopherdro boo they are still failing, they were green on my first commit 3 weeks ago ( which was rebased so not here anymore :( ) |
@jrichardlai I thought you had re based again from the previous comment. If the last time you rebased was over 3 weeks ago, please do so again now and lets see if they pass. |
Allow changing distanceFilter after _locationManager has been initialized.
6fa600c
to
84c9154
Compare
@jrichardlai updated the pull request. |
@christopherdro oh wow it seem to got green this time 👍 |
@facebook-github-bot shipit |
Thanks for importing. If you are an FB employee go to Phabricator to review. |
2310494
Summary: Allow changing distanceFilter after _locationManager has been initialized. There is 2 reasons for this PR: - When calling `getCurrentPosition`, `_observerOptions` is possibly not set properly ( as it is set only in `startObserving`), in this case it would have default values so `distanceFilter` will be 0 in this case ( which can be the right value but we should be more explicit about it, `kCLDistanceFilterNone` or `RCT_DEFAULT_LOCATION_ACCURACY`): <img width="961" alt="screen shot 2016-04-14 at 8 44 09 pm" src="https://cloud.githubusercontent.com/assets/159813/14551465/6aa8791a-0288-11e6-9c98-1687357f8c2a.png"> - Another issue is that `distanceFilter` is cached so it can't be changed afterwards: ```javascript let options; options = { enableHighAccuracy: true, distanceFilter: 20, }; this.watchId = this.geolocation.watchPosition( () => { }, () => { }, options, ); // => sets distanceFilter to 20 this.geolocation.clearWatch(this.watchId); options = { enableHighAccuracy: Closes facebook#6987 Differential Revision: D3258956 fb-gh-sync-id: 00a1d1b29d732a54cdc30e20a7a9a2de3dd9b725 fbshipit-source-id: 00a1d1b29d732a54cdc30e20a7a9a2de3dd9b725
Summary: Allow changing distanceFilter after _locationManager has been initialized. There is 2 reasons for this PR: - When calling `getCurrentPosition`, `_observerOptions` is possibly not set properly ( as it is set only in `startObserving`), in this case it would have default values so `distanceFilter` will be 0 in this case ( which can be the right value but we should be more explicit about it, `kCLDistanceFilterNone` or `RCT_DEFAULT_LOCATION_ACCURACY`): <img width="961" alt="screen shot 2016-04-14 at 8 44 09 pm" src="https://cloud.githubusercontent.com/assets/159813/14551465/6aa8791a-0288-11e6-9c98-1687357f8c2a.png"> - Another issue is that `distanceFilter` is cached so it can't be changed afterwards: ```javascript let options; options = { enableHighAccuracy: true, distanceFilter: 20, }; this.watchId = this.geolocation.watchPosition( () => { }, () => { }, options, ); // => sets distanceFilter to 20 this.geolocation.clearWatch(this.watchId); options = { enableHighAccuracy: Closes facebook#6987 Differential Revision: D3258956 fb-gh-sync-id: 00a1d1b29d732a54cdc30e20a7a9a2de3dd9b725 fbshipit-source-id: 00a1d1b29d732a54cdc30e20a7a9a2de3dd9b725
Summary: Allow changing distanceFilter after _locationManager has been initialized. There is 2 reasons for this PR: - When calling `getCurrentPosition`, `_observerOptions` is possibly not set properly ( as it is set only in `startObserving`), in this case it would have default values so `distanceFilter` will be 0 in this case ( which can be the right value but we should be more explicit about it, `kCLDistanceFilterNone` or `RCT_DEFAULT_LOCATION_ACCURACY`): <img width="961" alt="screen shot 2016-04-14 at 8 44 09 pm" src="https://cloud.githubusercontent.com/assets/159813/14551465/6aa8791a-0288-11e6-9c98-1687357f8c2a.png"> - Another issue is that `distanceFilter` is cached so it can't be changed afterwards: ```javascript let options; options = { enableHighAccuracy: true, distanceFilter: 20, }; this.watchId = this.geolocation.watchPosition( () => { }, () => { }, options, ); // => sets distanceFilter to 20 this.geolocation.clearWatch(this.watchId); options = { enableHighAccuracy: Closes facebook#6987 Differential Revision: D3258956 fb-gh-sync-id: 00a1d1b29d732a54cdc30e20a7a9a2de3dd9b725 fbshipit-source-id: 00a1d1b29d732a54cdc30e20a7a9a2de3dd9b725
Allow changing distanceFilter after _locationManager has been initialized.
There is 2 reasons for this PR:
getCurrentPosition
,_observerOptions
is possibly not set properly ( as it is set only instartObserving
), in this case it would have default values sodistanceFilter
will be 0 in this case ( which can be the right value but we should be more explicit about it,kCLDistanceFilterNone
orRCT_DEFAULT_LOCATION_ACCURACY
):distanceFilter
is cached so it can't be changed afterwards: