这是indexloc提供的服务,不要输入任何密码
Skip to content

Removing primaryButtonColor from PaymentSheet.Configuration #11136

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cttsai-stripe
Copy link
Contributor

Summary

Motivation

MOBILESDK-3745

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Before After
before screenshot after screenshot

Changelog

Copy link
Contributor

github-actions bot commented Jul 16, 2025

Diffuse output:

OLD: identity-example-release-base.apk (signature: V1, V2)
NEW: identity-example-release-pr.apk (signature: V1, V2)

          │          compressed           │         uncompressed         
          ├───────────┬───────────┬───────┼───────────┬───────────┬──────
 APK      │ old       │ new       │ diff  │ old       │ new       │ diff 
──────────┼───────────┼───────────┼───────┼───────────┼───────────┼──────
      dex │   2.1 MiB │   2.1 MiB │   0 B │   4.3 MiB │   4.3 MiB │  0 B 
     arsc │     1 MiB │     1 MiB │   0 B │     1 MiB │     1 MiB │  0 B 
 manifest │   2.3 KiB │   2.3 KiB │   0 B │     8 KiB │     8 KiB │  0 B 
      res │ 302.9 KiB │ 302.9 KiB │   0 B │   457 KiB │   457 KiB │  0 B 
   native │   6.2 MiB │   6.2 MiB │   0 B │  15.8 MiB │  15.8 MiB │  0 B 
    asset │   7.7 KiB │   7.7 KiB │   0 B │   7.4 KiB │   7.4 KiB │  0 B 
    other │  95.8 KiB │  95.7 KiB │ -13 B │ 183.5 KiB │ 183.5 KiB │  0 B 
──────────┼───────────┼───────────┼───────┼───────────┼───────────┼──────
    total │   9.8 MiB │   9.8 MiB │ -13 B │  21.8 MiB │  21.8 MiB │  0 B 

 DEX     │ old   │ new   │ diff      
─────────┼───────┼───────┼───────────
   files │     1 │     1 │ 0         
 strings │ 20682 │ 20682 │ 0 (+0 -0) 
   types │  6503 │  6503 │ 0 (+0 -0) 
 classes │  5266 │  5266 │ 0 (+0 -0) 
 methods │ 31511 │ 31511 │ 0 (+0 -0) 
  fields │ 18239 │ 18239 │ 0 (+0 -0) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  164 │  164 │  0   
 entries │ 3646 │ 3646 │  0
APK
    compressed    │   uncompressed   │                        
──────────┬───────┼───────────┬──────┤                        
 size     │ diff  │ size      │ diff │ path                   
──────────┼───────┼───────────┼──────┼────────────────────────
 29.2 KiB │  -9 B │  64.6 KiB │  0 B │ ∆ META-INF/CERT.SF     
 25.9 KiB │  -3 B │  64.5 KiB │  0 B │ ∆ META-INF/MANIFEST.MF 
  1.2 KiB │  -1 B │   1.2 KiB │  0 B │ ∆ META-INF/CERT.RSA    
──────────┼───────┼───────────┼──────┼────────────────────────
 56.2 KiB │ -13 B │ 130.4 KiB │  0 B │ (total)

@cttsai-stripe cttsai-stripe force-pushed the cttsai/remove-primary-button-color branch from 32b4f2c to e9504ae Compare July 16, 2025 00:30
@cttsai-stripe cttsai-stripe force-pushed the cttsai/remove-primary-button-color branch from e9504ae to df66a73 Compare July 16, 2025 06:01
@@ -1879,28 +1879,26 @@ public final class com/stripe/android/paymentsheet/PaymentSheet$Configuration :
public fun <init> (Ljava/lang/String;)V
public fun <init> (Ljava/lang/String;Lcom/stripe/android/paymentsheet/PaymentSheet$CustomerConfiguration;)V
public fun <init> (Ljava/lang/String;Lcom/stripe/android/paymentsheet/PaymentSheet$CustomerConfiguration;Lcom/stripe/android/paymentsheet/PaymentSheet$GooglePayConfiguration;)V
public fun <init> (Ljava/lang/String;Lcom/stripe/android/paymentsheet/PaymentSheet$CustomerConfiguration;Lcom/stripe/android/paymentsheet/PaymentSheet$GooglePayConfiguration;Landroid/content/res/ColorStateList;)V
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These changes are merely for passing the checks and should not matter. They are all removed in #11041

@@ -57,7 +55,6 @@ internal object PaymentSheetFixtures {
"ek_123"
),
googlePay = ConfigFixtures.GOOGLE_PAY,
primaryButtonColor = ColorStateList.valueOf(Color.Black.toArgb()),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The color is already set with appearance.

@cttsai-stripe cttsai-stripe marked this pull request as ready for review July 16, 2025 06:27
@cttsai-stripe cttsai-stripe requested review from a team as code owners July 16, 2025 06:27
primaryButton.setAppearanceConfiguration(
StripeTheme.primaryButtonStyle,
tintList = viewModel.config.primaryButtonColor ?: ColorStateList.valueOf(
StripeTheme.primaryButtonStyle.getBackgroundColor(context)
tintList = ColorStateList.valueOf(
Copy link
Collaborator

Choose a reason for hiding this comment

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

This change seems odd! Why do we need isSystemDarkTheme now, but we didn't before?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't have full context here. My hunch is that we were missing the theme before but it didn't matter much because most of the time the primary button color is the same for both light and dark theme. As we are migrating to setup the colors with appearance, the theme should be taken into account. That is what the default fallback is doing:

@ColorInt
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
fun PrimaryButtonStyle.getBackgroundColor(context: Context): Int {
    val isDark = context.isSystemDarkTheme()
    return (if (isDark) colorsDark else colorsLight).background.toArgb()
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants