Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[ios] Refactor MGLMapView's location services #4034

Merged
merged 1 commit into from
Feb 20, 2016

Conversation

friedbunny
Copy link
Contributor

Continuation of #3641, rebased onto the release-ios-v3.1.0 branch for the upcoming v3.1.2 release.

  • Pause location services when the app goes to sleep; address iOS 8 blur bar issue.
  • Only ask for location permissions if not already granted/denied.
  • Cleanup usage of .isDormant.dormant.

Partially addresses #2945, for which a full and complete fix waits until #4030.

/cc @1ec5 @boundsj

if (showsUserLocation == _showsUserLocation || _isTargetingInterfaceBuilder) return;

_showsUserLocation = showsUserLocation;
BOOL shouldEnableLocationServices = !self.locationManager && self.showsUserLocation;
Copy link
Contributor

Choose a reason for hiding this comment

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

Validation methods shouldn’t have preconditions. This flag should additionally check for self.dormant, such that you could call this method twice in a row without producing the opposite result.

@boundsj
Copy link
Contributor

boundsj commented Feb 19, 2016

@friedbunny 👍 although for "Only ask for location permissions if not already granted/denied" the CLLocationManager API already guards against redundant requests although this certainly does not hurt anything.

- Pause location services when the app goes to sleep; address iOS 8 blue bar issue.
- Only ask for location permissions if not already granted/denied.
- Cleanup usage of `.isDormant` → `.dormant`

Partially addresses #2945, for which a full and complete fix waits until #4030.
@friedbunny
Copy link
Contributor Author

@boundsj Aye, checking for kCLAuthorizationStatusNotDetermined isn't strictly necessary, but doing so is more explicit and we can avoid an extra little bit of work in most situations.

@friedbunny friedbunny force-pushed the fb-location-init-refactor-v3.1.2 branch from 9381ff2 to 15b9f31 Compare February 19, 2016 18:28
@friedbunny friedbunny changed the title [ios] Refactor location services [ios] Refactor MGLMapView's location services Feb 19, 2016
@1ec5
Copy link
Contributor

1ec5 commented Feb 19, 2016

👍

@friedbunny friedbunny merged commit 15b9f31 into release-ios-v3.1.0 Feb 20, 2016
@friedbunny friedbunny deleted the fb-location-init-refactor-v3.1.2 branch February 20, 2016 00:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
iOS Mapbox Maps SDK for iOS refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants