Skip to content
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

Add hidden extra sign up fields #552

Merged
merged 4 commits into from
Oct 24, 2019
Merged

Add hidden extra sign up fields #552

merged 4 commits into from
Oct 24, 2019

Conversation

lbalmaceda
Copy link
Contributor

Changes

Previously the extra sign up fields were limited to visible fields of type: name, email, phone number and number. This PR extends the support to hidden fields that are not being displayed in the sign up form but are still sent with a fixed value to the backend as root profile or user_metadata attributes.

I'm not a fan of keeping reference to CustomField type constants from the HiddenField class. Ideally these interface definition should be outside or in the parent abstract class. But doing that now would be a breaking change.

Usage:

Same builder method as before now accepts subclasses of SignUpField class.

Previously
List<CustomField> fields = new ArrayList<>();
fields.add(new CustomField(R.drawable.com_auth0_lock_ic_mobile, CustomField.FieldType.TYPE_NAME, "full_name", R.string.hint_name, CustomField.Storage.PROFILE_ROOT));
builder.withSignUpFields(fields);
Now

Note the method will still work accepting the List<CustomField> argument, but if you want to include HiddenField and any other future field you'd need to change the list type to List<SignUpField>.

List<SignUpField> fields = new ArrayList<>();
fields.add(new CustomField(R.drawable.com_auth0_lock_ic_mobile, CustomField.FieldType.TYPE_NAME, "full_name", R.string.hint_name, CustomField.Storage.PROFILE_ROOT));
fields.add(new HiddenField("reference", "1234", CustomField.Storage.PROFILE_ROOT));
builder.withSignUpFields(fields);

References

Testing

  • This change adds unit test coverage

  • This change has been tested on the latest version of the platform/language or why not

Checklist

@lbalmaceda lbalmaceda requested a review from a team October 7, 2019 22:00
@lbalmaceda lbalmaceda added the medium Medium review label Oct 7, 2019
*
* @param key the key to store this field as.
* @param value the fixed value to set for this field
* @param storage the location to store this value into.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Document the supported "keys" when the storage is "root profile". (or link to docs)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joshcanhelp joshcanhelp self-requested a review October 21, 2019 18:51
@lbalmaceda lbalmaceda requested review from a team and joshcanhelp and removed request for joshcanhelp and a team October 21, 2019 18:51
joshcanhelp
joshcanhelp previously approved these changes Oct 21, 2019
Copy link
Contributor

@joshcanhelp joshcanhelp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@lbalmaceda lbalmaceda requested a review from a team October 23, 2019 15:08
@lbalmaceda lbalmaceda added this to the v2-Next milestone Oct 23, 2019
@lbalmaceda lbalmaceda merged commit 17b858c into master Oct 24, 2019
@lbalmaceda lbalmaceda deleted the signup-fields branch October 24, 2019 19:29
@lbalmaceda lbalmaceda modified the milestones: v2-Next, 2.16.0 Oct 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CH: Added medium Medium review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants