Skip to content

Conversation

charlotteliang
Copy link
Contributor

When messaging updates token and notifying InstanceID, instanceID should first check to see the token from Messaging is different than the one in local cache or in the database.
This extra check helps reduce storage writing in the future when we remove InstanceID and handle token completely from Messaging.

scope:kFIRInstanceIDDefaultTokenScope];
NSString *cachedToken = cachedTokenInfo.token;

if (self.defaultFCMToken.length != tokenUpdatedFromMessaging.length ||
Copy link
Member

Choose a reason for hiding this comment

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

Why are the length checks needed? Aren't two isEqualToString checks sufficient?

Copy link
Contributor Author

@charlotteliang charlotteliang Dec 28, 2020

Choose a reason for hiding this comment

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

In case both are null, then [null isEqualtoString: null] return false, even though it should be true.

@charlotteliang charlotteliang merged commit 6ffc845 into master Dec 30, 2020
@charlotteliang charlotteliang deleted the fm-small-change branch December 30, 2020 00:12
@firebase firebase locked and limited conversation to collaborators Jan 29, 2021
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.

3 participants