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

Fix build, only ask for location permission in iosapp on user's instigation #2281

Merged
merged 1 commit into from
Sep 8, 2015

Conversation

friedbunny
Copy link
Contributor

Previously in #2265 we would ask for location permission at app startup if !settings->showsUserLocation. #2193 0a172a2 changed the way we use NSUserDefaults and mostly removed the settings object, which broke #2265.

Rather than fix our pestering location permissions ask at iosapp startup, this commit now only asks for location permissions when the user hits the locate-me button.

Once a user grants permission, the user dot appears because a userTrackingMode is set, showsUserLocation is permanently set to YES in NSUserDefaults and is restored at launch.

/cc @incanus @1ec5

Previously in #2265 we would ask for location permission at app startup if `!settings->showsUserLocation`. #2193 0a172a2 changed the way we used `NSUserDefaults` and mostly removed the `settings` object, which broke #2265.

Rather than fix our pestering location permissions ask at startup, this commit now only asks for location permissions when the user hits the locate-me button.

Once a user grants permission, the user dot appears because a `userTrackingMode` is set, `showsUserLocation` is permanently set to `YES` in `NSUserDefaults` and is restored at launch.
@friedbunny friedbunny added bug iOS Mapbox Maps SDK for iOS build labels Sep 8, 2015
@friedbunny friedbunny added this to the ios-v2.1.0 milestone Sep 8, 2015
@1ec5
Copy link
Contributor

1ec5 commented Sep 8, 2015

MBXViewController still sets showsUserLocation. Does that need to happen on a delay still?

@friedbunny
Copy link
Contributor Author

MBXViewController still sets showsUserLocation. Does that need to happen on a delay still?

Nope, because restoreState: will either:

  1. Set showsUserLocation to NO, because that's our NSUserDefault, in which case we don't ask for or need permissions. This is the first launch behavior.
  2. Set showsUserLocation to YES, in which case we already have location permissions because the user explicitly hit the locate-me button on some previous launch and said, "Yeah, track my location (and put the dot on the map)!"

@friedbunny
Copy link
Contributor Author

Incidentally, once we have location permissions, we assume that we always have location permissions. The user could disable them, in which case we fail silently and don't ask the user to reenable.

We could ask using mapView:didFailToLocateUserWithError:, like I do in Treble...

@incanus
Copy link
Contributor

incanus commented Sep 8, 2015

Incidentally, once we have location permissions, we assume that we always have location permissions. The user could disable them, in which case we fail silently and don't ask the user to reenable.

Considering this isn't even an internally user-facing app, I think it's overkill. The only folks using this are those developing on GL.

@incanus incanus merged commit 9a55e97 into master Sep 8, 2015
@incanus incanus deleted the location-schmocation branch September 8, 2015 17:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug build iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants