FCM V1 API Migration initial commit.#8087
Conversation
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. |
📝 PRs merging into main branchOur main branch should always be in a releasable state. If you are working on a larger change, or if you don't want this change to see the light of the day just yet, consider using a feature branch first, and only merge into the main branch when the code complete and ready to be released. |
|
The public api surface has changed for the subproject firebase-messaging: Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly. |
|
The public api surface has changed for the subproject firebase-messaging: Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly. |
1 similar comment
|
The public api surface has changed for the subproject firebase-messaging: Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly. |
| // onNewToken() is only invoked for the default app as there is no parameter to identify which | ||
| // app the token is for. We could add a new method onNewToken(FirebaseApp app, String token) or | ||
| // the like to handle multiple apps better. | ||
| if (FirebaseApp.DEFAULT_APP_NAME.equals(firebaseApp.getName())) { |
There was a problem hiding this comment.
nit: we could reduce the nesting by
if (!FirebaseApp.DEFAULT_APP_NAME.equals(firebaseApp.getName())) {
return;
}
| if (isUnregistered) { | ||
| messagingIntent.setAction(FirebaseMessagingService.ACTION_FCM_UNREGISTERED); | ||
| } else { | ||
| messagingIntent.setAction(FirebaseMessagingService.ACTION_FCM_REGISTERED); | ||
| } |
There was a problem hiding this comment.
nit: this can be simplified to one line: messagingIntent.setAction(isUnregistered ? ... : ...)
|
|
||
| // For V1 registration, the token received should be the same as the FID. | ||
| if (!TextUtils.isEmpty(registrationToken) | ||
| && registrationToken.contains(installationId)) { |
There was a problem hiding this comment.
nit: endWith may be better than contains?
| } else { | ||
| taskCompletionSource.setException( | ||
| new ExecutionException( | ||
| new IllegalArgumentException("FID not matching with received token!"))); |
There was a problem hiding this comment.
This error message could be confusing to developers. We should avoid using the term "token". Maybe consider a generic error message such as "Unexpected error occurred" or "Internal error occurred".
| } | ||
|
|
||
| @Test | ||
| public void testRegister_throwsWhenV1Disabled() throws Exception { |
There was a problem hiding this comment.
Shall we add more unit tests for testRegister and testUnregister for the success cases? For example,
- A call to
register()/unregister()will always invokeonRegistered()/onUnregistered(). - When FIS returns a different FID, a call to
register()should bypass the cache and re-register with the backend.
We can also add some tests for the auto-init enabled/disabled behaviors when firebase_messaging_insatllation_id_enabled = true.
|
The public api surface has changed for the subproject firebase-messaging: Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly. |
FCM V1 API Migration initial commit.