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.
This commit is contained in:
Jason Wray
2015-05-12 10:01:19 -07:00
parent 51618c35d7
commit 911a8ffc60

View File

@@ -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 -