Skip to content

Commit

Permalink
Add support for application:openURL:options: in FlutterPlugin (flut…
Browse files Browse the repository at this point in the history
…ter#3766)

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

* `application:handleOpenURL:`
* `application:openURL:sourceApplication:annotation:`
  • Loading branch information
tvolkert authored Jun 13, 2017
1 parent 800d817 commit 4f5d6fa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
15 changes: 15 additions & 0 deletions shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,21 @@ - (void)application:(UIApplication*)application
}
}

- (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]) {
Expand Down

0 comments on commit 4f5d6fa

Please sign in to comment.