Add support for application:openURL:options: in FlutterPlugin (flutter/engine#3766)

Both the following, which we also support, are deprecated in UIKit:

* `application:handleOpenURL:`
* `application:openURL:sourceApplication:annotation:`
This commit is contained in:
Todd Volkert
2017-06-12 20:57:12 -07:00
committed by GitHub
parent f38ab73dab
commit e69672b40a
2 changed files with 24 additions and 0 deletions

View File

@@ -93,6 +93,15 @@ NS_ASSUME_NONNULL_BEGIN
didReceiveRemoteNotification:(NSDictionary*)userInfo
fetchCompletionHandler:(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
openURL:(NSURL*)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey, id>*)options;
/**
Called if this plugin has been registered for `UIApplicationDelegate` callbacks.

View File

@@ -155,6 +155,21 @@
}
}
- (BOOL)application:(UIApplication*)application
openURL:(NSURL*)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey, id>*)options {
for (id<FlutterPlugin> plugin in _pluginDelegates) {
if ([plugin respondsToSelector:_cmd]) {
if ([plugin application:application
openURL:url
options:options]) {
return YES;
}
}
}
return NO;
}
- (BOOL)application:(UIApplication*)application handleOpenURL:(NSURL*)url {
for (id<FlutterPlugin> plugin in _pluginDelegates) {
if ([plugin respondsToSelector:_cmd]) {