-
Notifications
You must be signed in to change notification settings - Fork 624
Make Auth an deferred dependency #2418
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
Conversation
Coverage ReportAffected SDKs
Test Logs
NotesHTML coverage reports can be produced locally with Head commit (4a62ae37) is created by Prow via merging commits: 794d8f5 72c99d0. |
Binary Size ReportAffected SDKs
Test Logs
NotesHead commit (4a62ae37) is created by Prow via merging commits: 794d8f5 72c99d0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The general direction LGTM
executorService.execute( | ||
() -> tokenListener.onTokenChange(/* nullable */ tokenResult.getToken())); | ||
deferredAuthProvider.whenAvailable( | ||
// TODO: Could "whenAvailable" return the Auth instance rather than a provider for Auth? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return of the provider is intentional since it's more general and makes things lazy by default - so that we don't have to initialize with inside components unless get() is called on its provider.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could Deferred
be modified to extend Provider
? As I'm working on changes for Firestore, this would be incredibly convenient because some usages need to react instantly when the provider becomes available (i.e. via whenAvailable()
) and other instances need to get the instance and do something with it if it is non-null (which would be achieved by calling get()
).
Since OptionalProvider already implements both Deferred
and Provider
, this would be an incredibly easy change to implement. Also, it would satisfy @schmidt-sebastian's request for an isAvailable()
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vkryachko I've implemented this suggestion in #2432. I'll officially add you both as reviewers once the GitHub Actions pass.
Hey, firendly ping. Is there anything else needed to productionize this? FYI the test failure needs some attention
|
I fixed the compile failure. I don't think there is much else to do here until we have an actual test case that takes advantage of this feature (but this shouldn't block this PR). I will try to get it past the flaky tests today. |
2ab25f6
to
72c99d0
Compare
/test device-check-changed |
/test device-check-changed |
2 similar comments
/test device-check-changed |
/test device-check-changed |
Support Auth as an optional dependencies.
Tested manually via test app (which does not yet use actual dynamic module support).