-
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 2 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 |
---|---|---|
|
@@ -20,9 +20,12 @@ | |
import android.support.annotation.NonNull; | ||
import android.support.annotation.Nullable; | ||
import android.support.annotation.RestrictTo; | ||
import android.support.annotation.StringRes; | ||
import android.support.annotation.StyleRes; | ||
import android.text.TextUtils; | ||
|
||
import com.firebase.ui.auth.AuthUI.IdpConfig; | ||
import com.firebase.ui.auth.R; | ||
import com.firebase.ui.auth.util.ExtraConstants; | ||
import com.firebase.ui.auth.util.Preconditions; | ||
|
||
|
@@ -128,4 +131,24 @@ public FlowParameters[] newArray(int size) { | |
return new FlowParameters[size]; | ||
} | ||
}; | ||
|
||
public boolean isSingleProviderFlow() { | ||
return providerInfo.size() == 1; | ||
} | ||
|
||
public @StringRes int getGlobalTermsStringResource() { | ||
boolean hasTos = !TextUtils.isEmpty(termsOfServiceUrl); | ||
boolean hasPp = !TextUtils.isEmpty(privacyPolicyUrl); | ||
if(hasTos && hasPp) { | ||
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 you run Edit: Actually, I had a bunch of other style concerns so I've just created a patch to minimize the noise. Key takeaways:
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've been spoiled by auto formatting, sorry! Thank you for your comments, it is much appreciated. |
||
return R.string.fui_tos_and_pp; | ||
} else if(hasTos) { | ||
return R.string.fui_tos_only; | ||
} else { | ||
return R.string.fui_pp_only; | ||
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. This else implies the default is the privacy policy—is that what you want? If so, we should add checks, update the README n' docs, throw exceptions, yada yada for 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. You're right, I'll change this. We won't force them to have a ToS/Privacy policy though. |
||
} | ||
} | ||
|
||
public @StringRes int getGlobalTermsFooterStringResource() { | ||
return R.string.fui_tos_and_pp_footer; | ||
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. Should this have if statements like above? If not, let's just inline it in the XML. 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 added 2 more strings to deal with ToS only & Pp only. Having this makes more sense now :) |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ | |
import android.support.design.widget.TextInputLayout; | ||
import android.support.v4.app.FragmentTransaction; | ||
import android.support.v4.view.ViewCompat; | ||
import android.widget.TextView; | ||
|
||
import com.firebase.ui.auth.AuthUI; | ||
import com.firebase.ui.auth.IdpResponse; | ||
|
@@ -32,6 +33,7 @@ | |
import com.firebase.ui.auth.ui.idp.WelcomeBackIdpPrompt; | ||
import com.firebase.ui.auth.util.ExtraConstants; | ||
import com.firebase.ui.auth.util.data.ProviderUtils; | ||
import com.firebase.ui.auth.util.ui.PreambleHandler; | ||
import com.firebase.ui.auth.viewmodel.RequestCodes; | ||
import com.google.firebase.auth.EmailAuthProvider; | ||
|
||
|
@@ -69,6 +71,8 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { | |
.replace(R.id.fragment_register_email, fragment, CheckEmailFragment.TAG) | ||
.disallowAddToBackStack() | ||
.commit(); | ||
|
||
setUpTermsOfServiceFooter(); | ||
} | ||
|
||
@Override | ||
|
@@ -130,4 +134,14 @@ private void setSlideAnimation() { | |
// Make the next activity slide in | ||
overridePendingTransition(R.anim.fui_slide_in_right, R.anim.fui_slide_out_left); | ||
} | ||
|
||
private void setUpTermsOfServiceFooter() { | ||
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'm seeing this method a lot. I wonder if it makes sense to add a 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. Seems like a good idea to me, less repetition is better! |
||
FlowParameters flowParameters = getFlowParams(); | ||
if(!flowParameters.isSingleProviderFlow()) { | ||
PreambleHandler.setup(EmailActivity.this, | ||
flowParameters, | ||
flowParameters.getGlobalTermsFooterStringResource(), | ||
(TextView) findViewById(R.id.email_footer_tos_and_pp_text)); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ | |
import android.support.v7.app.AlertDialog; | ||
import android.text.TextUtils; | ||
import android.util.Log; | ||
import android.widget.TextView; | ||
|
||
import com.firebase.ui.auth.IdpResponse; | ||
import com.firebase.ui.auth.R; | ||
|
@@ -36,6 +37,7 @@ | |
import com.firebase.ui.auth.ui.AppCompatBase; | ||
import com.firebase.ui.auth.util.ExtraConstants; | ||
import com.firebase.ui.auth.util.FirebaseAuthError; | ||
import com.firebase.ui.auth.util.ui.PreambleHandler; | ||
import com.google.android.gms.tasks.OnFailureListener; | ||
import com.google.android.gms.tasks.OnSuccessListener; | ||
import com.google.firebase.FirebaseException; | ||
|
@@ -103,6 +105,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { | |
.replace(R.id.fragment_verify_phone, fragment, VerifyPhoneNumberFragment.TAG) | ||
.disallowAddToBackStack() | ||
.commit(); | ||
setUpTermsOfServiceFooter(); | ||
} | ||
|
||
@Override | ||
|
@@ -406,4 +409,14 @@ private SubmitConfirmationCodeFragment getSubmitConfirmationCodeFragment() { | |
return (SubmitConfirmationCodeFragment) getSupportFragmentManager().findFragmentByTag | ||
(SubmitConfirmationCodeFragment.TAG); | ||
} | ||
|
||
private void setUpTermsOfServiceFooter() { | ||
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. Yeah, I'm definitely thinking we need a utility, this is numeros quatros I've seen. 😆 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. 😅 |
||
FlowParameters flowParameters = getFlowParams(); | ||
if(!flowParameters.isSingleProviderFlow()) { | ||
PreambleHandler.setup(PhoneActivity.this, | ||
flowParameters, | ||
flowParameters.getGlobalTermsFooterStringResource(), | ||
(TextView) findViewById(R.id.email_footer_tos_and_pp_text)); | ||
} | ||
} | ||
} |
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