Skip to content

[Conditional Configurability][2] Implement selected_package condition evaluation#3111

Merged
vegaro merged 2 commits into
cesar/conditional-configurabilityfrom
cesar/pw-170-selected-package-condition-evaluation
Feb 18, 2026
Merged

[Conditional Configurability][2] Implement selected_package condition evaluation#3111
vegaro merged 2 commits into
cesar/conditional-configurabilityfrom
cesar/pw-170-selected-package-condition-evaluation

Conversation

@vegaro

@vegaro vegaro commented Feb 17, 2026

Copy link
Copy Markdown
Member

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)

@vegaro vegaro requested a review from a team as a February 17, 2026 15:58
@vegaro vegaro marked this pull request as draft February 17, 2026 16:01
@vegaro vegaro force-pushed the cesar/pw-170-selected-package-condition-evaluation branch from e8dc666 to d22d929 Compare February 17, 2026 16:04
@vegaro vegaro force-pushed the cesar/pw-169-android-data-layer-new-condition-types-serialization branch from 61daaea to a1b6ae1 Compare February 17, 2026 16:04
@vegaro vegaro changed the title [PW-170] Implement selected_package condition evaluation [Conditional Configurability][2] Implement selected_package condition evaluation Feb 17, 2026
@vegaro vegaro force-pushed the cesar/pw-169-android-data-layer-new-condition-types-serialization branch from a1b6ae1 to 5cd98a4 Compare February 17, 2026 16:16
@vegaro vegaro force-pushed the cesar/pw-170-selected-package-condition-evaluation branch from d22d929 to f2ca67e Compare February 17, 2026 16:16
@vegaro vegaro force-pushed the cesar/pw-169-android-data-layer-new-condition-types-serialization branch from 5cd98a4 to db3ef8d Compare February 17, 2026 16:57
@vegaro vegaro force-pushed the cesar/pw-170-selected-package-condition-evaluation branch from f2ca67e to 5f6bebb Compare February 17, 2026 16:57

vegaro commented Feb 17, 2026

Copy link
Copy Markdown
Member Author

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.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codecov

codecov Bot commented Feb 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.19%. Comparing base (db3ef8d) to head (5f6bebb).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vegaro vegaro changed the title [Conditional Configurability][2] Implement selected_package condition evaluation [Conditional Configurability][2] Implement selected_package condition evaluation Feb 18, 2026
@vegaro vegaro marked this pull request as ready for review February 18, 2026 10:33
@vegaro vegaro requested a review from facumenzella February 18, 2026 10:33
@vegaro vegaro force-pushed the cesar/pw-169-android-data-layer-new-condition-types-serialization branch from db3ef8d to aed71b5 Compare February 18, 2026 10:50
@vegaro vegaro force-pushed the cesar/pw-170-selected-package-condition-evaluation branch from 5f6bebb to 1327aba Compare February 18, 2026 10:50

@facumenzella facumenzella left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good! Matches iOS behavior where both IN and NOT_IN return false when no package is selected. 👍

@facumenzella facumenzella left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Look aligned with the iOS implementation 👍 . Let's bring this one to the main one

@vegaro vegaro force-pushed the cesar/pw-169-android-data-layer-new-condition-types-serialization branch from aed71b5 to ed770a3 Compare February 18, 2026 15:30
@vegaro vegaro force-pushed the cesar/pw-170-selected-package-condition-evaluation branch from 1327aba to 03f2bd3 Compare February 18, 2026 15:31
Base automatically changed from cesar/pw-169-android-data-layer-new-condition-types-serialization to cesar/conditional-configurability February 18, 2026 15:32
- 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>
@vegaro vegaro force-pushed the cesar/pw-170-selected-package-condition-evaluation branch from 03f2bd3 to 68d0698 Compare February 18, 2026 15:34
@vegaro vegaro merged commit a7f9fb0 into cesar/conditional-configurability Feb 18, 2026
1 of 4 checks passed
@vegaro vegaro deleted the cesar/pw-170-selected-package-condition-evaluation branch February 18, 2026 15:35
vegaro added a commit that referenced this pull request Feb 19, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants