[Conditional Configurability][2] Implement selected_package condition evaluation#3111
Conversation
e8dc666 to
d22d929
Compare
61daaea to
a1b6ae1
Compare
a1b6ae1 to
5cd98a4
Compare
d22d929 to
f2ca67e
Compare
5cd98a4 to
db3ef8d
Compare
f2ca67e to
5f6bebb
Compare
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## cesar/pw-169-android-data-layer-new-condition-types-serialization #3111 +/- ##
==================================================================================================
Coverage 79.19% 79.19%
==================================================================================================
Files 347 347
Lines 13956 13956
Branches 1896 1896
==================================================================================================
Hits 11052 11052
Misses 2114 2114
Partials 790 790 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
selected_package condition evaluation
db3ef8d to
aed71b5
Compare
5f6bebb to
1327aba
Compare
facumenzella
left a comment
There was a problem hiding this comment.
Left an inline comment about a minor testing gap 👍
| private fun ComponentOverride.Condition.SelectedPackage.evaluate(selectedPackageId: String?): Boolean { | ||
| if (selectedPackageId == null) return false | ||
| return when (operator) { | ||
| ComponentOverride.ArrayOperator.IN -> selectedPackageId in packages |
There was a problem hiding this comment.
Looks good! Matches iOS behavior where both IN and NOT_IN return false when no package is selected. 👍
facumenzella
left a comment
There was a problem hiding this comment.
Look aligned with the iOS implementation 👍 . Let's bring this one to the main one
aed71b5 to
ed770a3
Compare
1327aba to
03f2bd3
Compare
- Add SelectedPackage, Variable, and Package condition types - Extend IntroOffer/PromoOffer from object to data class with optional operator/value - Add EqualityOperator, ArrayOperator enums and ConditionValue sealed type - Update ConditionSerializer with new type mappings - Add placeholder branches in shouldApply() for new types (return false) - Add deserialization tests for all new condition types Co-authored-by: Cursor <cursoragent@cursor.com>
Add selectedPackageId parameter to buildPresentedPartial and thread it through all component states (stack, text, image, icon, video, timeline, tabs, carousel). Evaluate SelectedPackage conditions using in/not_in operators against the currently selected package identifier. Refactor shouldApply into Condition.evaluate for lower cyclomatic complexity. Co-authored-by: Cursor <cursoragent@cursor.com>
03f2bd3 to
68d0698
Compare
a7f9fb0
into
cesar/conditional-configurability
…on evaluation (#3111) ### Motivation The `selected_package` condition allows paywall components to change their appearance based on which package the user has selected (e.g., show different text when annual vs monthly is selected). ### Description - Introduces `ConditionContext` to carry evaluation state (`selectedPackageId`, `currentPackageId`, `customVariables`) - Extends `buildPresentedPartial` to accept `ConditionContext` parameter - Implements `SelectedPackage` condition evaluation with `in` / `not in` operators - Threads selected package ID from all component state classes through to condition evaluation - Unit tests for `selected_package` condition evaluation (in, not in, no selection) --------- Co-authored-by: Cursor <cursoragent@cursor.com>

Motivation
The
selected_packagecondition allows paywall components to change their appearance based on which package the user has selected (e.g., show different text when annual vs monthly is selected).Description
ConditionContextto carry evaluation state (selectedPackageId,currentPackageId,customVariables)buildPresentedPartialto acceptConditionContextparameterSelectedPackagecondition evaluation within/not inoperatorsselected_packagecondition evaluation (in, not in, no selection)