diff --git a/app/src/main/java/com/firebase/uidemo/auth/AuthUiActivity.java b/app/src/main/java/com/firebase/uidemo/auth/AuthUiActivity.java index 0b18950ce..a6efd38f6 100644 --- a/app/src/main/java/com/firebase/uidemo/auth/AuthUiActivity.java +++ b/app/src/main/java/com/firebase/uidemo/auth/AuthUiActivity.java @@ -81,11 +81,8 @@ public class AuthUiActivity extends AppCompatActivity { @BindView(R.id.google_logo) RadioButton mGoogleLogo; @BindView(R.id.no_logo) RadioButton mNoLogo; - @BindView(R.id.google_tos) RadioButton mUseGoogleTos; - @BindView(R.id.firebase_tos) RadioButton mUseFirebaseTos; - - @BindView(R.id.google_privacy) RadioButton mUseGooglePrivacyPolicy; - @BindView(R.id.firebase_privacy) RadioButton mUseFirebasePrivacyPolicy; + @BindView(R.id.google_tos_privacy) RadioButton mUseGoogleTosPp; + @BindView(R.id.firebase_tos_privacy) RadioButton mUseFirebaseTosPp; @BindView(R.id.google_scopes_header) TextView mGoogleScopesHeader; @BindView(R.id.google_scope_drive_file) CheckBox mGoogleScopeDriveFile; @@ -180,17 +177,20 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @OnClick(R.id.sign_in) public void signIn() { - startActivityForResult( - AuthUI.getInstance().createSignInIntentBuilder() - .setTheme(getSelectedTheme()) - .setLogo(getSelectedLogo()) - .setAvailableProviders(getSelectedProviders()) - .setTosAndPrivacyPolicyUrls(getSelectedTosUrl(), - getSelectedPrivacyPolicyUrl()) - .setIsSmartLockEnabled(mEnableCredentialSelector.isChecked(), - mEnableHintSelector.isChecked()) - .build(), - RC_SIGN_IN); + AuthUI.SignInIntentBuilder builder = AuthUI.getInstance().createSignInIntentBuilder() + .setTheme(getSelectedTheme()) + .setLogo(getSelectedLogo()) + .setAvailableProviders(getSelectedProviders()) + .setIsSmartLockEnabled(mEnableCredentialSelector.isChecked(), + mEnableHintSelector.isChecked()); + + if (getSelectedTosUrl() != null && getSelectedPrivacyPolicyUrl() != null) { + builder.setTosAndPrivacyPolicyUrls( + getSelectedTosUrl(), + getSelectedPrivacyPolicyUrl()); + } + + startActivityForResult(builder.build(), RC_SIGN_IN); } @OnClick(R.id.sign_in_silent) @@ -328,20 +328,30 @@ private List getSelectedProviders() { return selectedProviders; } + @Nullable private String getSelectedTosUrl() { - if (mUseGoogleTos.isChecked()) { + if (mUseGoogleTosPp.isChecked()) { return GOOGLE_TOS_URL; } - return FIREBASE_TOS_URL; + if (mUseFirebaseTosPp.isChecked()) { + return FIREBASE_TOS_URL; + } + + return null; } + @Nullable private String getSelectedPrivacyPolicyUrl() { - if (mUseGooglePrivacyPolicy.isChecked()) { + if (mUseGoogleTosPp.isChecked()) { return GOOGLE_PRIVACY_POLICY_URL; } - return FIREBASE_PRIVACY_POLICY_URL; + if (mUseFirebaseTosPp.isChecked()) { + return FIREBASE_PRIVACY_POLICY_URL; + } + + return null; } private void setGoogleScopesEnabled(boolean enabled) { diff --git a/app/src/main/res/layout/auth_ui_layout.xml b/app/src/main/res/layout/auth_ui_layout.xml index c16c150d1..6f99974a0 100644 --- a/app/src/main/res/layout/auth_ui_layout.xml +++ b/app/src/main/res/layout/auth_ui_layout.xml @@ -182,7 +182,7 @@ android:layout_height="wrap_content" android:layout_marginTop="16dp" android:layout_marginBottom="8dp" - android:text="@string/tos_header" /> + android:text="@string/tos_pp_header" /> + android:text="@string/tos_pp_google" /> - - - - - - - - + android:text="@string/tos_pp_firebase" /> + android:text="@string/tos_pp_none" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c500e7614..7900a7013 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -40,13 +40,10 @@ Google None - Terms of Service URL - Google - Firebase - - Privacy Policy URL - Google - Firebase + Terms of Service and Privacy Policy + Google + Firebase + None Example extra Google scopes Drive File diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/idp/AuthMethodPickerActivity.java b/auth/src/main/java/com/firebase/ui/auth/ui/idp/AuthMethodPickerActivity.java index 3ed8b5553..1bc7d4444 100644 --- a/auth/src/main/java/com/firebase/ui/auth/ui/idp/AuthMethodPickerActivity.java +++ b/auth/src/main/java/com/firebase/ui/auth/ui/idp/AuthMethodPickerActivity.java @@ -132,6 +132,12 @@ protected void onFailure(@NonNull Exception e) { PrivacyDisclosureUtils.setupTermsOfServiceAndPrivacyPolicyText(this, getFlowParams(), termsText); + + // No ToS or PP provided, so we should hide the view entirely + if (!getFlowParams().isPrivacyPolicyUrlProvided() && + !getFlowParams().isTermsOfServiceUrlProvided()) { + termsText.setVisibility(View.GONE); + } } private void populateIdpList(List providerConfigs, diff --git a/auth/src/main/res/layout-land/fui_auth_method_picker_layout.xml b/auth/src/main/res/layout-land/fui_auth_method_picker_layout.xml index 646d3cbda..8b2c4fcb4 100644 --- a/auth/src/main/res/layout-land/fui_auth_method_picker_layout.xml +++ b/auth/src/main/res/layout-land/fui_auth_method_picker_layout.xml @@ -15,14 +15,22 @@ app:layout_constraintTop_toTopOf="parent" tools:visibility="visible" /> + + app:layout_constraintVertical_weight="2" + tools:background="#bfbfbf" + tools:ignore="ContentDescription" + tools:layout_height="100dp" + tools:layout_width="100dp" /> + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintVertical_weight="1" + tools:text="By continuing you are indicating that you accept our Terms of Service and Privacy Policy" /> + style="@style/FirebaseUI.AuthMethodPicker.ButtonHolder" + tools:background="#bfbfbf" + tools:layout_height="250dp" /> diff --git a/auth/src/main/res/layout/fui_auth_method_picker_layout.xml b/auth/src/main/res/layout/fui_auth_method_picker_layout.xml index e5d558340..4bac31ba1 100644 --- a/auth/src/main/res/layout/fui_auth_method_picker_layout.xml +++ b/auth/src/main/res/layout/fui_auth_method_picker_layout.xml @@ -14,6 +14,8 @@ app:layout_constraintTop_toTopOf="parent" tools:visibility="visible" /> + + tools:background="#bfbfbf" + tools:ignore="ContentDescription" + tools:layout_height="100dp" + tools:layout_width="100dp" /> + android:gravity="bottom" + tools:background="#bfbfbf" + tools:layout_height="250dp" /> @@ -49,12 +57,16 @@ style="@style/FirebaseUI.Text.BodyText" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/fui_field_padding_vert" + android:paddingStart="8dp" + android:paddingEnd="8dp" android:layout_marginBottom="@dimen/fui_field_padding_vert" android:gravity="center" android:textColor="?android:textColorTertiary" android:textIsSelectable="true" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@+id/container" - app:layout_constraintBottom_toBottomOf="parent" /> + app:layout_constraintBottom_toBottomOf="parent" + tools:text="By continuing you are indicating that you accept our Terms of Service and Privacy Policy" /> diff --git a/buildSrc/src/main/kotlin/Config.kt b/buildSrc/src/main/kotlin/Config.kt index 6c422af83..fcab639e5 100644 --- a/buildSrc/src/main/kotlin/Config.kt +++ b/buildSrc/src/main/kotlin/Config.kt @@ -11,7 +11,7 @@ object Config { } object Plugins { - const val android = "com.android.tools.build:gradle:3.2.0-rc03" + const val android = "com.android.tools.build:gradle:3.2.0" const val kotlin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" const val google = "com.google.gms:google-services:4.0.2"