Add WorkflowPaywallView for multipage workflow step rendering#6692
Conversation
Mirrors Android's rename of Action.Workflow → Action.WorkflowTrigger (purchases-android#3380). Decodes backend "type": "workflow" into .workflowTrigger so workflow buttons are rendered (previously decoded as .unknown and hidden) and track as "workflow_trigger" in analytics. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
22f89b7 to
5415e29
Compare
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
❌ 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 1091a05. Configure here.
…view # Conflicts: # RevenueCatUI/Templates/V2/Components/Button/ButtonComponentView.swift
… codex/fix-workflow-review
4 builds increased size
RevenueCat 1.0 (1)
|
| Item | Install Size Change |
|---|---|
| DYLD.String Table | ⬆️ 42.9 kB |
| Code Signature | ⬆️ 5.4 kB |
| DYLD.Exports | ⬆️ 1.8 kB |
| Other | ⬆️ 160.9 kB |
BinarySizeTest 1.0 (1)
com.revenuecat.binary-size-test.local-source
⚖️ Compare build
📦 Install build
⏱️ Analyze build performance
Total install size change: ⬆️ 41.3 kB (0.34%)
Total download size change: ⬆️ 18.8 kB (0.47%)
Largest size changes
| Item | Install Size Change |
|---|---|
| 📝 RevenueCatUI.CurrentStepContent.value witness | ⬆️ 11.7 kB |
| 📝 RevenueCatUI.PaywallView.paywallView(for,workflowContext,useDraft... | ⬆️ 5.5 kB |
| 🗑 RevenueCatUI.PaywallView.paywallView(for,useDraftPaywall,actively... | ⬇️ -4.8 kB |
| 📝 RevenueCatUI.WorkflowPaywallView.value witness | ⬆️ 3.5 kB |
| DYLD.String Table | ⬆️ 3.0 kB |
BinarySizeTest 1.0 (1)
com.revenuecat.binary-size-test.cocoapods
⚖️ Compare build
📦 Install build
⏱️ Analyze build performance
Total install size change: ⬆️ 66.3 kB (0.25%)
Total download size change: ⬆️ 23.8 kB (0.39%)
Largest size changes
| Item | Install Size Change |
|---|---|
| DYLD.String Table | ⬆️ 16.7 kB |
| 📝 RevenueCatUI.CurrentStepContent.value witness | ⬆️ 11.9 kB |
| 📝 RevenueCatUI.PaywallView.paywallView(for,workflowContext,useDraft... | ⬆️ 5.5 kB |
| 🗑 RevenueCatUI.PaywallView.paywallView(for,useDraftPaywall,actively... | ⬇️ -4.8 kB |
| 📝 RevenueCatUI.WorkflowPaywallView.value witness | ⬆️ 3.5 kB |
BinarySizeTest 1.0 (1)
com.revenuecat.binary-size-test.spm
⚖️ Compare build
📦 Install build
⏱️ Analyze build performance
Total install size change: ⬆️ 36.8 kB (0.35%)
Total download size change: ⬆️ 17.8 kB (0.43%)
Largest size changes
| Item | Install Size Change |
|---|---|
| 📝 RevenueCatUI.CurrentStepContent.value witness | ⬆️ 11.6 kB |
| 📝 RevenueCatUI.PaywallView.paywallView(for,workflowContext,useDraft... | ⬆️ 5.5 kB |
| 🗑 RevenueCatUI.PaywallView.paywallView(for,useDraftPaywall,actively... | ⬇️ -4.7 kB |
| 📝 RevenueCatUI.WorkflowPaywallView.value witness | ⬆️ 3.5 kB |
| 📝 RevenueCatUI.WorkflowPaywallView.body | ⬆️ 2.7 kB |
🛸 Powered by Emerge Tools
Comment trigger: Size diff threshold of 100.00kB exceeded
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rchases-ios into codex/fix-workflow-review
| @@ -289,6 +295,7 @@ public struct PaywallView: View { | |||
| // swiftlint:disable:next function_body_length function_parameter_count | |||
| private func paywallView( | |||
There was a problem hiding this comment.
at some point we should rename this, since it can now open a paywall or a workflow. Not for this PR though
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>





Summary
WorkflowPaywallView, an internal SwiftUI view that owns aWorkflowNavigatorand renders the current workflow step as aPaywallsV2ViewPurchaseHandler,introEligibilityChecker, andshowZeroDecimalPlacePricesare injected by the caller — not hardcoded — so the view composes cleanly into the public entry point coming in the next PR.id(navigator.currentStepId)forces SwiftUI to tear down and recreatePaywallsV2View(and all its@StateObjects) on each step transition\.workflowTriggerActioninto the environment — buttons whoseidmatches a workflow trigger advance the step; buttons withaction: .workflowTriggerthat don't match log a warningonDismissis always called to close the workflow; otherwise back navigation pops to the previous step, and at the root step it delegates toonDismissWorkflowContext.offering(for:)resolves per-step offerings while preservingPresentedOfferingContext(placement/targeting metadata) across all stepsNo nav bar, no transitions, no public entry point in this PR — those come in the next PR.
Depends on
ButtonComponent.id✅WorkflowNavigator✅workflowTriggerActionenv hook ✅WorkflowContext✅Test plan
swift build)WorkflowPaywallViewTests— dismissal action logic (purchase complete, back available, root step)WorkflowContextTests—offering(for:)preservesPresentedOfferingContextacross steps🤖 Generated with Claude Code
Note
Medium Risk
Moderate risk because it changes
PaywallViewloading/rendering andPurchaseHandleroffering resolution to optionally fetch and drive workflow state, which can affect paywall presentation and dismissal behavior.Overview
Adds internal
WorkflowPaywallViewto render multi-step workflow paywalls by driving aWorkflowNavigatorand re-instantiatingPaywallsV2Viewper step, with back-vs-dismiss behavior that always dismisses the workflow after a purchase.Updates
PaywallViewandPurchaseHandlerto resolve both anOfferingand optionalWorkflowContext(resolvePaywallViewData), and conditionally renderWorkflowPaywallViewfor full-screen V2 paywalls when a workflow is present.Enhances workflow diagnostics and behavior:
WorkflowContext.offering(for:)preservesPresentedOfferingContextacross steps, unhandled.workflowTriggerbuttons now log a warning, and invalid workflow state logs a one-time error. Adds unit tests for workflow dismissal logic and context/offering resolution, and wires new sources into the Xcode project.Reviewed by Cursor Bugbot for commit 4150860. Bugbot is set up for automated code reviews on this repo. Configure here.