Skip to content

Commit

Permalink
Merge pull request #825 from firebase/version-2.1.1-dev
Browse files Browse the repository at this point in the history
Merge Version 2.1.1 to master
  • Loading branch information
samtstern authored Jul 25, 2017
2 parents b252af3 + 3753c34 commit bee4c1a
Show file tree
Hide file tree
Showing 172 changed files with 6,491 additions and 6,552 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ libraries.
```groovy
dependencies {
// FirebaseUI Database only
compile 'com.firebaseui:firebase-ui-database:2.1.0'
compile 'com.firebaseui:firebase-ui-database:2.1.1'
// FirebaseUI Auth only
compile 'com.firebaseui:firebase-ui-auth:2.1.0'
compile 'com.firebaseui:firebase-ui-auth:2.1.1'
// FirebaseUI Storage only
compile 'com.firebaseui:firebase-ui-storage:2.1.0'
compile 'com.firebaseui:firebase-ui-storage:2.1.1'
// Single target that includes all FirebaseUI libraries above
compile 'com.firebaseui:firebase-ui:2.1.0'
compile 'com.firebaseui:firebase-ui:2.1.1'
}
```

Expand Down Expand Up @@ -91,7 +91,7 @@ For convenience, here are some recent examples:

| FirebaseUI Version | Firebase/Play Services Version |
|--------------------|--------------------------------|
| 2.1.0 | 11.0.2 |
| 2.1.1 | 11.0.2 |
| 2.0.1 | 11.0.1 |
| 1.2.0 | 10.2.0 |
| 1.1.1 | 10.0.0 or 10.0.1 |
Expand Down
2 changes: 1 addition & 1 deletion auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Gradle, add the dependency:
```groovy
dependencies {
// ...
compile 'com.firebaseui:firebase-ui-auth:2.1.0'
compile 'com.firebaseui:firebase-ui-auth:2.1.1'
// Required only if Facebook login support is required
compile('com.facebook.android:facebook-android-sdk:4.22.1')
Expand Down
3 changes: 3 additions & 0 deletions auth/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ android {
targetSdkVersion targetSdk
versionCode 1
versionName "1.0"

resourcePrefix "fui_"
}

buildTypes {
Expand Down Expand Up @@ -43,6 +45,7 @@ android {
dependencies {
compile "com.android.support:design:$supportLibraryVersion"
compile "com.android.support:customtabs:$supportLibraryVersion"
compile 'com.android.support.constraint:constraint-layout:1.1.0-beta1'

compile "com.google.firebase:firebase-auth:$firebaseVersion"
compile "com.google.android.gms:play-services-auth:$firebaseVersion"
Expand Down
6 changes: 6 additions & 0 deletions auth/lint.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue id="all">
<ignore path="src/main/res/values/com_crashlytics_export_strings.xml" />
</issue>
</lint>
26 changes: 13 additions & 13 deletions auth/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,34 +32,34 @@

<activity
android:name=".ui.email.RecoverPasswordActivity"
android:label="@string/title_recover_password_activity"
android:exported="false" />
android:label="@string/fui_title_recover_password_activity"
android:exported="false"/>

<activity
android:name=".ui.email.RegisterEmailActivity"
android:label="@string/sign_in_default"
android:exported="false" />
android:label="@string/fui_sign_in_default"
android:exported="false"/>

<activity
android:name=".ui.phone.PhoneVerificationActivity"
android:label="@string/sign_in_with_phone_number"
android:exported="false"
android:windowSoftInputMode="stateAlwaysVisible" />
android:label="@string/fui_sign_in_with_phone_number"
android:windowSoftInputMode="stateAlwaysVisible"
android:exported="false"/>

<activity
android:name=".ui.accountlink.WelcomeBackIdpPrompt"
android:label="@string/title_welcome_back_idp_prompt"
android:exported="false" />
android:label="@string/fui_title_welcome_back_idp_prompt"
android:exported="false"/>

<activity
android:name=".ui.accountlink.WelcomeBackPasswordPrompt"
android:label="@string/title_welcome_back_password_prompt"
android:exported="false" />
android:label="@string/fui_title_welcome_back_password_prompt"
android:exported="false"/>

<activity
android:name=".ui.idp.AuthMethodPickerActivity"
android:label="@string/default_toolbar_title"
android:exported="false" />
android:label="@string/fui_default_toolbar_title"
android:exported="false"/>

<activity
android:name="com.facebook.FacebookActivity"
Expand Down
2 changes: 1 addition & 1 deletion auth/src/main/java/com/firebase/ui/auth/AuthUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public Task<Void> signOut(@NonNull FragmentActivity activity) {

// Twitter sign out
try {
TwitterProvider.signout(activity);
TwitterProvider.signOut(activity);
} catch (NoClassDefFoundError e) {
// do nothing
}
Expand Down
57 changes: 18 additions & 39 deletions auth/src/main/java/com/firebase/ui/auth/IdpResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,35 +24,28 @@

import com.firebase.ui.auth.ui.ExtraConstants;
import com.google.firebase.auth.FacebookAuthProvider;
import com.google.firebase.auth.GithubAuthProvider;
import com.google.firebase.auth.GoogleAuthProvider;
import com.google.firebase.auth.TwitterAuthProvider;

/**
* A container that encapsulates the result of authenticating with an Identity Provider.
*/
public class IdpResponse implements Parcelable {
private final String mProviderId;
private final String mEmail;
private final String mPhoneNumber;
private final User mUser;
private final String mToken;
private final String mSecret;
private final int mErrorCode;

private IdpResponse(int errorCode) {
this(null, null, null, null, null, errorCode);
this(null, null, null, errorCode);
}

private IdpResponse(
String providerId,
String email,
String phoneNumber,
User user,
String token,
String secret,
int errorCode) {
mProviderId = providerId;
mEmail = email;
mPhoneNumber = phoneNumber;
mUser = user;
mToken = token;
mSecret = secret;
mErrorCode = errorCode;
Expand Down Expand Up @@ -89,23 +82,23 @@ public Intent toIntent() {
@NonNull
@AuthUI.SupportedProvider
public String getProviderType() {
return mProviderId;
return mUser.getProviderId();
}

/**
* Get the email used to sign in.
*/
@Nullable
public String getEmail() {
return mEmail;
return mUser.getEmail();
}

/**
* Get the phone number used to sign in.
*/
@Nullable
public String getPhoneNumber() {
return mPhoneNumber;
return mUser.getPhoneNumber();
}

/**
Expand Down Expand Up @@ -138,9 +131,7 @@ public int describeContents() {

@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(mProviderId);
dest.writeString(mEmail);
dest.writeString(mPhoneNumber);
dest.writeParcelable(mUser, flags);
dest.writeString(mToken);
dest.writeString(mSecret);
dest.writeInt(mErrorCode);
Expand All @@ -150,9 +141,7 @@ public void writeToParcel(Parcel dest, int flags) {
@Override
public IdpResponse createFromParcel(Parcel in) {
return new IdpResponse(
in.readString(),
in.readString(),
in.readString(),
in.<User>readParcelable(User.class.getClassLoader()),
in.readString(),
in.readString(),
in.readInt()
Expand All @@ -167,21 +156,12 @@ public IdpResponse[] newArray(int size) {

@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public static class Builder {
private String mProviderId;
private String mEmail;
private String mPhoneNumber;
private User mUser;
private String mToken;
private String mSecret;

public Builder(@AuthUI.SupportedProvider @NonNull String providerId,
@Nullable String email) {
mProviderId = providerId;
mEmail = email;
}

public Builder setPhoneNumber(String phoneNumber) {
mPhoneNumber = phoneNumber;
return this;
public Builder(@NonNull User user) {
mUser = user;
}

public Builder setToken(String token) {
Expand All @@ -195,22 +175,21 @@ public Builder setSecret(String secret) {
}

public IdpResponse build() {
if ((mProviderId.equalsIgnoreCase(GoogleAuthProvider.PROVIDER_ID)
|| mProviderId.equalsIgnoreCase(FacebookAuthProvider.PROVIDER_ID)
|| mProviderId.equalsIgnoreCase(TwitterAuthProvider.PROVIDER_ID)
|| mProviderId.equalsIgnoreCase(GithubAuthProvider.PROVIDER_ID))
String providerId = mUser.getProviderId();
if ((providerId.equalsIgnoreCase(GoogleAuthProvider.PROVIDER_ID)
|| providerId.equalsIgnoreCase(FacebookAuthProvider.PROVIDER_ID)
|| providerId.equalsIgnoreCase(TwitterAuthProvider.PROVIDER_ID))
&& TextUtils.isEmpty(mToken)) {
throw new IllegalStateException(
"Token cannot be null when using a non-email provider.");
}
if (mProviderId.equalsIgnoreCase(TwitterAuthProvider.PROVIDER_ID)
if (providerId.equalsIgnoreCase(TwitterAuthProvider.PROVIDER_ID)
&& TextUtils.isEmpty(mSecret)) {
throw new IllegalStateException(
"Secret cannot be null when using the Twitter provider.");
}

return new IdpResponse(
mProviderId, mEmail, mPhoneNumber, mToken, mSecret, ResultCodes.OK);
return new IdpResponse(mUser, mToken, mSecret, ResultCodes.OK);
}
}
}
Loading

0 comments on commit bee4c1a

Please sign in to comment.