Skip to content

Add WorkflowContext to surface full workflow state from PurchaseHandler#6685

Merged
facumenzella merged 3 commits into
mainfrom
facu/workflow-context
Apr 24, 2026
Merged

Add WorkflowContext to surface full workflow state from PurchaseHandler#6685
facumenzella merged 3 commits into
mainfrom
facu/workflow-context

Conversation

@facumenzella

@facumenzella facumenzella commented Apr 23, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds WorkflowContext struct — bundles PublishedWorkflow, all Offerings, and the resolved initial Offering so a multi-step view can resolve any step on the fly
  • PurchaseHandler.resolveWorkflowContext(identifier:presentedOfferingContext:) — new internal method that surfaces the full context; the existing resolveWorkflowOfferingIdentifier now delegates to it and discards the context, so the current PaywallView path is unchanged

Previously the workflow + all offerings were fetched but immediately discarded after resolving only the initial step. This PR preserves them for WorkflowPaywallView (PR 4b) to use when navigating to subsequent steps.

Independent of PR 3 — can be reviewed in parallel.
Next: PR 4b (WorkflowPaywallView core), which depends on both this and PR 3.

Test plan

  • swift build passes (verified locally)
  • resolveWorkflowOfferingIdentifier behaviour is unchanged — it now delegates to resolveWorkflowContext and returns the same offering as before

🤖 Generated with Claude Code


Note

Medium Risk
Touches paywall offering resolution for the workflows endpoint path; behavior is intended to be unchanged but errors/metadata propagation could affect which offering is shown when workflows are enabled.

Overview
Adds a new internal WorkflowContext value that bundles the fetched PublishedWorkflow, the full Offerings response, the resolved initial Offering, and the optional PresentedOfferingContext for reuse across multi-step workflow navigation.

Refactors PurchaseHandler so resolveWorkflowOfferingIdentifier delegates to a new resolveWorkflowContext(identifier:presentedOfferingContext:), which returns both the resolved offering and the preserved workflow context, while keeping the existing paywall path returning the same Offering.

Updates the Xcode project to include the new source and adds WorkflowContextTests to validate presentedOfferingContext storage and that resolveWorkflowContext throws when the workflows flag is disabled.

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

@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 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 2a638cc. Configure here.

Comment thread RevenueCatUI/Purchasing/PurchaseHandler.swift Outdated
@facumenzella facumenzella force-pushed the facu/workflow-context branch from 2a638cc to 270b27f Compare April 23, 2026 15:08
@facumenzella facumenzella requested a review from a team as a code owner April 23, 2026 15:43
facumenzella and others added 2 commits April 24, 2026 10:42
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-context branch from 8599d27 to 983ed90 Compare April 24, 2026 08:47
TestData has no `offering` or `offerings` members; replace with
`offeringWithIntroOffer` and a local `makeOfferings` helper that
mirrors the pattern in PaywallViewConfigurationTests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@facumenzella facumenzella merged commit 3ae3566 into main Apr 24, 2026
16 of 18 checks passed
@facumenzella facumenzella deleted the facu/workflow-context branch April 24, 2026 10: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