|
| 1 | +# Upgrading to FirebaseUI 8.0 |
| 2 | + |
| 3 | +FirebaseUI version `8.0.0` has significant breaking API changes and also adopts new major versions of many critical dependencies. Below is a description of each breaking change. |
| 4 | + |
| 5 | +## All - Update to Java 8.0 and Android Gradle Plugin 7.0 |
| 6 | + |
| 7 | +In order to use FirebaseUI v8.0 or higher your app must use Java 8.0 language featuresa and version 7.x of the Android Gradle Plugin. |
| 8 | + |
| 9 | +### Java 8 |
| 10 | + |
| 11 | +Add the following to your app's `build.gradle` |
| 12 | + |
| 13 | +```groovy |
| 14 | +android { |
| 15 | + ... |
| 16 | + // Configure only for each module that uses Java 8 |
| 17 | + // language features (either in its source code or |
| 18 | + // through dependencies). |
| 19 | + compileOptions { |
| 20 | + sourceCompatibility JavaVersion.VERSION_1_8 |
| 21 | + targetCompatibility JavaVersion.VERSION_1_8 |
| 22 | + } |
| 23 | + // For Kotlin projects |
| 24 | + kotlinOptions { |
| 25 | + jvmTarget = "1.8" |
| 26 | + } |
| 27 | +} |
| 28 | +``` |
| 29 | + |
| 30 | +For more information on using Java 8 language features in your app, see the [Android documentation](https://developer.android.com/studio/write/java8-support). |
| 31 | + |
| 32 | +### AGP 7 |
| 33 | + |
| 34 | +In your root `build.gradle` file make sure you are using AGP 7 or higher: |
| 35 | + |
| 36 | +```groovy |
| 37 | +buildscript { |
| 38 | + // ... |
| 39 | + dependencies { |
| 40 | + // ... |
| 41 | + classpath 'com.android.tools.build:gradle:7.0.0' |
| 42 | + } |
| 43 | +} |
| 44 | +``` |
| 45 | + |
| 46 | +This will require installing Gradle 7 and JDK 11 on your machine. For more information on this relase see the [Android documentation](https://developer.android.com/studio/releases/gradle-plugin?buildsystem=ndk-build#7-0-0). |
| 47 | + |
| 48 | +## All - Update to Firebase BOM 28 |
| 49 | + |
| 50 | +FirebaseUI now depends on the Firebase SDK at BOM major version `28.0.0`. You should update your app to use the same major version to avoid possible compilation errors or crashes. |
| 51 | + |
| 52 | +For more information on this SDK release see the [Firebase Android SDK release notes](https://firebase.google.com/support/release-notes/android#bom_v28-0-0). |
| 53 | + |
| 54 | +## Auth - Transition to Material Compnents |
| 55 | + |
| 56 | +FirebaseUI Authentication now depends on the Material Design UI components rather than the older AppCompat components. This will require two breaking changes for existing users: |
| 57 | + |
| 58 | +First, you must define a theme with the following minimal properties: |
| 59 | + |
| 60 | + * `colorPrimary` |
| 61 | + * `colorPrimaryVariant` |
| 62 | + * `colorAccent` |
| 63 | + * `android:statusBarColor` (API > 21) or `colorPrimaryDark` (API < 21) |
| 64 | + |
| 65 | +Second, you must explicitly pass a reference to this theme when starting FirebaseUI using `setTheme()`: |
| 66 | + |
| 67 | +```java |
| 68 | +Intent signInIntent = |
| 69 | + AuthUI.getInstance(this).createSignInIntentBuilder() |
| 70 | + // ... |
| 71 | + .setTheme(R.style.AppTheme) |
| 72 | + .build()) |
| 73 | +``` |
| 74 | + |
| 75 | +For more information on how to build a Material theme, see the [Material Design documentation](https://material.io/resources/build-a-material-theme). |
| 76 | + |
| 77 | +## Auth - Remove offensive terms |
| 78 | + |
| 79 | +The offensive terms "whitelist" and "blacklist" have been removed from the FirebaseUI public API. Specifically the `IdpConfig.PhoneBuilder` class has changed: |
| 80 | + |
| 81 | +**Before** |
| 82 | +```java |
| 83 | +IdpConfig phoneConfigWithAllowedCountries = new IdpConfig.PhoneBuilder() |
| 84 | + .setWhitelistedCountries(allowedCountries) |
| 85 | + .build(); |
| 86 | + |
| 87 | +IdpConfig phoneConfigWithBlockedCountries = new IdpConfig.PhoneBuilder() |
| 88 | + .setBlacklistedCountries(blockedCountries) |
| 89 | + .build(); |
| 90 | +``` |
| 91 | + |
| 92 | +**After** |
| 93 | +```java |
| 94 | +IdpConfig phoneConfigWithAllowedCountries = new IdpConfig.PhoneBuilder() |
| 95 | + .setAllowedCountries(allowedCountries) |
| 96 | + .build(); |
| 97 | + |
| 98 | +IdpConfig phoneConfigWithBlockedCountries = new IdpConfig.PhoneBuilder() |
| 99 | + .setBlockedCountries(blockedCountries) |
| 100 | + .build(); |
| 101 | +``` |
| 102 | + |
| 103 | +## Firestore - Upgrade to AndroidX Paging 3 |
| 104 | + |
| 105 | +The `FirestorePagingAdapter` class now depends on AndroidX Paging version 3, which has a new API. |
| 106 | + |
| 107 | +To see the new FirebaseUI API, see the [firestore/README.md](../firestore/README.md) file for an example. |
| 108 | + |
| 109 | +For general information on upgrading your app to Paging 3, see [the Android documentation](https://developer.android.com/topic/libraries/architecture/paging/v3-migration). |
| 110 | + |
| 111 | +## Database - Upgrade to AndroidX PAging 3 |
| 112 | + |
| 113 | +The `FirebaseRecyclerPagingAdapter` class now depends on AndroidX Paging version 3, which has a new API. |
| 114 | + |
| 115 | +To see the new FirebaseUI API, see the [database/README.md](../database/README.md) file for an example. |
| 116 | + |
| 117 | +For general information on upgrading your app to Paging 3, see [the Android documentation](https://developer.android.com/topic/libraries/architecture/paging/v3-migration). |
0 commit comments