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. |
|
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. |
| @Deprecated | ||
| @NonNull | ||
| public Task<String> getToken() { | ||
| if (iid != null) { |
There was a problem hiding this comment.
Is there a reason for removing the FirebaseInstanceId calls? It's long deprecated, but removing the compatibility when including that SDK is probably a breaking change and would need to be documented.
| public Task<String> getToken() { | ||
| if (iid != null) { | ||
| return iid.getTokenTask(); | ||
| if (gmsRegistrationClient.isV1RegistrationEnabled()) { |
There was a problem hiding this comment.
Maybe this could be extracted into a helper?
| * Returns whether the existing token is a FID based on its length. | ||
| */ | ||
| boolean isFid() { | ||
| return token.length() <= 22; |
There was a problem hiding this comment.
Just, checking whether this is actually guaranteed in both cases (FID is always <=22 and FCM token is always > 22)?
| # 25.0.2 | ||
|
|
||
| - [changed] Fix ANR in SharedPreferencesQueue by reducing lock contention | ||
| - [feature] Added support for FCM registration using Firebase Installation ID as token |
There was a problem hiding this comment.
These will need to go in the next release and it will need to be a minor version bump since it's added new APIs (25.1.0).
| @@ -0,0 +1,193 @@ | |||
| // Copyright 2020 Google LLC | |||
| import java.util.concurrent.ExecutorService; | ||
|
|
||
| /** A client for the CloudMessaging API to make FCM registration calls. */ | ||
| public class GmsRegistrationClient { |
There was a problem hiding this comment.
This should be hidden since I don't think you want it as part of the public API (developers shouldn't be using it directly).
| executorService.execute( | ||
| () -> { | ||
| try { | ||
| String installationId = Tasks.await(firebaseInstallations.getId()); |
There was a problem hiding this comment.
I think this and other similar calls might be able to use a chain of continuations of the task, something like firebaseInstallations.getId().continueWithTask(...), which might simplify this somewhat.
| () -> { | ||
| try { | ||
| String installationId = Tasks.await(firebaseInstallations.getId()); | ||
| String registrationToken = Tasks.await(registerOverV1(installationId)); |
There was a problem hiding this comment.
I don't think it makes sense to have registerOverV1 return a Task and then only wait on the result. If it's only being called in a blocking manner, registerOverV1 should probably just be blocking.
| executorService.execute( | ||
| () -> { | ||
| try { | ||
| Tasks.await(unregisterOverV1()); |
There was a problem hiding this comment.
Same here, this probably should just be blocking and not return a Task if you're only going to be blocking on the Task.
| @@ -0,0 +1,155 @@ | |||
| // Copyright 2024 Google LLC | |||
FCM V1 API Migration initial commit.