From 911a8ffc603f4bf380b5f565dea5f0319a5d37b0 Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Tue, 12 May 2015 10:01:19 -0700 Subject: Add action sheet shortcut to Settings.app metrics opt-out MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- platform/ios/MGLMapView.mm | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'platform') 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 - -- cgit v1.2.1