Skip to content

feat(RevenueCatUI): add presentation-session PaywallStateStore#6992

Merged
MonikaMateska merged 2 commits into
mainfrom
pw-state/4-store
Jun 17, 2026
Merged

feat(RevenueCatUI): add presentation-session PaywallStateStore#6992
MonikaMateska merged 2 commits into
mainfrom
pw-state/4-store

Conversation

@MonikaMateska

@MonikaMateska MonikaMateska commented Jun 14, 2026

Copy link
Copy Markdown
Member

Motivation

Phase 0 stack (PWENG-56). Adds the presentation-session state store that holds current state-key values — scoped to the workflow when present, the single paywall otherwise — seeded from declared defaults and reset when the presentation ends.
Spec: https://github.com/RevenueCat/sdk-specs/tree/main/openspec/changes/add-paywall-component-state

Description

Adds the thread-safe PaywallStateStore and injects it into the environment at WorkflowPaywallView (shared across screens so state survives navigation) and PaywallsV2View (own store when presented standalone). Writes from stateUpdates and component wiring come in later phases.

Stack: 4/5 → base pw-state/3-condition.


Note

Low Risk
Foundation-only change: store and environment injection with no purchase/auth paths touched; behavior is gated behind later wiring of reads/writes.

Overview
Introduces PaywallStateStore, a thread-safe, presentation-scoped holder for declared paywall state keys (defaults, typed writes from stateUpdates, $value payload substitution, reset, and incremental registerDeclarations). It publishes SwiftUI changes via ObservableObject and is exposed as \.paywallStateStore in the environment.

WorkflowPaywallView owns one shared @StateObject store for the whole workflow (empty seed for now) and injects it so state can survive step navigation. PaywallsV2View seeds a local store from stateDeclarations when standalone, but reuses an inherited store when embedded in a workflow so it does not replace the workflow session store.

Unit tests cover seeding, apply/validation/coercion rules, reset, registration, observer notifications, and concurrent access. Wiring stateUpdates and feeding state into ConditionContext are explicitly deferred to later stack items.

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

@emerge-tools

emerge-tools Bot commented Jun 16, 2026

Copy link
Copy Markdown

4 builds increased size

Name Version Download Change Install Change Approval
RevenueCat
com.revenuecat.PaywallsTester
1.0 (1) 18.7 MB ⬆️ 21.6 kB (0.12%) 67.6 MB ⬆️ 89.6 kB (0.13%) N/A
BinarySizeTest
com.revenuecat.binary-size-test.local-source
1.0 (1) 4.3 MB ⬆️ 3.7 kB (0.09%) 13.0 MB ⬆️ 11.8 kB (0.09%) N/A
BinarySizeTest
com.revenuecat.binary-size-test.cocoapods
1.0 (1) 6.5 MB ⬆️ 4.8 kB (0.07%) 28.6 MB ⬆️ 20.1 kB (0.07%) N/A
BinarySizeTest
com.revenuecat.binary-size-test.spm
1.0 (1) 4.4 MB ⬆️ 3.4 kB (0.08%) 11.3 MB ⬆️ 7.9 kB (0.07%) N/A

RevenueCat 1.0 (1)
com.revenuecat.PaywallsTester

⚖️ Compare build
⏱️ Analyze build performance

Total install size change: ⬆️ 89.6 kB (0.13%)
Total download size change: ⬆️ 21.6 kB (0.12%)

Largest size changes

Item Install Size Change
DYLD.String Table ⬆️ 41.5 kB
Code Signature ⬆️ 2.2 kB
📝 RevenueCatUI.PaywallStateStore.PaywallStateStore ⬆️ 1.5 kB
DYLD.Exports ⬆️ 1.1 kB
Other ⬆️ 43.3 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: ⬆️ 11.8 kB (0.09%)
Total download size change: ⬆️ 3.7 kB (0.09%)

Largest size changes

Item Install Size Change
📝 RevenueCatUI.WorkflowPaywallView._stateStore ⬆️ 1.7 kB
DYLD.String Table ⬆️ 1.3 kB
RevenueCatUI.PaywallsV2View.init(paywallComponents,offering,purch... ⬆️ 648 B
Other ⬆️ 8.2 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: ⬆️ 20.1 kB (0.07%)
Total download size change: ⬆️ 4.8 kB (0.07%)

Largest size changes

Item Install Size Change
DYLD.String Table ⬆️ 8.2 kB
📝 RevenueCatUI.WorkflowPaywallView._stateStore ⬆️ 1.7 kB
RevenueCatUI.PaywallsV2View.init(paywallComponents,offering,purch... ⬆️ 648 B
Other ⬆️ 9.6 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: ⬆️ 7.9 kB (0.07%)
Total download size change: ⬆️ 3.4 kB (0.08%)

Largest size changes

Item Install Size Change
📝 RevenueCatUI.WorkflowPaywallView._stateStore ⬆️ 1.6 kB
RevenueCatUI.PaywallsV2View.init(paywallComponents,offering,purch... ⬆️ 648 B
Other ⬆️ 5.6 kB
View Treemap

Image of diff


🛸 Powered by Emerge Tools

@MonikaMateska MonikaMateska force-pushed the pw-state/3-condition branch from e9d5227 to f6d7bb2 Compare June 16, 2026 08:41
@MonikaMateska MonikaMateska force-pushed the pw-state/4-store branch 2 times, most recently from d280eac to ed2da74 Compare June 16, 2026 08:50
@MonikaMateska MonikaMateska force-pushed the pw-state/3-condition branch 2 times, most recently from 4cb851e to 938ee87 Compare June 16, 2026 08:56
@MonikaMateska MonikaMateska force-pushed the pw-state/4-store branch 2 times, most recently from a6e7599 to f7ed9f0 Compare June 16, 2026 08:59
@MonikaMateska MonikaMateska marked this pull request as ready for review June 16, 2026 09:01
@MonikaMateska MonikaMateska requested review from a team as code owners June 16, 2026 09:01
Comment thread RevenueCatUI/Templates/V2/WorkflowPaywallView.swift

@alexrepty alexrepty left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me, but the AI comment might be worth a look

@MonikaMateska MonikaMateska force-pushed the pw-state/3-condition branch from ca5734a to b320e0b Compare June 16, 2026 18:46
@MonikaMateska MonikaMateska force-pushed the pw-state/3-condition branch from b320e0b to 72653e2 Compare June 16, 2026 18:58
@MonikaMateska MonikaMateska force-pushed the pw-state/3-condition branch from 72653e2 to 812ed31 Compare June 16, 2026 20:41
Base automatically changed from pw-state/3-condition to main June 16, 2026 21:13

@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 1def974. Configure here.

Comment thread RevenueCatUI/Templates/V2/PaywallsV2View.swift
@MonikaMateska MonikaMateska merged commit de1d6c9 into main Jun 17, 2026
43 of 44 checks passed
@MonikaMateska MonikaMateska deleted the pw-state/4-store branch June 17, 2026 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants