-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Added main ToS/PP #1300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added main ToS/PP #1300
Changes from all commits
dac52e6
f5b0b75
420da68
5793bd8
670b363
21df8b3
3cedd37
302c94c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,11 +13,14 @@ | |
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.EditText; | ||
import android.widget.TextView; | ||
|
||
import com.firebase.ui.auth.R; | ||
import com.firebase.ui.auth.data.model.FlowParameters; | ||
import com.firebase.ui.auth.data.model.User; | ||
import com.firebase.ui.auth.ui.FragmentBase; | ||
import com.firebase.ui.auth.util.ExtraConstants; | ||
import com.firebase.ui.auth.util.data.PrivacyDisclosureUtils; | ||
import com.firebase.ui.auth.util.ui.ImeHelper; | ||
import com.firebase.ui.auth.util.ui.fieldvalidators.EmailFieldValidator; | ||
import com.firebase.ui.auth.viewmodel.ResourceObserver; | ||
|
@@ -96,6 +99,21 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat | |
} | ||
|
||
view.findViewById(R.id.button_next).setOnClickListener(this); | ||
|
||
TextView termsText = view.findViewById(R.id.email_tos_and_pp_text); | ||
TextView footerText = view.findViewById(R.id.email_footer_tos_and_pp_text); | ||
FlowParameters flowParameters = getFlowParams(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we get rid of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed it to pass flowParameters instead of making 2 more calls to getFlowParams() - unless you want me to change them all to getFlowParams()? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope, SGTM |
||
|
||
if (flowParameters.isSingleProviderFlow()) { | ||
PrivacyDisclosureUtils.setupTermsOfServiceAndPrivacyPolicyText(getContext(), | ||
flowParameters, | ||
termsText); | ||
} else { | ||
termsText.setVisibility(View.GONE); | ||
PrivacyDisclosureUtils.setupTermsOfServiceFooter(getContext(), | ||
flowParameters, | ||
footerText); | ||
} | ||
} | ||
|
||
@Override | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,9 +20,9 @@ | |
import com.firebase.ui.auth.data.model.User; | ||
import com.firebase.ui.auth.ui.FragmentBase; | ||
import com.firebase.ui.auth.util.ExtraConstants; | ||
import com.firebase.ui.auth.util.data.PrivacyDisclosureUtils; | ||
import com.firebase.ui.auth.util.data.ProviderUtils; | ||
import com.firebase.ui.auth.util.ui.ImeHelper; | ||
import com.firebase.ui.auth.util.ui.PreambleHandler; | ||
import com.firebase.ui.auth.util.ui.fieldvalidators.BaseValidator; | ||
import com.firebase.ui.auth.util.ui.fieldvalidators.EmailFieldValidator; | ||
import com.firebase.ui.auth.util.ui.fieldvalidators.NoOpValidator; | ||
|
@@ -80,7 +80,9 @@ public void onCreate(@Nullable Bundle savedInstanceState) { | |
@Override | ||
protected void onSuccess(@NonNull IdpResponse response) { | ||
startSaveCredentials( | ||
mHandler.getCurrentUser(), response, mPasswordEditText.getText().toString()); | ||
mHandler.getCurrentUser(), | ||
response, | ||
mPasswordEditText.getText().toString()); | ||
} | ||
|
||
@Override | ||
|
@@ -140,16 +142,17 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat | |
// Only show the name field if required | ||
nameInput.setVisibility(requireName ? View.VISIBLE : View.GONE); | ||
|
||
PreambleHandler.setup( | ||
getContext(), | ||
getFlowParams(), | ||
R.string.fui_button_text_save, | ||
view.<TextView>findViewById(R.id.create_account_text)); | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && getFlowParams().enableCredentials) { | ||
mEmailEditText.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO); | ||
} | ||
|
||
if (savedInstanceState != null) { return; } | ||
TextView footerText = view.findViewById(R.id.email_footer_tos_and_pp_text); | ||
PrivacyDisclosureUtils.setupTermsOfServiceFooter(getContext(), getFlowParams(), footerText); | ||
|
||
// WARNING: Nothing below this line will be executed on rotation | ||
if (savedInstanceState != null) { | ||
return; | ||
} | ||
|
||
// If email is passed in, fill in the field and move down to the name field. | ||
String email = mUser.getEmail(); | ||
|
@@ -233,11 +236,11 @@ private void validateAndRegisterUser() { | |
boolean nameValid = mNameValidator.validate(name); | ||
if (emailValid && passwordValid && nameValid) { | ||
mHandler.startSignIn(new IdpResponse.Builder( | ||
new User.Builder(EmailAuthProvider.PROVIDER_ID, email) | ||
.setName(name) | ||
.setPhotoUri(mUser.getPhotoUri()) | ||
.build()) | ||
.build(), | ||
new User.Builder(EmailAuthProvider.PROVIDER_ID, email) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is something wrong with the formatting settings? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wouldn't worry about this. Equally legible either way. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope, we just made an indentation change to the styling a long time ago and never bothered running it over the whole codebase. Like @samtstern said, we're not that nit picky. 😆 Thanks for checking though! 👍 I'll take another look at this tomorrow. |
||
.setName(name) | ||
.setPhotoUri(mUser.getPhotoUri()) | ||
.build()) | ||
.build(), | ||
password); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use this in
SignInKickstarter
too? I like your method much better.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure