This commit is contained in:
efrilm
2026-05-29 21:56:29 +07:00
parent 0ae599d8f8
commit 77651e2e95
2 changed files with 19 additions and 3 deletions
+11 -3
View File
@@ -1,6 +1,7 @@
import Flutter
import UIKit
import UserNotifications
import Firebase
@main
@objc class AppDelegate: FlutterAppDelegate {
@@ -8,11 +9,18 @@ import UserNotifications
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
FirebaseApp.configure()
// Set notification delegate so notifications show in foreground & background
UNUserNotificationCenter.current().delegate = self
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
return super.application(
application,
didFinishLaunchingWithOptions: launchOptions
)
}
// Called when a notification is delivered while app is in foreground
@@ -24,7 +32,7 @@ import UserNotifications
completionHandler([.banner, .badge, .sound])
}
// Called when user taps a notification (foreground or background)
// Called when user taps a notification
override func userNotificationCenter(
_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
@@ -32,4 +40,4 @@ import UserNotifications
) {
completionHandler()
}
}
}