Skip to content

Adding a FidListener that propagates fid changes to the clients. #2195

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 12 commits into from
Dec 1, 2020

Conversation

ankitaj224
Copy link
Contributor

No description provided.

@googlebot googlebot added the cla: yes Override cla label Nov 23, 2020
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Nov 23, 2020

Coverage Report

Affected SDKs

  • firebase-installations

    SDK overall coverage changed from 58.77% (4468726) to 60.38% (65007112) by +1.61%.

    Filename Base (4468726) Head (65007112) Diff
    AutoValue_InstallationResponse.java 42.86% 58.93% +16.07%
    FirebaseInstallations.java 97.88% 98.04% +0.16%

Test Logs

Notes

HTML coverage reports can be produced locally with ./gradlew <product>:checkCoverage.
Report files are located at <product-build-dir>/reports/jacoco/.

Head commit (65007112) is created by Prow via merging commits: 4468726 0e45a10.

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Nov 23, 2020

Binary Size Report

Affected SDKs

  • firebase-installations

    Type Base (4468726) Head (65007112) Diff
    aar 55.4 kB 56.5 kB +1.12 kB (+2.0%)
    apk (aggressive) 79.4 kB 79.4 kB -4 B (-0.0%)
    apk (release) 656 kB 657 kB +432 B (+0.1%)
  • firebase-installations-interop

    Type Base (4468726) Head (65007112) Diff
    aar 7.51 kB 8.04 kB +532 B (+7.1%)
    apk (release) 607 kB 607 kB +176 B (+0.0%)

Test Logs

Notes

Head commit (65007112) is created by Prow via merging commits: 4468726 0e45a10.

@ankitaj224 ankitaj224 requested a review from vkryachko November 25, 2020 07:17
*
* @hide
*/
void unregister(FidListener fidListener);
Copy link
Member

Choose a reason for hiding this comment

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

The handle is supposed to represent a registration so it shouldn't take a listener as a parameter. For an example see

/** Represents a listener that can be removed by calling {@link #remove()}. */
public interface ListenerRegistration {
/**
* Removes the listener being tracked by this {@code ListenerRegistration}. After the initial
* call, subsequent calls have no effect.
*/
void remove();
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PTAL. Thanks


FakeFidListener fidListener = new FakeFidListener();
// Register the FidListener
firebaseInstallations.registerFidListener(fidListener);
Copy link
Member

Choose a reason for hiding this comment

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

Please consider adding a test for removing a registration as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated this test to check the removing registration code as well. PTAL. Thanks

@google-oss-bot
Copy link
Contributor

The public api surface has changed for the subproject firebase-installations:
error: Added method com.google.firebase.installations.FirebaseInstallations.registerFidListener(com.google.firebase.installations.internal.FidListener) [AddedMethod]

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.

@ankitaj224 ankitaj224 requested a review from vkryachko November 30, 2020 18:15
@google-oss-bot
Copy link
Contributor

The public api surface has changed for the subproject firebase-installations:
error: Added method com.google.firebase.installations.FirebaseInstallations.registerFidListener(com.google.firebase.installations.internal.FidListener) [AddedMethod]

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.

@vkryachko
Copy link
Member

CI failures look legit, see: https://gist.github.com/vkryachko/d1cd35daaf62a63ff7aff9a94e1a28e4 regarding GuardedBy

@ankitaj224
Copy link
Contributor Author

CI failures look legit, see: https://gist.github.com/vkryachko/d1cd35daaf62a63ff7aff9a94e1a28e4 regarding GuardedBy

Thanks for pointing this out, Vlad. Fixed it.

Just curious: how did you generate this?

@vkryachko
Copy link
Member

@ankitaj224 No worries, I did not generate it, it was in the build log of the check-changed presubmit:
https://android-ci.firebaseopensource.com/view/gcs/android-ci/pr-logs/pull/firebase_firebase-android-sdk/2195/check-changed/1333493750147584001/

fidListeners.remove(fidListener);
public void unregister() {
synchronized (FirebaseInstallations.this) {
if (fidListeners.contains(listener)) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: consider removing the contains check as remove handles it internally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Done

@ankitaj224 ankitaj224 merged commit ddccf8e into master Dec 1, 2020
@google-oss-bot
Copy link
Contributor

@ankitaj224: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
smoke-tests 78d2468 link /test smoke-tests

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@firebase firebase locked and limited conversation to collaborators Jan 1, 2021
@kaibolay kaibolay deleted the fisHook branch September 15, 2022 13:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes Override cla size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants