diff options
Diffstat (limited to 'AuthSamples/Sample/ApplicationDelegate.m')
-rw-r--r-- | AuthSamples/Sample/ApplicationDelegate.m | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/AuthSamples/Sample/ApplicationDelegate.m b/AuthSamples/Sample/ApplicationDelegate.m index 594327f..3b49862 100644 --- a/AuthSamples/Sample/ApplicationDelegate.m +++ b/AuthSamples/Sample/ApplicationDelegate.m @@ -28,7 +28,10 @@ */ static __weak id<OpenURLDelegate> gOpenURLDelegate; -@implementation ApplicationDelegate +@implementation ApplicationDelegate { + // The main view controller of the sample app. + MainViewController *_sampleAppMainViewController; +} + (void)setOpenURLDelegate:(nullable id<OpenURLDelegate>)openURLDelegate { gOpenURLDelegate = openURLDelegate; @@ -44,9 +47,10 @@ static __weak id<OpenURLDelegate> gOpenURLDelegate; // Load and present the UI: UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - window.rootViewController = + _sampleAppMainViewController = [[MainViewController alloc] initWithNibName:NSStringFromClass([MainViewController class]) bundle:nil]; + window.rootViewController = _sampleAppMainViewController; self.window = window; [self.window makeKeyAndVisible]; @@ -72,4 +76,13 @@ static __weak id<OpenURLDelegate> gOpenURLDelegate; return NO; } +- (BOOL)application:(UIApplication *)application +continueUserActivity:(NSUserActivity *)userActivity + restorationHandler:(void (^)(NSArray *))restorationHandler { + if (userActivity.webpageURL) { + return [_sampleAppMainViewController handleIncomingLinkWithURL:userActivity.webpageURL]; + } + return NO; +} + @end |