[ios] Add iosapp Settings.app force touch quick action shortcut

This commit is contained in:
Jason Wray
2017-08-01 18:37:46 -04:00
parent 141cd32804
commit 55d31922fc
6 changed files with 30 additions and 14 deletions

View File

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

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 528 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -51,5 +51,16 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIApplicationShortcutItems</key>
<array>
<dict>
<key>UIApplicationShortcutItemTitle</key>
<string>Settings</string>
<key>UIApplicationShortcutItemType</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER).settings</string>
<key>UIApplicationShortcutItemIconFile</key>
<string>settings</string>
</dict>
</array>
</dict>
</plist>

View File

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