Skip to content

PW-1178 | Support package-level visibility via visible property and overrides#3279

Merged
facumenzella merged 13 commits intomainfrom
facundo/pw-1178-package-visibility-android
Apr 9, 2026
Merged

PW-1178 | Support package-level visibility via visible property and overrides#3279
facumenzella merged 13 commits intomainfrom
facundo/pw-1178-package-visibility-android

Conversation

@facumenzella
Copy link
Copy Markdown
Member

@facumenzella facumenzella commented Mar 26, 2026

Summary

Implements Android SDK support for khepri#18819 which adds a visible field and overrides to the Package and PartialPackage schema, allowing packages to be hidden by Rules.

  • Adds visible: Boolean? and overrides: List<ComponentOverride<PartialPackageComponent>> to PackageComponent
  • Adds PartialPackageComponent with visible: Boolean? (mirrors khepri's PartialPackage)
  • Adds PresentedPackagePartial following the existing partial component pattern
  • PackageComponentStyle now implements PackageContext and carries package-level visible, overrides, and offerEligibility
  • New PackageComponentState evaluates overrides at render time (window size, selection, offer eligibility, custom variables)
  • PackageComponentView gates rendering on the resolved package-level visibility
  • containsUnsupportedCondition updated to check package-level overrides

Test plan

  • Unit tests: deserialization of new visible and overrides fields (PackageComponentTests)
  • Unit tests: StyleFactory correctly populates visible and overrides on PackageComponentStyle (StyleFactoryTests)
  • Unit tests: containsUnsupportedCondition detects unsupported conditions in package overrides (ContainsUnsupportedConditionTests)
  • UI tests: package hidden when visible=false, shown when visible=true, and toggled via selected_package override condition (VisibilityConditionTests)
  • Snapshot tests: need to be regenerated after merging (run bundle exec fastlane generate_snapshots_RCUI)

Related

🤖 Generated with Claude Code


Note

Medium Risk
Changes paywall rendering behavior by conditionally hiding PackageComponents based on new rule evaluation, which could affect purchase UI visibility if misconfigured; coverage is improved with new unit/UI tests.

Overview
Adds package-level visibility control to paywalls by extending PackageComponent with an optional visible flag plus conditional overrides (via new PartialPackageComponent).

On the UI side, introduces PresentedPackagePartial and a new PackageComponentState that evaluates package overrides at render time (screen size/selection/offer eligibility/custom variables) and updates PackageComponentView to skip rendering when the resolved visibility is false; StyleFactory now builds and carries these overrides/visibility (defaulting to visible) and containsUnsupportedCondition now considers package-level overrides. Tests are expanded to cover JSON deserialization, style creation defaults, unsupported-condition detection, and Compose visibility behavior for packages.

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

…ides

Mirrors khepri#18819 which adds `visible` and `overrides` to the Package
and PartialPackage schema, allowing packages to be hidden by Rules.

- Add `visible: Boolean?` and `overrides: List<ComponentOverride<PartialPackageComponent>>`
  to `PackageComponent`
- Add `PartialPackageComponent` with `visible: Boolean?`
- Add `PresentedPackagePartial` following the existing partial pattern
- `PackageComponentStyle` now implements `PackageContext` and carries
  package-level `visible`, `overrides`, and `offerEligibility`
- `PackageComponentState` evaluates overrides at render time
- `PackageComponentView` gates rendering on the resolved visibility
- `containsUnsupportedCondition` updated to check package overrides
- Unit + UI tests for deserialization, style creation, and visibility behavior

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 26, 2026

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 79.20%. Comparing base (4a142cf) to head (0abf6ab).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
.../purchases/paywalls/components/PackageComponent.kt 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3279      +/-   ##
==========================================
- Coverage   79.20%   79.20%   -0.01%     
==========================================
  Files         352      352              
  Lines       14100    14104       +4     
  Branches     1940     1941       +1     
==========================================
+ Hits        11168    11171       +3     
  Misses       2136     2136              
- Partials      796      797       +1     

☔ 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.

@facumenzella facumenzella marked this pull request as ready for review April 8, 2026 14:11
@facumenzella facumenzella requested review from a team as code owners April 8, 2026 14:11
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

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 5e06e96. Configure here.

…d of defensive check

The paywall builder already enforces that a default-selected package
cannot be statically hidden. Documenting the invariant in a comment
rather than duplicating the constraint in code.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
facumenzella and others added 4 commits April 9, 2026 10:31
Proxy URL, applicationId override, and network security config were
local development settings that were unintentionally committed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…s always visible

The paywall builder guarantees the default-selected package is never
hidden, so tracking package visibility in PaywallState and reconciling
selection away from hidden packages is unnecessary complexity.

- Remove packageVisibility map, packagesEverVisible set
- Remove setPackageVisible / clearPackageVisible / reconcileSelectedIfHidden
- Remove LaunchedEffect / DisposableEffect from PackageComponentView
- Remove reconciliation tests from VisibilityConditionTests

PackageComponentView still gates rendering on packageState.visible so
hidden packages are simply not rendered.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@facumenzella facumenzella added pr:fix A bug fix and removed pr:feat A new feature labels Apr 9, 2026
…ding selected_package test

- visible = null matches the partial component pattern (null = inherit from
  base, not-null = override). visible = true caused any future override
  partial to silently force visibility to true.
- Self-hiding via selected_package override is not a valid config: a package
  hiding itself when selected would leave the selected purchase target
  invisible with no way to reconcile.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@vegaro vegaro left a comment

Choose a reason for hiding this comment

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

Makes sense! I haven't had the chance to test it manually but code looks good!

@facumenzella facumenzella enabled auto-merge April 9, 2026 09:31
@facumenzella facumenzella added this pull request to the merge queue Apr 9, 2026
Merged via the queue into main with commit c04fc89 Apr 9, 2026
37 checks passed
@facumenzella facumenzella deleted the facundo/pw-1178-package-visibility-android branch April 9, 2026 10:05
github-merge-queue bot pushed a commit that referenced this pull request Apr 9, 2026
**This is an automatic release.**

## RevenueCatUI SDK
### Paywallv2
#### 🐞 Bugfixes
* PW-1178 | Support package-level visibility via visible property and
overrides (#3279) via Facundo Menzella (@facumenzella)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk: this is primarily a version bump and release metadata/docs
updates, with no changes to runtime behavior beyond reporting the new
version string.
> 
> **Overview**
> Updates the Android SDK release from `10.1.0-SNAPSHOT` to **`10.0.2`**
across build/version metadata (`.version`, `gradle.properties`,
`Config.frameworkVersion`) and sample/test app dependency pins.
> 
> Refreshes release documentation and automation to publish and redirect
docs for `10.0.2` (CircleCI S3 deploy path and `docs/index.html`) and
records the `10.0.2` changelog entry (RevenueCatUI Paywallv2 bugfix
PW-1178).
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
be75649. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
facumenzella added a commit that referenced this pull request Apr 9, 2026
…verrides (#3279)

## Summary

Implements Android SDK support for khepri#18819 which adds a `visible`
field and `overrides` to the `Package` and `PartialPackage` schema,
allowing packages to be hidden by Rules.

- Adds `visible: Boolean?` and `overrides:
List<ComponentOverride<PartialPackageComponent>>` to `PackageComponent`
- Adds `PartialPackageComponent` with `visible: Boolean?` (mirrors
khepri's `PartialPackage`)
- Adds `PresentedPackagePartial` following the existing partial
component pattern
- `PackageComponentStyle` now implements `PackageContext` and carries
package-level `visible`, `overrides`, and `offerEligibility`
- New `PackageComponentState` evaluates overrides at render time (window
size, selection, offer eligibility, custom variables)
- `PackageComponentView` gates rendering on the resolved package-level
visibility
- `containsUnsupportedCondition` updated to check package-level
overrides

## Test plan

- [x] Unit tests: deserialization of new `visible` and `overrides`
fields (`PackageComponentTests`)
- [x] Unit tests: `StyleFactory` correctly populates `visible` and
`overrides` on `PackageComponentStyle` (`StyleFactoryTests`)
- [x] Unit tests: `containsUnsupportedCondition` detects unsupported
conditions in package overrides (`ContainsUnsupportedConditionTests`)
- [x] UI tests: package hidden when `visible=false`, shown when
`visible=true`, and toggled via `selected_package` override condition
(`VisibilityConditionTests`)
- [x] Snapshot tests: need to be regenerated after merging (run `bundle
exec fastlane generate_snapshots_RCUI`)

## Related

- Backend PR: RevenueCat/khepri#18819
- iOS implementation adds the same feature in
`PaywallPackageComponent.swift` + `PackageComponentViewModel.swift`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes paywall rendering behavior by conditionally hiding
`PackageComponent`s based on new rule evaluation, which could affect
purchase UI visibility if misconfigured; coverage is improved with new
unit/UI tests.
> 
> **Overview**
> Adds package-level visibility control to paywalls by extending
`PackageComponent` with an optional `visible` flag plus conditional
`overrides` (via new `PartialPackageComponent`).
> 
> On the UI side, introduces `PresentedPackagePartial` and a new
`PackageComponentState` that evaluates package overrides at render time
(screen size/selection/offer eligibility/custom variables) and updates
`PackageComponentView` to skip rendering when the resolved visibility is
false; `StyleFactory` now builds and carries these overrides/visibility
(defaulting to visible) and `containsUnsupportedCondition` now considers
package-level overrides. Tests are expanded to cover JSON
deserialization, style creation defaults, unsupported-condition
detection, and Compose visibility behavior for packages.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
0abf6ab. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@facumenzella facumenzella mentioned this pull request Apr 9, 2026
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