[bisq-network/bisq] Validate phone numbers (#3134)

Stan notifications at github.com
Fri Aug 23 19:29:38 UTC 2019


Created new PhoneNumberValidator + Test.  Validator hides
no arg constructor; public constructor requires two letter
ISO country code for validating inputs.

After successful validation, inputs are transformed into E.164
format and cached in a field, accessible via a getter method.
However, area and region codes are not checked for correctness.
End users are responsible for correctness of area/region codes.

Four i18n properties (validation.phone.*) were added to
displayStrings.properties

This is a partial fix for Issue bisq-network#3042.  The validator
will be integrated into the GUI if PR is approved & patch is
merged.

Question for Bisq devs:
Another new pkg protected class, CountryCallingCodes, contains
an immutable map of ISO country codes -> country calling codes;
it is the only non-validator class in its package.  The map
declaration is too large to live in the PhoneNumberValidator class,
even after tweaking idea.properties in an attempt to prevent
the IDE from freezing.  Is it OK to leave CountryCallingCodes
where it is, or is there a more appropriate home for it?
You can view, comment on, or merge this pull request online at:

  https://github.com/bisq-network/bisq/pull/3134

-- Commit Summary --

  * Validate phone numbers

-- File Changes --

    M core/src/main/resources/i18n/displayStrings.properties (5)
    A desktop/src/main/java/bisq/desktop/util/validation/CountryCallingCodes.java (278)
    A desktop/src/main/java/bisq/desktop/util/validation/PhoneNumberValidator.java (143)
    A desktop/src/test/java/bisq/desktop/util/validation/PhoneNumberValidatorTest.java (291)

-- Patch Links --

https://github.com/bisq-network/bisq/pull/3134.patch
https://github.com/bisq-network/bisq/pull/3134.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/3134
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20190823/074e0c15/attachment.html>


More information about the bisq-github mailing list