Skip to content

Commit cb92c8f

Browse files
committed
Update app sample to include privacy policy URL option
1 parent cde044f commit cb92c8f

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public class AuthUiActivity extends AppCompatActivity {
5252
private static final String UNCHANGED_CONFIG_VALUE = "CHANGE-ME";
5353
private static final String GOOGLE_TOS_URL = "https://www.google.com/policies/terms/";
5454
private static final String FIREBASE_TOS_URL = "https://firebase.google.com/terms/";
55+
private static final String GOOGLE_PRIVACY_POLICY_URL = "https://www.google.com/policies/privacy/";
5556
private static final int RC_SIGN_IN = 100;
5657

5758
@BindView(R.id.default_theme)
@@ -84,6 +85,9 @@ public class AuthUiActivity extends AppCompatActivity {
8485
@BindView(R.id.firebase_tos)
8586
RadioButton mUseFirebaseTos;
8687

88+
@BindView(R.id.google_privacy)
89+
RadioButton mUseGooglePrivacyPolicy;
90+
8791
@BindView(R.id.sign_in)
8892
Button mSignIn;
8993

@@ -185,6 +189,7 @@ public void signIn(View view) {
185189
.setLogo(getSelectedLogo())
186190
.setAvailableProviders(getSelectedProviders())
187191
.setTosUrl(getSelectedTosUrl())
192+
.setPrivacyPolicyUrl(getSelectedPrivacyPolicyUrl())
188193
.setIsSmartLockEnabled(mEnableSmartLock.isChecked())
189194
.setAllowNewEmailAccounts(mAllowNewEmailAccounts.isChecked())
190195
.build(),
@@ -327,6 +332,15 @@ private String getSelectedTosUrl() {
327332
return FIREBASE_TOS_URL;
328333
}
329334

335+
@MainThread
336+
private String getSelectedPrivacyPolicyUrl() {
337+
if (mUseGooglePrivacyPolicy.isChecked()) {
338+
return GOOGLE_PRIVACY_POLICY_URL;
339+
}
340+
341+
return GOOGLE_PRIVACY_POLICY_URL;
342+
}
343+
330344
@MainThread
331345
private boolean isGoogleConfigured() {
332346
return !UNCHANGED_CONFIG_VALUE.equals(

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,28 @@
140140

141141
</RadioGroup>
142142

143+
<TextView
144+
style="@style/Base.TextAppearance.AppCompat.Subhead"
145+
android:layout_width="wrap_content"
146+
android:layout_height="wrap_content"
147+
android:layout_marginBottom="8dp"
148+
android:layout_marginTop="16dp"
149+
android:text="@string/privacy_policy_header"/>
150+
151+
<RadioGroup
152+
android:layout_width="wrap_content"
153+
android:layout_height="wrap_content"
154+
android:orientation="vertical">
155+
156+
<RadioButton
157+
android:id="@+id/google_privacy"
158+
android:layout_width="wrap_content"
159+
android:layout_height="wrap_content"
160+
android:checked="true"
161+
android:text="@string/google_privacy_label"/>
162+
163+
</RadioGroup>
164+
143165
<TextView
144166
style="@style/Base.TextAppearance.AppCompat.Subhead"
145167
android:layout_width="wrap_content"

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
<string name="google_label_missing_config">Google - configuration missing</string>
3232
<string name="google_tos_label">Google TOS</string>
3333
<string name="firebase_tos_label">Firebase TOS</string>
34+
<string name="google_privacy_label">Google Privacy Policy</string>
3435
<string name="tos_header">Terms of Service URL:</string>
36+
<string name="privacy_policy_header">Privacy Policy URL:</string>
3537
<string name="unknown_response">Unexpected onActivityResult response code</string>
3638
<string name="unknown_sign_in_response">Unknown response from AuthUI sign-in</string>
3739
<string name="sign_in_cancelled">Sign in cancelled</string>

0 commit comments

Comments
 (0)