Skip to content

Add WorkflowPaywallView for multipage workflow step rendering#6692

Merged
facumenzella merged 14 commits into
mainfrom
facu/workflow-paywall-view
Apr 27, 2026
Merged

Add WorkflowPaywallView for multipage workflow step rendering#6692
facumenzella merged 14 commits into
mainfrom
facu/workflow-paywall-view

Conversation

@facumenzella

@facumenzella facumenzella commented Apr 24, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds WorkflowPaywallView, an internal SwiftUI view that owns a WorkflowNavigator and renders the current workflow step as a PaywallsV2View
  • PurchaseHandler, introEligibilityChecker, and showZeroDecimalPlacePrices are 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 recreate PaywallsV2View (and all its @StateObjects) on each step transition
  • Injects \.workflowTriggerAction into the environment — buttons whose id matches a workflow trigger advance the step; buttons with action: .workflowTrigger that don't match log a warning
  • Dismiss semantics: after a purchase completes, onDismiss is always called to close the workflow; otherwise back navigation pops to the previous step, and at the root step it delegates to onDismiss
  • WorkflowContext.offering(for:) resolves per-step offerings while preserving PresentedOfferingContext (placement/targeting metadata) across all steps
  • Invalid workflow state (unresolvable step/screen) renders a transparent placeholder and logs an error once

No nav bar, no transitions, no public entry point in this PR — those come in the next PR.

Depends on

Test plan

  • Build passes (swift build)
  • SwiftLint passes (0 violations)
  • WorkflowPaywallViewTests — dismissal action logic (purchase complete, back available, root step)
  • WorkflowContextTestsoffering(for:) preserves PresentedOfferingContext across steps
  • End-to-end manual test deferred to PR 4c (nav bar + public entry point)

🤖 Generated with Claude Code


Note

Medium Risk
Moderate risk because it changes PaywallView loading/rendering and PurchaseHandler offering resolution to optionally fetch and drive workflow state, which can affect paywall presentation and dismissal behavior.

Overview
Adds internal WorkflowPaywallView to render multi-step workflow paywalls by driving a WorkflowNavigator and re-instantiating PaywallsV2View per step, with back-vs-dismiss behavior that always dismisses the workflow after a purchase.

Updates PaywallView and PurchaseHandler to resolve both an Offering and optional WorkflowContext (resolvePaywallViewData), and conditionally render WorkflowPaywallView for full-screen V2 paywalls when a workflow is present.

Enhances workflow diagnostics and behavior: WorkflowContext.offering(for:) preserves PresentedOfferingContext across steps, unhandled .workflowTrigger buttons 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.

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>
@facumenzella facumenzella force-pushed the facu/workflow-paywall-view branch from 22f89b7 to 5415e29 Compare April 24, 2026 11:54
@facumenzella facumenzella changed the base branch from main to facundo/workflow-trigger-action-rename April 24, 2026 11:54
@facumenzella facumenzella marked this pull request as ready for review April 24, 2026 15:30
@facumenzella facumenzella requested review from a team as code owners April 24, 2026 15:30

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 3 potential issues.

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 1091a05. Configure here.

Comment thread RevenueCatUI/Templates/V2/WorkflowPaywallView.swift
Comment thread RevenueCatUI/Templates/V2/WorkflowPaywallView.swift
Comment thread RevenueCatUI/Templates/V2/WorkflowPaywallView.swift Outdated
Base automatically changed from facundo/workflow-trigger-action-rename to main April 24, 2026 15:38
@facumenzella facumenzella requested a review from a team as a code owner April 27, 2026 08:16
@emerge-tools

emerge-tools Bot commented Apr 27, 2026

Copy link
Copy Markdown

4 builds increased size

Name Version Download Change Install Change Approval
RevenueCat
com.revenuecat.PaywallsTester
1.0 (1) 17.8 MB ⬆️ 65.9 kB (0.37%) 64.0 MB ⬆️ 211.1 kB (0.33%) N/A
BinarySizeTest
com.revenuecat.binary-size-test.local-source
1.0 (1) 4.0 MB ⬆️ 18.8 kB (0.47%) 12.2 MB ⬆️ 41.3 kB (0.34%) ⏳ Needs approval
BinarySizeTest
com.revenuecat.binary-size-test.cocoapods
1.0 (1) 6.1 MB ⬆️ 23.8 kB (0.39%) 26.9 MB ⬆️ 66.3 kB (0.25%) ⏳ Needs approval
BinarySizeTest
com.revenuecat.binary-size-test.spm
1.0 (1) 4.1 MB ⬆️ 17.8 kB (0.43%) 10.6 MB ⬆️ 36.8 kB (0.35%) ⏳ Needs approval

RevenueCat 1.0 (1)
com.revenuecat.PaywallsTester

⚖️ Compare build
⏱️ Analyze build performance

Total install size change: ⬆️ 211.1 kB (0.33%)
Total download size change: ⬆️ 65.9 kB (0.37%)

Largest size changes

Item Install Size Change
DYLD.String Table ⬆️ 42.9 kB
Code Signature ⬆️ 5.4 kB
DYLD.Exports ⬆️ 1.8 kB
Other ⬆️ 160.9 kB
View Treemap

Image of diff

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
View Treemap

Image of diff

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
View Treemap

Image of diff

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
View Treemap

Image of diff


🛸 Powered by Emerge Tools

Comment trigger: Size diff threshold of 100.00kB exceeded

@facumenzella facumenzella changed the title Add WorkflowPaywallView for trigger-based multipage workflow navigation Add WorkflowPaywallView for multipage workflow step rendering Apr 27, 2026
@@ -289,6 +295,7 @@ public struct PaywallView: View {
// swiftlint:disable:next function_body_length function_parameter_count
private func paywallView(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

at some point we should rename this, since it can now open a paywall or a workflow. Not for this PR though

Comment thread RevenueCatUI/PaywallView.swift
Comment thread RevenueCatUI/Templates/V2/WorkflowPaywallView.swift
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@facumenzella facumenzella merged commit 1cc897c into main Apr 27, 2026
15 of 18 checks passed
@facumenzella facumenzella deleted the facu/workflow-paywall-view branch April 27, 2026 13:05
This was referenced Apr 30, 2026
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