UnbluFirebaseUIApplicationDelegate

@MainActor
class UnbluFirebaseUIApplicationDelegate

Basic implementation of UIApplicationDelegate which overrides some application notification api callbacks for easy Firebase integration. Always call the super implementation of the delegate first, before handling the functions by your own.

  • The window used by iOS to attach UI content. If you create a UIWindow programmatically instead of using Storyboard, you should set it to this property.

    Declaration

    Swift

    @MainActor
    var window: UIWindow?
    • Uses UnbluFirebaseNotificationCoordinator and calls FirebaseApp.configure and sets the Messaging.messaging().delegate and checks if there was an initial notification from which the app was started.
    • Please ensure to call this super implementation from within your AppDelegate

    Declaration

    Swift

    @MainActor
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]?) -> Bool
  • See original documentation from apple for didFailToRegisterForRemoteNotificationsWithError. If you override this function, please call super implementation first.

    Declaration

    Swift

    @MainActor
    func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: any Error)
  • Called when received a remote notification. Will call on_application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) if it was not an unblu notification

    Declaration

    Swift

    @MainActor
    func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any])
  • Called when received a remote notification. Will call on_application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) if it was not an unblu notification

    Declaration

    Swift

    @MainActor
    func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void)
  • Called when the push notification token was received/updated via Firebase

    Declaration

    Swift

    @MainActor
    func on_messaging(didReceiveRegistrationToken fcmToken: String?)
  • Called instead of the original didReceiveRemoteNotification function as unblu needs to make sure it is called

    Declaration

    Swift

    @MainActor
    func on_application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any])
  • Called instead of the original didReceiveRemoteNotification function as unblu needs to make sure it is called

    Declaration

    Swift

    @MainActor
    func on_application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void)
  • Will be called when the push notification token was received/updated via Firebase

    Declaration

    Swift

    @MainActor
    func unbluFirebaseNotificationCoordinator(_ unbluFirebaseNotificationCoordinator: UnbluFirebaseNotificationCoordinator, didReceiveRegistrationToken token: String?)

    Parameters

    unbluFirebaseNotificationCoordinator

    The firebase coordinator which received the message