Skip to content

Commit aef1d2f

Browse files
authored
Version 7.0.0
Version 7.0.0
2 parents 241aeb6 + 8468aaf commit aef1d2f

File tree

85 files changed

+641
-485
lines changed

Some content is hidden

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

85 files changed

+641
-485
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ google-services.json
1010

1111
crashlytics-build.properties
1212
auth/src/main/res/values/com_crashlytics_export_strings.xml
13+
*.log

.opensource/project.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"docs/upgrade-to-3.0.md": "Upgrade to v3.0",
1919
"docs/upgrade-to-4.0.md": "Upgrade to v4.0",
2020
"docs/upgrade-to-5.0.md": "Upgrade to v5.0",
21-
"docs/upgrade-to-6.0.md": "Upgrade to v6.0"
21+
"docs/upgrade-to-6.0.md": "Upgrade to v6.0",
22+
"docs/upgrade-to-7.0.md": "Upgrade to v7.0"
2223
},
2324

2425
"related": [

README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,16 @@ libraries.
4848
```groovy
4949
dependencies {
5050
// FirebaseUI for Firebase Realtime Database
51-
implementation 'com.firebaseui:firebase-ui-database:6.4.0'
51+
implementation 'com.firebaseui:firebase-ui-database:7.0.0'
5252
5353
// FirebaseUI for Cloud Firestore
54-
implementation 'com.firebaseui:firebase-ui-firestore:6.4.0'
54+
implementation 'com.firebaseui:firebase-ui-firestore:7.0.0'
5555
5656
// FirebaseUI for Firebase Auth
57-
implementation 'com.firebaseui:firebase-ui-auth:6.4.0'
57+
implementation 'com.firebaseui:firebase-ui-auth:7.0.0'
5858
5959
// FirebaseUI for Cloud Storage
60-
implementation 'com.firebaseui:firebase-ui-storage:6.4.0'
60+
implementation 'com.firebaseui:firebase-ui-storage:7.0.0'
6161
}
6262
```
6363

@@ -71,6 +71,7 @@ After the project is synchronized, we're ready to start using Firebase functiona
7171
If you are using an old version of FirebaseUI and upgrading, please see the appropriate
7272
migration guide:
7373

74+
* [Upgrade from 6.4.0 to 7.x.x](./docs/upgrade-to-7.0.md)
7475
* [Upgrade from 5.1.0 to 6.x.x](./docs/upgrade-to-6.0.md)
7576
* [Upgrade from 4.3.2 to 5.x.x](./docs/upgrade-to-5.0.md)
7677
* [Upgrade from 3.3.1 to 4.x.x](./docs/upgrade-to-4.0.md)

app/src/main/AndroidManifest.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
android:roundIcon="@mipmap/ic_launcher_round"
1717
android:supportsRtl="true"
1818
android:theme="@style/AppTheme"
19-
tools:ignore="GoogleAppIndexingWarning">
19+
tools:ignore="GoogleAppIndexingWarning,UnusedAttribute"
20+
android:usesCleartextTraffic="true">
2021

2122
<activity android:name=".ChooserActivity">
2223
<intent-filter>

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

+29-4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import android.content.Context;
1818
import android.content.Intent;
19+
import android.os.Build;
1920
import android.os.Bundle;
2021
import android.util.Log;
2122
import android.view.View;
@@ -108,6 +109,7 @@ public class AuthUiActivity extends AppCompatActivity {
108109
@BindView(R.id.hint_selector_enabled) CheckBox mEnableHintSelector;
109110
@BindView(R.id.allow_new_email_accounts) CheckBox mAllowNewEmailAccounts;
110111
@BindView(R.id.require_name) CheckBox mRequireName;
112+
@BindView(R.id.use_auth_emulator) CheckBox mUseEmulator;
111113

112114
@NonNull
113115
public static Intent createIntent(@NonNull Context context) {
@@ -188,6 +190,17 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
188190
}
189191
});
190192

