Update InstanceID to listen to a notification from Messaging #6286
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When we release Messaging that removes InstanceID dependency, Messaging will handle FCM token on its own. However, developers might still depend on both Messaging and InstanceID, each has its own cache for token, but share the same storage(keychain). We need to add a method in InstanceID to listen to a notification from Messaging for token refresh, if that happens, InstanceID will update its cache, but not storage, as Messaging already updated it.
We want developers to adopt this version before hand as we can't re-enforce iid version once messaging remove it from its dependency. So I updated the new version of messaging to depend on at least this version of IID.
Manual tested in the chen/fm-master branch which has the latest version of Messaging without IID dependency.
Add/delete token from Messaging API and try getToken in InstanceID should return the same token and FID.
Minor:
Fixed an issue that the local defaultFCMToken is not updated when calling tokenWithAuthorizedEntity:scope:options:handler. This cause developers won't get notified of token update. It is not discovered probably because not so many developers use this API.