Skip to content

feat(RevenueCatUI): evaluate state conditions in the override resolver#6993

Merged
MonikaMateska merged 2 commits into
mainfrom
pw-state/5-resolver
Jun 17, 2026
Merged

feat(RevenueCatUI): evaluate state conditions in the override resolver#6993
MonikaMateska merged 2 commits into
mainfrom
pw-state/5-resolver

Conversation

@MonikaMateska

@MonikaMateska MonikaMateska commented Jun 14, 2026

Copy link
Copy Markdown
Member

Checklist

  • If applicable, unit tests
  • If applicable, create follow-up issues for purchases-android and hybrids

Motivation

Final PR in the Phase 0 stack (PWENG-56). Wires state condition evaluation into the override resolver so state-driven overrides can be resolved.
Spec: https://github.com/RevenueCat/sdk-specs/tree/main/openspec/changes/add-paywall-component-state

Description

Replaces the PR3 stub with real state evaluation: type-aware comparison, missing key -> declared default, undeclared key -> false regardless of operator (per spec, deliberately unlike variable_condition). Extends ConditionContext with the store snapshot + defaults.

Note: the per-component resolver call sites aren't yet passing the store snapshot into conditionContext(...), so state conditions don't affect rendering at runtime yet, that threading is the open half of task 3.6. Flagging for review on whether it belongs here or a follow-up.

Stack: 5/5 → base pw-state/4-store.


Note

Medium Risk
Changes paywall override/visibility resolution semantics for a new condition type; behavior is well-tested but incorrect wiring later could silently leave state-driven overrides inert until snapshots are passed.

Overview
Implements real state extended-condition evaluation for Paywalls V2 component overrides, replacing the previous stub that always failed.

ConditionContext now carries a presentation-session snapshot (stateValues) plus declared stateDefaults. UIConfigProvider.conditionContext forwards those fields (defaulting to empty) so callers can supply store data when available.

Override resolution compares expected ConditionValues with type-strict rules (string/bool/int/double, numeric cross-type with epsilon). Missing store values use declared defaults; keys absent from both store and defaults never match (including notEquals), unlike missing custom variables.

Extensive PresentedPartialsTests cover equality, defaults, undeclared keys, AND with other conditions, and visibility override precedence.

Note: Component resolver call sites still invoke conditionContext without the store snapshot, so state conditions do not affect live rendering until that wiring lands (called out in PR description).

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

@emerge-tools

emerge-tools Bot commented Jun 14, 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 ⬆️ 2.1 kB (0.01%) 67.6 MB ⬆️ 11.6 kB (0.02%) N/A
BinarySizeTest
com.revenuecat.binary-size-test.local-source
1.0 (1) 4.3 MB ⬆️ 2.6 kB (0.06%) 13.0 MB ⬆️ 3.3 kB (0.03%) N/A
BinarySizeTest
com.revenuecat.binary-size-test.cocoapods
1.0 (1) 6.5 MB ⬆️ 1.5 kB (0.02%) 28.6 MB ⬆️ 3.4 kB (0.01%) N/A
BinarySizeTest
com.revenuecat.binary-size-test.spm
1.0 (1) 4.4 MB ⬆️ 2.6 kB (0.06%) 11.3 MB ⬆️ 3.3 kB (0.03%) N/A

RevenueCat 1.0 (1)
com.revenuecat.PaywallsTester

⚖️ Compare build
⏱️ Analyze build performance

Total install size change: ⬆️ 11.6 kB (0.02%)
Total download size change: ⬆️ 2.1 kB (0.01%)

Largest size changes

Item Install Size Change
DYLD.String Table ⬆️ 4.3 kB
RevenueCatUI.VideoComponentViewModel.VideoComponentViewModel ⬆️ 2.8 kB
Other ⬆️ 4.5 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: ⬆️ 3.3 kB (0.03%)
Total download size change: ⬆️ 2.6 kB (0.06%)

Largest size changes

Item Install Size Change
📝 RevenueCatUI.TimelineItemViewModel.styles(state,condition,isEligi... ⬆️ 1.3 kB
📝 RevenueCatUI.UIConfigProvider.conditionContext(selectedPackageId,... ⬆️ 1.0 kB
RevenueCatUI.TabsComponentViewModel.styles(state,condition,isElig... ⬆️ 976 B
🗑 RevenueCatUI.UIConfigProvider.conditionContext(selectedPackageId,... ⬇️ -976 B
RevenueCatUI.TimelineComponentView.timeline(style) ⬇️ -540 B
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: ⬆️ 3.4 kB (0.01%)
Total download size change: ⬆️ 1.5 kB (0.02%)

Largest size changes

Item Install Size Change
DYLD.String Table ⬆️ 2.0 kB
📝 RevenueCatUI.TimelineItemViewModel.styles(state,condition,isEligi... ⬆️ 1.3 kB
📝 RevenueCatUI.UIConfigProvider.conditionContext(selectedPackageId,... ⬆️ 1.0 kB
🗑 RevenueCatUI.UIConfigProvider.conditionContext(selectedPackageId,... ⬇️ -972 B
RevenueCatUI.TabsComponentViewModel.init(component,controlStackVi... ⬆️ 888 B
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: ⬆️ 3.3 kB (0.03%)
Total download size change: ⬆️ 2.6 kB (0.06%)

Largest size changes

Item Install Size Change
📝 RevenueCatUI.TimelineItemViewModel.styles(state,condition,isEligi... ⬆️ 1.2 kB
📝 RevenueCatUI.UIConfigProvider.conditionContext(selectedPackageId,... ⬆️ 1.0 kB
RevenueCatUI.TabsComponentViewModel.styles(state,condition,isElig... ⬆️ 976 B
🗑 RevenueCatUI.UIConfigProvider.conditionContext(selectedPackageId,... ⬇️ -976 B
RevenueCatUI.TimelineComponentView.timeline(style) ⬇️ -528 B
View Treemap

Image of diff


🛸 Powered by Emerge Tools

@MonikaMateska MonikaMateska force-pushed the pw-state/4-store branch 2 times, most recently from d8a13a3 to d280eac Compare June 16, 2026 08:41
@MonikaMateska MonikaMateska force-pushed the pw-state/5-resolver branch 2 times, most recently from 40ad940 to 5159bec Compare June 16, 2026 08:59
@MonikaMateska MonikaMateska marked this pull request as ready for review June 16, 2026 09:02
@MonikaMateska MonikaMateska requested review from a team as code owners June 16, 2026 09:02
@MonikaMateska MonikaMateska force-pushed the pw-state/5-resolver branch 2 times, most recently from 339f89a to dfac53c Compare June 16, 2026 18:46
@MonikaMateska MonikaMateska force-pushed the pw-state/4-store branch 2 times, most recently from 7d79357 to 81d8a41 Compare June 16, 2026 18:58
Base automatically changed from pw-state/4-store to main June 17, 2026 07:18
@MonikaMateska MonikaMateska requested a review from a team as a code owner June 17, 2026 07:18
@MonikaMateska MonikaMateska merged commit cf9eb88 into main Jun 17, 2026
41 of 43 checks passed
@MonikaMateska MonikaMateska deleted the pw-state/5-resolver branch June 17, 2026 08:32
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