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

Update afterpay/clearpay to support FR and ES. #5221

Merged
merged 24 commits into from Jul 6, 2022

Conversation

michelleb-stripe
Copy link
Contributor

@michelleb-stripe michelleb-stripe commented Jun 28, 2022

Summary

Update afterpay/clearpay to support new countries. A lot of these updates were to the Html element. This is so that clickable links would work correctly when they appeared after a Placeholder image.

Motivation

Request from platform team.

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

All screenshots with two messaging are showing the new messaging view with the original messaging view under it.

Dark with afterpay Light Different order image Light Clearpay final afterpay
dark-side-by-side-click-afterpay Korean-light-afterpay-side-by-side light-gb-clearpay fainl-afterpay

Changelog

  • Add afterpay/clearpay support for FR, ES and EUR currencies.

urlSpanStyle: SpanStyle = SpanStyle(textDecoration = TextDecoration.Underline)
enabled: Boolean = true,
urlSpanStyle: SpanStyle = SpanStyle(textDecoration = TextDecoration.Underline),
imageAlign: PlaceholderVerticalAlign = PlaceholderVerticalAlign.AboveBaseline
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The afterpay image is bottom aligned, whereas the affirm one is "aboveBaseline"

@github-actions
Copy link
Contributor

github-actions bot commented Jun 28, 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 │  14.9 MiB │  14.9 MiB │   +112 B │  50.4 MiB │  50.4 MiB │   -372 B 
     arsc │   1.7 MiB │   1.7 MiB │   +3 KiB │   1.7 MiB │   1.7 MiB │   +3 KiB 
 manifest │   3.6 KiB │   3.6 KiB │      0 B │  16.7 KiB │  16.7 KiB │      0 B 
      res │ 819.9 KiB │ 819.9 KiB │     -3 B │   1.3 MiB │   1.3 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 │  80.5 KiB │  80.5 KiB │      0 B │ 155.1 KiB │ 155.1 KiB │      0 B 
──────────┼───────────┼───────────┼──────────┼───────────┼───────────┼──────────
    total │    23 MiB │    23 MiB │ +3.1 KiB │  62.4 MiB │  62.5 MiB │ +2.7 KiB 

         │          raw           │             unique              
         ├────────┬────────┬──────┼────────┬────────┬───────────────
 DEX     │ old    │ new    │ diff │ old    │ new    │ diff          
─────────┼────────┼────────┼──────┼────────┼────────┼───────────────
   files │      4 │      4 │    0 │        │        │               
 strings │ 236534 │ 236555 │  +21 │ 208136 │ 208147 │ +11 (+34 -23) 
   types │  41718 │  41711 │   -7 │  38640 │  38636 │  -4 (+0 -4)   
 classes │  35950 │  35946 │   -4 │  35950 │  35946 │  -4 (+0 -4)   
 methods │ 211844 │ 211842 │   -2 │ 204784 │ 204776 │  -8 (+12 -20) 
  fields │ 155874 │ 155878 │   +4 │ 155134 │ 155137 │  +3 (+22 -19) 

 ARSC    │ old  │ new  │ diff       
─────────┼──────┼──────┼────────────
 configs │  292 │  291 │ -1 (+0 -1) 
 entries │ 5795 │ 5797 │ +2 (+4 -2)
APK
     compressed     │    uncompressed     │                               
─────────┬──────────┼──────────┬──────────┤                               
 size    │ diff     │ size     │ diff     │ path                          
─────────┼──────────┼──────────┼──────────┼───────────────────────────────
 1.7 MiB │   +3 KiB │  1.7 MiB │   +3 KiB │ ∆ resources.arsc              
 1.7 KiB │ +1.7 KiB │    4 KiB │   +4 KiB │ + res/uL.xml                  
         │ -1.7 KiB │          │   -4 KiB │ - res/DR.xml                  
 1.7 KiB │ +1.7 KiB │  3.9 KiB │ +3.9 KiB │ + res/Hz.xml                  
         │ -1.7 KiB │          │ -3.9 KiB │ - res/ZC.xml                  
 3.3 MiB │   +318 B │  8.7 MiB │    +92 B │ ∆ classes2.dex                
 2.6 MiB │   -206 B │  8.5 MiB │   -464 B │ ∆ classes3.dex                
 7.9 KiB │     +2 B │  7.8 KiB │     +2 B │ ∆ assets/dexopt/baseline.prof 
   707 B │     -1 B │  1.3 KiB │      0 B │ ∆ res/CF.xml                  
 1.5 KiB │     -1 B │  4.9 KiB │      0 B │ ∆ res/Gh.xml                  
 1.5 KiB │     -1 B │  5.2 KiB │      0 B │ ∆ res/WO.xml                  
─────────┼──────────┼──────────┼──────────┼───────────────────────────────
 7.7 MiB │ +3.1 KiB │ 18.9 MiB │ +2.7 KiB │ (total)
DEX
STRINGS:

   old    │ new    │ diff          
  ────────┼────────┼───────────────
   208136 │ 208147 │ +11 (+34 -23) 
  + stripe_ic_afterpay_logo
  + stripe_ic_clearpay_logo
  + stripe_paymentsheet_payment_method_afterpay
  + stripe_paymentsheet_payment_method_clearpay
  + �
  ���
  ��
  ���
  ���
  ���
  ���
  �������2�0�B���¢����J
  ����0�H¢����R�����0�X�T¢��
  R�����0�X�T¢��
  ¨�	
  + (
  ���
  ��
  
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ����2�0�B%��������0���������0��
  ��������0�¢����J	�
  ��0�H�J	����0�H�J�������0�H�J)����02�������0�2�������0�2
  ��������0�HÆ�J�����0�2�������0�HÖ�J	����0�HÖ�J	����0�HÖ�R�������0�¢��
  �����	R�����0�¢��
  ���
  ��R�����0�¢��
  �����¨��
  + \
  ���
  ���
  
  ���
  
  ���
  
  ���
  ���
  ���
  ���
  ���
  
  ��
  
  ���
  �� 
  ���
  ���
  ���
  ���
  ���
  ���
  
  ���
  ������� '2�0�:�'B!������0�������0��
  ��������0�¢����J	����0�HÆ�J	����0�HÂ�J�������0�HÆ�J)����02�������0�2�������0�2
  ��������0�HÆ�J�����0�2�������0�HÖ�J ����������������0�����0�0�0�0�H�J�����0�2�����0 J��!��0�2����0#H�J	�_��0%HÖ�J	�&��0�HÖ�R�����0�X��¢��
  R�������0�X��¢��
  ���	�
  R�����0�X��¢��
  �����R��
  ��0�8F¢��������¨�(
  + d
  
  ���
  
  ���
  
  ���
  
  ���
  
  ��_
  ���
  
  ���
  
  ���
  
  ���
  
  ���
  
  ���
  
  ���
  ���
  ���
  ���
  ���
  ���
  
  ���
  ����������0�2�����0�2�������0�2�����������0�����0
  0	2�������02����
  ��0�2�������0�2�������0�2�������0�2�����������0�����0�0�2���������0�����0�0�H�ø�ø��¢�������i����0�2�����0�2���������0�����0�0	2�����02��
  ��0�2�������0�2�������0�2���� ��0!2������0#H�ø�ø��¢���_�%�5�&��0�2�����0�2�����������0�����0�0	2���� ��0!H�¢���'����0�X�T¢��
  ���
  ���
  ��¡�0�¨�(
  + ><b>ⓘ</b></a>
  + _imageAlign
  + (IILandroidx/compose/ui/graphics/ColorFilter;)V
  + (Ljava/lang/String;Ljava/util/Map;JLandroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/Modifier;ZLandroidx/compose/ui/text/SpanStyle;ILandroidx/compose/runtime/Composer;II)V
  + <img src=afterpay/>
  + <img/>
  + <img/> <a href=
  + <installment_price/>
  + <num_installments/>
  + C(Html)P(2,4,0:c#ui.graphics.Color,6,5!1,7,3:c#ui.text.PlaceholderVerticalAlign)
  + Html-f3_i_IM
  + NO_BREAK_SPACE
  + SMAP
  AfterpayClearpayElementUI.kt
  Kotlin
  *S Kotlin
  *F
  + 1 AfterpayClearpayElementUI.kt
  com/stripe/android/ui/core/elements/AfterpayClearpayElementUIKt
  + 2 CompositionLocal.kt
  androidx/compose/runtime/CompositionLocal
  + 3 Dp.kt
  androidx/compose/ui/unit/DpKt
  *L
  1#1,58:1
  76#2:59
  155#3:60
  *S KotlinDebug
  *F
  + 1 AfterpayClearpayElementUI.kt
  com/stripe/android/ui/core/elements/AfterpayClearpayElementUIKt
  *L
  25#1:59
  51#1:60
  *E
  
  + SMAP
  Html.kt
  Kotlin
  *S Kotlin
  *F
  + 1 Html.kt
  com/stripe/android/ui/core/elements/HtmlKt
  + 2 _Collections.kt
  kotlin/collections/CollectionsKt___CollectionsKt
  + 3 TextUnit.kt
  androidx/compose/ui/unit/TextUnit
  + 4 CompositionLocal.kt
  androidx/compose/runtime/CompositionLocal
  + 5 Composables.kt
  androidx/compose/runtime/ComposablesKt
  + 6 Composer.kt
  androidx/compose/runtime/ComposerKt
  + 7 AnnotatedString.kt
  androidx/compose/ui/text/AnnotatedStringKt
  + 8 _Arrays.kt
  kotlin/collections/ArraysKt___ArraysKt
  *L
  1#1,261:1
  1177#2,2:262
  1251#2,2:264
  1254#2:268
  141#3,2:266
  76#4:269
  36#5:270
  36#5:277
  25#5:287
  50#5:294
  49#5:295
  50#5:302
  49#5:303
  1057#6,6:271
  1057#6,3:278
  1060#6,3:284
  1057#6,6:288
  1057#6,6:296
  1057#6,6:304
  835#7:281
  13536#8,2:282
  *S KotlinDebug
  *F
  + 1 Html.kt
  com/stripe/android/ui/core/elements/HtmlKt
  *L
  72#1:262,2
  72#1:264,2
  72#1:268
  76#1:266,2
  101#1:269
  138#1:270
  141#1:277
  225#1:287
  226#1:294
  226#1:295
  254#1:302
  254#1:303
  138#1:271,6
  141#1:278,3
  141#1:284,3
  225#1:288,6
  226#1:296,6
  254#1:304,6
  142#1:281
  144#1:282,2
  *E
  
  + SMAP
  Html.kt
  Kotlin
  *S Kotlin
  *F
  + 1 Html.kt
  com/stripe/android/ui/core/elements/HtmlKt_ClickableText_pressIndicator_1_1_1
  + 2 _Collections.kt
  kotlin/collections/CollectionsKt___CollectionsKt
  *L
  1#1,261:1
  286#2,2:262
  *S KotlinDebug
  *F
  + 1 Html.kt
  com/stripe/android/ui/core/elements/HtmlKt_ClickableText_pressIndicator_1_1_1
  *L
  230#1:262,2
  *E
  
  + SMAP
  LpmRepository.kt
  Kotlin
  *S Kotlin
  *F
  + 1 LpmRepository.kt
  com/stripe/android/ui/core/forms/resources/LpmRepository
  + 2 _Collections.kt
  kotlin/collections/CollectionsKt___CollectionsKt
  + 3 fake.kt
  kotlin/jvm/int
...✂
ARSC
CONFIGS:

   old │ new │ diff       
  ─────┼─────┼────────────
   292 │ 291 │ -1 (+0 -1) 
  - drawable-en-rGB
  

ENTRIES:

   old  │ new  │ diff       
  ──────┼──────┼────────────
   5795 │ 5797 │ +2 (+4 -2) 
  + drawable/stripe_ic_afterpay_logo
  + drawable/stripe_ic_clearpay_logo
  + string/stripe_paymentsheet_payment_method_afterpay
  + string/stripe_paymentsheet_payment_method_clearpay
  
  - drawable/stripe_ic_afterpay_clearpay_logo
  - string/stripe_paymentsheet_payment_method_afterpay_clearpay

@michelleb-stripe michelleb-stripe changed the title [WIP] Update afterpay/clearpay to support FR and ES. Update afterpay/clearpay to support FR and ES. Jun 28, 2022
amount.currencyCode
fun getLabel(resources: Resources): String {
val numInstallments = when (amount.currencyCode.lowercase()) {
"eur" -> 3
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have enums for currency?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, currently we don't. There is a java.util.Currency class that we could use to get strongly typed currencies. Right now I can see it being good to strongly type the currency in the Amount.kt, CurrencyFormatter. Not sure there is a lot of value in adding it for the older classes.

Given the size of this type of change I would recommend pulling it out as a tech debt item.

@@ -13,15 +14,35 @@ import java.util.Locale
class AfterpayClearpayHeaderElementTest {

@Test
fun `Verify label is correct`() {
fun `Verify label is correct for USD`() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a test for image first? As in one of the images you posted in the PR description

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can't do this on the main sheet because the order of the LPMs in the selectors is not consistent. As we advance our screenshot testing I think it would be good to add testing for the core UI components like the Html element rather than the payment method specific UI.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am not really following. Can't we change the locale to korean or something that makes the image icon tag first in the string? Not looking for a screenshot test, an assert as you have in this test would suffice

@michelleb-stripe michelleb-stripe removed their assignment Jun 30, 2022
jameswoo-stripe
jameswoo-stripe previously approved these changes Jul 5, 2022
@michelleb-stripe michelleb-stripe merged commit c16dd94 into master Jul 6, 2022
@michelleb-stripe michelleb-stripe deleted the michelleb/afterpay-06-22 branch July 6, 2022 00:27
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

4 participants