-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Auth code cleanup #376
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
Auth code cleanup #376
Conversation
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.
Cleaner code! 😄
public static final int RC_SIGN_IN = 16; | ||
public static final List<Integer> REQUEST_CODES = Arrays.asList( | ||
private static final List<Integer> REQUEST_CODES = Arrays.asList( |
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.
Was there a reason for keeping this stuff public?
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.
Nope this LGTM, not meant to be part of the public API/
@@ -80,30 +80,22 @@ private void startEmailHandler(String email, List<String> providers) { | |||
mActivityHelper.startActivityForResult(registerIntent, RC_REGISTER_ACCOUNT); | |||
} else { | |||
// account does exist | |||
for (String provider : providers) { |
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.
Here's the most important change in this PR: the for loop doesn't loop! Is my change appropriate or should we be doing something else 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.
Can we be sure that if the email provider is in the providers
collection that it will be at index 0
? I agree the loop was not needed but not sure that get(0)
will always be equivalent.
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.
List<String> providers
so isn't the first item in the for loop always going to be at index 0?
@@ -76,8 +78,7 @@ public CredentialRequest createCredentialRequest(List<IdpConfig> providers) { | |||
@Override | |||
protected void process( | |||
final GoogleApiClient client, | |||
final TaskCompletionSource<CredentialRequestResult> source) | |||
throws Exception { |
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 removed all the throws exception here. Did they serve a purpose?
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 guess not? @amandle see anything?
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 not sure why these are throwing Exception, @iainmcgin might know
|
||
<!-- accessibility --> | ||
<string name="accessibility_logo">App logo</string> | ||
<string name="accessibility_toggle">Toggle password visibility</string> |
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.
Are these descriptions adequate?
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.
LGTM
@@ -1,19 +0,0 @@ | |||
<?xml version="1.0" encoding="utf-8"?> |
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 rest is all unused layouts and resources.
Lint and Intellij are mostly happy now. |
I also updated the travis file to make builds faster. We're now at around 3 minutes! |
@samtstern could you merge master into dev or should I just add it here since it only has 2 commits? |
@SUPERCILEX merged master into 1.0.0-dev |
@samtstern Awesome, we're all green now! |
public static final int RC_SIGN_IN = 16; | ||
public static final List<Integer> REQUEST_CODES = Arrays.asList( | ||
private static final List<Integer> REQUEST_CODES = Arrays.asList( |
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.
Nope this LGTM, not meant to be part of the public API/
mActivityHelper.getApplicationContext(), SignInActivity.class); | ||
signInIntent.putExtra(ExtraConstants.EXTRA_EMAIL, email); | ||
mActivityHelper.startActivityForResult(signInIntent, RC_SIGN_IN); | ||
Intent intent = WelcomeBackIdpPrompt.createIntent( |
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 seems to be a behavior change from SignInActivity
to WelcomeBackIDPPrompt
.
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.
@@ -80,30 +80,22 @@ private void startEmailHandler(String email, List<String> providers) { | |||
mActivityHelper.startActivityForResult(registerIntent, RC_REGISTER_ACCOUNT); | |||
} else { | |||
// account does exist | |||
for (String provider : providers) { |
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.
Can we be sure that if the email provider is in the providers
collection that it will be at index 0
? I agree the loop was not needed but not sure that get(0)
will always be equivalent.
@@ -76,8 +78,7 @@ public CredentialRequest createCredentialRequest(List<IdpConfig> providers) { | |||
@Override | |||
protected void process( | |||
final GoogleApiClient client, | |||
final TaskCompletionSource<CredentialRequestResult> source) | |||
throws Exception { |
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 guess not? @amandle see anything?
|
||
<!-- accessibility --> | ||
<string name="accessibility_logo">App logo</string> | ||
<string name="accessibility_toggle">Toggle password visibility</string> |
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.
LGTM
@@ -44,8 +41,6 @@ public FacebookProviderShadow() { | |||
} | |||
} | |||
|
|||
public void __constructor__(Activity activity, List<String> scopes) {} |
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.
Are we sure none of the tests are implicitly using this? Android Studio would not be able to tell if this was unused.
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.
From what I've read (see Shadowing Constructors at the bottom of the page), this would be used to collect variables from the constructor, but it was empty. If you believe it serves a purpose, I will add it back.
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 actually used to prevent the real constructor from being called. Should have left a comment, sorry.
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.
@amandle Do you want me to add it back? Why aren't the tests failing then?
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.
Addressed your comments.
@@ -80,30 +80,22 @@ private void startEmailHandler(String email, List<String> providers) { | |||
mActivityHelper.startActivityForResult(registerIntent, RC_REGISTER_ACCOUNT); | |||
} else { | |||
// account does exist | |||
for (String provider : providers) { |
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.
List<String> providers
so isn't the first item in the for loop always going to be at index 0?
mActivityHelper.getApplicationContext(), SignInActivity.class); | ||
signInIntent.putExtra(ExtraConstants.EXTRA_EMAIL, email); | ||
mActivityHelper.startActivityForResult(signInIntent, RC_SIGN_IN); | ||
Intent intent = WelcomeBackIdpPrompt.createIntent( |
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.
@@ -44,8 +41,6 @@ public FacebookProviderShadow() { | |||
} | |||
} | |||
|
|||
public void __constructor__(Activity activity, List<String> scopes) {} |
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.
From what I've read (see Shadowing Constructors at the bottom of the page), this would be used to collect variables from the constructor, but it was empty. If you believe it serves a purpose, I will add it back.
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.
Updated dependencies and reorganized auth ones to follow a more conventional style: support/firebase -> third party -> test.
compile "com.android.support:design:${project.ext.support_library_version}" | ||
|
||
compile "com.google.firebase:firebase-auth:${project.ext.firebase_version}" | ||
compile "com.google.android.gms:play-services-auth:${project.ext.firebase_version}" | ||
|
||
compile 'com.facebook.android:facebook-android-sdk:4.16.1' |
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.
old: v4.14.1
compile "com.android.support:design:${project.ext.support_library_version}" | ||
|
||
compile "com.google.firebase:firebase-auth:${project.ext.firebase_version}" | ||
compile "com.google.android.gms:play-services-auth:${project.ext.firebase_version}" | ||
|
||
compile 'com.facebook.android:facebook-android-sdk:4.16.1' | ||
compile("com.twitter.sdk.android:twitter:2.1.1@aar") { |
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.
old: 2.0.0
} | ||
|
||
testCompile 'junit:junit:4.12' | ||
testCompile 'org.mockito:mockito-core:2.2.6' |
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.
old: 2.2.0
classpath 'com.google.gms:google-services:3.0.0' | ||
classpath 'io.fabric.tools:gradle:1.21.7' | ||
classpath 'io.fabric.tools:gradle:1.+' |
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.
Twitter recommends using open ended versions: https://fabric.io/kits/android/twitterkit/install
The Fabric Gradle plugin uses an open ended version to react quickly to Android tooling updates
@@ -1,4 +1,4 @@ | |||
project.ext.firebase_version = '9.6.1' | |||
project.ext.firebase_version = '9.8.00' |
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 (or any other firebase dev) Why the extra zero? It won't compile with just one zero.
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 That's really weird. It won't compile on my machine without the extra zero and it won't compile with the extra zero on Travis. I'll have to try clearing the cache and such.
I upgraded the I also made the xml style more consistent. (any objections to the style I chose?) |
Removed duplicate code and cleaned stuff up.
I did some final cleanup. Sorry for making this a big PR in the end. However, I do think it really cleans things up nicely. |
# Conflicts: # auth/src/main/java/com/firebase/ui/auth/ui/AcquireEmailHelper.java
@samtstern @amandle I added back the constructors for the tests and merged v1.0.0. We should be good to go now! |
@SUPERCILEX cool, will take a look. Just a heads up, we're nearing 1.0 release and trying to stabilize things at the moment, so it may make sense to hold off on merging this for the time being. |
@amandle Awesome, can't wait for 1.0! We'll finally have official Twitter support and keeping track of changes between master and v1.0.0-dev will no longer be a thing. For this PR, there shouldn't be an behavioral changes. Just code cleanup. |
# Conflicts: # auth/src/main/java/com/firebase/ui/auth/ui/idp/IdpSignInContainerActivity.java
# Conflicts: # common/constants.gradle
@SUPERCILEX just reviewed all of this again, it all LGTM. I believe merging your other CL caused a conflict but once that's fixed I will merge this as well. Again sorry for the delay here, after 1.0 we had to go tend to other projects which we had neglected due to the 1.0 release 😄 there's never enough time to go around! |
# Conflicts: # auth/build.gradle # auth/src/main/AndroidManifest.xml # auth/src/main/res/layout/auth_method_picker_layout.xml
@samtstern Sounds busy! 🏗 |
Squashed and merged! Thanks @SUPERCILEX |
For the removed todo, see http://stackoverflow.com/questions/2643949/can-i-use-a-static-variable-from-a-java-class-in-res-values-styles-xml.
I added RTL support, a wee bit of accessibility, and removed unused resources.
For other stuff, see the review below: