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 support for downloading images for LUXE payment methods. #5928

Merged
merged 34 commits into from
Dec 14, 2022

Conversation

jaynewstrom-stripe
Copy link
Collaborator

@jaynewstrom-stripe jaynewstrom-stripe commented Dec 8, 2022

Summary

Different approach to #5851

Motivation

https://paper.dropbox.com/doc/LUXE-Milestone-Images-V2--BtOExZa66TaUp8wYBzPWDezaAg-oIaL68ZVfjQ8J64zthANK

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Before After
before screenshot after screenshot

Changelog

@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 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 │  5.7 MiB │  5.7 MiB │ +9.2 KiB │  14.9 MiB │  14.9 MiB │ +23.8 KiB 
     arsc │    2 MiB │    2 MiB │    +52 B │     2 MiB │     2 MiB │     +52 B 
 manifest │  4.4 KiB │  4.4 KiB │      0 B │  20.8 KiB │  20.8 KiB │       0 B 
      res │  1.1 MiB │  1.1 MiB │   +138 B │   1.8 MiB │   1.8 MiB │    +620 B 
   native │  2.6 MiB │  2.6 MiB │      0 B │     6 MiB │     6 MiB │       0 B 
    asset │    3 MiB │    3 MiB │   +244 B │     3 MiB │     3 MiB │    +244 B 
    other │ 82.9 KiB │ 82.9 KiB │      0 B │ 158.3 KiB │ 158.3 KiB │       0 B 
──────────┼──────────┼──────────┼──────────┼───────────┼───────────┼───────────
    total │ 14.4 MiB │ 14.4 MiB │ +9.7 KiB │  27.9 MiB │  27.9 MiB │ +24.7 KiB 

         │          raw           │                unique                
         ├────────┬────────┬──────┼────────┬────────┬────────────────────
 DEX     │ old    │ new    │ diff │ old    │ new    │ diff               
─────────┼────────┼────────┼──────┼────────┼────────┼────────────────────
   files │      2 │      2 │    0 │        │        │                    
 strings │  91398 │  91523 │ +125 │  76606 │  76659 │  +53 (+553 -500)   
   types │  24243 │  24316 │  +73 │  21884 │  21906 │  +22 (+451 -429)   
 classes │  19748 │  19770 │  +22 │  19748 │  19770 │  +22 (+429 -407)   
 methods │ 104002 │ 104290 │ +288 │  99644 │  99823 │ +179 (+8173 -7994) 
  fields │ 104156 │ 104229 │  +73 │ 102856 │ 102916 │  +60 (+4460 -4400) 

 ARSC    │ old  │ new  │ diff       
─────────┼──────┼──────┼────────────
 configs │  334 │  334 │  0         
 entries │ 6421 │ 6422 │ +1 (+1 -0)
APK
     compressed      │     uncompressed     │                                
─────────┬───────────┼──────────┬───────────┤                                
 size    │ diff      │ size     │ diff      │ path                           
─────────┼───────────┼──────────┼───────────┼────────────────────────────────
 2.2 MiB │ +24.2 KiB │  5.9 MiB │   +49 KiB │ ∆ classes2.dex                 
 3.5 MiB │   -15 KiB │    9 MiB │ -25.3 KiB │ ∆ classes.dex                  
 8.3 KiB │    +231 B │  8.1 KiB │    +231 B │ ∆ assets/dexopt/baseline.prof  
 2.7 KiB │     +79 B │ 15.8 KiB │    +312 B │ ∆ res/dn.xml                   
 2.7 KiB │     +77 B │   16 KiB │    +308 B │ ∆ res/s0.xml                   
   2 MiB │     +52 B │    2 MiB │     +52 B │ ∆ resources.arsc               
   821 B │     +13 B │    689 B │     +13 B │ ∆ assets/dexopt/baseline.profm 
   998 B │      -3 B │  2.8 KiB │       0 B │ ∆ res/AE.xml                   
   612 B │      -2 B │  1.2 KiB │       0 B │ ∆ res/38.xml                   
   760 B │      -2 B │  1.4 KiB │       0 B │ ∆ res/BA.xml                   
   718 B │      -2 B │  1.5 KiB │       0 B │ ∆ res/Re.xml                   
   447 B │      -2 B │    712 B │       0 B │ ∆ res/kL1.xml                  
   683 B │      +1 B │  1.3 KiB │       0 B │ ∆ res/-G.xml                   
   848 B │      -1 B │  1.8 KiB │       0 B │ ∆ res/0M.xml                   
   675 B │      +1 B │  1.5 KiB │       0 B │ ∆ res/0x.xml                   
   952 B │      +1 B │  2.5 KiB │       0 B │ ∆ res/5d.xml                   
   886 B │      -1 B │  2.4 KiB │       0 B │ ∆ res/C7.xml                   
 1.5 KiB │      -1 B │  4.9 KiB │       0 B │ ∆ res/Gh.xml                   
   739 B │      -1 B │  1.5 KiB │       0 B │ ∆ res/Ig.xml                   
 1.2 KiB │      -1 B │    3 KiB │       0 B │ ∆ res/RX.xml                   
   726 B │      -1 B │  1.6 KiB │       0 B │ ∆ res/TP.xml                   
 1.3 KiB │      -1 B │  4.1 KiB │       0 B │ ∆ res/U9.xml                   
   526 B │      +1 B │    872 B │       0 B │ ∆ res/Ub.xml                   
   394 B │      -1 B │    544 B │       0 B │ ∆ res/Vj.xml                   
 1.2 KiB │      -1 B │  3.4 KiB │       0 B │ ∆ res/e1.xml                   
   646 B │      -1 B │  1.3 KiB │       0 B │ ∆ res/fL.xml                   
   689 B │      -1 B │  1.5 KiB │       0 B │ ∆ res/oT.xml                   
   681 B │      -1 B │  1.5 KiB │       0 B │ ∆ res/vD.xml                   
   708 B │      -1 B │  1.6 KiB │       0 B │ ∆ res/vM.xml                   
   434 B │      +1 B │    640 B │       0 B │ ∆ res/y9.xml                   
   798 B │      +1 B │  1.9 KiB │       0 B │ ∆ res/zW.xml                   
─────────┼───────────┼──────────┼───────────┼────────────────────────────────
 7.7 MiB │  +9.7 KiB │   17 MiB │ +24.7 KiB │ (total)
DEX
STRINGS:

   old   │ new   │ diff            
  ───────┼───────┼─────────────────
   76606 │ 76659 │ +53 (+553 -500) 
  + La6/a0_a;
  + La6/a0_b;
  + La6/d0_a;
  + La6/r_a;
  + La6/s_b;
  + La6/s_c;
  + La6/s_d;
  + La6/s_e;
  + La6/s_f;
  + La6/s_g;
  + La6/s_h;
  + La6/s_i;
  + La6/v_a;
  + Lac/c;
  + Lae/n;
  + Landroidx/activity/r;
  + Landroidx/appcompat/widget/f2_a;
  + Landroidx/appcompat/widget/w1_a;
  + Landroidx/compose/ui/platform/c0_a;
  + Landroidx/compose/ui/platform/d0_b;
  + Landroidx/compose/ui/platform/d0_c;
  + Landroidx/compose/ui/platform/d0_d;
  + Landroidx/compose/ui/platform/d0_e;
  + Landroidx/compose/ui/platform/d0_f;
  + Landroidx/compose/ui/platform/d0_g;
  + Landroidx/compose/ui/platform/d0_h;
  + Landroidx/compose/ui/platform/d0_i;
  + Landroidx/compose/ui/platform/d0_j;
  + Landroidx/compose/ui/platform/f2_a;
  + Landroidx/compose/ui/platform/y1_a;
  + Landroidx/fragment/app/a0_a;
  + Landroidx/fragment/app/b1_a;
  + Landroidx/fragment/app/b1_b;
  + Landroidx/fragment/app/f1;
  + Landroidx/fragment/app/g1;
  + Landroidx/fragment/app/h0_a;
  + Landroidx/fragment/app/l0_a;
  + Landroidx/fragment/app/n0_a;
  + Landroidx/fragment/app/q0_a;
  + Landroidx/fragment/app/q0_b;
  + Landroidx/fragment/app/s_a;
  + Landroidx/fragment/app/y<
  + Landroidx/lifecycle/d1_a;
  + Landroidx/lifecycle/d1_b;
  + Landroidx/lifecycle/d1_c;
  + Landroidx/lifecycle/d1_d;
  + Landroidx/lifecycle/m_a;
  + Landroidx/lifecycle/m_b;
  + Landroidx/lifecycle/p0_a;
  + Landroidx/lifecycle/p0_b;
  + Landroidx/lifecycle/r0_a;
  + Landroidx/lifecycle/r0_b;
  + Landroidx/lifecycle/s0_c;
  + Landroidx/lifecycle/s0_d;
  + Landroidx/recyclerview/widget/c0_a;
  + Landroidx/recyclerview/widget/d0_b;
  + Landroidx/recyclerview/widget/f_a;
  + Landroidx/recyclerview/widget/f_b;
  + Landroidx/recyclerview/widget/g_c;
  + Landroidx/recyclerview/widget/g_d;
  + Landroidx/recyclerview/widget/g_e;
  + Landroidx/recyclerview/widget/g_f;
  + Landroidx/recyclerview/widget/g_g;
  + Landroidx/recyclerview/widget/g_h;
  + Landroidx/recyclerview/widget/g_i;
  + Landroidx/recyclerview/widget/g_j;
  + Landroidx/recyclerview/widget/h_e<
  + Landroidx/recyclerview/widget/k_d_a;
  + Landroidx/recyclerview/widget/k_d_b;
  + Landroidx/recyclerview/widget/k_d;
  + Landroidx/recyclerview/widget/k_e;
  + Landroidx/recyclerview/widget/k_f;
  + Landroidx/recyclerview/widget/k_g;
  + Landroidx/recyclerview/widget/k_h;
  + Landroidx/recyclerview/widget/r_a;
  + Landroidx/recyclerview/widget/t_a;
  + Landroidx/recyclerview/widget/z_a;
  + Lb1/a0_a;
  + Lb1/a0_b;
  + Lb1/a0_c;
  + Lb1/a0_d;
  + Lb1/a0_e;
  + Lb1/a0_f;
  + Lb1/a0_g;
  + Lb1/j0_a;
  + Lb1/k_a_a;
  + Lb1/k_a_b;
  + Lb1/k_a_c;
  + Lb1/k_a_d;
  + Lb1/k_a_e;
  + Lb1/k_a;
  + Lb1/p_a;
  + Lb1/p_b;
  + Lb1/s_a;
  + Lb1/s_b;
  + Lb1/v_a;
  + Lb1/w_a_a;
  + Lb1/w_b;
  + Lb2/n_a;
  + Lb2/r_a;
  + Lb2/r_b;
  + Lb2/r_c;
  + Lb2/t_a;
  + Lb2/t_b;
  + Lb2/t_c;
  + Lb2/t_d;
  + Lb2/w_a;
  + Lb2/w_b;
  + Lb2/w_c;
  + Lb2/w_d;
  + Lb2/w_e;
  + Lb2/w_f;
  + Lb2/w_g;
  + Lb2/w_h;
  + Lb2/w_i;
  + Lb2/w_j;
  + Lb2/w_k;
  + Lb2/w_l;
  + Lb2/w_m;
  + Lb2/w_n;
  + Lb2/w_o;
  + Lb2/w_p;
  + Lb2/w<
  + Lc1/b6_a;
  + Lc1/c3_a;
  + Lc1/c3_b;
  + Lc1/c4_a;
  + Lc1/c4_b;
  + Lc1/c4_c;
  + Lc1/c4_d;
  + Lc1/c4_e;
  + Lc1/c4_f;
  + L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c5/d0_l;
  + Lc5/d0_l<
  + Lc5/d0<
  + Lc5/f0_a;
  + Lc5/f0_b;
  + Lc5/f0_c;
  + Lc5/f0<
  + Lc5/h0_a;
  + Lc
...✂
ARSC
ENTRIES:

   old  │ new  │ diff       
  ──────┼──────┼────────────
   6421 │ 6422 │ +1 (+1 -0) 
  + id/payment_method_icon


/**
* The customer's selected payment option.
*/
data class PaymentOption(
data class PaymentOption
@Deprecated("Not intended for public use.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should call this out in the changelog?

/**
* The drawable resource id of the icon that represents the payment option.
*/
@DrawableRes val drawableResourceId: Int,
@Deprecated("Please use fetchIcon instead.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should call this out in changelog?

/**
* Fetches the icon associated with this [PaymentOption].
*/
fun icon(): Drawable {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is new public API. Should be in the changelog.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch. I updated the Changelog with the suggested items.

private val paymentOption: PaymentOption,
) : Drawable() {
init {
@OptIn(DelicateCoroutinesApi::class)
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is used in integrators code, what happens when this API changes? Wouldn't the integrator be forced to update Stripe SDK version? Should we be more careful here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a stable API. The annotation has a description of:

Marks declarations in the coroutines that are delicate — they have limited use-case and shall be used with care in general code. Any use of a delicate declaration has to be carefully reviewed to make sure it is properly used and does not create problems like memory and resource leaks. Carefully read documentation of any declaration marked as DelicateCoroutinesApi.

Basically saying don't use this unless you're really sure you want to. In our case, I think it's the right API to use (GlobalScope), due to us not being in coroutines/structured concurrency land.

@jaynewstrom-stripe jaynewstrom-stripe merged commit cbe7222 into master Dec 14, 2022
@jaynewstrom-stripe jaynewstrom-stripe deleted the jaynewstrom/luxe-images-delegate branch December 14, 2022 22:31
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.

2 participants