Fix preload VideoComponent fallback override images#3449
Conversation
b7c835b to
d24abe5
Compare
Include localized image values and video fallback-source overrides when collecting Paywall Components image assets. Also deserialize video localization payloads so components_localizations can represent ThemeVideoUrls.
d24abe5 to
3640228
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3449 +/- ##
==========================================
+ Coverage 79.55% 79.81% +0.25%
==========================================
Files 365 365
Lines 14681 14686 +5
Branches 2002 2007 +5
==========================================
+ Hits 11680 11722 +42
+ Misses 2191 2145 -46
- Partials 810 819 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f209775 to
72d8c3d
Compare
TimelineComponent was not handled in findImageUrisToDownload, causing icon images inside timeline items to be skipped during pre-download. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| pages.flatMapTo(mutableSetOf()) { | ||
| it.findImageUrisToDownload() | ||
| } + | ||
| overrides.flatMapTo(mutableSetOf()) { |
| (fallback?.findImageUrisToDownload().orEmpty()) | ||
| } | ||
| is TimelineComponent -> { | ||
| items.flatMapTo(mutableSetOf()) { item -> |
|
iOS equivalent: RevenueCat/purchases-ios#6752 |
Replace the else branch with explicit cases for every PaywallComponent subtype. New subtypes will now fail to compile until they are handled, preventing silent regressions like the TimelineComponent one. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
430ad53 to
02a90a3
Compare
| } | ||
| is VideoComponent -> { | ||
| component.fallbackSource?.findImageUrisToDownload().orEmpty() + | ||
| component.overrides.orEmpty().flatMapTo(mutableSetOf()) { |
| component.fallbackSource?.findImageUrisToDownload().orEmpty() | ||
| } | ||
| is CountdownComponent -> { | ||
| component.countdownStack.findImageUrisToDownload() + |
There was a problem hiding this comment.
this wasn't needed, the filter { true } BFS search already "visits" the stacks
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ 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 f7afcc9. Configure here.
| it is TabsComponent || | ||
| it is ImageComponent || | ||
| it is CountdownComponent | ||
| }.flatMapTo(mutableSetOf()) { component -> |
There was a problem hiding this comment.
Localized images never preloaded — production code missing
High Severity
PaywallComponentsImagePreDownloader.preDownloadImages only accepts a PaywallComponentsConfig (the component tree), and OfferingImagePreDownloader.downloadV2Images only passes componentsConfig.base — never reading componentsLocalizations. Localized image values (LocalizationData.Image) are therefore never discovered or pre-downloaded. The test expects test_localized_image_low_res.webp from the localizations map to be downloaded, but the production code has no localization handling at all, directly contradicting the PR's stated goal.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit f7afcc9. Configure here.
There was a problem hiding this comment.
This is fine, it's not a regression
|
@facumenzella I've updated the PR to just fix the couple things that I found:
|
facumenzella
left a comment
There was a problem hiding this comment.
I think this is correct! I wonder if we should focus on preloading stuff before launch or we should just wait for optimizations, but overall it looks legit to me
|
@facumenzella yeah this ended up being unrelated to workflows in the end. But thought including those fixes still made sense |
**This is an automatic release.** ## RevenueCat SDK ### 📦 Dependency Updates * [RENOVATE] Update dependency gradle to v8.14.5 (#3459) via RevenueCat Git Bot (@RCGitBot) ## RevenueCatUI SDK ### ✨ New Features * Pre-warm image cache for workflow step states (#3447) via Cesar de la Vega (@vegaro) ### Paywallv2 #### ✨ New Features * Add `close_workflow` button action (#3453) via Cesar de la Vega (@vegaro) #### 🐞 Bugfixes * Fix preload VideoComponent fallback override images (#3449) via Cesar de la Vega (@vegaro) ### 🔄 Other Changes * Select blob source by priority and weighted random (#3458) via Toni Rico (@tonidero) * [AUTOMATIC] Update golden test files for backend integration tests (#3473) via RevenueCat Git Bot (@RCGitBot) * Clean up unreferenced topic files after successful remote-config refresh (#3439) via Toni Rico (@tonidero) * Cache remote config response in memory with TTL and persist to disk (#3457) via Toni Rico (@tonidero) * build(deps): bump fastlane from 2.233.1 to 2.234.0 (#3463) via dependabot[bot] (@dependabot[bot]) * Update codelabs links (#3460) via Jaewoong Eum (@skydoves) * Add RemoteConfigManager and TopicFetcher (#3437) via Toni Rico (@tonidero) * Add exit offers support to workflows (#3452) via Cesar de la Vega (@vegaro) * Update baseline profiles (#3461) via RevenueCat Git Bot (@RCGitBot) * Add network scaffolding for remote config endpoint (#3435) via Toni Rico (@tonidero) * test: cover singleStepFallbackId == initialStepId edge case (#3445) via Facundo Menzella (@facumenzella) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk: this is a release/versioning update (SNAPSHOT -> final) plus docs deployment path changes, with no functional code changes beyond version constants. > > **Overview** > Finalizes the `10.6.0` release by switching all version references from `10.6.0-SNAPSHOT` to `10.6.0` (root `.version`, `gradle.properties`, `Config.frameworkVersion`, and sample/test app `libs.versions.toml` files). > > Updates documentation publishing to point at the `10.6.0` docs path (CircleCI S3 sync target and `docs/index.html` redirect), and prepends the `10.6.0` section to `CHANGELOG.md`/`CHANGELOG.latest.md`. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 4da1697. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->


Why
Fixes gaps in Paywalls V2 image predownloading:
VideoComponentfallback-source overrides were not included in the predownload pass — only the basefallbackSourcewas fetchedCarouselComponentpages andCountdownComponentsub-stacks were being manually recursed in thewhenbranches, but the BFS traversal inPaywallComponent.filteralready visits them — resulting in double-traversalWhat
VideoComponentoverride fallback sources to the predownload passCarouselComponent.pagesandCountdownComponentsub-stacks (BFS handles them;CountdownComponentmoves to the no-op group with a comment)StackComponent.findImageUrisToDownloadto usefilter { true }with an exhaustivewhen(single source of truth for all component types; compiler enforces coverage when new types are added)List<ComponentOverride<T>>?.imageUrisToDownloadhelper to deduplicate the override traversal patternNote
Low Risk
Low risk: scoped to paywall image predownload URL collection, with added regression tests to catch missed/duplicate downloads.
Overview
Fixes Paywalls V2 image predownloading by including
VideoComponentfallback-source overrides in the predownload pass.Refactors
StackComponent.findImageUrisToDownload()to rely on the existing BFSPaywallComponent.filtertraversal (avoiding redundant manual recursion for carousel/countdown descendants), centralizes per-component URI extraction in an exhaustivewhen, and adds a small helper to dedupe override URI extraction. Updates tests to cover carousel page images plus video fallback/override fallback images.Reviewed by Cursor Bugbot for commit d0d52b9. Bugbot is set up for automated code reviews on this repo. Configure here.