stripe / stripe-android

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

Update PrimaryButtonUiStateMapper to use resolvableString #8670

Open tjclawson-stripe opened 1 week ago

tjclawson-stripe commented 1 week ago

Summary

Update PrimaryButtonUiStateMapper to use resolvableString to handle per app localization

Motivation

Needed for merchants using per-app localization that are below API 33

To test:

  1. Add

    val appLocales = LocaleListCompat.forLanguageTags("fr")
    AppCompatDelegate.setApplicationLocales(appLocales)

    to PaymentSheetPlaygroundActivity.onCreate()

  2. Add French to System Languages

Testing

Screenshots

Before After
Screenshot_1719001901 Screenshot_1719001689

Changelog

vercel[bot] commented 1 week ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
stripe-android ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 21, 2024 8:32pm
github-actions[bot] commented 1 week 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 │    +58 B │   8.7 MiB │   8.7 MiB │    +24 B 
     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 │ +1.4 KiB │   2.9 MiB │   2.9 MiB │ +1.4 KiB 
    other │   195 KiB │   195 KiB │     -4 B │ 428.4 KiB │ 428.4 KiB │      0 B 
──────────┼───────────┼───────────┼──────────┼───────────┼───────────┼──────────
    total │  12.8 MiB │  12.8 MiB │ +1.4 KiB │  21.8 MiB │  21.8 MiB │ +1.4 KiB 

 DEX     │ old   │ new   │ diff       
─────────┼───────┼───────┼────────────
   files │     1 │     1 │  0         
 strings │ 43585 │ 43585 │  0 (+2 -2) 
   types │ 14988 │ 14988 │  0 (+0 -0) 
 classes │ 12670 │ 12670 │  0 (+0 -0) 
 methods │ 62032 │ 62031 │ -1 (+6 -7) 
  fields │ 40957 │ 40956 │ -1 (+7 -8) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  242 │  242 │  0   
 entries │ 6043 │ 6043 │  0
APK ``` compressed │ uncompressed │ ──────────┬──────────┼───────────┬──────────┤ size │ diff │ size │ diff │ path ──────────┼──────────┼───────────┼──────────┼─────────────────────────────── 7.4 KiB │ +1.4 KiB │ 7.2 KiB │ +1.4 KiB │ ∆ assets/dexopt/baseline.prof 4 MiB │ +58 B │ 8.7 MiB │ +24 B │ ∆ classes.dex 49.6 KiB │ -7 B │ 117.1 KiB │ 0 B │ ∆ META-INF/MANIFEST.MF 52.9 KiB │ +3 B │ 117.2 KiB │ 0 B │ ∆ META-INF/CERT.SF ──────────┼──────────┼───────────┼──────────┼─────────────────────────────── 4.1 MiB │ +1.4 KiB │ 9 MiB │ +1.4 KiB │ (total) ```
DEX ``` STRINGS: old │ new │ diff ───────┼───────┼─────────── 43585 │ 43585 │ 0 (+2 -2) + VLZLLLLLLL + ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:aac1984,r8-mode:full,version:8.3.37} - VLLZLLLLLLL - ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:c35a707,r8-mode:full,version:8.3.37} METHODS: old │ new │ diff ───────┼───────┼──────────── 62032 │ 62031 │ -1 (+6 -7) + com.stripe.android.paymentsheet.ui.PrimaryButton getExternalLabel_paymentsheet_release() → b + com.stripe.android.paymentsheet.ui.PrimaryButton setExternalLabel_paymentsheet_release(b) + com.stripe.android.paymentsheet.ui.PrimaryButton setLabel(b) + i7.F c() → a + q7.S0 (b, a, boolean, boolean) + s7.E (E0, boolean, b, b, b, W, o0, o0, a) - X7.a d(Resources) → String - com.stripe.android.paymentsheet.ui.PrimaryButton getExternalLabel_paymentsheet_release() → String - com.stripe.android.paymentsheet.ui.PrimaryButton setExternalLabel_paymentsheet_release(String) - com.stripe.android.paymentsheet.ui.PrimaryButton setLabel(String) - i7.F c() → String - q7.S0 (String, a, boolean, boolean) - s7.E (Application, E0, boolean, b, b, b, W, o0, o0, a) FIELDS: old │ new │ diff ───────┼───────┼──────────── 40957 │ 40956 │ -1 (+7 -8) + com.stripe.android.paymentsheet.ui.PrimaryButton V: b + com.stripe.android.paymentsheet.ui.PrimaryButton a0: b + q7.S0 a: b + s7.E a: E0 + s7.E b: boolean + s7.E c: m0 + s7.E i: a - com.stripe.android.paymentsheet.ui.PrimaryButton V: String - com.stripe.android.paymentsheet.ui.PrimaryButton a0: String - q7.S0 a: String - s7.E a: Context - s7.E b: E0 - s7.E c: boolean - s7.E i: m0 - s7.E j: a ```