Skip to content

feat(paywalls): add dedicated state condition to component overrides#6991

Merged
MonikaMateska merged 1 commit into
mainfrom
pw-state/3-condition
Jun 16, 2026
Merged

feat(paywalls): add dedicated state condition to component overrides#6991
MonikaMateska merged 1 commit into
mainfrom
pw-state/3-condition

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

Phase 0 stack (PWENG-56). Introduces the dedicated state condition type in component overrides, joining the existing condition types. A dedicated type (rather than overloading variable_condition) gives clean forward-compat: older SDKs decode it as unsupported and fall back to the default paywall.
Spec: https://github.com/RevenueCat/sdk-specs/tree/main/openspec/changes/add-paywall-component-state

Description

Adds the state case to ExtendedCondition (toCondition().unsupported, isRule true) and the state_condition wire type. The resolver switch handles it as non-matching for now (case .state: return false); real evaluation lands in the resolver PR. @_spi(Internal); no public API change.

Stack: 3/5 → base pw-state/2-updates.


Note

Low Risk
Internal SPI-only paywall condition plumbing with evaluation disabled (false); behavior change is limited until the resolver PR lands.

Overview
Introduces a state extended override condition (state_condition on the wire: name, operator, value) for state-driven paywalls, separate from variable_condition so older SDKs can treat unknown types as unsupported and degrade safely.

ExtendedCondition gains encode/decode, isRule, and toCondition().unsupported; decoding is refactored into decodeCondition. Paywalls V2 evaluateCondition handles .state by always returning false until a follow-up PR implements real resolution. Package.resolved drops several test-only SPM pins (e.g. FlyingFox, OHHTTPStubs).

Tests cover JSON round-trips, malformed payloads → .unsupported, rule discard under discardRules, and forward-compat degradation.

Reviewed by Cursor Bugbot for commit 812ed31. 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

1 build increased size, 3 builds decreased size

Name Version Download Change Install Change Approval
RevenueCat
com.revenuecat.PaywallsTester
1.0 (1) 18.7 MB ⬆️ 3.6 kB (0.02%) 67.6 MB ⬆️ 7.4 kB (0.01%) N/A
BinarySizeTest
com.revenuecat.binary-size-test.local-source
1.0 (1) 4.3 MB ⬇️ 5.5 kB (-0.13%) 13.0 MB ⬇️ 11.6 kB (-0.09%) N/A
BinarySizeTest
com.revenuecat.binary-size-test.cocoapods
1.0 (1) 6.5 MB ⬇️ 6.7 kB (-0.1%) 28.6 MB ⬇️ 11.2 kB (-0.04%) N/A
BinarySizeTest
com.revenuecat.binary-size-test.spm
1.0 (1) 4.4 MB ⬇️ 6.2 kB (-0.14%) 11.3 MB ⬇️ 11.7 kB (-0.1%) N/A

RevenueCat 1.0 (1)
com.revenuecat.PaywallsTester

⚖️ Compare build
⏱️ Analyze build performance

Total install size change: ⬆️ 7.4 kB (0.01%)
Total download size change: ⬆️ 3.6 kB (0.02%)

Largest size changes

Item Install Size Change
DYLD.String Table ⬆️ 720 B
Other ⬆️ 6.7 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.6 kB (-0.09%)
Total download size change: ⬇️ 5.5 kB (-0.13%)

Largest size changes

Item Install Size Change
RevenueCat.Array.hash(into) ⬆️ 5.5 kB
RevenueCat.PaywallComponent.ComponentOverride.hash(into) ⬇️ -4.6 kB
RevenueCat.PaywallComponent.CountdownComponent.CountdownComponent ⬇️ -2.8 kB
🗑 Swift.Array.Array ⬇️ -2.7 kB
RevenueCat.PaywallComponent.VideoComponent.VideoComponent ⬇️ -2.6 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: ⬇️ 11.2 kB (-0.04%)
Total download size change: ⬇️ 6.7 kB (-0.1%)

Largest size changes

Item Install Size Change
RevenueCat.Array.hash(into) ⬆️ 5.5 kB
RevenueCat.PaywallComponent.ComponentOverride.hash(into) ⬇️ -4.6 kB
RevenueCat.PaywallComponent.CountdownComponent.CountdownComponent ⬇️ -2.8 kB
🗑 Swift.Array.Array ⬇️ -2.7 kB
RevenueCat.PaywallComponent.VideoComponent.VideoComponent ⬇️ -2.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: ⬇️ 11.7 kB (-0.1%)
Total download size change: ⬇️ 6.2 kB (-0.14%)

Largest size changes

Item Install Size Change
RevenueCat.Array.hash(into) ⬆️ 5.5 kB
RevenueCat.PaywallComponent.ComponentOverride.hash(into) ⬇️ -4.6 kB
🗑 Swift.Array.Array ⬇️ -3.1 kB
RevenueCat.PaywallComponent.CountdownComponent.CountdownComponent ⬇️ -2.8 kB
RevenueCat.PaywallComponent.VideoComponent.VideoComponent ⬇️ -2.6 kB
View Treemap

Image of diff


🛸 Powered by Emerge Tools

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

Comment thread Sources/Paywalls/Components/Common/ComponentOverrides.swift Outdated
@MonikaMateska MonikaMateska force-pushed the pw-state/3-condition branch 2 times, most recently from b320e0b to 72653e2 Compare June 16, 2026 18:58
@emerge-tools

emerge-tools Bot commented Jun 16, 2026

Copy link
Copy Markdown

📸 Snapshot Test

339 unchanged

Name Added Removed Modified Renamed Unchanged Errored Approval
RevenueCat
com.revenuecat.PaywallsTester
0 0 0 0 274 0 N/A
PaywallsTester V1 swift-snapshot-testing
com.revenuecat.PaywallsTester.v1-snapshots
0 0 0 0 65 0 N/A

🛸 Powered by Emerge Tools

Base automatically changed from pw-state/2-updates to main June 16, 2026 20:40
@MonikaMateska MonikaMateska force-pushed the pw-state/3-condition branch from 72653e2 to 812ed31 Compare June 16, 2026 20:41
@MonikaMateska MonikaMateska merged commit 58521d4 into main Jun 16, 2026
39 of 43 checks passed
@MonikaMateska MonikaMateska deleted the pw-state/3-condition branch June 16, 2026 21:13
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