Add onWebCheckoutOpened to PaywallListener#3809
Conversation
Notifies listeners when the user taps a web checkout CTA, so hosts can react (e.g. syncPurchases) on the other side of a web purchase flow instead of only seeing a generic dismiss. SDK-4398.
Kotlin default interface methods aren't inherited by Java callers without -Xjvm-default, so the Java api-tester's anonymous PaywallListener must implement every method explicitly. Fixes CI compile failure.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3809 +/- ##
=======================================
Coverage 80.43% 80.43%
=======================================
Files 407 407
Lines 16877 16877
Branches 2464 2464
=======================================
Hits 13575 13575
Misses 2342 2342
Partials 960 960 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@cursor review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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 3b43c28. Configure here.
handleUrlDestination silently no-ops for an unrecognized url_method (decoded as UNKNOWN), but the listener was still being told a web checkout had launched. Gate the notification on the URL actually being opened, and add regression tests for both the unknown-method and non-autoDismiss paths.
…ions Reduces rememberPaywallActionHandler's cyclomatic complexity below threshold. TooManyFunctions suppression matches existing convention in LoadingPaywall.kt/PaywallActivity.kt.
| } | ||
| } | ||
|
|
||
| URLOpener.openURL(this, url, openingMethod) |
There was a problem hiding this comment.
I guess this may still fail if there is an issue with the URL... but that shouldn't normally happen and one could argue it's a problem on the developer side so I think it's fine for this.
URLOpener.openURL previously returned Unit, so handleUrlDestination always reported success for any recognized method even if the actual Android URL-opening call failed (no matching activity, bad URI). openURL now returns whether it actually opened the URL. Per review discussion: #3809 (comment)

Motivation
Adds a callback to
PaywallListenerso host apps know when a paywall hands off to web checkout, instead of just seeing it dismiss with no signal.Part of SDK-4398.
Changes
PaywallListener.onWebCheckoutOpened(): no-op default, called when a web-checkout button is tapped and the URL actually opens.PaywallResultunchanged.Related PRs
Testing
PaywallActionTests: autoDismiss true/false, unknown-method case.api.txtupdated.Note
Low Risk
Backward-compatible public API default method; behavior is limited to paywall web-checkout navigation and listener signaling, with no purchase or auth changes.
Overview
Adds
PaywallListener.onWebCheckoutOpened()(default no-op) so host apps can tell when a paywall web-checkout CTA successfully hands off to an external URL, separate from dismiss/cancel.PaywallResultis unchanged;PaywallActivityforwards the callback to the app listener.Web checkout handling in
InternalPaywallis extracted intohandleLaunchWebCheckout, which callsnotifyWebCheckoutOpened()only when the URL actually opens.URLOpener.openURLandhandleUrlDestinationnow returnBooleanso unknown open methods and open failures (e.g. no handler) do not fire the listener.autoDismissbehavior is unchanged.Public
api.txt, Java API tester, mocks, andPaywallActionTestscover auto-dismiss on/off, unknown method, and failed deep-link open.Reviewed by Cursor Bugbot for commit b67639b. Bugbot is set up for automated code reviews on this repo. Configure here.