Skip to content

Commit 9b3a67c

Browse files
committed
Merge remote-tracking branch 'upstream/master' into email-refactor
2 parents ce80ee9 + 6a86d99 commit 9b3a67c

File tree

21 files changed

+167
-106
lines changed

21 files changed

+167
-106
lines changed

README.md

Lines changed: 5 additions & 4 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.2.2'
50+
implementation 'com.firebaseui:firebase-ui-database:3.3.0'
5151
5252
// FirebaseUI for Cloud Firestore
53-
implementation 'com.firebaseui:firebase-ui-firestore:3.2.2'
53+
implementation 'com.firebaseui:firebase-ui-firestore:3.3.0'
5454
5555
// FirebaseUI for Firebase Auth
56-
implementation 'com.firebaseui:firebase-ui-auth:3.2.2'
56+
implementation 'com.firebaseui:firebase-ui-auth:3.3.0'
5757
5858
// FirebaseUI for Cloud Storage
59-
implementation 'com.firebaseui:firebase-ui-storage:3.2.2'
59+
implementation 'com.firebaseui:firebase-ui-storage:3.3.0'
6060
}
6161
```
6262

@@ -103,6 +103,7 @@ For convenience, here are some recent examples:
103103

104104
| FirebaseUI Version | Firebase/Play Services Version |
105105
|--------------------|--------------------------------|
106+
| 3.3.0 | 12.0.1 |
106107
| 3.2.2 | 11.8.0 |
107108
| 3.1.3 | 11.8.0 |
108109
| 3.1.2 | 11.6.2 |

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ dependencies {
5858
// They are used to make some aspects of the demo app implementation simpler for
5959
// demonstrative purposes, and you may find them useful in your own apps; YMMV.
6060
implementation "android.arch.lifecycle:runtime:$architectureVersion"
61-
implementation 'pub.devrel:easypermissions:1.1.3'
61+
implementation 'pub.devrel:easypermissions:1.2.0'
6262
implementation 'com.jakewharton:butterknife:8.8.1'
6363
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
6464
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'

app/src/main/java/com/firebase/uidemo/auth/SignedInActivity.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@
4040
import com.google.firebase.auth.EmailAuthProvider;
4141
import com.google.firebase.auth.FacebookAuthProvider;
4242
import com.google.firebase.auth.FirebaseAuth;
43+
import com.google.firebase.auth.FirebaseAuthProvider;
4344
import com.google.firebase.auth.FirebaseUser;
4445
import com.google.firebase.auth.GoogleAuthProvider;
4546
import com.google.firebase.auth.PhoneAuthProvider;
4647
import com.google.firebase.auth.TwitterAuthProvider;
48+
import com.google.firebase.auth.UserInfo;
4749

4850
import java.util.ArrayList;
4951
import java.util.List;
@@ -152,11 +154,11 @@ private void populateProfile() {
152154
TextUtils.isEmpty(user.getDisplayName()) ? "No display name" : user.getDisplayName());
153155

154156
List<String> providers = new ArrayList<>();
155-
if (user.getProviders() == null || user.getProviders().isEmpty()) {
157+
if (user.getProviderData().isEmpty()) {
156158
providers.add("Anonymous");
157159
} else {
158-
for (String provider : user.getProviders()) {
159-
switch (provider) {
160+
for (UserInfo info : user.getProviderData()) {
161+
switch (info.getProviderId()) {
160162
case GoogleAuthProvider.PROVIDER_ID:
161163
providers.add(getString(R.string.providers_google));
162164
break;
@@ -172,8 +174,12 @@ private void populateProfile() {
172174
case PhoneAuthProvider.PROVIDER_ID:
173175
providers.add(getString(R.string.providers_phone));
174176
break;
177+
case FirebaseAuthProvider.PROVIDER_ID:
178+
// Ignore this provider, it's not very meaningful
179+
break;
175180
default:
176-
throw new IllegalStateException("Unknown provider: " + provider);
181+
throw new IllegalStateException(
182+
"Unknown provider: " + info.getProviderId());
177183
}
178184
}
179185
}

app/src/main/res/layout/activity_chat.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
android:layout_width="0dp"
4343
android:layout_height="wrap_content"
4444
android:layout_weight="1"
45+
android:hint="@string/hint_message"
4546
android:imeOptions="actionDone"
4647
android:inputType="text" />
4748

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,5 @@
9797
Make sure your device is online and that Anonymous Auth is configured in your Firebase project
9898
(https://console.firebase.google.com/project/_/authentication/providers)
9999
</string>
100+
<string name="hint_message">Say something…</string>
100101
</resources>

auth/README.md

Lines changed: 2 additions & 2 deletions
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.2.2'
65+
implementation 'com.firebaseui:firebase-ui-auth:3.3.0'
6666
6767
// Required only if Facebook login support is required
6868
// Find the latest Facebook SDK releases here: https://goo.gl/Ce5L94
@@ -84,7 +84,7 @@ android {
8484
8585
defaultConfig {
8686
// ...
87-
resConfigs "auto"
87+
resConfigs "en" // And any other languages you support
8888
}
8989
}
9090
```

auth/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ android {
3636
dependencies {
3737
implementation "com.android.support:design:$supportLibraryVersion"
3838
implementation "com.android.support:customtabs:$supportLibraryVersion"
39-
implementation 'com.android.support.constraint:constraint-layout:1.1.0-beta5'
39+
implementation 'com.android.support.constraint:constraint-layout:1.1.0-beta6'
4040

4141
implementation "android.arch.lifecycle:extensions:$architectureVersion"
4242
annotationProcessor "android.arch.lifecycle:compiler:$architectureVersion"

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.firebase.ui.auth;
22

33
import android.support.annotation.IntDef;
4+
import android.support.annotation.NonNull;
5+
import android.support.annotation.RestrictTo;
46

57
import java.lang.annotation.Retention;
68
import java.lang.annotation.RetentionPolicy;
@@ -50,4 +52,23 @@ public final class ErrorCodes {
5052
private ErrorCodes() {
5153
throw new AssertionError("No instance for you!");
5254
}
55+
56+
@NonNull
57+
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
58+
public static String toFriendlyMessage(@Code int code) {
59+
switch (code) {
60+
case UNKNOWN_ERROR:
61+
return "Unknown error";
62+
case NO_NETWORK:
63+
return "No internet connection";
64+
case PLAY_SERVICES_UPDATE_CANCELLED:
65+
return "Play Services update cancelled";
66+
case DEVELOPER_ERROR:
67+
return "Developer error";
68+
case PROVIDER_ERROR:
69+
return "Provider error";
70+
default:
71+
throw new IllegalArgumentException("Unknown code: " + code);
72+
}
73+
}
5374
}

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class FirebaseUiException extends Exception {
1111

1212
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
1313
public FirebaseUiException(@ErrorCodes.Code int code) {
14-
mErrorCode = code;
14+
this(code, ErrorCodes.toFriendlyMessage(code));
1515
}
1616

1717
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
@@ -20,6 +20,11 @@ public FirebaseUiException(@ErrorCodes.Code int code, @NonNull String message) {
2020
mErrorCode = code;
2121
}
2222

23+
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
24+
public FirebaseUiException(@ErrorCodes.Code int code, @NonNull Throwable cause) {
25+
this(code, ErrorCodes.toFriendlyMessage(code), cause);
26+
}
27+
2328
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
2429
public FirebaseUiException(@ErrorCodes.Code int code,
2530
@NonNull String message,
@@ -28,12 +33,6 @@ public FirebaseUiException(@ErrorCodes.Code int code,
2833
mErrorCode = code;
2934
}
3035

31-
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
32-
public FirebaseUiException(@ErrorCodes.Code int code, @NonNull Throwable cause) {
33-
super(cause);
34-
mErrorCode = code;
35-
}
36-
3736
/**
3837
* @return error code associated with this exception
3938
* @see com.firebase.ui.auth.ErrorCodes

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ public static IdpResponse from(@NonNull Exception e) {
103103
if (e instanceof FirebaseUiException) {
104104
return new IdpResponse((FirebaseUiException) e);
105105
} else {
106-
return new IdpResponse(new FirebaseUiException(ErrorCodes.UNKNOWN_ERROR, e));
106+
FirebaseUiException wrapped = new FirebaseUiException(ErrorCodes.UNKNOWN_ERROR, e);
107+
wrapped.setStackTrace(e.getStackTrace());
108+
return new IdpResponse(wrapped);
107109
}
108110
}
109111

@@ -213,7 +215,11 @@ public void writeToParcel(Parcel dest, int flags) {
213215
} catch (IOException e) {
214216
// Somewhere down the line, the exception is holding on to an object that isn't
215217
// serializable so default to some exception. It's the best we can do in this case.
216-
dest.writeSerializable(new FirebaseUiException(ErrorCodes.UNKNOWN_ERROR));
218+
FirebaseUiException fake = new FirebaseUiException(ErrorCodes.UNKNOWN_ERROR,
219+
"Fake exception created, original: " + mException
220+
+ ", original cause: " + mException.getCause());
221+
fake.setStackTrace(mException.getStackTrace());
222+
dest.writeSerializable(fake);
217223
} finally {
218224
if (oos != null) {
219225
try {

0 commit comments

Comments
 (0)