Update nirvana_iosApp.swift
This commit is contained in:
@@ -77,7 +77,7 @@ class AppDelegate: NSObject, UIApplicationDelegate {
|
|||||||
// TODO: Handle data of notification
|
// TODO: Handle data of notification
|
||||||
|
|
||||||
// With swizzling disabled you must let Messaging know about the message, for Analytics
|
// With swizzling disabled you must let Messaging know about the message, for Analytics
|
||||||
// Messaging.messaging().appDidReceiveMessage(userInfo)
|
Messaging.messaging().appDidReceiveMessage(notification)
|
||||||
|
|
||||||
// Print message ID.
|
// Print message ID.
|
||||||
if let messageID = notification[gcmMessageIDKey] {
|
if let messageID = notification[gcmMessageIDKey] {
|
||||||
@@ -94,9 +94,6 @@ class AppDelegate: NSObject, UIApplicationDelegate {
|
|||||||
completionHandler(.noData)
|
completionHandler(.noData)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// For iOS 9+
|
// For iOS 9+
|
||||||
@@ -137,14 +134,13 @@ extension AppDelegate: MessagingDelegate {
|
|||||||
print("Firebase registration token: \(String(describing: fcmToken))")
|
print("Firebase registration token: \(String(describing: fcmToken))")
|
||||||
|
|
||||||
let dataDict: [String: String] = ["token": fcmToken ?? ""]
|
let dataDict: [String: String] = ["token": fcmToken ?? ""]
|
||||||
print(fcmToken)
|
|
||||||
NotificationCenter.default.post(
|
NotificationCenter.default.post(
|
||||||
name: Notification.Name("FCMToken"),
|
name: Notification.Name("FCMToken"),
|
||||||
object: nil,
|
object: nil,
|
||||||
userInfo: dataDict
|
userInfo: dataDict
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: If necessary send token to application server.
|
// TODO: If necessary send token to application server...need to use this in cloud functionb to send the message to this user
|
||||||
// Note: This callback is fired at each app startup and whenever a new token is generated.
|
// Note: This callback is fired at each app startup and whenever a new token is generated.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user