stripe / stripe-android

Stripe Android SDK
https://stripe.com/docs/mobile/android
MIT License
1.23k stars 628 forks source link

Refactor PaymentSheetTopBarState to not require a PaymentSheetScreen object #8694

Closed amk-stripe closed 4 days ago

amk-stripe commented 5 days ago

Summary

Refactor PaymentSheetTopBarState to not require a PaymentSheetScreen object

Motivation

Makes it so that CustomerSheetViewState doesn't need to create instances of PaymentSheetScreens which are not actually used as screens.

Testing

There are existing unit tests for PaymentSheetTopBarState. No behavior changes in this PR.

github-actions[bot] commented 5 days ago

Diffuse output:

OLD: paymentsheet-example-release-master.apk (signature: V1, V2)
NEW: paymentsheet-example-release-pr.apk (signature: V1, V2)

          │           compressed           │           uncompressed           
          ├───────────┬───────────┬────────┼───────────┬───────────┬──────────
 APK      │ old       │ new       │ diff   │ old       │ new       │ diff     
──────────┼───────────┼───────────┼────────┼───────────┼───────────┼──────────
      dex │     4 MiB │     4 MiB │ +393 B │   8.7 MiB │   8.7 MiB │ +1.5 KiB 
     arsc │   2.3 MiB │   2.3 MiB │    0 B │   2.3 MiB │   2.3 MiB │      0 B 
 manifest │   5.1 KiB │   5.1 KiB │    0 B │  25.6 KiB │  25.6 KiB │      0 B 
      res │ 918.5 KiB │ 918.5 KiB │    0 B │   1.5 MiB │   1.5 MiB │      0 B 
   native │   2.6 MiB │   2.6 MiB │    0 B │     6 MiB │     6 MiB │      0 B 
    asset │   2.9 MiB │   2.9 MiB │  -27 B │   2.9 MiB │   2.9 MiB │    -27 B 
    other │   195 KiB │   195 KiB │  -17 B │ 428.4 KiB │ 428.4 KiB │      0 B 
──────────┼───────────┼───────────┼────────┼───────────┼───────────┼──────────
    total │  12.8 MiB │  12.8 MiB │ +349 B │  21.8 MiB │  21.8 MiB │ +1.5 KiB 

 DEX     │ old   │ new   │ diff              
─────────┼───────┼───────┼───────────────────
   files │     1 │     1 │   0               
 strings │ 43552 │ 43558 │  +6 (+14 -8)      
   types │ 14972 │ 14975 │  +3 (+3 -0)       
 classes │ 12656 │ 12658 │  +2 (+2 -0)       
 methods │ 61964 │ 61969 │  +5 (+2091 -2086) 
  fields │ 40889 │ 40914 │ +25 (+79 -54)     

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  242 │  242 │  0   
 entries │ 6043 │ 6043 │  0
APK ``` compressed │ uncompressed │ ──────────┬────────┼───────────┬──────────┤ size │ diff │ size │ diff │ path ──────────┼────────┼───────────┼──────────┼─────────────────────────────── 4 MiB │ +393 B │ 8.7 MiB │ +1.5 KiB │ ∆ classes.dex 7.4 KiB │ -27 B │ 7.2 KiB │ -27 B │ ∆ assets/dexopt/baseline.prof 49.6 KiB │ -11 B │ 117.1 KiB │ 0 B │ ∆ META-INF/MANIFEST.MF 52.9 KiB │ -5 B │ 117.2 KiB │ 0 B │ ∆ META-INF/CERT.SF 1.2 KiB │ -1 B │ 1.2 KiB │ 0 B │ ∆ META-INF/CERT.RSA ──────────┼────────┼───────────┼──────────┼─────────────────────────────── 4.1 MiB │ +349 B │ 9 MiB │ +1.5 KiB │ (total) ```
DEX ``` STRINGS: old │ new │ diff ───────┼───────┼───────────── 43552 │ 43558 │ +6 (+14 -8) + ADD_ANOTHER_PAYMENT_METHOD + ADD_FIRST_PAYMENT_METHOD + EDIT_PAYMENT_METHOD + FORM + Lo8/l; + Lo8/m; + MANAGE_ONE_SAVED_PAYMENT_METHOD + MANAGE_SAVED_PAYMENT_METHODS + SELECT_SAVED_PAYMENT_METHODS + VERTICAL_MODE + VLZZLZLZ + [Lq7/E1; + create(Lcom/stripe/android/paymentsheet/ui/SheetScreen;ZZZZZ)Lcom/stripe/android/paymentsheet/ui/PaymentSheetTopBarState; + ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:8546e19,r8-mode:full,version:8.3.37} - Attempting to use UnsupportedAddPaymentMethodInteractor - UNSUPPORTED_ADD_PAYMENT_METHOD_INTERACTOR_USED - VLZZLLZ - add_payment_method_interactor.unsupported_implementation.used - create(Lcom/stripe/android/paymentsheet/navigation/PaymentSheetScreen;ZZZZ)Lcom/stripe/android/paymentsheet/ui/PaymentSheetTopBarState; - function_accessed - handleViewAction_ - ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:ae43989,r8-mode:full,version:8.3.37} TYPES: old │ new │ diff ───────┼───────┼──────────── 14972 │ 14975 │ +3 (+3 -0) + Lo8/l; + Lo8/m; + [Lq7/E1; METHODS: old │ new │ diff ───────┼───────┼────────────────── 61964 │ 61969 │ +5 (+2091 -2086) + A0.h G(Object, Object) → Object + A0.k J(Object) → Object + A4.a G(Object, Object) → Object + A5.A G(Object, Object) → Object + A5.C G(Object, Object) → Object + A5.D G(Object, Object) → Object + A5.F G(Object, Object) → Object + A5.G J(Object) → Object + A5.H G(Object, Object) → Object + A5.I J(Object) → Object + A5.b J(Object) → Object + A5.c G(Object, Object) → Object + A5.d G(Object, Object) → Object + A5.e F(Object, Object, Object) → Object + A5.f J(Object) → Object + A5.g G(Object, Object) → Object + A5.h G(Object, Object) → Object + A5.j G(Object, Object) → Object + A5.k G(Object, Object) → Object + A5.o J(Object) → Object + A5.p G(Object, Object) → Object + A5.q J(Object) → Object + A5.s G(Object, Object) → Object + A5.t G(Object, Object) → Object + A5.v G(Object, Object) → Object + A5.w J(Object) → Object + A5.x G(Object, Object) → Object + A5.y G(Object, Object) → Object + A5.z G(Object, Object) → Object + B2.a G(Object, Object) → Object + B5.a F(Object, Object, Object) → Object + B5.c G(Object, Object) → Object + B5.d G(Object, Object) → Object + B5.e F(Object, Object, Object) → Object + B5.i J(Object) → Object + B5.j J(Object) → Object + B5.k J(Object) → Object + B5.l G(Object, Object) → Object + B5.m J(Object) → Object + B5.n G(Object, Object) → Object + B5.o G(Object, Object) → Object + B5.p G(Object, Object) → Object + B5.q J(Object) → Object + B5.s G(Object, Object) → Object + B5.t G(Object, Object) → Object + B5.u G(Object, Object) → Object + B5.v G(Object, Object) → Object + B5.w J(Object) → Object + B5.x G(Object, Object) → Object + B6.j G(Object, Object) → Object + B6.k G(Object, Object) → Object + B6.p G(Object, Object) → Object + B7.I G(Object, Object) → Object + B7.g0 G(Object, Object) → Object + B7.j0 G(Object, Object) → Object + B7.m0 G(Object, Object) → Object + B7.m G(Object, Object) → Object + B7.n0 G(Object, Object) → Object + C0.c L() + C0.c n0() + C0.d B(long) → long + C0.d C(float) → float + C0.d H(long) → int + C0.d Q(float) → int + C0.d Z(long) → long + C0.d c0(long) → float + C0.d k0(float) → long + C0.d p0(int) → float + C0.d r0(float) → float + C0.e n0() + C0.h n0() + C0.j n0() + C0.k J(Object) → Object + C2.a G(Object, Object) → Object + C4.g G(Object, Object) → Object + C4.l G(Object, Object) → Object + C4.m G(Object, Object) → Object + C4.n G(Object, Object) → Object + C4.o G(Object, Object) → Object + C4.p G(Object, Object) → Object + C4.t J(Object) → Object + C5.a F(Object, Object, Object) → Object + C5.c G(Object, Object) → Object + C5.d G(Object, Object) → Object + C5.e G(Object, Object) → Object + C5.f G(Object, Object) → Object + C5.g F(Object, Object, Object) → Object + C5.k J(Object) → Object + C5.l G(Object, Object) → Object + C5.m J(Object) → Object + C5.o G(Object, Object) → Object + C5.p G(Object, Object) → Object + C5.q G(Object, Object) → Object + C5.r G(Object, Obje ...✂ ```