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

[Not being merged to master] Add public api for primary button #4888

Merged
merged 6 commits into from
Apr 21, 2022

Conversation

skyler-stripe
Copy link
Contributor

@skyler-stripe skyler-stripe commented Apr 20, 2022

Summary

NOT BEING MERGED TO MASTER

Motivation

  • Adds more customization to payment sheet.
  • Will be merged to private beta branch

Testing

  • Added tests
  • Modified tests
  • Manually verified
  • default looks the same
  • just setting variables api will also set primary button
  • setting primary button changes the button differently from variables api values
  • original primaryButton api still works.

Screenshots

// no primarybutton showing that it follows the base level.
val appearance = PaymentSheet.Appearance(
    colorsLight = PaymentSheet.Colors.defaultLight.copy(
        primary = Color.RED
    ),
    shapes = PaymentSheet.Shapes.default.copy(
        borderStrokeWidthDp = 5.0f,
        cornerRadiusDp = 20.0f
    ),
    typography = PaymentSheet.Typography.default.copy(
        fontResId = R.font.cursive
    )
)

config1

// simple background change
val appearance = PaymentSheet.Appearance(
    colorsLight = PaymentSheet.Colors.defaultLight.copy(
        primary = Color.RED
    ),
    primaryButton = PaymentSheet.PrimaryButton(
        colorsLight = PaymentSheet.PrimaryButtonColors.defaultLight.copy(
            background = Color.BLACK,
        )
    )
)

config3

// primary button config that is different to show that it changes independently when set  
val appearance = PaymentSheet.Appearance(
    colorsLight = PaymentSheet.Colors.defaultLight.copy(
        primary = Color.RED
    ),
    shapes = PaymentSheet.Shapes.default.copy(
        cornerRadiusDp = 5.0f
    ),
    typography = PaymentSheet.Typography.default.copy(
        fontResId = null
    ),
    primaryButton = PaymentSheet.PrimaryButton(
        colorsLight = PaymentSheet.PrimaryButtonColors(
            background = Color.TRANSPARENT,
            onBackground = Color.BLACK,
            border = Color.BLACK,
        ),
        shape = PaymentSheet.PrimaryButtonShape(
            cornerRadiusDp = 0.0f,
        ),
        typography = PaymentSheet.PrimaryButtonTypography(
            fontResId = R.font.cursive
        )
    )
)

config2

@github-actions
Copy link
Contributor

github-actions bot commented Apr 20, 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 │  13.2 MiB │  13.2 MiB │ +10.9 KiB │  44.2 MiB │  44.2 MiB │ +16.4 KiB 
     arsc │   1.6 MiB │   1.6 MiB │  -1.9 KiB │   1.6 MiB │   1.6 MiB │  -1.9 KiB 
 manifest │   2.9 KiB │   2.9 KiB │       0 B │  12.3 KiB │  12.3 KiB │       0 B 
      res │ 692.1 KiB │ 675.1 KiB │ -16.9 KiB │   1.1 MiB │   1.1 MiB │ -36.5 KiB 
    asset │  79.4 KiB │  78.9 KiB │    -518 B │ 108.9 KiB │ 108.4 KiB │    -518 B 
    other │    80 KiB │    80 KiB │       0 B │ 154.9 KiB │ 154.9 KiB │       0 B 
──────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────
    total │  15.6 MiB │  15.6 MiB │  -8.5 KiB │  47.1 MiB │  47.1 MiB │ -22.4 KiB 

         │          raw           │               unique               
         ├────────┬────────┬──────┼────────┬────────┬──────────────────
 DEX     │ old    │ new    │ diff │ old    │ new    │ diff             
─────────┼────────┼────────┼──────┼────────┼────────┼──────────────────
   files │      3 │      3 │    0 │        │        │                  
 strings │ 213296 │ 213328 │  +32 │ 188084 │ 188139 │  +55 (+174 -119) 
   types │  36851 │  36854 │   +3 │  34246 │  34265 │  +19 (+47 -28)   
 classes │  31671 │  31682 │  +11 │  31671 │  31682 │  +11 (+30 -19)   
 methods │ 189885 │ 190049 │ +164 │ 183952 │ 184124 │ +172 (+286 -114) 
  fields │ 130644 │ 130623 │  -21 │ 129808 │ 129783 │  -25 (+79 -104)  

 ARSC    │ old  │ new  │ diff         
─────────┼──────┼──────┼──────────────
 configs │  292 │  292 │   0          
 entries │ 5607 │ 5593 │ -14 (+0 -14)
APK
      compressed      │     uncompressed     │                               
──────────┬───────────┼──────────┬───────────┤                               
 size     │ diff      │ size     │ diff      │ path                          
──────────┼───────────┼──────────┼───────────┼───────────────────────────────
  3.6 MiB │ +17.8 KiB │ 10.2 MiB │ +45.1 KiB │ ∆ classes3.dex                
  3.2 MiB │    -7 KiB │  8.7 MiB │ -28.7 KiB │ ∆ classes2.dex                
          │  -2.7 KiB │          │  -6.5 KiB │ - res/Fv.xml                  
          │    -2 KiB │          │  -4.8 KiB │ - res/KT.xml                  
  1.6 MiB │  -1.9 KiB │  1.6 MiB │  -1.9 KiB │ ∆ resources.arsc              
          │  -1.7 KiB │          │  -4.5 KiB │ - res/sC.xml                  
          │  -1.3 KiB │          │  -2.8 KiB │ - res/74.xml                  
          │  -1.2 KiB │          │  -2.3 KiB │ - res/wW.xml                  
          │  -1.1 KiB │          │  -2.3 KiB │ - res/kY.xml                  
          │  -1.1 KiB │          │  -2.1 KiB │ - res/Hv.xml                  
          │  -1.1 KiB │          │  -2.2 KiB │ - res/dQ.xml                  
          │    -1 KiB │          │  -1.9 KiB │ - res/JN.xml                  
          │    -939 B │          │  -1.8 KiB │ - res/5K.xml                  
          │    -853 B │          │  -1.4 KiB │ - res/u4.xml                  
          │    -714 B │          │  -1.2 KiB │ - res/XN.xml                  
          │    -709 B │          │  -1.5 KiB │ - res/qu.xml                  
          │    -656 B │          │  -1.1 KiB │ - res/Sg.xml                  
    7 KiB │    -518 B │  6.9 KiB │    -518 B │ ∆ assets/dexopt/baseline.prof 
  6.5 MiB │      +2 B │ 25.3 MiB │       0 B │ ∆ classes.dex                 
    320 B │      -2 B │    464 B │       0 B │ ∆ res/9o.xml                  
    707 B │      +2 B │  1.3 KiB │       0 B │ ∆ res/CF.xml                  
    324 B │      +2 B │    464 B │       0 B │ ∆ res/uP.xml                  
    760 B │      +1 B │  1.7 KiB │       0 B │ ∆ res/4L.xml                  
    796 B │      +1 B │  1.6 KiB │       0 B │ ∆ res/LG.xml                  
    326 B │      -1 B │    464 B │       0 B │ ∆ res/U41.xml                 
  1.2 KiB │      +1 B │  3.5 KiB │       0 B │ ∆ res/_n.xml                  
    334 B │      +1 B │    400 B │       0 B │ ∆ res/kL.xml                  
──────────┼───────────┼──────────┼───────────┼───────────────────────────────
 14.8 MiB │  -8.5 KiB │ 45.8 MiB │ -22.4 KiB │ (total)
