Created
June 8, 2024 00:14
-
-
Save jezell/8a6b4c7bf61916ffc03a0245a9e99c85 to your computer and use it in GitHub Desktop.
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
import UIKit | |
import Flutter | |
import app_links | |
@UIApplicationMain | |
@objc class AppDelegate: FlutterAppDelegate { | |
override func application( | |
_ application: UIApplication, | |
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? | |
) -> Bool { | |
GeneratedPluginRegistrant.register(with: self) | |
if let url = AppLinks.shared.getLink(launchOptions: launchOptions) { | |
// We have a link, propagate it to your Flutter app | |
AppLinks.shared.handleLink(url: url) | |
return true | |
} | |
super.application(application, didFinishLaunchingWithOptions: launchOptions) | |
return false | |
} | |
override func application(_ application: UIApplication, | |
continue userActivity: NSUserActivity, | |
restorationHandler: @escaping ([any UIUserActivityRestoring]?) -> Void) -> Bool { | |
if userActivity.activityType == NSUserActivityTypeBrowsingWeb { | |
let url = userActivity.webpageURL | |
AppLinks.shared.handleLink(url: url!) | |
return true | |
} | |
return false | |
} | |
override func application( | |
_ app: UIApplication, | |
open url: URL, | |
options: [UIApplication.OpenURLOptionsKey : Any] = [:] | |
) -> Bool { | |
AppLinks.shared.handleLink(url: url) | |
return true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment