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 phone number validation #5502

Merged
merged 2 commits into from
Sep 1, 2022
Merged

Conversation

jameswoo-stripe
Copy link
Contributor

Summary

Add phone number validation with minimum phone number length dependent on country phone pattern

Motivation

Address element private beta

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Screen.Recording.2022-08-31.at.2.22.06.PM.mov

Changelog

  • [Added] Phone number minimum length validation in Payment Sheet

@github-actions
Copy link
Contributor

github-actions bot commented Aug 31, 2022

Diffuse output:

OLD: paymentsheet-example-release-master.apk (signature: none)
NEW: paymentsheet-example-release-pr.apk (signature: none)

          │            compressed            │           uncompressed           
          ├───────────┬───────────┬──────────┼───────────┬───────────┬──────────
 APK      │ old       │ new       │ diff     │ old       │ new       │ diff     
──────────┼───────────┼───────────┼──────────┼───────────┼───────────┼──────────
      dex │  15.4 MiB │  15.4 MiB │   +845 B │  52.1 MiB │  52.1 MiB │ +2.3 KiB 
     arsc │   1.8 MiB │   1.8 MiB │ +2.4 KiB │   1.8 MiB │   1.8 MiB │ +2.4 KiB 
 manifest │     4 KiB │     4 KiB │      0 B │  18.5 KiB │  18.5 KiB │      0 B 
      res │ 874.5 KiB │ 874.5 KiB │     +5 B │   1.4 MiB │   1.4 MiB │      0 B 
   native │   2.5 MiB │   2.5 MiB │      0 B │   5.9 MiB │   5.9 MiB │      0 B 
    asset │     3 MiB │     3 MiB │     +2 B │     3 MiB │     3 MiB │     +2 B 
    other │  81.7 KiB │  81.7 KiB │      0 B │ 155.6 KiB │ 155.6 KiB │      0 B 
──────────┼───────────┼───────────┼──────────┼───────────┼───────────┼──────────
    total │  23.6 MiB │  23.6 MiB │ +3.3 KiB │  64.3 MiB │  64.3 MiB │ +4.8 KiB 

         │          raw           │             unique              
         ├────────┬────────┬──────┼────────┬────────┬───────────────
 DEX     │ old    │ new    │ diff │ old    │ new    │ diff          
─────────┼────────┼────────┼──────┼────────┼────────┼───────────────
   files │      4 │      4 │    0 │        │        │               
 strings │ 251781 │ 251792 │  +11 │ 214758 │ 214768 │ +10 (+37 -27) 
   types │  44413 │  44414 │   +1 │  40773 │  40774 │  +1 (+4 -3)   
 classes │  37969 │  37970 │   +1 │  37969 │  37970 │  +1 (+4 -3)   
 methods │ 222030 │ 222045 │  +15 │ 214021 │ 214036 │ +15 (+37 -22) 
  fields │ 163231 │ 163241 │  +10 │ 162188 │ 162198 │ +10 (+31 -21) 

 ARSC    │ old  │ new  │ diff       
─────────┼──────┼──────┼────────────
 configs │  292 │  292 │  0         
 entries │ 6238 │ 6239 │ +1 (+1 -0)
APK
     compressed     │    uncompressed     │                               
─────────┬──────────┼──────────┬──────────┤                               
 size    │ diff     │ size     │ diff     │ path                          
