-
Notifications
You must be signed in to change notification settings - Fork 677
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
base: master
Are you sure you want to change the base?
Conversation
Diffuse output:
APK
|
32b4f2c
to
e9504ae
Compare
e9504ae
to
df66a73
Compare
@@ -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 |
There was a problem hiding this comment.
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()), |
There was a problem hiding this comment.
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.
primaryButton.setAppearanceConfiguration( | ||
StripeTheme.primaryButtonStyle, | ||
tintList = viewModel.config.primaryButtonColor ?: ColorStateList.valueOf( | ||
StripeTheme.primaryButtonStyle.getBackgroundColor(context) | ||
tintList = ColorStateList.valueOf( |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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()
}
Summary
Motivation
MOBILESDK-3745
Testing
Screenshots
Changelog