Integrate AdMob reward verification flow in adapter#3468
Conversation
63bbdb1 to
8088338
Compare
5e78e69 to
63d3926
Compare
tonidero
left a comment
There was a problem hiding this comment.
Right now, just concerned a bit with the static nature of the state we are holding... Trying to think of ways we can bound it to the purchases instance at least...
bb245d4 to
2619158
Compare
2619158 to
f87cb50
Compare
Expose a small Purchases lifecycle registration bridge and use it as the default registrar for AdMob reward verification hooks.
Map core reward verification responses into AdMob adapter results and preserve cancellation while treating non-terminal states as failed until retry orchestration lands.
Store per-ad verification state on enable, consume it when AdMob reports a reward, and deliver verification outcomes on the main thread through a lifecycle-owned manager.
b367836 to
5b7c933
Compare
| } else { | ||
| block() | ||
| } | ||
| } |
There was a problem hiding this comment.
This is pretty the same as PurchasesOrchestrator.dispatch but I was not sure if the wiring was worth while. Perhaps this helper can be promoted to core.
Remove the single-field State wrapper and store the client transaction id directly by ad until reward verification consumes it.
Let the lifecycle runtime own the weak ad-to-transaction map directly now that no storage abstraction is needed.
Make the missing transaction id path return before checking verification runtime state so manager control flow follows the reward callback lifecycle directly.
Keep missing-state, missing-runtime, and polling delivery branches together in the manager callback flow.
Remove a small failed-result wrapper so the manager shows fallback result delivery directly in each branch.
Rename completion callback parameters and notification helpers so callback flow reads as started/completed events rather than result values.
Schedule verification under the runtime lock and fail the completion callback if the launched verification job is cancelled before producing a result.
Extract the runtime test seam and assert cancelled verification work completes with a failed reward verification result.
Treat any failed verification coroutine completion as a terminal failed reward verification result.
Apply detekt formatting corrections for reward verification manager and poller imports.
Refresh API dumps after reward verification callback naming and lifecycle registration changes.
Call the placement-aware AdMob show overload with an explicit reward listener from reward verification wrappers.
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 f077332. Configure here.
Split reward verification show overloads so calls without placement preserve load-time analytics placement while explicit placement overloads continue to override.
Refresh AdMob API signatures after splitting reward verification show overloads by placement handling.
…ard-verification-adapter-core-integration
…r-split' into admob-reward-verification-adapter-core-integration
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## admob-reward-verification-locator-split #3468 +/- ##
==========================================================================
Coverage ? 79.94%
==========================================================================
Files ? 374
Lines ? 14995
Branches ? 2066
==========================================================================
Hits ? 11988
Misses ? 2167
Partials ? 840 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|

Checklist
purchases-iosand hybridsMotivation
The AdMob adapter reward verification APIs are scaffolded, and core reward verification result plumbing is available in
:purchases. This PR wires the adapter callback flow end-to-end so AdMob reward callbacks can return deterministic verification outcomes now, while keeping full polling/retry orchestration out of scope for a follow-up PR.Description
RewardVerificationResultvalues.enableRewardVerification()and consumes that state when AdMob reports a reward.RewardVerificationManagerto own state, verification scope, cleanup, and main-thread callback delivery.RewardVerificationResult.failedwhen reward verification show overloads are used without priorenableRewardVerification()or when runtime state is unavailable.PENDING,UNKNOWN, and backend errors as failed results for now; retry/backoff orchestration remains out of scope.Out of scope in this PR:
Note
Medium Risk
Adds new asynchronous reward-verification flow (lifecycle hooks, background polling, main-thread callback delivery) that affects rewarded ad showing behavior and introduces new failure modes if misconfigured.
Overview
Implements the previously-scaffolded AdMob reward verification APIs:
enableRewardVerification()now installs per-ad client transaction IDs andshow()overloads now invoke a verification pipeline instead of throwingNotImplementedError, with callbacks delivered on the main thread.Adds a lifecycle-owned
RewardVerificationManager/runtime that hooks into a new publicPurchasesLifecycleregistration API to create/cancel a verification coroutine scope, track ad→transaction IDs (viaWeakHashMap), and fail-safe toRewardVerificationResult.failedwhen setup/state is missing.Introduces a
Pollerthat calls coreawaitGetRewardVerificationResultand maps core statuses into adapter results (treatingPENDING/UNKNOWN/errors as failed for now), plus unit/Robolectric coverage for lifecycle registration, polling mapping, placement override behavior, and cancellation handling.Reviewed by Cursor Bugbot for commit 8591366. Bugbot is set up for automated code reviews on this repo. Configure here.