-
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 3 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 |
---|---|---|
|
@@ -92,9 +92,8 @@ public void onComplete(@NonNull Task<CredentialRequestResponse> task) { | |
|
||
private void startAuthMethodChoice() { | ||
List<AuthUI.IdpConfig> idpConfigs = getArguments().providerInfo; | ||
|
||
|
||
// If there is only one provider selected, launch the flow directly | ||
if (idpConfigs.size() == 1) { | ||
if (getArguments().isSingleProviderFlow()) { | ||
AuthUI.IdpConfig firstIdpConfig = idpConfigs.get(0); | ||
String firstProvider = firstIdpConfig.getProviderId(); | ||
switch (firstProvider) { | ||
|
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,19 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat | |
} | ||
|
||
view.findViewById(R.id.button_next).setOnClickListener(this); | ||
|
||
TextView termsText = view.<TextView>findViewById(R.id.email_tos_and_pp_text); | ||
|
||
TextView footerText = view.<TextView>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(), | ||
getFlowParams(), | ||
termsText); | ||
} else { | ||
PrivacyDisclosureUtils.setupTermsOfServiceFooter(getContext(), | ||
getFlowParams(), | ||
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,11 +142,6 @@ 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); | ||
} | ||
|
@@ -171,6 +168,9 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat | |
} else { | ||
safeRequestFocus(mEmailEditText); | ||
} | ||
|
||
TextView footerText = view.<TextView>findViewById(R.id.email_footer_tos_and_pp_text); | ||
PrivacyDisclosureUtils.setupTermsOfServiceFooter(getContext(), getFlowParams(), footerText); | ||
} | ||
|
||
private void safeRequestFocus(final View v) { | ||
|
@@ -233,11 +233,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); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ | |
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.ImageView; | ||
import android.widget.TextView; | ||
import android.widget.Toast; | ||
|
||
import com.firebase.ui.auth.AuthUI; | ||
|
@@ -42,6 +43,7 @@ | |
import com.firebase.ui.auth.data.remote.PhoneSignInHandler; | ||
import com.firebase.ui.auth.data.remote.TwitterSignInHandler; | ||
import com.firebase.ui.auth.ui.AppCompatBase; | ||
import com.firebase.ui.auth.util.data.PrivacyDisclosureUtils; | ||
import com.firebase.ui.auth.viewmodel.ResourceObserver; | ||
import com.firebase.ui.auth.viewmodel.idp.ProviderSignInBase; | ||
import com.firebase.ui.auth.viewmodel.idp.SocialProviderResponseHandler; | ||
|
@@ -106,6 +108,11 @@ protected void onFailure(@NonNull Exception e) { | |
} | ||
} | ||
}); | ||
|
||
TextView termsText = findViewById(R.id.main_tos_and_pp); | ||
PrivacyDisclosureUtils.setupTermsOfServiceAndPrivacyPolicyText(AuthMethodPickerActivity.this, | ||
|
||
getFlowParams(), | ||
termsText); | ||
} | ||
|
||
private void populateIdpList(List<IdpConfig> providerConfigs, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,9 +34,9 @@ | |
import com.firebase.ui.auth.ui.FragmentBase; | ||
import com.firebase.ui.auth.util.CustomCountDownTimer; | ||
import com.firebase.ui.auth.util.ExtraConstants; | ||
import com.firebase.ui.auth.util.data.PrivacyDisclosureUtils; | ||
import com.firebase.ui.auth.util.ui.BucketedTextChangeListener; | ||
import com.firebase.ui.auth.util.ui.ImeHelper; | ||
import com.firebase.ui.auth.util.ui.PreambleHandler; | ||
|
||
/** | ||
* Display confirmation code to verify phone numbers input in {{@link VerifyPhoneNumberFragment}} | ||
|
@@ -56,7 +56,6 @@ public class SubmitConfirmationCodeFragment extends FragmentBase { | |
private Button mSubmitConfirmationButton; | ||
private CustomCountDownTimer mCountdownTimer; | ||
private PhoneActivity mVerifier; | ||
private TextView mAgreementText; | ||
private long mMillisUntilFinished; | ||
|
||
public static SubmitConfirmationCodeFragment newInstance(FlowParameters flowParameters, | ||
|
@@ -73,8 +72,10 @@ public static SubmitConfirmationCodeFragment newInstance(FlowParameters flowPara | |
|
||
@Nullable | ||
@Override | ||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable | ||
Bundle savedInstanceState) { | ||
public View onCreateView(@NonNull LayoutInflater inflater, | ||
@Nullable ViewGroup container, | ||
@Nullable | ||
|
||
Bundle savedInstanceState) { | ||
View v = inflater.inflate(R.layout.fui_confirmation_code_layout, container, false); | ||
FragmentActivity parentActivity = getActivity(); | ||
|
||
|
@@ -83,7 +84,6 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c | |
mResendCodeTextView = v.findViewById(R.id.resend_code); | ||
mConfirmationCodeEditText = v.findViewById(R.id.confirmation_code); | ||
mSubmitConfirmationButton = v.findViewById(R.id.submit_confirmation_code); | ||
mAgreementText = v.findViewById(R.id.create_account_tos); | ||
|
||
final String phoneNumber = getArguments().getString(ExtraConstants.PHONE); | ||
|
||
|
@@ -93,10 +93,16 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c | |
setupCountDown(RESEND_WAIT_MILLIS); | ||
setupSubmitConfirmationCodeButton(); | ||
setupResendConfirmationCodeTextView(phoneNumber); | ||
setUpTermsOfService(); | ||
return v; | ||
} | ||
|
||
@Override | ||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | ||
super.onViewCreated(view, savedInstanceState); | ||
TextView footerText = view.<TextView>findViewById(R.id.email_footer_tos_and_pp_text); | ||
PrivacyDisclosureUtils.setupTermsOfServiceFooter(getContext(), getFlowParams(), footerText); | ||
} | ||
|
||
@Override | ||
public void onStart() { | ||
super.onStart(); | ||
|
@@ -221,13 +227,6 @@ private void cancelTimer() { | |
} | ||
} | ||
|
||
private void setUpTermsOfService() { | ||
PreambleHandler.setup(getContext(), | ||
getFlowParams(), | ||
R.string.fui_continue_phone_login, | ||
mAgreementText); | ||
} | ||
|
||
@VisibleForTesting(otherwise = VisibleForTesting.NONE) | ||
CustomCountDownTimer getCountdownTimer() { | ||
return mCountdownTimer; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,7 @@ | |
import com.firebase.ui.auth.util.ExtraConstants; | ||
import com.firebase.ui.auth.util.GoogleApiUtils; | ||
import com.firebase.ui.auth.util.data.PhoneNumberUtils; | ||
import com.firebase.ui.auth.util.data.PrivacyDisclosureUtils; | ||
import com.firebase.ui.auth.util.ui.ImeHelper; | ||
import com.firebase.ui.auth.viewmodel.RequestCodes; | ||
import com.google.android.gms.auth.api.credentials.Credential; | ||
|
@@ -55,7 +56,6 @@ | |
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) | ||
public class VerifyPhoneNumberFragment extends FragmentBase implements View.OnClickListener { | ||
public static final String TAG = "VerifyPhoneFragment"; | ||
|
||
private Context mAppContext; | ||
|
||
private CountryListSpinner mCountryListSpinner; | ||
|
@@ -107,15 +107,14 @@ public void onDonePressed() { | |
parentActivity.setTitle(getString(R.string.fui_verify_phone_number_title)); | ||
setupCountrySpinner(); | ||
setupSendCodeButton(); | ||
setupTerms(); | ||
|
||
return v; | ||
} | ||
|
||
private void setupTerms() { | ||
final String verifyPhoneButtonText = getString(R.string.fui_verify_phone_number); | ||
final String terms = getString(R.string.fui_sms_terms_of_service, verifyPhoneButtonText); | ||
mSmsTermsText.setText(terms); | ||
@Override | ||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | ||
super.onViewCreated(view, savedInstanceState); | ||
TextView footerText = view.<TextView>findViewById(R.id.email_footer_tos_and_pp_text); | ||
setupPrivacyDisclosures(footerText); | ||
} | ||
|
||
@Override | ||
|
@@ -273,6 +272,23 @@ private void setCountryCode(PhoneNumber phoneNumber) { | |
} | ||
} | ||
|
||
private void setupPrivacyDisclosures(TextView footerText) { | ||
final String verifyPhoneButtonText = getString(R.string.fui_verify_phone_number); | ||
final String multipleProviderFlowText = getString(R.string.fui_sms_terms_of_service, | ||
verifyPhoneButtonText); | ||
FlowParameters flowParameters = getFlowParams(); | ||
PrivacyDisclosureUtils.setupTermsOfServiceAndPrivacyPolicySmsText(getContext(), | ||
flowParameters, | ||
mSmsTermsText, | ||
multipleProviderFlowText); | ||
|
||
if (!flowParameters.isSingleProviderFlow()) { | ||
|
||
PrivacyDisclosureUtils.setupTermsOfServiceFooter(getContext(), | ||
flowParameters, | ||
footerText); | ||
} | ||
} | ||
|
||
void showError(String e) { | ||
mPhoneInputLayout.setError(e); | ||
} | ||
|
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