Skip to content

Add WorkflowNavigator for multipage workflow step navigation#6680

Merged
facumenzella merged 4 commits into
mainfrom
facu/workflow-navigator
Apr 23, 2026
Merged

Add WorkflowNavigator for multipage workflow step navigation#6680
facumenzella merged 4 commits into
mainfrom
facu/workflow-navigator

Conversation

@facumenzella

@facumenzella facumenzella commented Apr 23, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds WorkflowNavigator — an ObservableObject that owns navigation state for a PublishedWorkflow
  • Makes WorkflowTrigger and WorkflowTriggerAction @_spi(Internal) public so RevenueCatUI can access them
  • Adds stepTriggers / stepTriggerActions public computed properties on WorkflowStep (proxy for the @DefaultDecodable-wrapped stored properties, which can't be made directly public)
  • 12 unit tests covering the full navigation logic

WorkflowNavigator API:

  • currentStepId: String@Published, starts at workflow.initialStepId
  • currentStep: WorkflowStep? — resolved from currentStepId
  • canNavigateBack: Bool
  • triggerAction(componentId:) -> WorkflowStep? — finds the trigger matching componentId, validates triggerActions[actionId].type == "step" and target step exists, pushes to back stack, advances currentStepId
  • navigateBack() -> WorkflowStep? — pops back stack

Pure logic, no UI. This is the iOS equivalent of purchases-android#3379.

Stacks on: #(PR 1 — PaywallButtonComponent.id)
Next: PR 3 (button trigger action + isWorkflowActive)

Test plan

  • swift build passes (verified locally)
  • swift test --filter WorkflowNavigatorTests — 12/12 pass (verified locally)

🤖 Generated with Claude Code


Note

Medium Risk
Introduces new navigation state/logic for Paywalls V2 workflows and changes access levels of workflow response models via @_spi(Internal), which could affect internal API usage and step-trigger behavior if misused.

Overview
Adds WorkflowNavigator, an ObservableObject that tracks a workflow’s current step, supports forward navigation via component trigger actions, and maintains a back stack for navigateBack().

Updates workflow response models so RevenueCatUI can read trigger and action data: WorkflowTrigger/WorkflowTriggerAction become @_spi(Internal) public, and WorkflowStep exposes stepTriggers/stepTriggerActions computed accessors. Includes a new WorkflowNavigatorTests suite covering forward/back navigation and common failure cases.

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

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@facumenzella facumenzella requested a review from vegaro April 23, 2026 12:36
@vegaro

vegaro commented Apr 23, 2026

Copy link
Copy Markdown
Member

Looks like the xcodeproj is out of sync

@facumenzella

Copy link
Copy Markdown
Member Author

ready @vegaro

Comment thread RevenueCatUI/Templates/V2/ViewModelHelpers/WorkflowNavigator.swift
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