-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix broken play services checks #462
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
Fix broken play services checks #462
Conversation
Signed-off-by: Alex Saveau <[email protected]>
Signed-off-by: Alex Saveau <[email protected]>
@@ -169,9 +168,7 @@ private void finish() { | |||
public void saveCredentialsOrFinish(FirebaseUser firebaseUser, | |||
@Nullable String password, | |||
@Nullable IdpResponse response) { | |||
if (!mHelper.getFlowParams().smartLockEnabled | |||
|| !PlayServicesHelper.getInstance(getContext()).isPlayServicesAvailable() |
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.
@samtstern Is there a reason for keeping this here? Since KickOffActivity
acts as the gatekeeper, shouldn't play services always be available when we get here?
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.
That should be true, fine with your new change.
Signed-off-by: Alex Saveau <[email protected]>
This PR now includes #447 because there were some conflicts with |
Signed-off-by: Alex Saveau <[email protected]>
Signed-off-by: Alex Saveau <[email protected]>
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.
This is a good simplification! Good to keep all of these checks in KickoffActivity. Just a few comments.
return; | ||
} | ||
|
||
GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance(); |
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.
Although you're getting rid of PlayServicesHelper
I'd still like to centralize all Play services availability logic somewhere. Even if the class is just a host for a singleton of GoogleApiAvailability
that's a win for future testing. Play services has given me a lot of trouble in testing (although you seem to have simplified a lot of it here).
} | ||
} | ||
|
||
@Override | ||
public void onSaveInstanceState(Bundle outState) { | ||
// It doesn't matter what we put here, we just don't want outState to be empty | ||
outState.putBoolean(ExtraConstants.HAS_EXISTING_INSTANCE, true); | ||
outState.putBoolean(ExtraConstants.HAS_EXISTING_INSTANCE, !mIsWaitingForPlayServices); |
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 use of HAS_EXISTING _INSTANCE
to store the inverse of mIsWaitingForPlayServices
is a little confusing.
Can we do two separate extras? One which is always true
like before and one which stores the state of mIsWaitingForPlayServices
.
@@ -169,9 +168,7 @@ private void finish() { | |||
public void saveCredentialsOrFinish(FirebaseUser firebaseUser, | |||
@Nullable String password, | |||
@Nullable IdpResponse response) { | |||
if (!mHelper.getFlowParams().smartLockEnabled | |||
|| !PlayServicesHelper.getInstance(getContext()).isPlayServicesAvailable() |
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.
That should be true, fine with your new change.
…ailability # Conflicts: # auth/src/main/java/com/firebase/ui/auth/util/signincontainer/SaveSmartLock.java # auth/src/test/java/com/firebase/ui/auth/ui/email/RegisterEmailActivityTest.java
Signed-off-by: Alex Saveau <[email protected]>
Signed-off-by: Alex Saveau <[email protected]>
Signed-off-by: Alex Saveau <[email protected]>
Woah! We have a net negative of 529 removed lines of code! |
Signed-off-by: Alex Saveau <[email protected]>
} | ||
} | ||
|
||
private PendingIntent getEmailHintIntent() { |
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.
Do we want to move this to PlayServicesHelper
or leave it here?
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.
This can stay
} | ||
|
||
@Override | ||
public PendingIntent getEmailHintIntent(FragmentActivity fragmentActivity) { |
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.
I'm amazed that nobody noticed: getEmailHintIntent
was the only method being used in this entire class!!!
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.
That is hilarious. I always hated this class!
I love this CL, merging! P.S. I don't think any of the repo owners will be in the office next week so this will be the last CL for a while! First week of Jan we will QA and release |
@samtstern Awesome! Enjoy your break and happy holidays! |
Hey @samtstern,
While trying to find a device with play services 10.0, I noticed that our checks were broken: the dialog wouldn't display itself and I kept getting weird errors:
I have no idea what caused the errors, but I rewrote our entry checks and everything is working now. The new code also improves the "S" in SOLID for
SignInDelegate
because it no longer has to care about network or play services issues. Cheers! 😄PS: I think there is a bug in play services, but I couldn't find anywhere to report it so I thought maybe someone from the Firebase team could pass this on to the right person.
I tried using
makeGooglePlayServicesAvailable
, but it crashes the app if the dialog is dismissed twice.