193+
// useEmulator can't be reversed until the FirebaseApp is cleared, so we make this
194+
// checkbox "sticky" until the app is restarted
195+
mUseEmulator.setOnCheckedChangeListener(new OnCheckedChangeListener() {
196+
@Override
197+
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
198+
if (isChecked) {
199+
mUseEmulator.setEnabled(false);
200+
}
201+
}
202+
});
203+
191204
if (ConfigurationUtils.isGoogleMisconfigured(this)
192205
|| ConfigurationUtils.isFacebookMisconfigured(this)) {
193206
showSnackbar(R.string.configuration_required);
@@ -231,9 +244,19 @@ public void signInWithEmailLink(@Nullable String link) {
231244
startActivityForResult(buildSignInIntent(link), RC_SIGN_IN);
232245
}
233246

247+
@NonNull
248+
public AuthUI getAuthUI() {
249+
AuthUI authUI = AuthUI.getInstance();
250+
if (mUseEmulator.isChecked()) {
251+
authUI.useEmulator("10.0.2.2", 9099);
252+
}
253+
254+
return authUI;
255+
}
256+
234257
@NonNull
235258
public Intent buildSignInIntent(@Nullable String link) {
236-
AuthUI.SignInIntentBuilder builder = AuthUI.getInstance().createSignInIntentBuilder()
259+
AuthUI.SignInIntentBuilder builder = getAuthUI().createSignInIntentBuilder()
237260
.setTheme(getSelectedTheme())
238261
.setLogo(getSelectedLogo())
239262
.setAvailableProviders(getSelectedProviders())
@@ -273,7 +296,7 @@ public Intent buildSignInIntent(@Nullable String link) {
273296

274297
@OnClick(R.id.sign_in_silent)
275298
public void silentSignIn() {
276-
AuthUI.getInstance().silentSignIn(this, getSelectedProviders())
299+
getAuthUI().silentSignIn(this, getSelectedProviders())
277300
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
278301
@Override
279302
public void onComplete(@NonNull Task<AuthResult> task) {
@@ -348,8 +371,10 @@ private void startSignedInActivity(@Nullable IdpResponse response) {
348371
public void toggleDarkTheme() {
349372
int mode = mDarkTheme.isChecked() ?
350373
AppCompatDelegate.MODE_NIGHT_YES : AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
351-
AppCompatDelegate.setDefaultNightMode(mode);
352-
getDelegate().setLocalNightMode(mode);
374+
if (Build.VERSION.SDK_INT >= 17) {
375+
AppCompatDelegate.setDefaultNightMode(mode);
376+
getDelegate().setLocalNightMode(mode);
377+
}
353378
}
354379

355380
@StyleRes

app/src/main/java/com/firebase/uidemo/util/ConfigurationUtils.java

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import com.google.firebase.auth.ActionCodeSettings;
99

1010
import java.util.ArrayList;
11-
import java.util.Arrays;
1211
import java.util.List;
1312

1413
import androidx.annotation.NonNull;

app/src/main/res/layout-land/auth_method_picker_custom_layout.xml

+1-6
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,7 @@
9090

9191
</FrameLayout>
9292

93-
<!--
94-
NOTE: This sample app uses this class from the FirebaseUI library to show the Google Sign
95-
in button. However this button is NOT considered part of the public API and you should not
96-
use it in your own app.
97-
-->
98-
<com.firebase.ui.auth.util.ui.SupportVectorDrawablesButton
93+
<Button
9994
android:id="@+id/custom_google_signin_button"
10095
style="@style/FirebaseUI.Button.AccountChooser.GoogleButton"
10196
android:layout_width="wrap_content"

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<LinearLayout
3-
xmlns:android="http://schemas.android.com/apk/res/android"
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
43
xmlns:tools="http://schemas.android.com/tools"
4+
xmlns:app="http://schemas.android.com/apk/res-auto"
55
android:id="@+id/root"
66
android:layout_width="match_parent"
77
android:layout_height="match_parent"
@@ -12,13 +12,13 @@
1212
android:orientation="vertical"
1313
tools:context=".auth.AuthUiActivity">
1414

15-
<TextView
15+
<androidx.appcompat.widget.AppCompatTextView
1616
style="@style/Base.TextAppearance.AppCompat.Headline"
1717
android:layout_width="wrap_content"
1818
android:layout_height="wrap_content"
1919
android:layout_gravity="center_horizontal"
20-
android:drawableTop="@drawable/firebase_auth_120dp"
21-
android:text="@string/title_anonymous_upgrade" />
20+
android:text="@string/title_anonymous_upgrade"
21+
app:drawableTopCompat="@drawable/firebase_auth_120dp" />
2222

2323
<TextView
2424
android:id="@+id/status_text"

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

+1-6
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,7 @@
7373

7474
</FrameLayout>
7575

76-
<!--
77-
NOTE: This sample app uses this class from the FirebaseUI library to show the Google Sign
78-
in button. However this button is NOT considered part of the public API and you should not
79-
use it in your own app.
80-
-->
81-
<com.firebase.ui.auth.util.ui.SupportVectorDrawablesButton
76+
<Button
8277
android:id="@+id/custom_google_signin_button"
8378
style="@style/FirebaseUI.Button.AccountChooser.GoogleButton"
8479
android:layout_width="wrap_content"

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

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools"
4+
xmlns:app="http://schemas.android.com/apk/res-auto"
45
android:id="@+id/root"
56
android:layout_width="match_parent"
67
android:layout_height="match_parent"
@@ -20,13 +21,13 @@
2021
android:orientation="vertical"
2122
android:paddingBottom="32dp">
2223

23-
<TextView
24+
<androidx.appcompat.widget.AppCompatTextView
2425
style="@style/Base.TextAppearance.AppCompat.Headline"
2526
android:layout_width="wrap_content"
2627
android:layout_height="wrap_content"
2728
android:layout_gravity="center_horizontal"
28-
android:drawableTop="@drawable/firebase_auth_120dp"
29-
android:text="@string/launch_title" />
29+
android:text="@string/launch_title"
30+
app:drawableTopCompat="@drawable/firebase_auth_120dp"/>
3031

3132
<Button
3233
android:id="@+id/sign_in"
@@ -346,6 +347,13 @@
346347
android:checked="true"
347348
android:text="@string/options_require_name" />
348349

350+
<CheckBox
351+
android:id="@+id/use_auth_emulator"
352+
android:layout_width="wrap_content"
353+
android:layout_height="wrap_content"
354+
android:checked="false"
355+
android:text="@string/options_use_auth_emulator" />
356+
349357
</LinearLayout>
350358

351359
</ScrollView>

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
android:layout_marginBottom="16dp"
1919
android:orientation="vertical">
2020

21-
<TextView
21+
<androidx.appcompat.widget.AppCompatTextView
2222
style="@style/Base.TextAppearance.AppCompat.Headline"
2323
android:layout_width="wrap_content"
2424
android:layout_height="wrap_content"
2525
android:layout_gravity="center_horizontal"
26-
android:drawableTop="@drawable/firebase_auth_120dp"
27-
android:text="@string/signed_in_header" />
26+
android:text="@string/signed_in_header"
27+
app:drawableTopCompat="@drawable/firebase_auth_120dp" />
2828

2929
<LinearLayout
3030
android:layout_width="wrap_content"

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

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
<string name="options_enable_hint_selector">Enable Smart Lock\'s hint selector</string>
6969
<string name="options_allow_new_email_acccount">Allow new account creation</string>
7070
<string name="options_require_name">Require first/last name with email accounts.</string>
71+
<string name="options_use_auth_emulator">Connect to auth emulator (localhost:9099).</string>
7172

7273
<string name="configuration_required">Configuration required - see README.md</string>
7374
<string name="google_label_missing_config">Google configuration missing</string>

auth/README.md

+22-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ and [Web](https://github.com/firebase/firebaseui-web/).
3232
1. [Demo](#demo)
3333
1. [Configuration](#configuration)
3434
1. [Provider config](#identity-provider-configuration)
35+
1. [Auth emulator config](#auth-emulator-configuration)
3536
1. [Usage instructions](#using-firebaseui-for-authentication)
3637
1. [AuthUI sign-in](#authui-sign-in)
3738
1. [Handling responses](#handling-the-sign-in-response)
@@ -65,11 +66,11 @@ Gradle, add the dependency:
6566
```groovy
6667
dependencies {
6768
// ...
68-
implementation 'com.firebaseui:firebase-ui-auth:6.4.0'
69+
implementation 'com.firebaseui:firebase-ui-auth:7.0.0'
6970
7071
// Required only if Facebook login support is required
7172
// Find the latest Facebook SDK releases here: https://github.com/facebook/facebook-android-sdk/blob/master/CHANGELOG.md
72-
implementation 'com.facebook.android:facebook-login:4.x'
73+
implementation 'com.facebook.android:facebook-login:8.1.0'
7374
}
7475
```
7576

@@ -150,6 +151,25 @@ Note: unlike other sign-in methods, signing in with these providers involves the
150151
You must enable the "Request email addresses from users" permission in the "Permissions" tab of your
151152
Twitter app.
152153

154+
### Auth emulator configuration
155+
156+
As of version `7.0.0` FirebaseUI is compatible with the Firebase Authentication emulator:
157+
https://firebase.google.com/docs/emulator-suite
158+
159+
Use the `useEmulator` method to point an AuthUI instance at the emulator:
160+
161+
```java
162+
AuthUI authUI = AuthUI.getInstance();
163+
164+
// "10.0.2.2" is the special host value for contacting "localhost" from within
165+
// the Android Emulator
166+
authUI.useEmulator("10.0.2.2", 9099);
167+
```
168+
169+
By default Android blocks connections to `http://` endpoints such as the Auth emulator.
170+
To allow your app to communicate with the Auth emulator, use a [network security configuration](https://developer.android.com/training/articles/security-config)
171+
or set `android:usesCleartextTraffic="true"` in `AndroidManifest.xml`.
172+
153173
## Using FirebaseUI for authentication
154174

155175
Before invoking the FirebaseUI authentication flow, your app should check

0 commit comments

Comments
 (0)