Skip to content

Commit 4bedc0f

Browse files
authored
Merge pull request #1258 from firebase/version-3.3.1
Version 3.3.1
2 parents f15b36f + 42dbd73 commit 4bedc0f

File tree

129 files changed

+666
-748
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+666
-748
lines changed

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ android:
2222
# https://github.com/travis-ci/travis-ci/issues/6040#issuecomment-219367943
2323
- tools
2424
- tools
25-
before_script: mv library/google-services.json app/google-services.json
26-
script: ./gradlew clean assembleDebug check
25+
before_script:
26+
- cp library/google-services.json app/google-services.json
27+
- cp library/google-services.json proguard-tests/google-services.json
28+
script: ./gradlew clean assembleDebug proguard-tests:build check
2729
after_success: ./scripts/artifactory.sh
2830
after_failure:
2931
# tests

README.md

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ libraries.
4747
```groovy
4848
dependencies {
4949
// FirebaseUI for Firebase Realtime Database
50-
implementation 'com.firebaseui:firebase-ui-database:3.3.0'
50+
implementation 'com.firebaseui:firebase-ui-database:3.3.1'
5151
5252
// FirebaseUI for Cloud Firestore
53-
implementation 'com.firebaseui:firebase-ui-firestore:3.3.0'
53+
implementation 'com.firebaseui:firebase-ui-firestore:3.3.1'
5454
5555
// FirebaseUI for Firebase Auth
56-
implementation 'com.firebaseui:firebase-ui-auth:3.3.0'
56+
implementation 'com.firebaseui:firebase-ui-auth:3.3.1'
5757
5858
// FirebaseUI for Cloud Storage
59-
implementation 'com.firebaseui:firebase-ui-storage:3.3.0'
59+
implementation 'com.firebaseui:firebase-ui-storage:3.3.1'
6060
}
6161
```
6262

@@ -103,21 +103,13 @@ For convenience, here are some recent examples:
103103

104104
| FirebaseUI Version | Firebase/Play Services Version |
105105
|--------------------|--------------------------------|
106+
| 3.3.1 | 15.0.0 |
106107
| 3.3.0 | 12.0.1 |
107108
| 3.2.2 | 11.8.0 |
108109
| 3.1.3 | 11.8.0 |
109-
| 3.1.2 | 11.6.2 |
110-
| 3.1.0 | 11.4.2 |
111110
| 3.0.0 | 11.4.2 |
112111
| 2.4.0 | 11.4.0 |
113-
| 2.3.0 | 11.0.4 |
114-
| 2.2.0 | 11.0.4 |
115-
| 2.1.1 | 11.0.2 |
116-
| 2.0.1 | 11.0.1 |
117-
| 1.2.0 | 10.2.0 |
118112
| 1.1.1 | 10.0.0 or 10.0.1 |
119-
| 1.0.1 | 10.0.0 or 10.0.1 |
120-
| 1.0.0 | 9.8.0 |
121113

122114

123115
### Upgrading dependencies