DEX
STRINGS:

   old    │ new    │ diff            
  ────────┼────────┼─────────────────
   188084 │ 188139 │ +55 (+174 -119) 
  + *
  ���
  ���
  ���
  ���
  ���
  ���
  
  ���
  ���
  ���
  ����� �2�����0�����0�0�:����B�¢����J�����0�2�����0�2��	��0�H�J��
  ��0�2�����02��
  ����0�H�¨��
  + ,
  ���
  ���
  
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  �7� �2�0�:����B���������0�������0�������0�¢����J��
  ��0�R�����0�X��¢��
  �����	R�����0�X��¢��
  ���
  ��R�����0�X��¢��
  ����	�����¨��
  + <
  ���
  ���
  
  ���
  ���
  ���
  ���
  ���
  
  ���
  
  ��
  ���
  ���
  
  ���
  �������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�HÖ�J�����0�2�������0�HÖ�J	����0�HÖ�J	����0�HÖ�J�����0�2�����0�2�����0�HÖ�R�����0�X��¢��
  �����	R�����0�X��¢��
  ���
  ��R�����0�X��¢��
  ����	¨��
  + \
  ���
  ���
  
  ���
  
  ���
  ���
  
  ���
  
  ���
  
  ���
  ���
  ���
  ���
  ���
  
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  �����2�0�:�!B5��������0����������0�0�������0����	��0
  ������0¢���
  J�����0�2�����0�H�J�����0�H�@ø�¢����J�����0�2�����0�H�@ø�¢����J�����0�2�����0�H�@ø�¢����J�����0�2�����0 R���������0�0�X��¢��
  R�����0�X��¢��
  R��	��0
  X��¢��
  R�����0�X��¢��
  R�����0X��¢��
  R���������0�0�¢��
  ���������
  ���¨�
  + _linkedAccountSessionId
  + (Lcom/stripe/android/connections/ConnectionsSheet;)V
  + (Lcom/stripe/android/payments/bankaccount/navigation/CollectBankAccountContract_Args;Lkotlinx/coroutines/flow/MutableSharedFlow;Lcom/stripe/android/payments/bankaccount/domain/CreateLinkAccountSession;Lcom/stripe/android/payments/bankaccount/domain/AttachLinkAccountSession;Lcom/stripe/android/core/Logger;)V
  + (Ljava/lang/String;Ljava/lang/String;Lcom/stripe/android/payments/bankaccount/CollectBankAccountConfiguration;)V
  + ConnectionsPaymentsProxy.kt
  + IsConnectionsAvailable.kt
  + Lcom/stripe/android/connections/ConnectionsSheet_Companion;
  + Lcom/stripe/android/connections/ConnectionsSheet_Configuration;
  + Lcom/stripe/android/connections/ConnectionsSheet;
  + Lcom/stripe/android/connections/ConnectionsSheetResult_Canceled;
  + Lcom/stripe/android/connections/ConnectionsSheetResult_Completed;
  + Lcom/stripe/android/connections/ConnectionsSheetResult_Failed;
  + Lcom/stripe/android/connections/ConnectionsSheetResult;
  + Lcom/stripe/android/connections/ConnectionsSheetResultCallback;
  + Lcom/stripe/android/connections/model/LinkAccountSession;
  + Lcom/stripe/android/payments/connections/ConnectionsPaymentsProxy_Companion_create_1;
  + Lcom/stripe/android/payments/connections/ConnectionsPaymentsProxy_Companion_create_2;
  + Lcom/stripe/android/payments/connections/ConnectionsPaymentsProxy_Companion;
  + Lcom/stripe/android/payments/connections/ConnectionsPaymentsProxy_sam_com_stripe_android_connections_ConnectionsSheetResultCallback_0;
  + Lcom/stripe/android/payments/connections/ConnectionsPaymentsProxy;
  + Lcom/stripe/android/payments/connections/DefaultConnectionsPaymentsProxy;
  + Lcom/stripe/android/payments/connections/UnsupportedConnectionsPaymentsProxy;
  + Lcom/stripe/android/payments/connections/reflection/DefaultIsConnectionsAvailable;
  + Lcom/stripe/android/payments/connections/reflection/IsConnectionsAvailable;
  + SMAP
  CollectBankAccountViewModel.kt
  Kotlin
  *S Kotlin
  *F
  + 1 CollectBankAccountViewModel.kt
  com/stripe/android/payments/bankaccount/ui/CollectBankAccountViewModel
  + 2 fake.kt
  kotlin/jvm/internal/FakeKt
  *L
  1#1,144:1
  1#2:145
  *E
  
  + SMAP
  CollectBankAccountViewModel.kt
  Kotlin
  *S Kotlin
  *F
  + 1 CollectBankAccountViewModel.kt
  com/stripe/android/payments/bankaccount/ui/CollectBankAccountViewModel_attachLinkAccountSessionToIntent_1
  + 2 fake.kt
  kotlin/jvm/internal/FakeKt
  *L
  1#1,144:1
  1#2:145
  *E
  
  + com.stripe.android.connections.ConnectionsSheet
  + connectionsPaymentsProxy
  + connectionsSheet
  + isConnectionsAvailable
  + onConnectionsResult(Lcom/stripe/android/connections/ConnectionsSheetResult;)V
  + onConnectionsSheetResult
  + �
  
  ���
  ���
  
  ���
  ����0�*�0�H�����0�*�0�H¨��
  + �
  ���
  ��
  ���
  ���
  �������2�0�B���¢����R�����0�¢��
  ������R�����0�¢��
  ������¨�	
  + (
  ���
  ��
  ���
  ���
  ���
  ���
  
  ���
  
  ���
  ������2�0�B�¢����J�����02����0�J�����02����0�J�����02�����0�J�����02�����0	J��
  ��02��
  ��0�R�����0�X��¢��
  R�����0�X��¢��
  R�����0�X��¢��
  R�����0	X��¢��
  R�
...✂
ARSC
ENTRIES:

   old  │ new  │ diff         
  ──────┼──────┼──────────────
   5607 │ 5593 │ -14 (+0 -14) 
  - drawable/stripe_ic_bank_boa
  - drawable/stripe_ic_bank_capitalone
  - drawable/stripe_ic_bank_citi
  - drawable/stripe_ic_bank_compass
  - drawable/stripe_ic_bank_morganchase
  - drawable/stripe_ic_bank_nfcu
  - drawable/stripe_ic_bank_pnc
  - drawable/stripe_ic_bank_stripe
  - drawable/stripe_ic_bank_suntrust
  - drawable/stripe_ic_bank_svb
  - drawable/stripe_ic_bank_td
  - drawable/stripe_ic_bank_usaa
  - drawable/stripe_ic_bank_usbank
  - drawable/stripe_ic_bank_wellsfargo

@skyler-stripe skyler-stripe changed the title [Not being merged to master] Add public api for primary button [Not being merged to master, WIP] Add public api for primary button Apr 20, 2022
@skyler-stripe skyler-stripe force-pushed the addPrimaryButtonRules branch 2 times, most recently from 9252188 to d811099 Compare April 20, 2022 17:47
@skyler-stripe skyler-stripe force-pushed the addPrimaryButtonRules branch from d811099 to b0b94ad Compare April 20, 2022 17:48
@skyler-stripe skyler-stripe changed the title [Not being merged to master, WIP] Add public api for primary button [Not being merged to master] Add public api for primary button Apr 20, 2022
@skyler-stripe skyler-stripe force-pushed the addPrimaryButtonRules branch from 47e4fba to f812e2c Compare April 20, 2022 19:15
@skyler-stripe skyler-stripe force-pushed the payment_sheet_appearance_beta_1 branch from bb9653e to 2602a0d Compare April 21, 2022 00:17
@skyler-stripe skyler-stripe merged commit 02a5819 into payment_sheet_appearance_beta_1 Apr 21, 2022
@skyler-stripe skyler-stripe deleted the addPrimaryButtonRules branch April 21, 2022 16:59
skyler-stripe added a commit that referenced this pull request May 17, 2022
* Add public api for project wardrobe (not being merged to master) (#4760)

* add public api for project wardrobe

* attempt #2

* change from floats to TextUnits for default typography

* forgot typography

* api dump

* [Not being merged to master] Add public api for primary button (#4888)

* Add public api for primary button

* apidump

* add nullables to make construction easier

* update docs

* Create Appearance Playground (#4897)

* add screenshot tests for apperance work (#4939)

* add primary button rules to playground (#4935)

* Add project wardrobe configs to init events (#4967)

* Add project wardrobe configs to init events

* shorten config field to save url size

* Dogfood feedback for Appearance APIs (#4996)

* address dogfooding comments

* api dump
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.

5 participants