Skip to content

Add close_workflow button action#3453

Merged
vegaro merged 8 commits into
mainfrom
cesar/close-workflow-button-action
May 8, 2026
Merged

Add close_workflow button action#3453
vegaro merged 8 commits into
mainfrom
cesar/close-workflow-button-action

Conversation

@vegaro

@vegaro vegaro commented May 7, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds close_workflow button action that always dismisses the paywall regardless of workflow step
  • Flows through the existing button-action pipeline: ButtonComponent.Action.CloseWorkflowButtonComponentStyle.Action.CloseWorkflowPaywallAction.External.CloseWorkflowviewModel.closePaywall()
  • No new ViewModel function or event type needed. CloseWorkflow propagates to the outer paywall-level handler via the existing else -> onClick(action) path
  • The matching close_workflow analytics event lands later with the Analytics milestone

Note

Medium Risk
Introduces a new serialized button action that directly dismisses the paywall, which could change navigation/dismiss behavior in workflow-based paywalls if misconfigured or triggered unexpectedly.

Overview
Adds a new close_workflow button action end-to-end (component model, style conversion, UI action mapping) so dashboard-configured buttons can always dismiss the paywall via viewModel.closePaywall().

Updates serialization/deserialization to recognize the new action type, wires it through PaywallAction.External, and adds/extends unit + compose tests (including sheet propagation) plus interaction mapping coverage.

Reviewed by Cursor Bugbot for commit c3a0e31. Bugbot is set up for automated code reviews on this repo. Configure here.

@codecov

codecov Bot commented May 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 42.85714% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.46%. Comparing base (17eff89) to head (c3a0e31).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...t/purchases/paywalls/components/ButtonComponent.kt 42.85% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3453      +/-   ##
==========================================
- Coverage   79.48%   79.46%   -0.02%     
==========================================
  Files         363      363              
  Lines       14562    14569       +7     
  Branches     1979     1983       +4     
==========================================
+ Hits        11574    11577       +3     
- Misses       2190     2194       +4     
  Partials      798      798              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vegaro vegaro changed the title feat: add close_workflow button action Add close_workflow button action May 7, 2026
@vegaro vegaro marked this pull request as ready for review May 7, 2026 16:15
@vegaro vegaro requested review from a team as code owners May 7, 2026 16:15
@vegaro vegaro requested a review from facumenzella May 7, 2026 16:16

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 283ae6d. Configure here.

@vegaro vegaro enabled auto-merge May 8, 2026 06:55
@vegaro vegaro added this pull request to the merge queue May 8, 2026
Merged via the queue into main with commit 2a53b03 May 8, 2026
36 checks passed
@vegaro vegaro deleted the cesar/close-workflow-button-action branch May 8, 2026 07:27
facumenzella added a commit to RevenueCat/purchases-ios that referenced this pull request May 13, 2026
* feat: add close_workflow button action

Ports RevenueCat/purchases-android#3453 to iOS. Adds a new
`close_workflow` button action that always dismisses the entire paywall,
regardless of workflow step or whether triggered from inside a sheet.

The action flows through the existing pipeline:
- `PaywallComponent.ButtonComponent.Action.closeWorkflow` (serialization)
- `ButtonComponentViewModel.Action.closeWorkflow` (view model)
- `closeWorkflowAction` environment key (set at RootView, propagates
  through sheets where local onDismiss only closes the sheet)
- `ButtonComponentView` reads the env key and calls it on tap

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: preserve close_workflow behavior without public API change

* fix: make close_workflow dismiss the full workflow

* fix: include close workflow marker in button equality

* fix: apply closeWorkflowAction after bottomSheet so sheets inherit it

The environment modifier must be outer to bottomSheet — views created
inside BottomSheetOverlayModifier.body are siblings of content and only
inherit from the modifier's outer context, not from inner modifiers on
the content itself.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test: add close_workflow mapping and equality regression tests

- ButtonComponentCodableTests: assert that close_workflow and navigate_back
  buttons with identical .action values are nonetheless unequal via
  isCloseWorkflowAction (Equatable and Hashable both verified)
- ButtonComponentViewModelMappingTests (new file): assert that a decoded
  close_workflow button maps to .closeWorkflow in the view model (interaction
  value "close_workflow"), and navigate_back maps to .navigateBack

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: add ButtonComponentViewModelMappingTests.swift to RevenueCat.xcodeproj

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: add ButtonComponentViewModelMappingTests.swift file reference to xcodeproj

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Review fixes: consistent optional chain, single-decode for close_workflow, drop fragile hash assertion

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Simplify: set closeWorkflowAction env in LoadedPaywallsV2View, drop param from ComponentsView and RootView

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
github-merge-queue Bot pushed a commit that referenced this pull request May 13, 2026
**This is an automatic release.**

## RevenueCat SDK
### 📦 Dependency Updates
* [RENOVATE] Update dependency gradle to v8.14.5 (#3459) via RevenueCat
Git Bot (@RCGitBot)

## RevenueCatUI SDK
### ✨ New Features
* Pre-warm image cache for workflow step states (#3447) via Cesar de la
Vega (@vegaro)
### Paywallv2
#### ✨ New Features
* Add `close_workflow` button action (#3453) via Cesar de la Vega
(@vegaro)
#### 🐞 Bugfixes
* Fix preload VideoComponent fallback override images (#3449) via Cesar
de la Vega (@vegaro)

### 🔄 Other Changes
* Select blob source by priority and weighted random (#3458) via Toni
Rico (@tonidero)
* [AUTOMATIC] Update golden test files for backend integration tests
(#3473) via RevenueCat Git Bot (@RCGitBot)
* Clean up unreferenced topic files after successful remote-config
refresh (#3439) via Toni Rico (@tonidero)
* Cache remote config response in memory with TTL and persist to disk
(#3457) via Toni Rico (@tonidero)
* build(deps): bump fastlane from 2.233.1 to 2.234.0 (#3463) via
dependabot[bot] (@dependabot[bot])
* Update codelabs links (#3460) via Jaewoong Eum (@skydoves)
* Add RemoteConfigManager and TopicFetcher (#3437) via Toni Rico
(@tonidero)
* Add exit offers support to workflows (#3452) via Cesar de la Vega
(@vegaro)
* Update baseline profiles (#3461) via RevenueCat Git Bot (@RCGitBot)
* Add network scaffolding for remote config endpoint (#3435) via Toni
Rico (@tonidero)
* test: cover singleStepFallbackId == initialStepId edge case (#3445)
via Facundo Menzella (@facumenzella)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk: this is a release/versioning update (SNAPSHOT -> final) plus
docs deployment path changes, with no functional code changes beyond
version constants.
> 
> **Overview**
> Finalizes the `10.6.0` release by switching all version references
from `10.6.0-SNAPSHOT` to `10.6.0` (root `.version`,
`gradle.properties`, `Config.frameworkVersion`, and sample/test app
`libs.versions.toml` files).
> 
> Updates documentation publishing to point at the `10.6.0` docs path
(CircleCI S3 sync target and `docs/index.html` redirect), and prepends
the `10.6.0` section to `CHANGELOG.md`/`CHANGELOG.latest.md`.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
4da1697. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
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