-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
16 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
import flutter_sharing_intent | ||
import UIKit | ||
import Flutter | ||
|
||
@UIApplicationMain | ||
@objc class AppDelegate: FlutterAppDelegate { | ||
override func application( | ||
_ application: UIApplication, | ||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? | ||
) -> Bool { | ||
GeneratedPluginRegistrant.register(with: self) | ||
return super.application(application, didFinishLaunchingWithOptions: launchOptions) | ||
} | ||
_ app: UIApplication, | ||
open url: URL, | ||
options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { | ||
// This line is not in the flutter_sharing_intent tutorial but was here | ||
// before | ||
GeneratedPluginRegistrant.register(with: self) | ||
let sharingIntent = SwiftFlutterSharingIntentPlugin.instance | ||
// if the url is made from SwiftFlutterSharingIntentPlugin then handle it | ||
// with plugin [SwiftFlutterSharingIntentPlugin] | ||
if sharingIntent.hasSameSchemePrefix(url: url) { | ||
return sharingIntent.application(app, open: url, options: options) | ||
} | ||
// Proceed url handling for other Flutter libraries like uni_links | ||
return super.application(app, open: url, options:options) | ||
} | ||
} |