diff --git a/app/AppDelegate.m b/app/AppDelegate.m
index 99f23f7e85..3c42107931 100644
--- a/app/AppDelegate.m
+++ b/app/AppDelegate.m
@@ -310,7 +310,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
if (self.window != nil) {
// For iOS <13, where the app delegate owns the window instead of the scene
- if ([NSUserDefaults.standardUserDefaults boolForKey:@"recovery"]) {
+ UIApplicationShortcutItem *recoveryAction = [launchOptions valueForKey:UIApplicationLaunchOptionsShortcutItemKey]; // Came from Quick Action?
+ if ([NSUserDefaults.standardUserDefaults boolForKey:@"recovery"] || [recoveryAction.type isEqualToString:@"recoveryQuickAction"]) {
UINavigationController *vc = [[UIStoryboard storyboardWithName:@"About" bundle:nil] instantiateInitialViewController];
AboutViewController *avc = (AboutViewController *) vc.topViewController;
avc.recoveryMode = YES;
@@ -331,6 +332,15 @@ - (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet<
}
}
+- (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL))completionHandler { // Quick Action while running for iOS <13; AppDelegate owns the window
+ if([shortcutItem.type isEqualToString:@"recoveryQuickAction"]) {
+ UINavigationController *vc = [[UIStoryboard storyboardWithName:@"About" bundle:nil] instantiateInitialViewController];
+ AboutViewController *avc = (AboutViewController *) vc.topViewController;
+ avc.recoveryMode = YES;
+ self.window.rootViewController = vc;
+ }
+}
+
- (void)dealloc {
if (self.reachability != NULL) {
SCNetworkReachabilityUnscheduleFromRunLoop(self.reachability, CFRunLoopGetMain(), kCFRunLoopCommonModes);
diff --git a/app/Assets.xcassets/Recover.imageset/Contents.json b/app/Assets.xcassets/Recover.imageset/Contents.json
new file mode 100644
index 0000000000..a1d1bbd894
--- /dev/null
+++ b/app/Assets.xcassets/Recover.imageset/Contents.json
@@ -0,0 +1,16 @@
+{
+ "images" : [
+ {
+ "filename" : "sf_gearshape.svg",
+ "idiom" : "universal"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ },
+ "properties" : {
+ "preserves-vector-representation" : true,
+ "template-rendering-intent" : "template"
+ }
+}
diff --git a/app/Assets.xcassets/Recover.imageset/sf_gearshape.svg b/app/Assets.xcassets/Recover.imageset/sf_gearshape.svg
new file mode 100644
index 0000000000..122b005951
--- /dev/null
+++ b/app/Assets.xcassets/Recover.imageset/sf_gearshape.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/app/Info.plist b/app/Info.plist
index a4f151cbea..ec805ac9b2 100644
--- a/app/Info.plist
+++ b/app/Info.plist
@@ -82,6 +82,21 @@
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
+ UIApplicationShortcutItems
+
+
+ UIApplicationShortcutItemIconFile
+ Recover
+ UIApplicationShortcutItemType
+ recoveryQuickAction
+ UIApplicationShortcutItemTitle
+ Recovery Mode
+ UIApplicationShortcutItemSubtitle
+ Restart the app directly to settings
+ UIApplicationShortcutItemIconSymbolName
+ gearshape
+
+
fuc
ICON_STUFF
diff --git a/app/SceneDelegate.m b/app/SceneDelegate.m
index 308f3b8fae..1b027c6a9b 100644
--- a/app/SceneDelegate.m
+++ b/app/SceneDelegate.m
@@ -21,7 +21,8 @@ @interface SceneDelegate ()
@implementation SceneDelegate
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
- if ([NSUserDefaults.standardUserDefaults boolForKey:@"recovery"]) {
+ bool fromRecoveryAction = (connectionOptions.shortcutItem != NULL) ? [connectionOptions.shortcutItem.type isEqualToString:@"recoveryQuickAction"] : false; // Came from Quick Action?
+ if ([NSUserDefaults.standardUserDefaults boolForKey:@"recovery"] || fromRecoveryAction) {
UINavigationController *vc = [[UIStoryboard storyboardWithName:@"About" bundle:nil] instantiateInitialViewController];
AboutViewController *avc = (AboutViewController *) vc.topViewController;
avc.recoveryMode = YES;
@@ -65,4 +66,13 @@ - (void)sceneWillResignActive:(UIScene *)scene {
}
}
+- (void)windowScene:(UIWindowScene *)windowScene performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL))completionHandler { // Quick Action while running for iOS >=13
+ if([shortcutItem.type isEqualToString:@"recoveryQuickAction"]) {
+ UINavigationController *vc = [[UIStoryboard storyboardWithName:@"About" bundle:nil] instantiateInitialViewController];
+ AboutViewController *avc = (AboutViewController *) vc.topViewController;
+ avc.recoveryMode = YES;
+ self.window.rootViewController = vc;
+ }
+}
+
@end