From a1a54ad1f9d845c8cff31e0d5faca2a012213b80 Mon Sep 17 00:00:00 2001 From: Brandon Parrish Date: Fri, 25 May 2018 09:55:41 -0700 Subject: [PATCH] Added application callback (#5369) * Added application callback * Formatting --- .../darwin/ios/framework/Headers/FlutterPlugin.h | 9 +++++++++ .../ios/framework/Source/FlutterAppDelegate.mm | 14 ++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h b/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h index 646ffa30d74fd..1fe71dd8b2ca1 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h @@ -146,6 +146,15 @@ NS_ASSUME_NONNULL_BEGIN */ - (BOOL)application:(UIApplication*)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler; + +/** + Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + + - Returns: `YES` if this plugin handles the request. + */ +- (BOOL)application:(UIApplication*)application + continueUserActivity:(NSUserActivity*)userActivity + restorationHandler:(void (^)(NSArray*))restorationHandler; @end /** diff --git a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm index a5132bf4ee4e0..0eddadab0de12 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm @@ -235,6 +235,20 @@ - (void)application:(UIApplication*)application } } +- (void)application:(UIApplication*)application + continueUserActivity:(NSUserActivity*)userActivity + restorationHandler:(void (^)(NSArray*))restorationHandler { + for (id plugin in _pluginDelegates) { + if ([plugin respondsToSelector:_cmd]) { + if ([plugin application:application + continueUserActivity:userActivty + restorationHandler:restorationHandler]) { + return; + } + } + } +} + // TODO(xster): move when doing https://github.com/flutter/flutter/issues/3671. - (NSObject*)binaryMessenger { UIViewController* rootViewController = _window.rootViewController;