Add WorkflowNavigator for multipage workflow step navigation#3379
Conversation
Introduces a standalone `WorkflowNavigator` that tracks the current step in a `PublishedWorkflow` and handles forward navigation via component triggers and back navigation via a back stack. Not wired into any UI yet — a follow-up PR will consume this from `PaywallViewModel` to drive multipage paywall navigation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3379 +/- ##
=======================================
Coverage 79.20% 79.20%
=======================================
Files 360 360
Lines 14437 14437
Branches 1982 1982
=======================================
Hits 11435 11435
Misses 2194 2194
Partials 808 808 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| return workflow.steps[prevStepId] | ||
| } | ||
|
|
||
| fun canNavigateBack(): Boolean = backStack.isNotEmpty() |
There was a problem hiding this comment.
curious, why fun and not val?
There was a problem hiding this comment.
changing to val to match CustomerCenterNavigationState
facumenzella
left a comment
There was a problem hiding this comment.
Comparing with the iOS equivalent (purchases-ios#6680), there are three test cases present on iOS that are missing here:
-
Multi-step back navigation — iOS has
testMultipleForwardAndBackNavigationsWorkCorrectlywhich doesstep1→step2→step3→back→step2→back→step1. The Android tests only go back one step, so theArrayDequeisn't fully exercised as a stack. -
Trigger with a nil/missing
actionId— iOS hastestTriggerActionWithMissingActionIdReturnsNilfor the case where a trigger matches bycomponentIdbut has noactionId. Not covered here. -
Target step not in
workflow.steps— iOS hastestTriggerActionWithTargetStepNotInWorkflowReturnsNilfor whentriggerAction.stepIdpoints to a step that doesn't exist in the workflow. The Android code handles this (theworkflow.steps[stepId] ?: run { ... }guard), but there's no test for it.
None of these are blocking, but worth adding for parity.
**This is an automatic release.** ## RevenueCat SDK ### ✨ New Features * Unified StoreReplacementMode API (RevenueCat#3234) via Will Taylor (@fire-at-will) * Add placement and targeting context to paywall events (RevenueCat#3253) via Dan Pannasch (@dpannasch) ### 🐞 Bugfixes * Fix null Placements when offering_ids_by_placement is absent (RevenueCat#3254) via Dan Pannasch (@dpannasch) ## RevenueCatUI SDK ### Paywallv2 #### ✨ New Features * Wire multipage workflow navigation into PaywallViewModel (RevenueCat#3381) via Cesar de la Vega (@vegaro) ### 🔄 Other Changes * Add `triggerType` to `WorkflowTrigger` (RevenueCat#3393) via Cesar de la Vega (@vegaro) * Extract private function `NavigateTo.toPaywallAction` (RevenueCat#3392) via Cesar de la Vega (@vegaro) * Bump revenucatui-tests gradle cache key (RevenueCat#3391) via Toni Rico (@tonidero) * Create `WorkflowTriggerType` and `WorkflowTriggerActionType` (RevenueCat#3386) via Cesar de la Vega (@vegaro) * Update baseline profiles (RevenueCat#3390) via RevenueCat Git Bot (@RCGitBot) * Plumb `componentId` through buttons on workflow interactions (RevenueCat#3380) via Cesar de la Vega (@vegaro) * Add `ButtonComponent.Action.Workflow` (RevenueCat#3385) via Cesar de la Vega (@vegaro) * Add `componentId` to `ButtonCoomponentStyle` (RevenueCat#3384) via Cesar de la Vega (@vegaro) * Migrate all suspendCoroutine usages to suspendCancellableCoroutine (RevenueCat#3365) via Jaewoong Eum (@skydoves) * Add `WorkflowNavigator` for multipage workflow step navigation (RevenueCat#3379) via Cesar de la Vega (@vegaro) * build(deps): bump fastlane-plugin-revenuecat_internal from `b822f01` to `d24ab26` (RevenueCat#3383) via dependabot[bot] (@dependabot[bot]) * Add `id` field to `ButtonComponent` (RevenueCat#3377) via Cesar de la Vega (@vegaro) * Add CI workflows for generating Baseline Profiles (RevenueCat#3372) via Jaewoong Eum (@skydoves) * add min sdk level for paywalls and customer center (RevenueCat#2465) via Muhammad-Sharif Moustafa (@mshmoustafa) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk release bookkeeping: updates version strings, changelogs, and documentation deployment targets without changing runtime logic beyond the reported version identifier. > > **Overview** > Cuts the `10.3.0` release by updating all version references from `10.3.0-SNAPSHOT` to `10.3.0` across build config (`gradle.properties`, `.version`, `Config.frameworkVersion`) and sample/test app dependency pins. > > Updates release documentation publishing to sync Dokka output to the `10.3.0` S3 path and changes `docs/index.html` to redirect to `10.3.0`. Also promotes release notes by moving `CHANGELOG.latest.md` entries into a new `CHANGELOG.md` section for `10.3.0`. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 056ce62. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
Summary
WorkflowNavigatorclass that tracks the current step in aPublishedWorkflowand supports forward navigation via component triggers + back navigation via a back stack.PaywallViewModelto drive multipage paywall navigation.Note
Low Risk
Low risk: new, internal navigation helper and tests only; no existing UI flow is modified, though future integration will rely on correct trigger/step ID handling.
Overview
Introduces
WorkflowNavigator, an internal helper that tracks the currentPublishedWorkflowstep via aStateFlow, advances to the next step when a component trigger maps to astepaction, and maintains a back stack fornavigateBack/canNavigateBack.Adds comprehensive tests validating forward navigation, back navigation behavior, and non-navigation on invalid component/action/step references.
Reviewed by Cursor Bugbot for commit 22c1559. Bugbot is set up for automated code reviews on this repo. Configure here.