Skip to content

CCC-129: Add Compose support for Cash App Pay Button#164

Merged
pedronveloso merged 15 commits into
mainfrom
pedro/buttons-in-compose
Feb 6, 2026
Merged

CCC-129: Add Compose support for Cash App Pay Button#164
pedronveloso merged 15 commits into
mainfrom
pedro/buttons-in-compose

Conversation

@pedronveloso

@pedronveloso pedronveloso commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

What

Up until now our SDK bundled unmanaged styled Cash App Pay buttons, that were part of the main SDK's library. This change does 2 things:

  • Move the current View-based implementation into a separate module, published separately as well
  • Create a new module containing a Jetpack Compose equivalent of these buttons, same style variants available

Notes:

  • Added compose-lints (Slack's Compose lint rules) for better code quality
  • Added Compose Previews showing all button styles and states
  • The logic for publishing these has not yet been tested, that will be handled as part of a separate issue

Proof

I've separately updated the Dev App to showcase these (separate PR to follow), adding that video here for reference of what these changes look like and as proof everything works as expected.

cap-sdk-compose-v2.mp4

Move existing View-based components into their own module.
Create a Compose-based implementation of our Cash App Pay Button.
@pedronveloso pedronveloso changed the base branch from main to pedro/modernize-build-files-setup February 3, 2026 19:14
@pedronveloso pedronveloso changed the base branch from pedro/modernize-build-files-setup to main February 4, 2026 13:38
@pedronveloso pedronveloso changed the base branch from main to pedro/modernize-build-files-setup February 4, 2026 13:38
@pedronveloso pedronveloso changed the base branch from pedro/modernize-build-files-setup to main February 4, 2026 13:43
* main:
  CCC-2345: Cleanup SDK public API (#162)
  Move Gradle build files to Kotlin Syntax; Version catalog (#163)
Comment thread ui-compose/build.gradle.kts Outdated
Comment thread ui-compose/src/main/java/app/cash/paykit/ui/compose/CashAppPayButtonStyle.kt Outdated
Comment thread ui-compose/src/main/res/values/strings.xml Outdated
Comment thread ui-views/build.gradle.kts
Comment thread ui-compose/src/main/java/app/cash/paykit/ui/compose/CashAppPayButton.kt Outdated
Comment thread ui-views/src/main/res/values/strings.xml
Comment thread ui-compose/src/main/java/app/cash/paykit/ui/compose/CashAppPayButton.kt Outdated
Comment thread ui-compose/build.gradle.kts Outdated
implementation(platform(libs.compose.bom))
implementation(libs.compose.foundation)
implementation(libs.compose.material)
implementation(libs.compose.ui)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This should be an api dep since Modifier is exposed in public API

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Compose runtime should also be an api dep since we expose a Composer (automatically added by the compiler plugin to @Composable functions) in public API

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks like you updated the Compose UI dep, but missed adding the Compose runtime dep

Comment thread ui-compose/lint.xml Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR moves the Cash App Pay button from the core SDK into separate optional modules to reduce the SDK's footprint and provide Compose support. The button is now available as either a View-based implementation (ui-views) or a Jetpack Compose implementation (ui-compose).

Changes:

  • Extracted the View-based CashAppPayButton from the core module into a new ui-views module with updated package name from app.cash.paykit.core.ui to app.cash.paykit.ui.views
  • Created a new ui-compose module providing a Compose equivalent with the same style variants (Default, Alt, MonochromeDark, MonochromeLight)
  • Updated build configuration to support Compose, including adding Compose BOM, Slack's compose-lints, and ktlint configuration for Composable functions

Reviewed changes

Copilot reviewed 24 out of 33 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
settings.gradle.kts Added ui-views and ui-compose modules to the project
gradle/libs.versions.toml Added Compose dependencies (BOM, compose-lints) and updated junitAndroidx version; moved version pinning comment to apply to all plugin versions
build.gradle.kts Added imports and ktlint configuration to ignore function naming for Composable annotations
logging/build.gradle.kts Removed redundant kotlin jvmToolchain block
core/build.gradle.kts Removed comment about dependency version pinning (now in libs.versions.toml)
core/api/core.api Removed CashAppPayButton from public API
ui-views/build.gradle.kts New module configuration for View-based button
ui-views/src/main/java/.../CashAppPayButton.kt Moved button implementation with package name changed to app.cash.paykit.ui.views
ui-views/src/main/res/ Moved button resources (drawables, styles, strings) with trailing newlines added
ui-views/api/ui-views.api New API file for ui-views module
ui-compose/build.gradle.kts New module configuration for Compose button with Compose plugin and dependencies
ui-compose/src/main/java/.../CashAppPayButton.kt New Compose button implementation matching View-based button's behavior
ui-compose/src/main/java/.../CashAppPayButtonStyle.kt Enum defining button style variants
ui-compose/src/main/res/ Button resources for Compose module (drawables, strings)
ui-compose/lint.xml Lint configuration allowing Material 2 ripple API
ui-compose/api/ui-compose.api New API file for ui-compose module
CHANGELOG.md Documented breaking change and new Compose dependency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CHANGELOG.md
Comment on lines +107 to +110
modifier = modifier
.defaultMinSize(minHeight = 48.dp)
.height(48.dp)
.fillMaxWidth()

Copilot AI Feb 5, 2026

Copy link

Choose a reason for hiding this comment

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

The fillMaxWidth() modifier is applied after the user-provided modifier, which means it will override any width constraints the user tries to set. This limits flexibility compared to the View-based button where width can be controlled via XML attributes. Consider removing fillMaxWidth() or applying it before the user modifier (e.g., modifier.fillMaxWidth().then(modifier)) to allow developers to constrain the width if needed. Alternatively, document this behavior clearly in the KDoc.

Suggested change
modifier = modifier
.defaultMinSize(minHeight = 48.dp)
.height(48.dp)
.fillMaxWidth()
modifier = Modifier
.defaultMinSize(minHeight = 48.dp)
.height(48.dp)
.fillMaxWidth()
.then(modifier)

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is intentional

Comment on lines +108 to +109
.defaultMinSize(minHeight = 48.dp)
.height(48.dp)

Copilot AI Feb 5, 2026

Copy link

Choose a reason for hiding this comment

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

The defaultMinSize(minHeight = 48.dp) followed immediately by height(48.dp) is redundant. The explicit height modifier will override the minimum height constraint. Consider removing defaultMinSize since the fixed height already achieves the desired size constraint.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is intentional

pedronveloso and others added 7 commits February 5, 2026 18:55
Use `Button` instead of `Box` which is a better fit as it handles many of the things we were trying to achieve out of the box
The public API signature includes androidx.compose.ui.Modifier and androidx.compose.runtime.Composer types from the Compose libraries.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

@drewhamilton drewhamilton left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Would be great to follow this up with Paparazzi tests!

Comment thread ui-compose/src/main/res/values/public.xml
Comment thread ui-views/src/main/res/values/public.xml
pedronveloso and others added 2 commits February 6, 2026 17:29
Co-authored-by: Drew Hamilton <drewh@squareup.com>
Co-authored-by: Drew Hamilton <drewh@squareup.com>
@pedronveloso pedronveloso merged commit ad69805 into main Feb 6, 2026
3 checks passed
@pedronveloso pedronveloso deleted the pedro/buttons-in-compose branch February 6, 2026 17:40
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.

3 participants