─────────┼──────────┼──────────┼──────────┼───────────────────────────────
 1.8 MiB │ +2.4 KiB │  1.8 MiB │ +2.4 KiB │ ∆ resources.arsc              
 3.2 MiB │ +1.1 KiB │  9.1 MiB │ +2.2 KiB │ ∆ classes4.dex                
 2.3 MiB │   -290 B │    7 MiB │    +76 B │ ∆ classes3.dex                
   1 KiB │     +3 B │  2.6 KiB │      0 B │ ∆ res/j9.xml                  
 8.7 KiB │     +2 B │  8.6 KiB │     +2 B │ ∆ assets/dexopt/baseline.prof 
 1.2 KiB │     -1 B │  3.8 KiB │      0 B │ ∆ res/7k.xml                  
 1.1 KiB │     -1 B │  3.1 KiB │      0 B │ ∆ res/Cm.xml                  
 1.1 KiB │     -1 B │  3.1 KiB │      0 B │ ∆ res/FR.xml                  
 1.5 KiB │     -1 B │  4.9 KiB │      0 B │ ∆ res/Gh.xml                  
 1,009 B │     +1 B │  2.8 KiB │      0 B │ ∆ res/R5.xml                  
 1.3 KiB │     +1 B │  4.1 KiB │      0 B │ ∆ res/U9.xml                  
 1.5 KiB │     +1 B │  5.2 KiB │      0 B │ ∆ res/WO.xml                  
   758 B │     +1 B │  1.4 KiB │      0 B │ ∆ res/WZ.xml                  
   735 B │     +1 B │  1.4 KiB │      0 B │ ∆ res/_Y.xml                  
 1.3 KiB │     +1 B │  3.9 KiB │      0 B │ ∆ res/_n.xml                  
   534 B │     +1 B │    984 B │      0 B │ ∆ res/aR.xml                  
 1.8 KiB │     -1 B │ 10.4 KiB │      0 B │ ∆ res/dn.xml                  
   831 B │     +1 B │  1.8 KiB │      0 B │ ∆ res/fx.xml                  
   802 B │     -1 B │  1.7 KiB │      0 B │ ∆ res/wf.xml                  
─────────┼──────────┼──────────┼──────────┼───────────────────────────────
 7.3 MiB │ +3.3 KiB │ 17.9 MiB │ +4.8 KiB │ (total)
DEX
STRINGS:

   old    │ new    │ diff          
  ────────┼────────┼───────────────
   214758 │ 214768 │ +10 (+37 -27) 
  + incomplete_phone_number
  + �
  
  ���
  
  ���
  
  ������0�2�����0�2�������0�H�@
  + �
  
  ���
  
  ���
  
  ���
  �����0�2�����0�2�����0�2�����0�H�@
  + >
  ���
  ��
  ���
  ���
  
  ���
  ���
  ��_
  ���
  ���
  
  �� 
  ���
  ���
  
  ���
  �������2�0�B���¢����J��
  ������0�0�2�����0�H�J�������0�2�����0�2�����0�J�����0�2�����0�J�������0�2�����0�¢����J�������0�2�����0�H¢����R�����0�X�T¢��
  R�����0�¢��
  ������R��	������0�����00
  X��¢��
  ¨��
  + j
  ���
  ���
  
  ���
  ���
  ��
  
  ���
  ���
  ���
  ���
  ���
  
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ��
  ��� <2�0�:�<B7���������0��
  ��������0�������������0�0���������0�¢���	J��/��0�J��0��0�2��1��0�J��2��032��4��0�J��5��032��6��0�H�J��7����032��8��0!¢���9J��:��032��;��0�R��
  ������0�0�X��¢��
  R��������0�0�X��¢��
  R��
  ��0�X��¢��
  R�����0�¢��
  ������R����
  ������0�0�X��¢��
  ������R���������0�0�X��¢��
  ������R���������0�0�X��¢��
  ������R�����0�¢��
  ������R���������0�0�X��¢��
  ������R�� ������0!0�X��¢��
  �����R��#������0_0�X��¢��
  R��%�
  ������0!0�X��¢��
  R��&������0�0�X��¢��
  ���'��R��(������0�0�X��¢��
  ���)��R�����0�X��¢��
  ���*�+R��,������0-0�X��¢��
  ���.��¨�=
  + Lcom/stripe/android/ui/core/elements/PhoneNumberController_error_1;
  + Lcom/stripe/android/ui/core/elements/PhoneNumberController_isComplete_1;
  + Lcom/stripe/android/ui/core/elements/PhoneNumberElementUIKt_PhoneNumberElementUI_9;
  + Lcom/stripe/android/ui/core/elements/PhoneNumberElementUIKt_PhoneNumberElementUI_hasFocus_2;
  + PhoneNumberElementUI_rvJmuoc_lambda-10
  + PhoneNumberElementUI_rvJmuoc_lambda-11
  + SMAP
  Emitters.kt
  Kotlin
  *S Kotlin
  *F
  + 1 Emitters.kt
  kotlinx/coroutines/flow/FlowKt__EmittersKt_unsafeTransform_1_1
  + 2 Transform.kt
  kotlinx/coroutines/flow/FlowKt__TransformKt
  + 3 PhoneNumberController.kt
  com/stripe/android/ui/core/elements/PhoneNumberController
  *L
  1#1,222:1
  48#2:223
  55#3,2:224
  *E
  
  + SMAP
  Emitters.kt
  Kotlin
  *S Kotlin
  *F
  + 1 Emitters.kt
  kotlinx/coroutines/flow/FlowKt__EmittersKt_unsafeTransform_1_1
  + 2 Transform.kt
  kotlinx/coroutines/flow/FlowKt__TransformKt
  + 3 PhoneNumberController.kt
  com/stripe/android/ui/core/elements/PhoneNumberController
  *L
  1#1,222:1
  48#2:223
  85#3:224
  *E
  
  + SMAP
  Emitters.kt
  Kotlin
  *S Kotlin
  *F
  + 1 Emitters.kt
  kotlinx/coroutines/flow/FlowKt__EmittersKt_unsafeTransform_1_1
  + 2 Transform.kt
  kotlinx/coroutines/flow/FlowKt__TransformKt
  + 3 PhoneNumberController.kt
  com/stripe/android/ui/core/elements/PhoneNumberController
  *L
  1#1,222:1
  48#2:223
  87#3:224
  *E
  
  + SMAP
  PhoneNumberController.kt
  Kotlin
  *S Kotlin
  *F
  + 1 PhoneNumberController.kt
  com/stripe/android/ui/core/elements/PhoneNumberController
  + 2 Transform.kt
  kotlinx/coroutines/flow/FlowKt__TransformKt
  + 3 Emitters.kt
  kotlinx/coroutines/flow/FlowKt__EmittersKt
  + 4 SafeCollector.common.kt
  kotlinx/coroutines/flow/internal/SafeCollector_commonKt
  *L
  1#1,157:1
  47#2:158
  49#2:162
  47#2:163
  49#2:167
  47#2:168
  49#2:172
  50#3:159
  55#3:161
  50#3:164
  55#3:166
  50#3:169
  55#3:171
  106#4:160
  106#4:165
  106#4:170
  *S KotlinDebug
  *F
  + 1 PhoneNumberController.kt
  com/stripe/android/ui/core/elements/PhoneNumberController
  *L
  54#1:158
  54#1:162
  85#1:163
  85#1:167
  87#1:168
  87#1:172
  54#1:159
  54#1:161
  85#1:164
  85#1:166
  87#1:169
  87#1:171
  54#1:160
  85#1:165
  87#1:170
  *E
  
  + SMAP
  PhoneNumberController.kt
  Kotlin
  *S Kotlin
  *F
  + 1 PhoneNumberController.kt
  com/stripe/android/ui/core/elements/PhoneNumberController_countryConfig_1
  + 2 fake.kt
  kotlin/jvm/internal/FakeKt
  *L
  1#1,157:1
  1#2:158
  *E
  
  + SMAP
  PhoneNumberController.kt
  Kotlin
  *S Kotlin
  *F
  + 1 PhoneNumberController.kt
  com/stripe/android/ui/core/elements/PhoneNumberController_countryConfig_2
  + 2 fake.kt
  kotlin/jvm/internal/FakeKt
  *L
  1#1,157:1
  1#2:158
  *E
  
  + SMAP
  PhoneNumberElementUI.kt
  Kotlin
  *S Kotlin
  *F
  + 1 PhoneNumberElementUI.kt
  com/stripe/android/ui/core/elements/PhoneNumberElementUIKt
  + 2 CompositionLocal.kt
  androidx/compose/runtime/CompositionLocal
  + 3 Composables.kt
  androidx/compose/runtime/ComposablesKt
  + 4 Composer.kt
  androidx/compose/runtime/ComposerKt
  + 5 SnapshotState.kt
...✂
ARSC
ENTRIES:

   old  │ new  │ diff       
  ──────┼──────┼────────────
   6238 │ 6239 │ +1 (+1 -0) 
  + string/incomplete_phone_number

@jameswoo-stripe jameswoo-stripe merged commit ce98e09 into master Sep 1, 2022
@jameswoo-stripe jameswoo-stripe deleted the jameswoo/phone-number-validation branch September 1, 2022 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants