Adding new embedded theming token types to Android SDK#12695
Conversation
|
Diffuse output: APK |
jaynewstrom-stripe
left a comment
There was a problem hiding this comment.
You can fix the build errors by running ./gradlew detektFormat --no-configuration-cache locally.
You can make sure there won't be any build/CI issues by running CI=true ./gradlew :connect:compileDebugKotlin locally.
| @Poko | ||
| @PreviewConnectSDK | ||
| class Action private constructor( | ||
| @ColorInt internal val colorText: Int? = null, |
There was a problem hiding this comment.
Is there a need for the default here?
| @ColorInt internal val colorText: Int? = null, | |
| @ColorInt internal val colorText: Int?, |
There was a problem hiding this comment.
This same comment applies to nearly all the new things. I think you can get rid of them all.
There was a problem hiding this comment.
I was following the same pattern as the existing classes. They all have <type>? = null. Should I be changing it for the new classes? Or follow that same pattern?
There was a problem hiding this comment.
Since these all should have builders, there shouldn't be a need for defaults (and it just bloats the code, as the kotlin compiler generates additional code for this pattern).
ad30305 to
2007d1e
Compare
|
The bitrise check is failing and I'm not too sure why. It would be great if I could have some help figuring out what the issue is! |
| @Poko | ||
| @PreviewConnectSDK | ||
| class Action private constructor( | ||
| @ColorInt internal val colorText: Int? = null, |
There was a problem hiding this comment.
Since these all should have builders, there shouldn't be a need for defaults (and it just bloats the code, as the kotlin compiler generates additional code for this pattern).
gimenete-stripe
left a comment
There was a problem hiding this comment.
Looking good! I left a few comments.
Would be also good to add some tests.
| public final class com/stripe/android/connect/appearance/BadgeDefaults : android/os/Parcelable { | ||
| public static final field $stable I | ||
| public static final field CREATOR Landroid/os/Parcelable$Creator; | ||
| public fun <init> (Ljava/lang/Float;Ljava/lang/Float;Lcom/stripe/android/connect/appearance/Typography$Style;)V |
There was a problem hiding this comment.
Constructor should be private/internal.
There was a problem hiding this comment.
I made it private now but ./gradlew apiDump still generates it with public final class which is the pattern that all the classes follow in this file.
| public final class com/stripe/android/connect/appearance/ButtonDefaults : android/os/Parcelable { | ||
| public static final field $stable I | ||
| public static final field CREATOR Landroid/os/Parcelable$Creator; | ||
| public fun <init> (Ljava/lang/Float;Ljava/lang/Float;Lcom/stripe/android/connect/appearance/Typography$Style;)V |
There was a problem hiding this comment.
Constructor should be private/internal.
There was a problem hiding this comment.
Same thing with my comment from above
Thanks for the feedback! I added some tests to check that the new tokens are mapping properly and serializes to the correct values. I also added tests to check the deprecated parameters don't cause a breaking change. It still works if the parameters in Form and Action aren't defined, but when they are defined, then the value within the Form and Action classes are used. |
gimenete-stripe
left a comment
There was a problem hiding this comment.
Approving since my feedback has been addressed! Great work!
Not sure about the constructors being private/internal. I'm not a Kotlin expert.
0a11772 to
139a5cf
Compare
Thank you! I had to make some new changes because the bitrise check was failing but I just had to rebase and it's passing now. Could I get it approved again? |
r? @stripe/mx-mobile-reviewers
r? @stripe/android-sdk-reviewers
Summary
In this PR, the mappings of Android SDK names to the web ConnectJS names of the new theming tokens for embedded components were added. This change allows platforms to customize embedded components on Android as well, ensuring a consistent experience across mobile and web.
Additionally, a new testing interface for the theming tokens was added in
connect-example. This allows for easier testing of the new tokens since users can granularly change the values. Previously, we could only see a difference in theme by changing a preset theme, which would make it difficult to see the effects the changes would have and catch any bugs with testing.Some parameters were deprecated due to the addition of the new classes
FormandAction. The deprecated parameters were moved out of theColorsclass if it was a token that affectedFormorActioncomponents since it is better categorized there.Motivation
Platforms requested more granular theming to ensure the embedded UI matches their native UI. New tokens that allow finer control over padding, font, and color for components have been implemented on ConnectJS behind the
enable_new_embedded_theming_tokensflag. The last phase of implementation is to bring this to mobile SDKs.For more context: Adding additional theming functionality for embedded components
Testing
Testing was done locally with the Android Simulator. A screen recording is provided below
Screenshots
Screen.Recording.2026-03-30.at.9.39.26.AM.mov
Changelog