Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fcm sample app using autoFetchDeviceToken #592

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Apps/CocoaPods-FCM/src/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ class AppDelegate: NSObject, UIApplicationDelegate {
MessagingPushFCM.initialize { config in
config.autoFetchDeviceToken = true
}

// Manually get FCM device token. Swizzling hasn't been working for me.
Messaging.messaging().delegate = self

/**
Registers the `AppDelegate` class to handle when a push notification gets clicked.
This line of code is optional and only required if you have custom code that needs to run when a push notification gets clicked on.
Expand All @@ -50,7 +46,12 @@ class AppDelegate: NSObject, UIApplicationDelegate {
return true
}

// Because this is a SwiftUI app, we need to add this function to inform FCM about an APN token being registered.
// Without this function, the FCM delegate will not be called with a FCM token registered.
// Docs: https://firebase.google.com/docs/cloud-messaging/ios/client#token-swizzle-disabled
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
// You may or may not set apnsToken here
// Adding this method will also serve the purpose
Messaging.messaging().apnsToken = deviceToken
}
}
Expand Down
1 change: 0 additions & 1 deletion Sources/Common/Service/Request/MetricRequest.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import Foundation

// https://customer.io/docs/api/#operation/pushMetrics
Expand Down
Loading