From 55d31922fcd47947b17261177e6d91201fe7c02a Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Tue, 1 Aug 2017 18:37:46 -0400 Subject: [ios] Add iosapp Settings.app force touch quick action shortcut --- .../Assets.xcassets/settings.imageset/Contents.json | 15 +-------------- .../Assets.xcassets/settings.imageset/settings.pdf | Bin 0 -> 9177 bytes .../Assets.xcassets/settings.imageset/settings.png | Bin 528 -> 0 bytes .../Assets.xcassets/settings.imageset/settings@2x.png | Bin 1130 -> 0 bytes platform/ios/app/Info.plist | 11 +++++++++++ platform/ios/app/MBXAppDelegate.m | 18 ++++++++++++++++++ 6 files changed, 30 insertions(+), 14 deletions(-) create mode 100644 platform/ios/app/Assets.xcassets/settings.imageset/settings.pdf delete mode 100644 platform/ios/app/Assets.xcassets/settings.imageset/settings.png delete mode 100644 platform/ios/app/Assets.xcassets/settings.imageset/settings@2x.png diff --git a/platform/ios/app/Assets.xcassets/settings.imageset/Contents.json b/platform/ios/app/Assets.xcassets/settings.imageset/Contents.json index 1eeddba9b9..228b81a818 100644 --- a/platform/ios/app/Assets.xcassets/settings.imageset/Contents.json +++ b/platform/ios/app/Assets.xcassets/settings.imageset/Contents.json @@ -2,24 +2,11 @@ "images" : [ { "idiom" : "universal", - "filename" : "settings.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "settings@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" + "filename" : "settings.pdf" } ], "info" : { "version" : 1, "author" : "xcode" - }, - "properties" : { - "template-rendering-intent" : "template" } } \ No newline at end of file diff --git a/platform/ios/app/Assets.xcassets/settings.imageset/settings.pdf b/platform/ios/app/Assets.xcassets/settings.imageset/settings.pdf new file mode 100644 index 0000000000..46aa7443f0 Binary files /dev/null and b/platform/ios/app/Assets.xcassets/settings.imageset/settings.pdf differ diff --git a/platform/ios/app/Assets.xcassets/settings.imageset/settings.png b/platform/ios/app/Assets.xcassets/settings.imageset/settings.png deleted file mode 100644 index 5d7643eef5..0000000000 Binary files a/platform/ios/app/Assets.xcassets/settings.imageset/settings.png and /dev/null differ diff --git a/platform/ios/app/Assets.xcassets/settings.imageset/settings@2x.png b/platform/ios/app/Assets.xcassets/settings.imageset/settings@2x.png deleted file mode 100644 index 2bb9f0ebad..0000000000 Binary files a/platform/ios/app/Assets.xcassets/settings.imageset/settings@2x.png and /dev/null differ diff --git a/platform/ios/app/Info.plist b/platform/ios/app/Info.plist index d5b6825422..167e66fa09 100644 --- a/platform/ios/app/Info.plist +++ b/platform/ios/app/Info.plist @@ -51,5 +51,16 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + UIApplicationShortcutItems + + + UIApplicationShortcutItemTitle + Settings + UIApplicationShortcutItemType + $(PRODUCT_BUNDLE_IDENTIFIER).settings + UIApplicationShortcutItemIconFile + settings + + 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 -- cgit v1.2.1