[Conditional Configurability][4] Add unsupported condition validation to trigger fallback paywall#3113
Conversation
4071045 to
acdeaf9
Compare
56b5031 to
8fa05ed
Compare
8fa05ed to
3607d07
Compare
c865ed3 to
60b19e8
Compare
3607d07 to
903b0ec
Compare
This stack of pull requests is managed by Graphite. Learn more about stacking. |
60b19e8 to
63353fe
Compare
903b0ec to
48cd554
Compare
48cd554 to
88e257e
Compare
3073f26 to
d026dce
Compare
88e257e to
2020bc1
Compare
d026dce to
a78ec8c
Compare
082e975 to
72b2a6b
Compare
a78ec8c to
2c9d8df
Compare
facumenzella
left a comment
There was a problem hiding this comment.
Hey! Quick note - the tests don't compile for me. See inline comment below.
facumenzella
left a comment
There was a problem hiding this comment.
Hey! Quick heads up - the tests don't compile for me.
2c9d8df to
b4e7c82
Compare
72b2a6b to
1d0e5b1
Compare
| customVariables: Map<String, CustomVariableValue>, | ||
| ): Boolean { | ||
| val variableValue = customVariables[variable] ?: return operator == ComponentOverride.EqualityOperator.NOT_EQUALS | ||
| val matches = matchesValue(variableValue) |
There was a problem hiding this comment.
Using toDouble() and == for comparison could cause precision issues with large integers and may behave differently than iOS. Worth checking parity with purchases-ios.
📸 Snapshot Test571 unchanged
🛸 Powered by Emerge Tools |
facumenzella
left a comment
There was a problem hiding this comment.
I think this looks good. I want to test the whole thing once it gets pilled up in one branch. Awesome work @vegaro
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## cesar/conditional-configurability #3113 +/- ##
==================================================================
Coverage 79.22% 79.22%
==================================================================
Files 347 347
Lines 13948 13948
Branches 1893 1893
==================================================================
Hits 11050 11050
Misses 2112 2112
Partials 786 786 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f4dfbe2 to
f599ef3
Compare
1765a5c to
4d767ae
Compare
114c8c1 to
34d0953
Compare
4d767ae to
6d4b836
Compare
When any component override contains a Condition.Unsupported (an unrecognized condition type), the paywall now fails validation and falls back to the default legacy paywall. This ensures developers cannot ship paywalls with conditions the SDK cannot evaluate, which could result in incorrect visibility states. - Add UnsupportedCondition to PaywallValidationError - Validate conditions in toPresentedOverrides, failing early on Unsupported - Add unit tests: unsupported condition triggers fallback, recognized conditions render normally Co-authored-by: Cursor <cursoragent@cursor.com>
6d4b836 to
d983d64
Compare

Motivation
When a paywall uses condition types that this SDK version doesn't understand (e.g., conditions added in a newer backend version), the SDK should gracefully fall back to the default paywall rather than rendering incorrectly.
Description
UnsupportedConditionvalidation intoPresentedOverrides. If any override contains anUnsupportedcondition, it produces aPaywallValidationErrorPaywallValidationError.UnsupportedConditionerror type with descriptive error string