stripe-android icon indicating copy to clipboard operation
stripe-android copied to clipboard

[Breaking change] Use suspendable function instead of `Flow` in `GooglePayRepository`

Open samer-stripe opened this issue 2 years ago • 1 comments

Summary

Replaces the usage of Flow with a suspendable function that returns the result.

Motivation

All consumers of isReady from GooglePayRepository use the returned Flow as a single emitting source by consuming only the first result using first(). Since we are only expecting a single result every time, it is better to represent isReady as a single result suspendable function.

Testing

  • [ ] Added tests
  • [ ] Modified tests
  • [ ] Manually verified

Screenshots

Before After
before screenshot after screenshot

Changelog

samer-stripe avatar Aug 16 '23 19:08 samer-stripe

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 │   3.5 MiB │   3.5 MiB │   -320 B │   7.7 MiB │   7.7 MiB │   -136 B 
     arsc │   2.1 MiB │   2.1 MiB │      0 B │   2.1 MiB │   2.1 MiB │      0 B 
 manifest │   4.9 KiB │   4.9 KiB │      0 B │  24.1 KiB │  24.1 KiB │      0 B 
      res │ 867.8 KiB │ 867.8 KiB │      0 B │   1.3 MiB │   1.3 MiB │      0 B 
   native │   2.6 MiB │   2.6 MiB │      0 B │     6 MiB │     6 MiB │      0 B 
    asset │     3 MiB │     3 MiB │ +1.2 KiB │     3 MiB │     3 MiB │ +1.2 KiB 
    other │ 199.6 KiB │ 199.6 KiB │     +2 B │ 446.7 KiB │ 446.7 KiB │      0 B 
──────────┼───────────┼───────────┼──────────┼───────────┼───────────┼──────────
    total │  12.2 MiB │  12.2 MiB │   +921 B │  20.6 MiB │  20.6 MiB │ +1.1 KiB 

 DEX     │ old   │ new   │ diff           
─────────┼───────┼───────┼────────────────
   files │     1 │     1 │  0             
 strings │ 38157 │ 38155 │ -2 (+6 -8)     
   types │ 12609 │ 12608 │ -1 (+5 -6)     
 classes │ 10639 │ 10638 │ -1 (+0 -1)     
 methods │ 55920 │ 55919 │ -1 (+126 -127) 
  fields │ 35096 │ 35095 │ -1 (+147 -148) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  291 │  291 │  0   
 entries │ 6925 │ 6925 │  0
APK
     compressed      │     uncompressed     │                                
──────────┬──────────┼───────────┬──────────┤                                
 size     │ diff     │ size      │ diff     │ path                           
──────────┼──────────┼───────────┼──────────┼────────────────────────────────
  6.3 KiB │ +1.2 KiB │   6.2 KiB │ +1.2 KiB │ ∆ assets/dexopt/baseline.prof  
  3.5 MiB │   -320 B │   7.7 MiB │   -136 B │ ∆ classes.dex                  
 62.7 KiB │     +4 B │ 140.8 KiB │      0 B │ ∆ META-INF/CERT.SF             
    762 B │     -3 B │     630 B │     -3 B │ ∆ assets/dexopt/baseline.profm 
  1.2 KiB │     -2 B │   1.2 KiB │      0 B │ ∆ META-INF/CERT.RSA            
──────────┼──────────┼───────────┼──────────┼────────────────────────────────
  3.6 MiB │   +921 B │   7.9 MiB │ +1.1 KiB │ (total)
DEX
STRINGS:

   old   │ new   │ diff       
  ───────┼───────┼────────────
   38157 │ 38155 │ -2 (+6 -8) 
  + [Lic/b;
  + [Lic/g0;
  + [Lic/m;
  + [Lic/v;
  + [Lic/y;
  + ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:7a2858f,r8-mode:full,version:8.0.46}
  
  - _isReadyState
  - Lic/q0;
  - [Lic/b0;
  - [Lic/h;
  - [Lic/i0;
  - [Lic/o;
  - [Lic/x;
  - ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:4c30aa5,r8-mode:full,version:8.0.46}
  

TYPES:

   old   │ new   │ diff       
  ───────┼───────┼────────────
   12609 │ 12608 │ -1 (+5 -6) 
  + [Lic/b;
  + [Lic/g0;
  + [Lic/m;
  + [Lic/v;
  + [Lic/y;
  
  - Lic/q0;
  - [Lic/b0;
  - [Lic/h;
  - [Lic/i0;
  - [Lic/o;
  - [Lic/x;
  

METHODS:

   old   │ new   │ diff           
  ───────┼───────┼────────────────
   55920 │ 55919 │ -1 (+126 -127) 
  + com.stripe.android.googlepaylauncher.GooglePayLauncherActivity i(h)
  + com.stripe.android.googlepaylauncher.GooglePayLauncherActivity j() → t
  + com.stripe.android.googlepaylauncher.GooglePayPaymentMethodLauncherActivity i(b0)
  + com.stripe.android.googlepaylauncher.GooglePayPaymentMethodLauncherActivity j() → o0
  + com.stripe.android.googlepaylauncher.GooglePayPaymentMethodLauncherActivity k(b0)
  + ic.a0 <init>(int, Throwable)
  + ic.a <init>(Context, b, m, boolean, boolean, d)
  + ic.a a(d) → Object
  + ic.b0 <init>()
  + ic.b <clinit>()
  + ic.b <init>(String, int, int)
  + ic.b valueOf(String) → b
  + ic.b values() → b[]
  + ic.c0 <init>(d0)
  + ic.c0 a(d)
  + ic.c <init>(boolean, int, boolean)
  + ic.c describeContents() → int
  + ic.c equals(Object) → boolean
  + ic.c hashCode() → int
  + ic.c toString() → String
  + ic.c writeToParcel(Parcel, int)
  + ic.d0 <init>(b0, w, x, e, boolean, Context, c, Set, a, a, boolean, h, e, c)
  + ic.d0 a(String, long, String)
  + ic.d <init>(b, String, String, boolean, c, boolean, boolean)
  + ic.e0 <init>(GooglePayPaymentMethodLauncherActivity, d)
  + ic.e0 A(Object, Object) → Object
  + ic.e0 b(Object, d) → d
  + ic.e0 i(Object) → Object
  + ic.e <init>()
  + ic.f0 <init>(GooglePayPaymentMethodLauncherActivity, k, d)
  + ic.g0 <clinit>()
  + ic.g0 <init>(String, Set, boolean, String, String)
  + ic.g0 describeContents() → int
  + ic.g0 equals(Object) → boolean
  + ic.g0 hashCode() → int
  + ic.g0 toString() → String
  + ic.g0 writeToParcel(Parcel, int)
  + ic.g <init>(Throwable)
  + ic.g equals(Object) → boolean
  + ic.g hashCode() → int
  + ic.g toString() → String
  + ic.h0 <init>(w, String, long, String, g0)
  + ic.h <init>()
  + ic.i0 <init>()
  + ic.i0 a(n, Object) → Intent
  + ic.i0 c(Intent, int) → Object
  + ic.i <init>(GooglePayLauncherActivity, int, Intent, d)
  + ic.i A(Object, Object) → Object
  + ic.i b(Object, d) → d
  + ic.i i(Object) → Object
  + ic.j0 <init>(Application, boolean, String, String, Set)
  + ic.j0 equals(Object) → boolean
  + ic.j0 hashCode() → int
  + ic.j0 toString() → String
  + ic.j <init>(GooglePayLauncherActivity, d)
  + ic.k0 <init>(j0, int)
  + ic.k0 j() → Object
  + ic.k <init>(GooglePayLauncherActivity, v, g3, d)
  + ic.l0 <init>(h0)
  + ic.l0 a(Object)
  + ic.l0 create(Class) → r1
  + ic.l0 create(Class, c) → r1
  + ic.l <init>()
  + ic.l c() → String
  + ic.l f() → d
  + ic.m0 <init>(o0, d)
  + ic.m0 i(Object) → Object
  + ic.m <clinit>()
  + ic.m <init>(String, d)
  + ic.m describeContents() → int
  + ic.m equals(Object) → boolean
  + ic.m f() → d
  + ic.m hashCode() → int
  + ic.m toString() → String
  + ic.m writeToParcel(Parcel, int)
  + ic.n0 <init>(o0, d)
  + ic.n <init>(String, d, String)
  + ic.n f() → d
  + ic.o0 <init>(p, i, h0, p0, q, a, l1)
  + ic.o0 b(d) → Object
  + ic.o0 c(k, d) → Object
  + ic.o <init>(l)
  + ic.o create(Class) → r1
  + ic.o create(Class, c) → r1
  + ic.p0 <init>(Context)
  + ic.p <init>(t, d)
  + ic.p i(Object) → Object
  + ic.q <init>(t, d)
  + ic.r <init>(t, d)
  + ic.s <init>(t, int, Intent, d)
  + ic.s A(Object, Object) → Object
  + ic.s b(Object, d) → d
  + ic.t <init>(p, i, l, p0, d1, q, a, l1)
  + ic.t b(d) → Object
  + ic.t c(l, d) → Object
  + ic.t d(f5, String) → p
  + ic.t e(int, Intent, d) → Object
  + ic.u <init>(d0, d)
  + ic.u A(Object, Object) → Object
  + ic.u b(Object, d) → d
  + ic.u i(Object) → Object
  + ic.v <clinit>()
  + ic.v <init>(boolean, int, boolean)
  + ic.v describeContents() → int
  + ic.v equals(Object) → boolean
  + ic.v hashCode() → int
  + ic.v toString() →
...✂

github-actions[bot] avatar Aug 16 '23 19:08 github-actions[bot]

Closing for now, will revisit in SDK modernization

samer-stripe avatar May 26 '24 15:05 samer-stripe