Skip to content

feat(paywalls) Generic Web View#3501

Draft
JZDesign wants to merge 11 commits into
mainfrom
cursor/android-web-warming-cb6a
Draft

feat(paywalls) Generic Web View#3501
JZDesign wants to merge 11 commits into
mainfrom
cursor/android-web-warming-cb6a

Conversation

@JZDesign

@JZDesign JZDesign commented May 21, 2026

Copy link
Copy Markdown
Contributor

Checklist

  • If applicable, unit tests
  • If applicable, create follow-up issues for purchases-ios and hybrids

Motivation

Bring the Android Paywalls V2 asset pre-download path in line with the iOS jzdesign/test-web-warming concept by recognizing web view components and warming their content before rendering.

Resolves PWENG-98

Description

  • Adds an internal web_view paywall component model.
  • Collects web view URLs during V2 paywall and workflow asset pre-download traversal, including nested stacks, headers, sticky footers, and sheet destination stacks.
  • Adds a WebView-based pre-downloader with HTTPS-only loading, blocked mixed content, disabled file/content access, and bounded cleanup.
  • Adds minimal RevenueCatUI rendering support for decoded web view components with matching URL hardening and WebView release cleanup.
  • Adds targeted tests for component decoding and web view pre-download collection.

Verified with:

  • ./gradlew :purchases:testDefaultsBc8DebugUnitTest --tests "com.revenuecat.purchases.utils.OfferingImagePreDownloaderTest" --tests "com.revenuecat.purchases.paywalls.components.WebViewComponentTests" :ui:revenuecatui:testDefaultsBc8DebugUnitTest --tests "com.revenuecat.purchases.ui.revenuecatui.helpers.ContainsUnsupportedConditionTests"
  • ./gradlew detektAll
Open in Web Open in Cursor 

@JZDesign JZDesign changed the title Add Android web view cache warming feat(paywalls) Generic Web View May 28, 2026
@codecov

codecov Bot commented May 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 57.89474% with 40 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.05%. Comparing base (4b64a99) to head (78d1bae).
⚠️ Report is 35 commits behind head on main.

Files with missing lines Patch % Lines
...revenuecat/purchases/utils/WebViewPreDownloader.kt 13.15% 33 Missing ⚠️
...purchases/utils/PaywallComponentFilterExtension.kt 33.33% 0 Missing and 4 partials ⚠️
...hases/utils/PaywallComponentsImagePreDownloader.kt 95.00% 0 Missing and 2 partials ⚠️
.../purchases/paywalls/components/WebViewComponent.kt 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3501      +/-   ##
==========================================
- Coverage   80.11%   80.05%   -0.07%     
==========================================
  Files         371      373       +2     
  Lines       15166    15259      +93     
  Branches     2100     2135      +35     
==========================================
+ Hits        12150    12215      +65     
- Misses       2166     2199      +33     
+ Partials      850      845       -5     

☔ View full report in Codecov by Harness.
📢 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.

cursoragent and others added 6 commits June 8, 2026 09:45
Co-authored-by: jacob.rakidzich <jacob.rakidzich@revenuecat.com>
Co-authored-by: jacob.rakidzich <jacob.rakidzich@revenuecat.com>
Co-authored-by: jacob.rakidzich <jacob.rakidzich@revenuecat.com>
Co-authored-by: jacob.rakidzich <jacob.rakidzich@revenuecat.com>
Co-authored-by: jacob.rakidzich <jacob.rakidzich@revenuecat.com>
@alexrepty alexrepty force-pushed the cursor/android-web-warming-cb6a branch from 75c3749 to 63a8a3f Compare June 8, 2026 07:45
alexrepty and others added 3 commits June 11, 2026 20:18
…edownload test

mockk 1.13.11 has no top-level io.mockk.capture; capture is a MockKMatcherScope
member resolved inside the verify {} block. The stray import broke unit-test
compilation for the :purchases module. Removing it restores the build; the
web_view pre-download tests (HTTPS-only, template-skipping, multi-location
traversal, dedup) now compile and pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add support for new WebView schema fields and fallback rendering. WebViewComponent now preserves id, name, protocol_version, a fallback StackComponent and a Capabilities block (with NetworkAccess.allowed_domains). Paywall traversal logic was updated to descend into WebView fallbacks. StyleFactory now builds an optional fallback StackComponentStyle and WebViewComponentStyle carries fallbackStackComponentStyle. ComponentView and WebViewComponentView signatures were extended to forward click handlers and an interaction tracker; the view renders the fallback stack when the resolved URL is invalid. Added and updated tests: WebViewComponent deserialization/tests expanded, pre-downloader test for nested webview fallback, StyleFactory test for fallback creation, and URL resolver tests for disallowed schemes.
@RevenueCat-Danger-Bot

RevenueCat-Danger-Bot commented Jun 18, 2026

Copy link
Copy Markdown
1 Error
🚫 This PR changes 1221 lines of production Kotlin/Java code, over the 300-line limit. Split it into smaller PRs, or add the skip-pr-lines-changed-check label to bypass.

Generated by 🚫 Danger

@emerge-tools

emerge-tools Bot commented Jun 18, 2026

Copy link
Copy Markdown

📸 Snapshot Test

593 unchanged

Name Added Removed Modified Renamed Unchanged Errored Approval
TestPurchasesUIAndroidCompatibility Paparazzi
com.revenuecat.testpurchasesuiandroidcompatibility.paparazzi
0 0 0 0 258 0 N/A
TestPurchasesUIAndroidCompatibility
com.revenuecat.testpurchasesuiandroidcompatibility
0 0 0 0 335 0 N/A

🛸 Powered by Emerge Tools

Introduce bidirectional messaging for Paywalls V2 web_view components. Adds PaywallWebViewMessage, PaywallWebViewValue, PaywallWebViewController, and PaywallWebViewMessageHandler types, plus a WebViewJavaScriptBridge to safely deliver/receive messages, a parser and message/type constants, and a variables provider that merges SDK-managed and app-provided variables while sanitizing reserved keys. Integrates the handler into PaywallOptions and PaywallState, wires the bridge into WebViewComponentView with proper lifecycle handling, and updates style/component code to carry component IDs. Includes unit tests for value parsing/serialization and bridge-related behavior.
Add PaywallOptionsWebViewHandlerTest to verify builder stores/omits the WebView message handler, that options differing only by handler are not equal, and that hashCode intentionally ignores the handler to avoid spurious state updates. Expand WebViewJavaScriptBridgeTest with additional cases: origin/path validation, rc:step-complete and rc:error handling, malformed message rejection, auto-sending variables without a handler, updating variables/color scheme/locale, protection of envelope identity fields, escaping of U+2028/U+2029 in outbound payloads, and native interface attach/inject/release behavior. These tests improve coverage and ensure stable, secure messaging between the WebView and native layer.
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.

4 participants