Skip to content

Fix an issue that apns token is not sent during app fresh install #9152

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

Merged
merged 7 commits into from
Jan 6, 2022

Conversation

charlotteliang
Copy link
Contributor

@charlotteliang charlotteliang commented Dec 31, 2021

This fixes #8738 and #9003

The current implementation assumes APNS token is returned from apple system always after a new FCM token is fetched and stored during app install.
Seems like APNS token can be returned faster than that and currently the client only sends out request updating APNS token with FCM token when a cached FCM token exists.
Now update the logic to if no cached token exists and a new APNS token is set, always send a request to backend to update the FCM token with the apns token.

  • Added a SwiftUI test app that uses the latest SwiftUI lifecycle
  • Removed a redundant apns token key

@google-oss-bot
Copy link

google-oss-bot commented Dec 31, 2021

Size Report 1

Affected Products

  • FirebaseMessaging

    TypeBase (5822a5a)Merge (ee2ce69)Diff
    CocoaPods?728 kB? (?)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/qh6cLsb3nu.html

@google-oss-bot
Copy link

google-oss-bot commented Dec 31, 2021

Coverage Report 1

Affected Products

  • FirebaseMessaging-iOS-FirebaseMessaging.framework

    Overall coverage changed from ? (5822a5a) to 63.54% (ee2ce69) by ?.

    29 individual files with coverage change

    FilenameBase (5822a5a)Merge (ee2ce69)Diff
    FIRMessaging.m?55.48%?
    FIRMessagingAnalytics.m?80.71%?
    FIRMessagingAPNSInfo.m?86.96%?
    FIRMessagingAuthKeychain.m?85.90%?
    FIRMessagingAuthService.m?92.03%?
    FIRMessagingBackupExcludedPlist.m?85.07%?
    FIRMessagingCheckinPreferences.m?97.03%?
    FIRMessagingCheckinService.m?89.19%?
    FIRMessagingCheckinStore.m?80.92%?
    FIRMessagingContextManagerService.m?66.48%?
    FIRMessagingExtensionHelper.m?78.57%?
    FIRMessagingKeychain.m?93.39%?
    FIRMessagingLogger.m?100.00%?
    FIRMessagingPendingTopicsList.m?89.02%?
    FIRMessagingPersistentSyncMessage.m?38.10%?
    FIRMessagingPubSub.m?52.14%?
    FIRMessagingRemoteNotificationsProxy.m?75.84%?
    FIRMessagingRmqManager.m?57.00%?
    FIRMessagingSyncMessageManager.m?68.89%?
    FIRMessagingTokenDeleteOperation.m?0.00%?
    FIRMessagingTokenFetchOperation.m?75.74%?
    FIRMessagingTokenInfo.m?78.86%?
    FIRMessagingTokenManager.m?37.18%?
    FIRMessagingTokenOperation.m?96.43%?
    FIRMessagingTokenStore.m?66.00%?
    FIRMessagingTopicOperation.m?0.00%?
    FIRMessagingUtilities.m?57.20%?
    NSDictionary+FIRMessaging.m?21.21%?
    NSError+FIRMessaging.m?100.00%?

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/46s4Ovw6d7.html

Copy link
Member

@ryanwilson ryanwilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM just a couple small things, thanks!

Copy link
Member

@ryanwilson ryanwilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Firebase Messaging: Fails to receive a notifications in iOS - SwiftUI
4 participants