|
|
@@ -9,7 +9,7 @@ import FirebaseCore
|
|
|
import GoogleMaps
|
|
|
|
|
|
@main
|
|
|
-class AppDelegate: RCTAppDelegate, UIApplicationDelegate, UNUserNotificationCenterDelegate, MessagingDelegate {
|
|
|
+class AppDelegate: RCTAppDelegate, UNUserNotificationCenterDelegate, MessagingDelegate {
|
|
|
|
|
|
override func application(
|
|
|
_ application: UIApplication,
|
|
|
@@ -50,11 +50,11 @@ class AppDelegate: RCTAppDelegate, UIApplicationDelegate, UNUserNotificationCent
|
|
|
}
|
|
|
|
|
|
// MARK: - Linking (RN RCTLinkingManager)
|
|
|
- func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
|
|
|
+ override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
|
|
|
return RCTLinkingManager.application(app, open: url, options: options)
|
|
|
}
|
|
|
|
|
|
- func application(
|
|
|
+ override func application(
|
|
|
_ application: UIApplication,
|
|
|
continue userActivity: NSUserActivity,
|
|
|
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void
|
|
|
@@ -68,12 +68,12 @@ class AppDelegate: RCTAppDelegate, UIApplicationDelegate, UNUserNotificationCent
|
|
|
|
|
|
// MARK: - Push Notifications (RNCPushNotificationIOS)
|
|
|
// Required to register for notifications
|
|
|
- func application(_ application: UIApplication, didRegister notificationSettings: UIUserNotificationSettings) {
|
|
|
+ override func application(_ application: UIApplication, didRegister notificationSettings: UIUserNotificationSettings) {
|
|
|
RNCPushNotificationIOS.didRegister(notificationSettings)
|
|
|
}
|
|
|
|
|
|
// Required for the register event
|
|
|
- func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
|
|
|
+ override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
|
|
|
// 1. 将 APNs Device Token 关联至 Firebase Messaging
|
|
|
Messaging.messaging().apnsToken = deviceToken
|
|
|
// 2. 获取当前的 FCM Token 并通过通知中心发送给 RN 端
|
|
|
@@ -89,12 +89,12 @@ class AppDelegate: RCTAppDelegate, UIApplicationDelegate, UNUserNotificationCent
|
|
|
}
|
|
|
|
|
|
// Required for the notification event
|
|
|
- func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
|
|
|
+ override func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
|
|
|
RNCPushNotificationIOS.didReceiveRemoteNotification(userInfo, fetchCompletionHandler: completionHandler)
|
|
|
}
|
|
|
|
|
|
// Required for the registrationError event
|
|
|
- func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
|
|
|
+ override func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
|
|
|
RNCPushNotificationIOS.didFailToRegisterForRemoteNotificationsWithError(error)
|
|
|
}
|
|
|
|