auth/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Gradle, add the dependency:
6262
```groovy
6363
dependencies {
6464
// ...
65-
implementation 'com.firebaseui:firebase-ui-auth:3.3.0'
65+
implementation 'com.firebaseui:firebase-ui-auth:3.3.1'
6666
6767
// Required only if Facebook login support is required
6868
// Find the latest Facebook SDK releases here: https://goo.gl/Ce5L94

auth/auth-proguard.pro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Twitter and Facebook are optional
2-
-dontwarn com.twitter.**
32
-dontwarn com.facebook.**
4-
-dontwarn com.firebase.ui.auth.provider.**
3+
-dontwarn com.twitter.**
54

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

1716
# Retrofit config
1817
-dontnote retrofit2.Platform
19-
-dontwarn retrofit2.Platform$Java8
18+
-dontwarn retrofit2.** # Also keeps Twitter at bay as long as they keep using Retrofit
19+
-dontwarn okio.**
2020
-keepattributes Exceptions

auth/src/main/java/com/firebase/ui/auth/AuthUI.java

Lines changed: 43 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import com.firebase.ui.auth.data.remote.FacebookSignInHandler;
3535
import com.firebase.ui.auth.data.remote.TwitterSignInHandler;
3636
import com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity;
37+
import com.firebase.ui.auth.util.CredentialUtils;
3738
import com.firebase.ui.auth.util.ExtraConstants;
3839
import com.firebase.ui.auth.util.GoogleApiUtils;
3940
import com.firebase.ui.auth.util.Preconditions;
@@ -210,7 +211,11 @@ private AuthUI(FirebaseApp app) {
210211
mApp = app;
211212
mAuth = FirebaseAuth.getInstance(mApp);
212213

213-
mAuth.setFirebaseUIVersion(BuildConfig.VERSION_NAME);
214+
try {
215+
mAuth.setFirebaseUIVersion(BuildConfig.VERSION_NAME);
216+
} catch (Exception e) {
217+
Log.e(TAG, "Couldn't set the FUI version.", e);
218+
}
214219
mAuth.useAppLanguage();
215220
}
216221

@@ -272,32 +277,36 @@ public static int getDefaultTheme() {
272277
*/
273278
@NonNull
274279
public Task<Void> signOut(@NonNull Context context) {
275-
mAuth.signOut();
276-
277280
Task<Void> maybeDisableAutoSignIn = GoogleApiUtils.getCredentialsClient(context)
278281
.disableAutoSignIn()
279-
.continueWithTask(new Continuation<Void, Task<Void>>() {
282+
.continueWith(new Continuation<Void, Void>() {
280283
@Override
281-
public Task<Void> then(@NonNull Task<Void> task) {
284+
public Void then(@NonNull Task<Void> task) {
282285
// We want to ignore a specific exception, since it's not a good reason
283286
// to fail (see Issue 1156).
284-
if (!task.isSuccessful() && (task.getException() instanceof ApiException)) {
285-
ApiException ae = (ApiException) task.getException();
286-
if (ae.getStatusCode() == CommonStatusCodes.CANCELED) {
287-
Log.w(TAG, "Could not disable auto-sign in, maybe there are no " +
288-
"SmartLock accounts available?", ae);
289-
290-
return Tasks.forResult(null);
291-
}
287+
Exception e = task.getException();
288+
if (e instanceof ApiException
289+
&& ((ApiException) e).getStatusCode() == CommonStatusCodes.CANCELED) {
290+
Log.w(TAG, "Could not disable auto-sign in, maybe there are no " +
291+
"SmartLock accounts available?", e);
292+
return null;
292293
}
293294

294-
return task;
295+
return task.getResult();
295296
}
296297
});
297298

298299
return Tasks.whenAll(
299300
signOutIdps(context),
300-
maybeDisableAutoSignIn);
301+
maybeDisableAutoSignIn
302+
).continueWith(new Continuation<Void, Void>() {
303+
@Override
304+
public Void then(@NonNull Task<Void> task) {
305+
task.getResult(); // Propagate exceptions
306+
mAuth.signOut();
307+
return null;
308+
}
309+
});
301310
}
302311

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

323332
// Ensure the order in which tasks are executed properly destructures the user.
324333
return signOutIdps(context).continueWithTask(new Continuation<Void, Task<Void>>() {
325-
@Override
326-
public Task<Void> then(@NonNull Task<Void> task) {
327-
task.getResult(); // Propagate exception if there was one
328-
return currentUser.delete();
329-
}
330-
}).continueWithTask(new Continuation<Void, Task<Void>>() {
331334
@Override
332335
public Task<Void> then(@NonNull Task<Void> task) {
333336
task.getResult(); // Propagate exception if there was one
@@ -337,9 +340,9 @@ public Task<Void> then(@NonNull Task<Void> task) {
337340
credentialTasks.add(client.delete(credential));
338341
}
339342
return Tasks.whenAll(credentialTasks)
340-
.continueWithTask(new Continuation<Void, Task<Void>>() {
343+
.continueWith(new Continuation<Void, Void>() {
341344
@Override
342-
public Task<Void> then(@NonNull Task<Void> task) {
345+
public Void then(@NonNull Task<Void> task) {
343346
Exception e = task.getException();
344347
Throwable t = e == null ? null : e.getCause();
345348
if (!(t instanceof ApiException)
@@ -348,13 +351,19 @@ public Task<Void> then(@NonNull Task<Void> task) {
348351
// one. This can occur if we failed to save the credential or it
349352
// was deleted elsewhere. However, a lack of stored credential
350353
// doesn't mean fully deleting the user failed.
351-
task.getResult();
354+
return task.getResult();
352355
}
353356

354-
return Tasks.forResult(null);
357+
return null;
355358
}
356359
});
357360
}
361+
}).continueWithTask(new Continuation<Void, Task<Void>>() {
362+
@Override
363+
public Task<Void> then(@NonNull Task<Void> task) {
364+
task.getResult(); // Propagate exception if there was one
365+
return currentUser.delete();
366+
}
358367
});
359368
}
360369

@@ -384,11 +393,13 @@ private static List<Credential> getCredentialsFromFirebaseUser(@NonNull Firebase
384393
}
385394

386395
String type = ProviderUtils.providerIdToAccountType(userInfo.getProviderId());
387-
388-
credentials.add(new Credential.Builder(
389-
user.getEmail() == null ? user.getPhoneNumber() : user.getEmail())
390-
.setAccountType(type)
391-
.build());
396+
if (type == null) {
397+
// Since the account type is null, we've got an email credential. Adding a fake
398+
// password is the only way to tell Smart Lock that this is an email credential.
399+
credentials.add(CredentialUtils.buildCredentialOrThrow(user, "pass", null));
400+
} else {
401+
credentials.add(CredentialUtils.buildCredentialOrThrow(user, null, type));
402+
}
392403
}
393404

394405
return credentials;
@@ -623,8 +634,8 @@ public EmailBuilder setAllowNewAccounts(boolean allow) {
623634
}
624635

625636
/**
626-
* Configures the requirement for the user to enter first and last name
627-
* in the email sign up flow.
637+
* Configures the requirement for the user to enter first and last name in the email
638+
* sign up flow.
628639
* <p>
629640
* Name is required by default.
630641
*/

auth/src/main/java/com/firebase/ui/auth/data/model/FlowParameters.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
package com.firebase.ui.auth.data.model;
1515

1616
import android.content.Intent;
17-
import android.os.Bundle;
1817
import android.os.Parcel;
1918
import android.os.Parcelable;
2019
import android.support.annotation.DrawableRes;
@@ -84,13 +83,6 @@ public static FlowParameters fromIntent(Intent intent) {
8483
return intent.getParcelableExtra(ExtraConstants.FLOW_PARAMS);
8584
}
8685

87-
/**
88-
* Extract FlowParameters from a Bundle.
89-
*/
90-
public static FlowParameters fromBundle(Bundle bundle) {
91-
return bundle.getParcelable(ExtraConstants.FLOW_PARAMS);
92-
}
93-
9486
@Override
9587
public void writeToParcel(Parcel dest, int flags) {
9688
dest.writeString(appName);

auth/src/main/java/com/firebase/ui/auth/data/model/Resource.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,6 @@ private Resource(State state, T value, Exception exception) {
2424
mException = exception;
2525
}
2626

27-
/**
28-
* Creates a successful, empty Resource.
29-
*/
30-
@NonNull
31-
public static Resource<Void> forVoidSuccess() {
32-
return new Resource<>(State.SUCCESS, null, null);
33-
}
34-
3527
/**
3628
* Creates a successful resource containing a value.
3729
*/

auth/src/main/java/com/firebase/ui/auth/data/remote/FacebookSignInHandler.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import com.facebook.FacebookCallback;
1313
import com.facebook.FacebookException;
1414
import com.facebook.FacebookRequestError;
15-
import com.facebook.FacebookSdk;
1615
import com.facebook.GraphRequest;
1716
import com.facebook.GraphResponse;
1817
import com.facebook.WebDialog;
@@ -43,13 +42,11 @@ public class FacebookSignInHandler extends ProviderSignInBase<AuthUI.IdpConfig>
4342
static {
4443
boolean available;
4544
try {
46-
//noinspection unused to possibly throw
47-
Class c = FacebookSdk.class;
45+
Class.forName("com.facebook.login.LoginManager");
4846
available = true;
49-
} catch (NoClassDefFoundError e) {
47+
} catch (ClassNotFoundException e) {
5048
available = false;
5149
}
52-
//noinspection ConstantConditions IntelliJ is wrong
5350
IS_AVAILABLE = available;
5451
}
5552

auth/src/main/java/com/firebase/ui/auth/data/remote/SignInKickstarter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ private void handleCredential(final Credential credential) {
192192
final IdpResponse response = new IdpResponse.Builder(
193193
new User.Builder(EmailAuthProvider.PROVIDER_ID, id).build()).build();
194194

195+
setResult(Resource.<IdpResponse>forLoading());
195196
getAuth().signInWithEmailAndPassword(id, password)
196197
.addOnSuccessListener(new OnSuccessListener<AuthResult>() {
197198
@Override

auth/src/main/java/com/firebase/ui/auth/data/remote/TwitterSignInHandler.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,13 @@ public class TwitterSignInHandler extends ProviderSignInBase<Void> {
3535
static {
3636
boolean available;
3737
try {
38-
//noinspection unused to possibly throw
39-
Class c = TwitterCore.class;
38+
Class.forName("com.twitter.sdk.android.core.identity.TwitterAuthClient");
4039
available = true;
41-
} catch (NoClassDefFoundError e) {
40+
} catch (ClassNotFoundException e) {
4241
available = false;
4342
}
44-
//noinspection ConstantConditions IntelliJ is wrong
4543
IS_AVAILABLE = available;
4644

47-
//noinspection ConstantConditions IntelliJ is still wrong
4845
if (IS_AVAILABLE) {
4946
Context context = AuthUI.getApplicationContext();
5047
Twitter.initialize(new TwitterConfig.Builder(context)

auth/src/main/java/com/firebase/ui/auth/ui/AppCompatBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ public class AppCompatBase extends HelperActivityBase {
2727
protected void onCreate(@Nullable Bundle savedInstanceState) {
2828
super.onCreate(savedInstanceState);
2929
setTheme(R.style.FirebaseUI); // Provides default values
30-
setTheme(getFlowHolder().getArguments().themeId);
30+
setTheme(getFlowParams().themeId);
3131
}
3232
}
Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
11
package com.firebase.ui.auth.ui;
22

3-
import android.content.IntentSender;
43
import android.os.Bundle;
54
import android.support.annotation.Nullable;
65
import android.support.annotation.RestrictTo;
76
import android.support.v4.app.Fragment;
87
import android.view.ContextThemeWrapper;
98

9+
import com.firebase.ui.auth.IdpResponse;
1010
import com.firebase.ui.auth.data.model.FlowParameters;
11-
import com.firebase.ui.auth.util.AuthHelper;
11+
import com.google.firebase.auth.FirebaseUser;
1212

1313
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
1414
public class FragmentBase extends Fragment {
15-
16-
private FlowParameters mFlowParameters;
17-
private AuthHelper mAuthHelper;
15+
private HelperActivityBase mActivity;
1816
private ProgressDialogHolder mProgressDialogHolder;
1917

2018
@Override
2119
public void onCreate(@Nullable Bundle savedInstanceState) {
2220
super.onCreate(savedInstanceState);
2321

24-
mAuthHelper = new AuthHelper(getFlowParams());
25-
ContextThemeWrapper context = new ContextThemeWrapper(
26-
getContext(), getFlowParams().themeId);
27-
mProgressDialogHolder = new ProgressDialogHolder(context);
22+
if (!(getActivity() instanceof HelperActivityBase)) {
23+
throw new IllegalStateException("Cannot use this fragment without the helper activity");
24+
}
25+
mActivity = (HelperActivityBase) getActivity();
26+
27+
mProgressDialogHolder = new ProgressDialogHolder(new ContextThemeWrapper(
28+
getContext(), getFlowParams().themeId));
2829
}
2930

3031
@Override
@@ -34,23 +35,13 @@ public void onDestroy() {
3435
}
3536

3637
public FlowParameters getFlowParams() {
37-
if (mFlowParameters == null) {
38-
mFlowParameters = FlowParameters.fromBundle(getArguments());
39-
}
40-
41-
return mFlowParameters;
42-
}
43-
44-
public AuthHelper getAuthHelper() {
45-
return mAuthHelper;
46-
}
47-
48-
public ProgressDialogHolder getDialogHolder() {
49-
return mProgressDialogHolder;
38+
return mActivity.getFlowParams();
5039
}
5140

52-
public void startIntentSenderForResult(IntentSender sender, int requestCode)
53-
throws IntentSender.SendIntentException {
54-
startIntentSenderForResult(sender, requestCode, null, 0, 0, 0, null);
41+
public void startSaveCredentials(
42+
FirebaseUser firebaseUser,
43+
IdpResponse response,
44+
@Nullable String password) {
45+
mActivity.startSaveCredentials(firebaseUser, response, password);
5546
}
5647
}

0 commit comments

Comments
 (0)