Skip to content

Commit

Permalink
feat: adapt AppDelegate
Browse files Browse the repository at this point in the history
  • Loading branch information
tamslo committed Jun 8, 2023
1 parent e621cfa commit 6dfccef
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions app/ios/Runner/AppDelegate.swift
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)
}
}

0 comments on commit 6dfccef

Please sign in to comment.