diff options
author | Jason Wray <jason@kulturny.com> | 2015-05-12 10:01:19 -0700 |
---|---|---|
committer | Jason Wray <jason@kulturny.com> | 2015-05-21 00:12:49 -0700 |
commit | 911a8ffc603f4bf380b5f565dea5f0319a5d37b0 (patch) | |
tree | 6eaff1cddcd454c769600ac8206111f8ca75b543 /platform | |
parent | 51618c35d79cfb237e62e70993182e87903c3ccd (diff) | |
download | qtlocation-mapboxgl-911a8ffc603f4bf380b5f565dea5f0319a5d37b0.tar.gz |
Add action sheet shortcut to Settings.app metrics opt-out
Only applicable to iOS 8+. Checks if metrics setting has been declared to be offered in app, if not: adds ℹ️ action to open the app's Settings.app section.
Fixes #1519. Squash of #1529.
Diffstat (limited to 'platform')
-rw-r--r-- | platform/ios/MGLMapView.mm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm index 5d14107518..ca0b9bc78f 100644 --- a/platform/ios/MGLMapView.mm +++ b/platform/ios/MGLMapView.mm @@ -294,6 +294,12 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration) @"Improve This Map", nil]; + // iOS 8+: add action that opens app's Settings.app panel, if applicable + if (&UIApplicationOpenSettingsURLString != NULL && ! [MGLAccountManager mapboxMetricsEnabledSettingShownInApp]) + { + [_attributionSheet addButtonWithTitle:@"Adjust Privacy Settings"]; + } + // setup compass // _compass = [[UIImageView alloc] initWithImage:[MGLMapView resourceImageNamed:@"Compass.png"]]; @@ -1270,6 +1276,11 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration) [[UIApplication sharedApplication] openURL: [NSURL URLWithString:feedbackURL]]; } + // skips to 4 because button is conditionally added after cancel (index 3) + else if (buttonIndex == actionSheet.firstOtherButtonIndex + 4) + { + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]; + } } #pragma mark - Properties - |