Skip to content

Commit

Permalink
Version 7.0.0
Browse files Browse the repository at this point in the history
Version 7.0.0
  • Loading branch information
samtstern authored Nov 11, 2020
2 parents 241aeb6 + 8468aaf commit aef1d2f
Show file tree
Hide file tree
Showing 85 changed files with 641 additions and 485 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ google-services.json

crashlytics-build.properties
auth/src/main/res/values/com_crashlytics_export_strings.xml
*.log
3 changes: 2 additions & 1 deletion .opensource/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"docs/upgrade-to-3.0.md": "Upgrade to v3.0",
"docs/upgrade-to-4.0.md": "Upgrade to v4.0",
"docs/upgrade-to-5.0.md": "Upgrade to v5.0",
"docs/upgrade-to-6.0.md": "Upgrade to v6.0"
"docs/upgrade-to-6.0.md": "Upgrade to v6.0",
"docs/upgrade-to-7.0.md": "Upgrade to v7.0"
},

"related": [
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ libraries.
```groovy
dependencies {
// FirebaseUI for Firebase Realtime Database
implementation 'com.firebaseui:firebase-ui-database:6.4.0'
implementation 'com.firebaseui:firebase-ui-database:7.0.0'
// FirebaseUI for Cloud Firestore
implementation 'com.firebaseui:firebase-ui-firestore:6.4.0'
implementation 'com.firebaseui:firebase-ui-firestore:7.0.0'
// FirebaseUI for Firebase Auth
implementation 'com.firebaseui:firebase-ui-auth:6.4.0'
implementation 'com.firebaseui:firebase-ui-auth:7.0.0'
// FirebaseUI for Cloud Storage
implementation 'com.firebaseui:firebase-ui-storage:6.4.0'
implementation 'com.firebaseui:firebase-ui-storage:7.0.0'
}
```

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

* [Upgrade from 6.4.0 to 7.x.x](./docs/upgrade-to-7.0.md)
* [Upgrade from 5.1.0 to 6.x.x](./docs/upgrade-to-6.0.md)
* [Upgrade from 4.3.2 to 5.x.x](./docs/upgrade-to-5.0.md)
* [Upgrade from 3.3.1 to 4.x.x](./docs/upgrade-to-4.0.md)
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
tools:ignore="GoogleAppIndexingWarning,UnusedAttribute"
android:usesCleartextTraffic="true">

<activity android:name=".ChooserActivity">
<intent-filter>
Expand Down
33 changes: 29 additions & 4 deletions app/src/main/java/com/firebase/uidemo/auth/AuthUiActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
Expand Down Expand Up @@ -108,6 +109,7 @@ public class AuthUiActivity extends AppCompatActivity {
@BindView(R.id.hint_selector_enabled) CheckBox mEnableHintSelector;
@BindView(R.id.allow_new_email_accounts) CheckBox mAllowNewEmailAccounts;
@BindView(R.id.require_name) CheckBox mRequireName;
@BindView(R.id.use_auth_emulator) CheckBox mUseEmulator;

@NonNull
public static Intent createIntent(@NonNull Context context) {
Expand Down Expand Up @@ -188,6 +190,17 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
}
});

// useEmulator can't be reversed until the FirebaseApp is cleared, so we make this
// checkbox "sticky" until the app is restarted
mUseEmulator.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
mUseEmulator.setEnabled(false);
}
}
});

if (ConfigurationUtils.isGoogleMisconfigured(this)
|| ConfigurationUtils.isFacebookMisconfigured(this)) {
showSnackbar(R.string.configuration_required);
Expand Down Expand Up @@ -231,9 +244,19 @@ public void signInWithEmailLink(@Nullable String link) {
startActivityForResult(buildSignInIntent(link), RC_SIGN_IN);
}

@NonNull
public AuthUI getAuthUI() {
AuthUI authUI = AuthUI.getInstance();
if (mUseEmulator.isChecked()) {
authUI.useEmulator("10.0.2.2", 9099);
}

return authUI;
}

@NonNull
public Intent buildSignInIntent(@Nullable String link) {
AuthUI.SignInIntentBuilder builder = AuthUI.getInstance().createSignInIntentBuilder()
AuthUI.SignInIntentBuilder builder = getAuthUI().createSignInIntentBuilder()
.setTheme(getSelectedTheme())
.setLogo(getSelectedLogo())
.setAvailableProviders(getSelectedProviders())
Expand Down Expand Up @@ -273,7 +296,7 @@ public Intent buildSignInIntent(@Nullable String link) {

@OnClick(R.id.sign_in_silent)
public void silentSignIn() {
AuthUI.getInstance().silentSignIn(this, getSelectedProviders())
getAuthUI().silentSignIn(this, getSelectedProviders())
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
Expand Down Expand Up @@ -348,8 +371,10 @@ private void startSignedInActivity(@Nullable IdpResponse response) {
public void toggleDarkTheme() {
int mode = mDarkTheme.isChecked() ?
AppCompatDelegate.MODE_NIGHT_YES : AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
AppCompatDelegate.setDefaultNightMode(mode);
getDelegate().setLocalNightMode(mode);
if (Build.VERSION.SDK_INT >= 17) {
AppCompatDelegate.setDefaultNightMode(mode);
getDelegate().setLocalNightMode(mode);
}
}

@StyleRes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.google.firebase.auth.ActionCodeSettings;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import androidx.annotation.NonNull;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,7 @@

</FrameLayout>

<!--
NOTE: This sample app uses this class from the FirebaseUI library to show the Google Sign
in button. However this button is NOT considered part of the public API and you should not
use it in your own app.
-->
<com.firebase.ui.auth.util.ui.SupportVectorDrawablesButton
<Button
android:id="@+id/custom_google_signin_button"
style="@style/FirebaseUI.Button.AccountChooser.GoogleButton"
android:layout_width="wrap_content"
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/res/layout/activity_anonymous_upgrade.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand All @@ -12,13 +12,13 @@
android:orientation="vertical"
tools:context=".auth.AuthUiActivity">

<TextView
<androidx.appcompat.widget.AppCompatTextView
style="@style/Base.TextAppearance.AppCompat.Headline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:drawableTop="@drawable/firebase_auth_120dp"
android:text="@string/title_anonymous_upgrade" />
android:text="@string/title_anonymous_upgrade"
app:drawableTopCompat="@drawable/firebase_auth_120dp" />

<TextView
android:id="@+id/status_text"
Expand Down
7 changes: 1 addition & 6 deletions app/src/main/res/layout/auth_method_picker_custom_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,7 @@

</FrameLayout>

<!--
NOTE: This sample app uses this class from the FirebaseUI library to show the Google Sign
in button. However this button is NOT considered part of the public API and you should not
use it in your own app.
-->
<com.firebase.ui.auth.util.ui.SupportVectorDrawablesButton
<Button
android:id="@+id/custom_google_signin_button"
style="@style/FirebaseUI.Button.AccountChooser.GoogleButton"
android:layout_width="wrap_content"
Expand Down
14 changes: 11 additions & 3 deletions app/src/main/res/layout/auth_ui_layout.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand All @@ -20,13 +21,13 @@
android:orientation="vertical"
android:paddingBottom="32dp">

<TextView
<androidx.appcompat.widget.AppCompatTextView
style="@style/Base.TextAppearance.AppCompat.Headline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:drawableTop="@drawable/firebase_auth_120dp"
android:text="@string/launch_title" />
android:text="@string/launch_title"
app:drawableTopCompat="@drawable/firebase_auth_120dp"/>

<Button
android:id="@+id/sign_in"
Expand Down Expand Up @@ -346,6 +347,13 @@
android:checked="true"
android:text="@string/options_require_name" />

<CheckBox
android:id="@+id/use_auth_emulator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android:text="@string/options_use_auth_emulator" />

</LinearLayout>

</ScrollView>
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/layout/signed_in_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
android:layout_marginBottom="16dp"
android:orientation="vertical">

<TextView
<androidx.appcompat.widget.AppCompatTextView
style="@style/Base.TextAppearance.AppCompat.Headline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:drawableTop="@drawable/firebase_auth_120dp"
android:text="@string/signed_in_header" />
android:text="@string/signed_in_header"
app:drawableTopCompat="@drawable/firebase_auth_120dp" />

<LinearLayout
android:layout_width="wrap_content"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
<string name="options_enable_hint_selector">Enable Smart Lock\'s hint selector</string>
<string name="options_allow_new_email_acccount">Allow new account creation</string>
<string name="options_require_name">Require first/last name with email accounts.</string>
<string name="options_use_auth_emulator">Connect to auth emulator (localhost:9099).</string>

<string name="configuration_required">Configuration required - see README.md</string>
<string name="google_label_missing_config">Google configuration missing</string>
Expand Down
24 changes: 22 additions & 2 deletions auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ and [Web](https://github.com/firebase/firebaseui-web/).
1. [Demo](#demo)
1. [Configuration](#configuration)
1. [Provider config](#identity-provider-configuration)
1. [Auth emulator config](#auth-emulator-configuration)
1. [Usage instructions](#using-firebaseui-for-authentication)
1. [AuthUI sign-in](#authui-sign-in)
1. [Handling responses](#handling-the-sign-in-response)
Expand Down Expand Up @@ -65,11 +66,11 @@ Gradle, add the dependency:
```groovy
dependencies {
// ...
implementation 'com.firebaseui:firebase-ui-auth:6.4.0'
implementation 'com.firebaseui:firebase-ui-auth:7.0.0'
// Required only if Facebook login support is required
// Find the latest Facebook SDK releases here: https://github.com/facebook/facebook-android-sdk/blob/master/CHANGELOG.md
implementation 'com.facebook.android:facebook-login:4.x'
implementation 'com.facebook.android:facebook-login:8.1.0'
}
```

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

### Auth emulator configuration

As of version `7.0.0` FirebaseUI is compatible with the Firebase Authentication emulator:
https://firebase.google.com/docs/emulator-suite

Use the `useEmulator` method to point an AuthUI instance at the emulator:

```java
AuthUI authUI = AuthUI.getInstance();

// "10.0.2.2" is the special host value for contacting "localhost" from within
// the Android Emulator
authUI.useEmulator("10.0.2.2", 9099);
```

By default Android blocks connections to `http://` endpoints such as the Auth emulator.
To allow your app to communicate with the Auth emulator, use a [network security configuration](https://developer.android.com/training/articles/security-config)
or set `android:usesCleartextTraffic="true"` in `AndroidManifest.xml`.

## Using FirebaseUI for authentication

Before invoking the FirebaseUI authentication flow, your app should check
Expand Down
Loading

0 comments on commit aef1d2f

Please sign in to comment.