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

Ask for 'always' location permissions, too - #1909

Merged
friedbunny merged 3 commits into
masterfrom
location-permissions-ask
Aug 25, 2015
Merged

friedbunny merged 3 commits into
masterfrom
location-permissions-ask

Conversation

@friedbunny

Copy link
Copy Markdown
Contributor

If an iOS app only has the NSLocationAlwaysUsageDescription key, MBGL will never ask for location permission. This PR checks for both always and inUse permission keys, then asks the user (with a preference for the less permissive inUse).

/cc @1ec5 @incanus @bleege

@friedbunny friedbunny added bug iOS Mapbox Maps SDK for iOS labels Jul 21, 2015
@1ec5

1ec5 commented Jul 21, 2015

Copy link
Copy Markdown
Contributor

👍

@incanus

incanus commented Jul 21, 2015

Copy link
Copy Markdown
Contributor

👍

Any way to write tests on this?

@friedbunny

Copy link
Copy Markdown
Contributor Author

Any way to write tests on this?

Not with how location is set up right now in the tests, authorization is essentially overridden.

@friedbunny

Copy link
Copy Markdown
Contributor Author

At least, I thought so... tests on Travis legitimately failed:

/Users/travis/build/mapbox/mapbox-gl-native/test/ios/MapViewTests.m:551: ((tester.mapView.userLocationVisible) equal to (YES)) failed: ("NO") is not equal to ("YES") - user location should be visible:

@friedbunny friedbunny added this to the v0.6.0 milestone Jul 22, 2015
@friedbunny

Copy link
Copy Markdown
Contributor Author

The relevant failing test, testUserTrackingModeFollow, now passes, but Travis choked on an unrelated metrics test instead: ✗ -[MetricsTests testTimerCreatedAfterEventPushed] (57 ms) (0)

@1ec5

1ec5 commented Jul 22, 2015

Copy link
Copy Markdown
Contributor

@friedbunny, that’s #1887.

@1ec5

1ec5 commented Jul 29, 2015

Copy link
Copy Markdown
Contributor

The current Travis failure doesn’t look related to #1887 after all. Any idea what’s going on?

@friedbunny

Copy link
Copy Markdown
Contributor Author

-[MetricsTests testTimerCreatedAfterEventPushed] passes locally and doesn't touch location at all.

The failure test/ios/MetricsTests.m:148: (([[[MGLMapboxEvents sharedManager] eventQueue] count]) equal to (1)) failed: ("3") is not equal to ("1"): points to Travis having severe timing issues and/or Travis somehow allowing tests to bleed into each other.

@friedbunny

Copy link
Copy Markdown
Contributor Author

Going to rebase and merge this, independently of tracking down #1930.

@friedbunny
friedbunny force-pushed the location-permissions-ask branch from 355ac67 to 36f7f90 Compare August 11, 2015 01:41
@friedbunny

Copy link
Copy Markdown
Contributor Author

... except that now testUserTrackingModeFollow is failing.

I thought that the tests were bypassing the permissions dialog, but it turns out that was only half correct: we were not actually asking for `always` location permission in MBGL.
@friedbunny
friedbunny force-pushed the location-permissions-ask branch from 36f7f90 to 4977858 Compare August 25, 2015 22:03
@friedbunny
friedbunny merged commit 3643053 into master Aug 25, 2015
@friedbunny
friedbunny deleted the location-permissions-ask branch August 25, 2015 23:55
@friedbunny

Copy link
Copy Markdown
Contributor Author

Got the tests to pass on Travis (twice, IN A ROW), so this got mergezilla'd before my magic pixie dust wore off.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug iOS Mapbox Maps SDK for iOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants