diff options
author | Jason Wray <jason@mapbox.com> | 2017-08-01 18:37:46 -0400 |
---|---|---|
committer | Jason Wray <jason@mapbox.com> | 2017-08-02 18:46:13 -0400 |
commit | 55d31922fcd47947b17261177e6d91201fe7c02a (patch) | |
tree | 6c4ef786884e6fdb3182c1ca9e322b5945dae01e /platform/ios/app/MBXAppDelegate.m | |
parent | 141cd328043fb58c137c77bcb4f7c949c31831ba (diff) | |
download | qtlocation-mapboxgl-55d31922fcd47947b17261177e6d91201fe7c02a.tar.gz |
[ios] Add iosapp Settings.app force touch quick action shortcut
Diffstat (limited to 'platform/ios/app/MBXAppDelegate.m')
-rw-r--r-- | platform/ios/app/MBXAppDelegate.m | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/platform/ios/app/MBXAppDelegate.m b/platform/ios/app/MBXAppDelegate.m index c2834bfa7f..1934f4912b 100644 --- a/platform/ios/app/MBXAppDelegate.m +++ b/platform/ios/app/MBXAppDelegate.m @@ -26,4 +26,22 @@ NSString * const MBXMapboxAccessTokenDefaultsKey = @"MBXMapboxAccessToken"; return YES; } +#pragma mark - Quick actions + +- (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL))completionHandler { + completionHandler([self handleShortcut:shortcutItem]); +} + +- (BOOL)handleShortcut:(UIApplicationShortcutItem *)shortcut { + if ([[shortcut.type componentsSeparatedByString:@"."].lastObject isEqual:@"settings"]) { + dispatch_async(dispatch_get_main_queue(), ^{ + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]; + }); + + return YES; + } + + return NO; +} + @end |