Skip to content

Remove unnecessary (?) SignInActivity #443

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 36 commits into from
Dec 7, 2016
Merged

Remove unnecessary (?) SignInActivity #443

merged 36 commits into from
Dec 7, 2016

Conversation

SUPERCILEX
Copy link
Collaborator

Hi @samtstern, this is the last PR in my "simplify email auth" series.

I'm confused about SignInActivity: why is it around? WelcomeBackPasswordPrompt basically does the same thing as SignInActivity but better. It doesn't let the user edit their email mid sign-in and gives them a friendly Welcome back! message. Was there a reason for keeping SignInActivity around?

SUPERCILEX and others added 30 commits November 23, 2016 19:30
…factor

# Conflicts:
#	auth/src/main/java/com/firebase/ui/auth/ui/email/RegisterEmailActivity.java
Signed-off-by: Alex Saveau <[email protected]>
Signed-off-by: Alex Saveau <[email protected]>
Signed-off-by: Alex Saveau <[email protected]>
Signed-off-by: Alex Saveau <[email protected]>
# Conflicts:
#	auth/src/main/java/com/firebase/ui/auth/provider/FacebookProvider.java
…-unnecessary-sign-in-activity

# Conflicts:
#	auth/src/main/AndroidManifest.xml
#	auth/src/main/java/com/firebase/ui/auth/ui/email/RegisterEmailActivity.java
#	auth/src/main/java/com/firebase/ui/auth/ui/email/SignInActivity.java
#	auth/src/main/java/com/firebase/ui/auth/ui/idp/AuthMethodPickerActivity.java
#	auth/src/main/res/values/strings.xml
#	auth/src/test/java/com/firebase/ui/auth/ui/email/WelcomeBackPasswordPromptTest.java
#	auth/src/test/java/com/firebase/ui/auth/ui/idp/AuthMethodPickerActivityTest.java
Signed-off-by: Alex Saveau <[email protected]>
…-unnecessary-sign-in-activity

# Conflicts:
#	auth/src/main/java/com/firebase/ui/auth/ui/ActivityHelper.java
#	auth/src/main/java/com/firebase/ui/auth/ui/accountlink/WelcomeBackPasswordPrompt.java
#	auth/src/main/java/com/firebase/ui/auth/ui/email/RegisterEmailActivity.java
#	auth/src/main/java/com/firebase/ui/auth/ui/email/SignInActivity.java
#	auth/src/test/java/com/firebase/ui/auth/ui/email/RegisterEmailActivityTest.java
Signed-off-by: Alex Saveau <[email protected]>
…-leak

# Conflicts:
#	auth/src/main/java/com/firebase/ui/auth/provider/FacebookProvider.java
Signed-off-by: Alex Saveau <[email protected]>
Signed-off-by: Alex Saveau <[email protected]>
@samtstern
Copy link
Contributor

I will take a deeper look at this tomorrow but I agree with your initial assessment, those two Activities seem to do basically the same job and SignInActivity can be removed.

After this goes in I am going to refactor the email flow a little further, I played with it a lot today and I found some cases where it seems to be jumping around. But let's get through this change first, just a warning that if you do decide to do any more email-flow changes after this one give me a heads up since we'll almost certainly conflict.

Copy link
Collaborator Author

@SUPERCILEX SUPERCILEX left a comment

Choose a reason for hiding this comment

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

@samtstern nope, I'm not planning on changing anything after this so you should be good to go!

AuthCredential authCredential =
AuthCredentialHelper.getAuthCredential(mIdpResponse);
authResult.getUser().linkWithCredential(authCredential);
firebaseAuth.signOut();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@samtstern Do you know why we were doing this? It seems unnecessary and just using linkWithCredential works fine.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like it was added in this commit

The only reason I can think to do this is that known issue about FirebaseUser changes not taking effect until signout/signin, but I believe that's only for explicit profile information change requests.

One thing I am seeing now is that the linkWithCredential call is done as fire-and-forget, which will almost certainly create some strange race conditions.

Seems like the original author should have been chaining the link-->signout-->sign in operations together.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Humm, so should I revert and use a continuation or leave it at linkWithCredential?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we leave it with your new implementation. I can't see a reason for the sign out thing.

<string name="trouble_signing_in">Trouble signing in?</string>
<string name="sign_in">Sign in</string>
<string name="sign_in_default">Sign in</string>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was a nasty one! WelcomeBackPasswordPrompt kept using the word "Start" everywhere which was extremely confusing. Turns out our sample was accidentally overriding this string resource. Since I think this could be a common occurrence, I've changed the name to sign_in_default.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I just noticed this too, thanks for sorting that out.

Signed-off-by: Alex Saveau <[email protected]>
…-unnecessary-sign-in-activity

# Conflicts:
#	auth/src/main/java/com/firebase/ui/auth/provider/TwitterProvider.java
@SUPERCILEX
Copy link
Collaborator Author

@samtstern merged!

.withIntent(startIntent)
.create()
.visible()
.get();
}

@Test
public void testSignInButton_validatesFields() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't WelcomeBackPasswordPrompt validate fields now that we're removing SignInActivity?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@samtstern Great catch!!! Error handling was completely broken: the loading dialog was started before we checked for errors and never dismissed if there was an error so the user ended up being stuck with a loading dialog. Also, we were setting the error on the editText instead of the TextInputLayout. Whew!

Signed-off-by: Alex Saveau <[email protected]>
@samtstern
Copy link
Contributor

This whole change LGTM, merging into 1.1.0-dev

@samtstern samtstern merged commit ff427d6 into firebase:version-1.1.0-dev Dec 7, 2016
@SUPERCILEX SUPERCILEX deleted the remove-unnecessary-sign-in-activity branch December 7, 2016 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants