Skip to content

Commit aa447a6

Browse files
authored
Version 4.2.1
2 parents df657cd + a2d1846 commit aa447a6

30 files changed

+253
-110
lines changed

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ android:
2525
before_script:
2626
- cp library/google-services.json app/google-services.json
2727
- cp library/google-services.json proguard-tests/google-services.json
28-
script: ./gradlew clean assembleDebug proguard-tests:build check
28+
script:
29+
- ./gradlew clean
30+
- ./gradlew assembleDebug proguard-tests:build check
2931
after_success: ./scripts/artifactory.sh
3032
after_failure:
3133
# tests

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,19 @@ libraries.
5050
```groovy
5151
dependencies {
5252
// FirebaseUI for Firebase Realtime Database
53-
implementation 'com.firebaseui:firebase-ui-database:4.2.0'
53+
implementation 'com.firebaseui:firebase-ui-database:4.2.1'
5454
5555
// FirebaseUI for Cloud Firestore
56-
implementation 'com.firebaseui:firebase-ui-firestore:4.2.0'
56+
implementation 'com.firebaseui:firebase-ui-firestore:4.2.1'
5757
5858
// FirebaseUI for Firebase Auth
59-
implementation 'com.firebaseui:firebase-ui-auth:4.2.0'
59+
implementation 'com.firebaseui:firebase-ui-auth:4.2.1'
6060
6161
// FirebaseUI for Firebase Auth (GitHub provider)
62-
implementation 'com.firebaseui:firebase-ui-auth-github:4.2.0'
62+
implementation 'com.firebaseui:firebase-ui-auth-github:4.2.1'
6363
6464
// FirebaseUI for Cloud Storage
65-
implementation 'com.firebaseui:firebase-ui-storage:4.2.0'
65+
implementation 'com.firebaseui:firebase-ui-storage:4.2.1'
6666
}
6767
```
6868

@@ -105,15 +105,15 @@ versions. This means that FirebaseUI has independent dependencies on each of the
105105
For best results, your app should depend on a version of each dependency with the same major
106106
version number as the version used by FirebaseUI.
107107

108-
As of version `4.2.0`, FirebaseUI has the following dependency versions:
108+
As of version `4.2.1`, FirebaseUI has the following dependency versions:
109109

110110
| Library | Version |
111111
|----------------------|--------------------------------|
112-
| `firebase-auth` | 16.0.3 |
113-
| `play-services-auth` | 16.0.0 |
114-
| `firebase-database` | 16.0.2 |
115-
| `firebase-firestore` | 17.1.0 |
116-
| `firebase-storage` | 16.0.2 |
112+
| `firebase-auth` | 16.0.5 |
113+
| `play-services-auth` | 16.0.1 |
114+
| `firebase-database` | 16.0.3 |
115+
| `firebase-firestore` | 17.1.1 |
116+
| `firebase-storage` | 16.0.3 |
117117

118118
### Upgrading dependencies
119119

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

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,8 @@ public class AuthUiActivity extends AppCompatActivity {
8181
@BindView(R.id.google_logo) RadioButton mGoogleLogo;
8282
@BindView(R.id.no_logo) RadioButton mNoLogo;
8383

84-
@BindView(R.id.google_tos) RadioButton mUseGoogleTos;
85-
@BindView(R.id.firebase_tos) RadioButton mUseFirebaseTos;
86-
87-
@BindView(R.id.google_privacy) RadioButton mUseGooglePrivacyPolicy;
88-
@BindView(R.id.firebase_privacy) RadioButton mUseFirebasePrivacyPolicy;
84+
@BindView(R.id.google_tos_privacy) RadioButton mUseGoogleTosPp;
85+
@BindView(R.id.firebase_tos_privacy) RadioButton mUseFirebaseTosPp;
8986

9087
@BindView(R.id.google_scopes_header) TextView mGoogleScopesHeader;
9188
@BindView(R.id.google_scope_drive_file) CheckBox mGoogleScopeDriveFile;
@@ -180,17 +177,20 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
180177

181178
@OnClick(R.id.sign_in)
182179
public void signIn() {
183-
startActivityForResult(
184-
AuthUI.getInstance().createSignInIntentBuilder()
185-
.setTheme(getSelectedTheme())
186-
.setLogo(getSelectedLogo())
187-
.setAvailableProviders(getSelectedProviders())
188-
.setTosAndPrivacyPolicyUrls(getSelectedTosUrl(),
189-
getSelectedPrivacyPolicyUrl())
190-
.setIsSmartLockEnabled(mEnableCredentialSelector.isChecked(),
191-
mEnableHintSelector.isChecked())
192-
.build(),
193-
RC_SIGN_IN);
180+
AuthUI.SignInIntentBuilder builder = AuthUI.getInstance().createSignInIntentBuilder()
181+
.setTheme(getSelectedTheme())
182+
.setLogo(getSelectedLogo())
183+
.setAvailableProviders(getSelectedProviders())
184+
.setIsSmartLockEnabled(mEnableCredentialSelector.isChecked(),
185+
mEnableHintSelector.isChecked());
186+
187+
if (getSelectedTosUrl() != null && getSelectedPrivacyPolicyUrl() != null) {
188+
builder.setTosAndPrivacyPolicyUrls(
189+
getSelectedTosUrl(),
190+
getSelectedPrivacyPolicyUrl());
191+
}
192+
193+
startActivityForResult(builder.build(), RC_SIGN_IN);
194194
}
195195

196196
@OnClick(R.id.sign_in_silent)
@@ -328,20 +328,30 @@ private List<IdpConfig> getSelectedProviders() {
328328
return selectedProviders;
329329
}
330330

331+
@Nullable
331332
private String getSelectedTosUrl() {
332-
if (mUseGoogleTos.isChecked()) {
333+
if (mUseGoogleTosPp.isChecked()) {
333334
return GOOGLE_TOS_URL;
334335
}
335336

336-
return FIREBASE_TOS_URL;
337+
if (mUseFirebaseTosPp.isChecked()) {
338+
return FIREBASE_TOS_URL;
339+
}
340+
341+
return null;
337342
}
338343

344+
@Nullable
339345
private String getSelectedPrivacyPolicyUrl() {
340-
if (mUseGooglePrivacyPolicy.isChecked()) {
346+
if (mUseGoogleTosPp.isChecked()) {
341347
return GOOGLE_PRIVACY_POLICY_URL;
342348
}
343349

344-
return FIREBASE_PRIVACY_POLICY_URL;
350+
if (mUseFirebaseTosPp.isChecked()) {
351+
return FIREBASE_PRIVACY_POLICY_URL;
352+
}
353+
354+
return null;
345355
}
346356

347357
private void setGoogleScopesEnabled(boolean enabled) {

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

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -182,53 +182,30 @@
182182
android:layout_height="wrap_content"
183183
android:layout_marginTop="16dp"
184184
android:layout_marginBottom="8dp"
185-
android:text="@string/tos_header" />
185+
android:text="@string/tos_pp_header" />
186186

187187
<RadioGroup
188188
android:layout_width="wrap_content"
189189
android:layout_height="wrap_content"
190190
android:orientation="vertical">
191191

192192
<RadioButton
193-
android:id="@+id/google_tos"
193+
android:id="@+id/google_tos_privacy"
194194
android:layout_width="wrap_content"
195195
android:layout_height="wrap_content"
196196
android:checked="true"
197-
android:text="@string/tos_google" />
197+
android:text="@string/tos_pp_google" />
198198

199199
<RadioButton
200-
android:id="@+id/firebase_tos"
200+
android:id="@+id/firebase_tos_privacy"
201201
android:layout_width="wrap_content"
202202
android:layout_height="wrap_content"
203-
android:text="@string/tos_firebase" />
204-
205-
</RadioGroup>
206-
207-
<TextView
208-
style="@style/Base.TextAppearance.AppCompat.Subhead"
209-
android:layout_width="wrap_content"
210-
android:layout_height="wrap_content"
211-
android:layout_marginTop="16dp"
212-
android:layout_marginBottom="8dp"
213-
android:text="@string/pp_header" />
214-
215-
<RadioGroup
216-
android:layout_width="wrap_content"
217-
android:layout_height="wrap_content"
218-
android:orientation="vertical">
219-
220-
<RadioButton
221-
android:id="@+id/google_privacy"
222-
android:layout_width="wrap_content"
223-
android:layout_height="wrap_content"
224-
android:checked="true"
225-
android:text="@string/pp_google" />
203+
android:text="@string/tos_pp_firebase" />
226204

227205
<RadioButton
228-
android:id="@+id/firebase_privacy"
229206
android:layout_width="wrap_content"
230207
android:layout_height="wrap_content"
231-
android:text="@string/pp_firebase" />
208+
android:text="@string/tos_pp_none" />
232209

233210
</RadioGroup>
234211

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,10 @@
4040
<string name="logo_google">Google</string>
4141
<string name="logo_none">None</string>
4242

43-
<string name="tos_header">Terms of Service URL</string>
44-
<string name="tos_google">Google</string>
45-
<string name="tos_firebase">Firebase</string>
46-
47-
<string name="pp_header">Privacy Policy URL</string>
48-
<string name="pp_google">Google</string>
49-
<string name="pp_firebase">Firebase</string>
43+
<string name="tos_pp_header">Terms of Service and Privacy Policy</string>
44+
<string name="tos_pp_google">Google</string>
45+
<string name="tos_pp_firebase">Firebase</string>
46+
<string name="tos_pp_none">None</string>
5047

5148
<string name="google_scopes_header">Example extra Google scopes</string>
5249
<string name="google_scope_drive_file">Drive File</string>

auth-github/build.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
android {
2+
lintOptions {
3+
disable("UnknownNullness") // TODO fix in future PR
4+
}
5+
}
6+
17
dependencies {
28
compileOnly(project(":auth")) { isTransitive = false }
39
compileOnly(Config.Libs.Firebase.auth) { isTransitive = false }

auth/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ Gradle, add the dependency:
6565
```groovy
6666
dependencies {
6767
// ...
68-
implementation 'com.firebaseui:firebase-ui-auth:4.2.0'
68+
implementation 'com.firebaseui:firebase-ui-auth:4.2.1'
6969
7070
// Required only if GitHub OAuth support is required
71-
implementation 'com.firebaseui:firebase-ui-auth-github:4.2.0'
71+
implementation 'com.firebaseui:firebase-ui-auth-github:4.2.1'
7272
7373
// Required only if Facebook login support is required
7474
// Find the latest Facebook SDK releases here: https://goo.gl/Ce5L94

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,7 @@ private abstract class AuthIntentBuilder<T extends AuthIntentBuilder> {
10251025
final List<IdpConfig> mProviders = new ArrayList<>();
10261026
String mTosUrl;
10271027
String mPrivacyPolicyUrl;
1028+
boolean mAlwaysShowProviderChoice = false;
10281029
boolean mEnableCredentials = true;
10291030
boolean mEnableHints = true;
10301031

@@ -1156,6 +1157,19 @@ public T setIsSmartLockEnabled(boolean enableCredentials, boolean enableHints) {
11561157
return (T) this;
11571158
}
11581159

1160+
/**
1161+
* Forces the sign-in method choice screen to always show, even if there is only
1162+
* a single provider configured.
1163+
* <p>
1164+
* <p>This is false by default.
1165+
* @param alwaysShow if true, force the sign-in choice screen to show.
1166+
*/
1167+
@NonNull
1168+
public T setAlwaysShowSignInMethodScreen(boolean alwaysShow) {
1169+
mAlwaysShowProviderChoice = alwaysShow;
1170+
return (T) this;
1171+
}
1172+
11591173
@CallSuper
11601174
@NonNull
11611175
public Intent build() {
@@ -1201,7 +1215,8 @@ protected FlowParameters getFlowParams() {
12011215
mPrivacyPolicyUrl,
12021216
mEnableCredentials,
12031217
mEnableHints,
1204-
mEnableAnonymousUpgrade);
1218+
mEnableAnonymousUpgrade,
1219+
mAlwaysShowProviderChoice);
12051220
}
12061221
}
12071222
}

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public class FlowParameters implements Parcelable {
5757
public final boolean enableCredentials;
5858
public final boolean enableHints;
5959
public final boolean enableAnonymousUpgrade;
60+
public final boolean alwaysShowProviderChoice;
6061

6162
public FlowParameters(
6263
@NonNull String appName,
@@ -67,7 +68,8 @@ public FlowParameters(
6768
@Nullable String privacyPolicyUrl,
6869
boolean enableCredentials,
6970
boolean enableHints,
70-
boolean enableAnonymousUpgrade) {
71+
boolean enableAnonymousUpgrade,
72+
boolean alwaysShowProviderChoice) {
7173
this.appName = Preconditions.checkNotNull(appName, "appName cannot be null");
7274
this.providers = Collections.unmodifiableList(
7375
Preconditions.checkNotNull(providers, "providers cannot be null"));
@@ -78,6 +80,7 @@ public FlowParameters(
7880
this.enableCredentials = enableCredentials;
7981
this.enableHints = enableHints;
8082
this.enableAnonymousUpgrade = enableAnonymousUpgrade;
83+
this.alwaysShowProviderChoice = alwaysShowProviderChoice;
8184
}
8285

8386
/**
@@ -98,6 +101,7 @@ public void writeToParcel(Parcel dest, int flags) {
98101
dest.writeInt(enableCredentials ? 1 : 0);
99102
dest.writeInt(enableHints ? 1 : 0);
100103
dest.writeInt(enableAnonymousUpgrade ? 1 : 0);
104+
dest.writeInt(alwaysShowProviderChoice ? 1 : 0);
101105
}
102106

103107
@Override
@@ -117,6 +121,7 @@ public FlowParameters createFromParcel(Parcel in) {
117121
boolean enableCredentials = in.readInt() != 0;
118122
boolean enableHints = in.readInt() != 0;
119123
boolean enableAnonymousUpgrade = in.readInt() != 0;
124+
boolean alwaysShowProviderChoice = in.readInt() != 0;
120125

121126
return new FlowParameters(
122127
appName,
@@ -127,7 +132,8 @@ public FlowParameters createFromParcel(Parcel in) {
127132
privacyPolicyUrl,
128133
enableCredentials,
129134
enableHints,
130-
enableAnonymousUpgrade);
135+
enableAnonymousUpgrade,
136+
alwaysShowProviderChoice);
131137
}
132138

133139
@Override
@@ -151,4 +157,8 @@ public boolean isPrivacyPolicyUrlProvided() {
151157
public boolean isAnonymousUpgradeEnabled() {
152158
return enableAnonymousUpgrade;
153159
}
160+
161+
public boolean shouldShowProviderChoice() {
162+
return !isSingleProviderFlow() || alwaysShowProviderChoice;
163+
}
154164
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public void onComplete(@NonNull Task<CredentialRequestResponse> task) {
9696

9797
private void startAuthMethodChoice() {
9898
// If there is only one provider selected, launch the flow directly
99-
if (getArguments().isSingleProviderFlow()) {
99+
if (!getArguments().shouldShowProviderChoice()) {
100100
AuthUI.IdpConfig firstIdpConfig = getArguments().providers.get(0);
101101
String firstProvider = firstIdpConfig.getProviderId();
102102
switch (firstProvider) {

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import android.support.annotation.RestrictTo;
99
import android.support.v7.app.AppCompatActivity;
1010

11+
import com.firebase.ui.auth.AuthUI;
1112
import com.firebase.ui.auth.ErrorCodes;
1213
import com.firebase.ui.auth.IdpResponse;
1314
import com.firebase.ui.auth.data.model.FlowParameters;
@@ -29,11 +30,13 @@ protected static Intent createBaseIntent(
2930
@NonNull Context context,
3031
@NonNull Class<? extends Activity> target,
3132
@NonNull FlowParameters flowParams) {
32-
return new Intent(
33+
Intent intent = new Intent(
3334
checkNotNull(context, "context cannot be null"),
3435
checkNotNull(target, "target activity cannot be null"))
3536
.putExtra(ExtraConstants.FLOW_PARAMS,
3637
checkNotNull(flowParams, "flowParams cannot be null"));
38+
intent.setExtrasClassLoader(AuthUI.class.getClassLoader());
39+
return intent;
3740
}
3841

3942
@Override

auth/src/main/java/com/firebase/ui/auth/ui/email/CheckEmailFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
113113
TextView footerText = view.findViewById(R.id.email_footer_tos_and_pp_text);
114114
FlowParameters flowParameters = getFlowParams();
115115

116-
if (flowParameters.isSingleProviderFlow()) {
116+
if (!flowParameters.shouldShowProviderChoice()) {
117117
PrivacyDisclosureUtils.setupTermsOfServiceAndPrivacyPolicyText(requireContext(),
118118
flowParameters,
119119
termsText);

auth/src/main/java/com/firebase/ui/auth/ui/idp/AuthMethodPickerActivity.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ protected void onFailure(@NonNull Exception e) {
132132
PrivacyDisclosureUtils.setupTermsOfServiceAndPrivacyPolicyText(this,
133133
getFlowParams(),
134134
termsText);
135+
136+
// No ToS or PP provided, so we should hide the view entirely
137+
if (!getFlowParams().isPrivacyPolicyUrlProvided() &&
138+
!getFlowParams().isTermsOfServiceUrlProvided()) {
139+
termsText.setVisibility(View.GONE);
140+
}
135141
}
136142

137143
private void populateIdpList(List<IdpConfig> providerConfigs,

0 commit comments

Comments
 (0)