Skip to content

Version 3.3.1 #1258

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 31 commits into from
Apr 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ec06203
Rewrite email logic with new architecture
SUPERCILEX Mar 25, 2018
87ba079
Cleanup
SUPERCILEX Mar 25, 2018
fa67c4c
Make lint happy
SUPERCILEX Mar 25, 2018
07cde19
Remove unused strings
SUPERCILEX Mar 26, 2018
ce80ee9
Merge remote-tracking branch 'upstream/version-3.3.0-dev' into email-…
SUPERCILEX Mar 26, 2018
0754fe4
Merge remote-tracking branch 'origin/email-refactor' into unused
SUPERCILEX Mar 26, 2018
9b3a67c
Merge remote-tracking branch 'upstream/master' into email-refactor
SUPERCILEX Mar 28, 2018
4d2298b
Merge branch 'email-refactor' into unused
SUPERCILEX Mar 28, 2018
677e139
Begin development on 3.3.1
samtstern Mar 29, 2018
afa5e63
Ensure release variants build successfully without any setup
SUPERCILEX Mar 29, 2018
5158bd7
The build should fail
SUPERCILEX Mar 29, 2018
34cc4b1
Back to green
SUPERCILEX Mar 29, 2018
2609e02
Ensure release variants build successfully without any setup (#1228)
samtstern Mar 29, 2018
fb23799
Catch setFirebaseUIVersion crashes (#1236)
SUPERCILEX Apr 2, 2018
ad671f2
Fix possible infinite loading
SUPERCILEX Apr 2, 2018
9d954e4
Rewrite email logic with new architecture (#1214)
samtstern Apr 2, 2018
a6b646b
Fix bad sign out/delete behavior
SUPERCILEX Apr 4, 2018
4b37fa2
Fix NPE when returning from anti-social providers
SUPERCILEX Apr 4, 2018
03d0d64
Fix test
SUPERCILEX Apr 4, 2018
032df2b
Fix bad sign out/delete behavior (#1240)
samtstern Apr 11, 2018
35cede6
Address review feedback
SUPERCILEX Apr 12, 2018
88c52da
Fix email and Google providers creating duplicate credentials (#1229)
SUPERCILEX Apr 12, 2018
8faf550
Permanently fix sign out crashes
SUPERCILEX Apr 12, 2018
017eb15
Permanently fix sign out crashes (#1252)
samtstern Apr 12, 2018
fa5cb40
Eliminate unnecessary starting of credential save activity for anti-s…
samtstern Apr 13, 2018
32fe56e
Update play services to 15.0.0
samtstern Apr 13, 2018
a01ddd7
Fix build
samtstern Apr 13, 2018
9f6bfe3
Update play services to 15.0.0 (#1254)
samtstern Apr 13, 2018
7b4d5a4
Correct bintray configuration, fixes #1225
samtstern Apr 16, 2018
ca28044
Correct bintray configuration, fixes #1225 (#1257)
samtstern Apr 16, 2018
42dbd73
Version 3.3.1
samtstern Apr 16, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ android:
# https://github.com/travis-ci/travis-ci/issues/6040#issuecomment-219367943
- tools
- tools
before_script: mv library/google-services.json app/google-services.json
script: ./gradlew clean assembleDebug check
before_script:
- cp library/google-services.json app/google-services.json
- cp library/google-services.json proguard-tests/google-services.json
script: ./gradlew clean assembleDebug proguard-tests:build check
after_success: ./scripts/artifactory.sh
after_failure:
# tests
Expand Down
18 changes: 5 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ libraries.
```groovy
dependencies {
// FirebaseUI for Firebase Realtime Database
implementation 'com.firebaseui:firebase-ui-database:3.3.0'
implementation 'com.firebaseui:firebase-ui-database:3.3.1'

// FirebaseUI for Cloud Firestore
implementation 'com.firebaseui:firebase-ui-firestore:3.3.0'
implementation 'com.firebaseui:firebase-ui-firestore:3.3.1'

// FirebaseUI for Firebase Auth
implementation 'com.firebaseui:firebase-ui-auth:3.3.0'
implementation 'com.firebaseui:firebase-ui-auth:3.3.1'

// FirebaseUI for Cloud Storage
implementation 'com.firebaseui:firebase-ui-storage:3.3.0'
implementation 'com.firebaseui:firebase-ui-storage:3.3.1'
}
```

Expand Down Expand Up @@ -103,21 +103,13 @@ For convenience, here are some recent examples:

| FirebaseUI Version | Firebase/Play Services Version |
|--------------------|--------------------------------|
| 3.3.1 | 15.0.0 |
| 3.3.0 | 12.0.1 |
| 3.2.2 | 11.8.0 |
| 3.1.3 | 11.8.0 |
| 3.1.2 | 11.6.2 |
| 3.1.0 | 11.4.2 |
| 3.0.0 | 11.4.2 |
| 2.4.0 | 11.4.0 |
| 2.3.0 | 11.0.4 |
| 2.2.0 | 11.0.4 |
| 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 |
| 1.0.1 | 10.0.0 or 10.0.1 |
| 1.0.0 | 9.8.0 |


### Upgrading dependencies
Expand Down
2 changes: 1 addition & 1 deletion auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Gradle, add the dependency:
```groovy
dependencies {
// ...
implementation 'com.firebaseui:firebase-ui-auth:3.3.0'
implementation 'com.firebaseui:firebase-ui-auth:3.3.1'

// Required only if Facebook login support is required
// Find the latest Facebook SDK releases here: https://goo.gl/Ce5L94
Expand Down
6 changes: 3 additions & 3 deletions auth/auth-proguard.pro
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Twitter and Facebook are optional
-dontwarn com.twitter.**
-dontwarn com.facebook.**
-dontwarn com.firebase.ui.auth.provider.**
-dontwarn com.twitter.**

# Don't note a bunch of dynamically referenced classes
-dontnote com.google.**
Expand All @@ -16,5 +15,6 @@

# Retrofit config
-dontnote retrofit2.Platform
-dontwarn retrofit2.Platform$Java8
-dontwarn retrofit2.** # Also keeps Twitter at bay as long as they keep using Retrofit
-dontwarn okio.**
-keepattributes Exceptions
75 changes: 43 additions & 32 deletions auth/src/main/java/com/firebase/ui/auth/AuthUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.firebase.ui.auth.data.remote.FacebookSignInHandler;
import com.firebase.ui.auth.data.remote.TwitterSignInHandler;
import com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity;
import com.firebase.ui.auth.util.CredentialUtils;
import com.firebase.ui.auth.util.ExtraConstants;
import com.firebase.ui.auth.util.GoogleApiUtils;
import com.firebase.ui.auth.util.Preconditions;
Expand Down Expand Up @@ -210,7 +211,11 @@ private AuthUI(FirebaseApp app) {
mApp = app;
mAuth = FirebaseAuth.getInstance(mApp);

mAuth.setFirebaseUIVersion(BuildConfig.VERSION_NAME);
try {
mAuth.setFirebaseUIVersion(BuildConfig.VERSION_NAME);
} catch (Exception e) {
Log.e(TAG, "Couldn't set the FUI version.", e);
}
mAuth.useAppLanguage();
}

Expand Down Expand Up @@ -272,32 +277,36 @@ public static int getDefaultTheme() {
*/
@NonNull
public Task<Void> signOut(@NonNull Context context) {
mAuth.signOut();

Task<Void> maybeDisableAutoSignIn = GoogleApiUtils.getCredentialsClient(context)
.disableAutoSignIn()
.continueWithTask(new Continuation<Void, Task<Void>>() {
.continueWith(new Continuation<Void, Void>() {
@Override
public Task<Void> then(@NonNull Task<Void> task) {
public Void then(@NonNull Task<Void> task) {
// We want to ignore a specific exception, since it's not a good reason
// to fail (see Issue 1156).
if (!task.isSuccessful() && (task.getException() instanceof ApiException)) {
ApiException ae = (ApiException) task.getException();
if (ae.getStatusCode() == CommonStatusCodes.CANCELED) {
Log.w(TAG, "Could not disable auto-sign in, maybe there are no " +
"SmartLock accounts available?", ae);

return Tasks.forResult(null);
}
Exception e = task.getException();
if (e instanceof ApiException
&& ((ApiException) e).getStatusCode() == CommonStatusCodes.CANCELED) {
Log.w(TAG, "Could not disable auto-sign in, maybe there are no " +
"SmartLock accounts available?", e);
return null;
}

return task;
return task.getResult();
}
});

return Tasks.whenAll(
signOutIdps(context),
maybeDisableAutoSignIn);
maybeDisableAutoSignIn
).continueWith(new Continuation<Void, Void>() {
@Override
public Void then(@NonNull Task<Void> task) {
task.getResult(); // Propagate exceptions
mAuth.signOut();
return null;
}
});
}

/**
Expand All @@ -322,12 +331,6 @@ public Task<Void> delete(@NonNull Context context) {

// Ensure the order in which tasks are executed properly destructures the user.
return signOutIdps(context).continueWithTask(new Continuation<Void, Task<Void>>() {
@Override
public Task<Void> then(@NonNull Task<Void> task) {
task.getResult(); // Propagate exception if there was one
return currentUser.delete();
}
}).continueWithTask(new Continuation<Void, Task<Void>>() {
@Override
public Task<Void> then(@NonNull Task<Void> task) {
task.getResult(); // Propagate exception if there was one
Expand All @@ -337,9 +340,9 @@ public Task<Void> then(@NonNull Task<Void> task) {
credentialTasks.add(client.delete(credential));
}
return Tasks.whenAll(credentialTasks)
.continueWithTask(new Continuation<Void, Task<Void>>() {
.continueWith(new Continuation<Void, Void>() {
@Override
public Task<Void> then(@NonNull Task<Void> task) {
public Void then(@NonNull Task<Void> task) {
Exception e = task.getException();
Throwable t = e == null ? null : e.getCause();
if (!(t instanceof ApiException)
Expand All @@ -348,13 +351,19 @@ public Task<Void> then(@NonNull Task<Void> task) {
// one. This can occur if we failed to save the credential or it
// was deleted elsewhere. However, a lack of stored credential
// doesn't mean fully deleting the user failed.
task.getResult();
return task.getResult();
}

return Tasks.forResult(null);
return null;
}
});
}
}).continueWithTask(new Continuation<Void, Task<Void>>() {
@Override
public Task<Void> then(@NonNull Task<Void> task) {
task.getResult(); // Propagate exception if there was one
return currentUser.delete();
}
});
}

Expand Down Expand Up @@ -384,11 +393,13 @@ private static List<Credential> getCredentialsFromFirebaseUser(@NonNull Firebase
}

String type = ProviderUtils.providerIdToAccountType(userInfo.getProviderId());

credentials.add(new Credential.Builder(
user.getEmail() == null ? user.getPhoneNumber() : user.getEmail())
.setAccountType(type)
.build());
if (type == null) {
// Since the account type is null, we've got an email credential. Adding a fake
// password is the only way to tell Smart Lock that this is an email credential.
credentials.add(CredentialUtils.buildCredentialOrThrow(user, "pass", null));
} else {
credentials.add(CredentialUtils.buildCredentialOrThrow(user, null, type));
}
}

return credentials;
Expand Down Expand Up @@ -623,8 +634,8 @@ public EmailBuilder setAllowNewAccounts(boolean allow) {
}

/**
* Configures the requirement for the user to enter first and last name
* in the email sign up flow.
* Configures the requirement for the user to enter first and last name in the email
* sign up flow.
* <p>
* Name is required by default.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
package com.firebase.ui.auth.data.model;

import android.content.Intent;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.DrawableRes;
Expand Down Expand Up @@ -84,13 +83,6 @@ public static FlowParameters fromIntent(Intent intent) {
return intent.getParcelableExtra(ExtraConstants.FLOW_PARAMS);
}

/**
* Extract FlowParameters from a Bundle.
*/
public static FlowParameters fromBundle(Bundle bundle) {
return bundle.getParcelable(ExtraConstants.FLOW_PARAMS);
}

@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(appName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ private Resource(State state, T value, Exception exception) {
mException = exception;
}

/**
* Creates a successful, empty Resource.
*/
@NonNull
public static Resource<Void> forVoidSuccess() {
return new Resource<>(State.SUCCESS, null, null);
}

/**
* Creates a successful resource containing a value.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.FacebookRequestError;
import com.facebook.FacebookSdk;
import com.facebook.GraphRequest;
import com.facebook.GraphResponse;
import com.facebook.WebDialog;
Expand Down Expand Up @@ -43,13 +42,11 @@ public class FacebookSignInHandler extends ProviderSignInBase<AuthUI.IdpConfig>
static {
boolean available;
try {
//noinspection unused to possibly throw
Class c = FacebookSdk.class;
Class.forName("com.facebook.login.LoginManager");
available = true;
} catch (NoClassDefFoundError e) {
} catch (ClassNotFoundException e) {
available = false;
}
//noinspection ConstantConditions IntelliJ is wrong
IS_AVAILABLE = available;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ private void handleCredential(final Credential credential) {
final IdpResponse response = new IdpResponse.Builder(
new User.Builder(EmailAuthProvider.PROVIDER_ID, id).build()).build();

setResult(Resource.<IdpResponse>forLoading());
getAuth().signInWithEmailAndPassword(id, password)
.addOnSuccessListener(new OnSuccessListener<AuthResult>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,13 @@ public class TwitterSignInHandler extends ProviderSignInBase<Void> {
static {
boolean available;
try {
//noinspection unused to possibly throw
Class c = TwitterCore.class;
Class.forName("com.twitter.sdk.android.core.identity.TwitterAuthClient");
available = true;
} catch (NoClassDefFoundError e) {
} catch (ClassNotFoundException e) {
available = false;
}
//noinspection ConstantConditions IntelliJ is wrong
IS_AVAILABLE = available;

//noinspection ConstantConditions IntelliJ is still wrong
if (IS_AVAILABLE) {
Context context = AuthUI.getApplicationContext();
Twitter.initialize(new TwitterConfig.Builder(context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ public class AppCompatBase extends HelperActivityBase {
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTheme(R.style.FirebaseUI); // Provides default values
setTheme(getFlowHolder().getArguments().themeId);
setTheme(getFlowParams().themeId);
}
}
41 changes: 16 additions & 25 deletions auth/src/main/java/com/firebase/ui/auth/ui/FragmentBase.java
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
package com.firebase.ui.auth.ui;

import android.content.IntentSender;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.annotation.RestrictTo;
import android.support.v4.app.Fragment;
import android.view.ContextThemeWrapper;

import com.firebase.ui.auth.IdpResponse;
import com.firebase.ui.auth.data.model.FlowParameters;
import com.firebase.ui.auth.util.AuthHelper;
import com.google.firebase.auth.FirebaseUser;

@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public class FragmentBase extends Fragment {

private FlowParameters mFlowParameters;
private AuthHelper mAuthHelper;
private HelperActivityBase mActivity;
private ProgressDialogHolder mProgressDialogHolder;

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

mAuthHelper = new AuthHelper(getFlowParams());
ContextThemeWrapper context = new ContextThemeWrapper(
getContext(), getFlowParams().themeId);
mProgressDialogHolder = new ProgressDialogHolder(context);
if (!(getActivity() instanceof HelperActivityBase)) {
throw new IllegalStateException("Cannot use this fragment without the helper activity");
}
mActivity = (HelperActivityBase) getActivity();

mProgressDialogHolder = new ProgressDialogHolder(new ContextThemeWrapper(
getContext(), getFlowParams().themeId));
}

@Override
Expand All @@ -34,23 +35,13 @@ public void onDestroy() {
}

public FlowParameters getFlowParams() {
if (mFlowParameters == null) {
mFlowParameters = FlowParameters.fromBundle(getArguments());
}

return mFlowParameters;
}

public AuthHelper getAuthHelper() {
return mAuthHelper;
}

public ProgressDialogHolder getDialogHolder() {
return mProgressDialogHolder;
return mActivity.getFlowParams();
}

public void startIntentSenderForResult(IntentSender sender, int requestCode)
throws IntentSender.SendIntentException {
startIntentSenderForResult(sender, requestCode, null, 0, 0, 0, null);
public void startSaveCredentials(
FirebaseUser firebaseUser,
IdpResponse response,
@Nullable String password) {
mActivity.startSaveCredentials(firebaseUser, response, password);
}
}
Loading