56 lines
1.7 KiB
Swift
56 lines
1.7 KiB
Swift
import UIKit
|
|
import Flutter
|
|
import Firebase
|
|
import flutter_local_notifications
|
|
import FBSDKCoreKit
|
|
|
|
@main
|
|
@objc class AppDelegate: FlutterAppDelegate {
|
|
override func application(
|
|
_ application: UIApplication,
|
|
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
|
) -> Bool {
|
|
|
|
// For Push Notification Action Buttons
|
|
FlutterLocalNotificationsPlugin.setPluginRegistrantCallback { (registry) in
|
|
GeneratedPluginRegistrant.register(with: registry)
|
|
}
|
|
|
|
// ✅ Initialize Firebase
|
|
FirebaseApp.configure()
|
|
|
|
// ✅ Initialize Facebook SDK
|
|
ApplicationDelegate.shared.application(
|
|
application,
|
|
didFinishLaunchingWithOptions: launchOptions
|
|
)
|
|
|
|
if #available(iOS 10.0, *) {
|
|
UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate
|
|
}
|
|
|
|
GeneratedPluginRegistrant.register(with: self)
|
|
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
|
}
|
|
|
|
// ✅ Handle Facebook URL Scheme
|
|
override func application(
|
|
_ app: UIApplication,
|
|
open url: URL,
|
|
options: [UIApplication.OpenURLOptionsKey : Any] = [:]
|
|
) -> Bool {
|
|
|
|
// Handle Facebook URL
|
|
let facebookHandled = ApplicationDelegate.shared.application(
|
|
app,
|
|
open: url,
|
|
sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String,
|
|
annotation: options[UIApplication.OpenURLOptionsKey.annotation]
|
|
)
|
|
|
|
// Call super to handle other URL schemes (like Google Sign-In)
|
|
let superHandled = super.application(app, open: url, options: options)
|
|
|
|
return facebookHandled || superHandled
|
|
}
|
|
} |