Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 30 additions & 20 deletions app/src/main/java/com/firebase/uidemo/auth/AuthUiActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -328,20 +328,30 @@ private List<IdpConfig> 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) {
Expand Down
35 changes: 6 additions & 29 deletions app/src/main/res/layout/auth_ui_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -182,53 +182,30 @@
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="8dp"
android:text="@string/tos_header" />
android:text="@string/tos_pp_header" />

<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">

<RadioButton
android:id="@+id/google_tos"
android:id="@+id/google_tos_privacy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/tos_google" />
android:text="@string/tos_pp_google" />

<RadioButton
android:id="@+id/firebase_tos"
android:id="@+id/firebase_tos_privacy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/tos_firebase" />

</RadioGroup>

<TextView
style="@style/Base.TextAppearance.AppCompat.Subhead"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="8dp"
android:text="@string/pp_header" />

<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">

<RadioButton
android:id="@+id/google_privacy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/pp_google" />
android:text="@string/tos_pp_firebase" />

<RadioButton
android:id="@+id/firebase_privacy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pp_firebase" />
android:text="@string/tos_pp_none" />

</RadioGroup>

Expand Down
11 changes: 4 additions & 7 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,10 @@
<string name="logo_google">Google</string>
<string name="logo_none">None</string>

<string name="tos_header">Terms of Service URL</string>
<string name="tos_google">Google</string>
<string name="tos_firebase">Firebase</string>

<string name="pp_header">Privacy Policy URL</string>
<string name="pp_google">Google</string>
<string name="pp_firebase">Firebase</string>
<string name="tos_pp_header">Terms of Service and Privacy Policy</string>
<string name="tos_pp_google">Google</string>
<string name="tos_pp_firebase">Firebase</string>
<string name="tos_pp_none">None</string>

<string name="google_scopes_header">Example extra Google scopes</string>
<string name="google_scope_drive_file">Drive File</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<IdpConfig> providerConfigs,
Expand Down
23 changes: 18 additions & 5 deletions auth/src/main/res/layout-land/fui_auth_method_picker_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,22 @@
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />

<!-- TODO remove lint ignore once the bug is fixed:
https://issuetracker.google.com/issues/38281866-->
<ImageView
android:id="@+id/logo"
style="@style/FirebaseUI.AuthMethodPicker.Logo"
android:layout_marginTop="@dimen/fui_field_padding_vert"
android:layout_marginBottom="@dimen/fui_field_padding_vert"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@+id/container"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@+id/main_tos_and_pp"
tools:ignore="ContentDescription" /> <!-- TODO remove once the bug is fixed: https://issuetracker.google.com/issues/38281866-->
app:layout_constraintVertical_weight="2"
tools:background="#bfbfbf"
tools:ignore="ContentDescription"
tools:layout_height="100dp"
tools:layout_width="100dp" />

<TextView
android:id="@+id/main_tos_and_pp"
Expand All @@ -31,20 +39,23 @@
android:layout_height="0dp"
android:layout_marginLeft="@dimen/fui_wrapper_padding_horiz"
android:layout_marginRight="@dimen/fui_wrapper_padding_horiz"
android:layout_marginTop="@dimen/fui_field_padding_vert"
android:layout_marginBottom="@dimen/fui_field_padding_vert"
android:gravity="center"
android:textColor="?android:attr/textColorTertiary"
android:textIsSelectable="false"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@+id/container"
app:layout_constraintTop_toBottomOf="@+id/logo"
app:layout_constraintBottom_toBottomOf="parent" />
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" />

<ScrollView
android:id="@+id/container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="0dp"
android:layout_marginTop="@dimen/fui_field_padding_vert"
android:layout_marginBottom="@dimen/fui_field_padding_vert"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
Expand All @@ -53,7 +64,9 @@

<LinearLayout
android:id="@+id/btn_holder"
style="@style/FirebaseUI.AuthMethodPicker.ButtonHolder" />
style="@style/FirebaseUI.AuthMethodPicker.ButtonHolder"
tools:background="#bfbfbf"
tools:layout_height="250dp" />

</ScrollView>

Expand Down
20 changes: 16 additions & 4 deletions auth/src/main/res/layout/fui_auth_method_picker_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />

<!-- TODO remove lint ignore once the bug is fixed:
https://issuetracker.google.com/issues/38281866-->
<ImageView
android:id="@+id/logo"
style="@style/FirebaseUI.AuthMethodPicker.Logo"
Expand All @@ -24,12 +26,16 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@+id/container"
app:layout_constraintVertical_weight="1"
tools:ignore="ContentDescription" /> <!-- TODO remove once the bug is fixed: https://issuetracker.google.com/issues/38281866-->
tools:background="#bfbfbf"
tools:ignore="ContentDescription"
tools:layout_height="100dp"
tools:layout_width="100dp" />

<ScrollView
android:id="@+id/container"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginBottom="@dimen/fui_field_padding_vert"
android:fillViewport="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Expand All @@ -40,7 +46,9 @@
<LinearLayout
android:id="@+id/btn_holder"
style="@style/FirebaseUI.AuthMethodPicker.ButtonHolder"
android:gravity="bottom" />
android:gravity="bottom"
tools:background="#bfbfbf"
tools:layout_height="250dp" />

</ScrollView>

Expand All @@ -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" />

</android.support.constraint.ConstraintLayout>
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down