You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.1KB

  1. import UIKit
  2. import Flutter
  3. import Firebase
  4. @UIApplicationMain
  5. @objc class AppDelegate: FlutterAppDelegate {
  6. override func application(
  7. _ application: UIApplication,
  8. didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  9. ) -> Bool {
  10. FirebaseApp.configure()
  11. GeneratedPluginRegistrant.register(with: self)
  12. if #available(iOS 10.0, *) {
  13. // For iOS 10 display notification (sent via APNS)
  14. UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
  15. let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
  16. UNUserNotificationCenter.current().requestAuthorization(
  17. options: authOptions,
  18. completionHandler: {_, _ in })
  19. } else {
  20. let settings: UIUserNotificationSettings =
  21. UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
  22. application.registerUserNotificationSettings(settings)
  23. }
  24. application.registerForRemoteNotifications()
  25. return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  26. }
  27. }