(offer, step, sessionId)
| 184 | } |
| 185 | |
| 186 | async function createRewardedAd(offer, step, sessionId) { |
| 187 | if (!admob?.RewardedAd) { |
| 188 | throw new Error("Rewarded ads are not available in this build."); |
| 189 | } |
| 190 | |
| 191 | const userId = await getRewardIdentity(); |
| 192 | const customData = [ |
| 193 | `session=${sessionId}`, |
| 194 | `offer=${offer.id}`, |
| 195 | `step=${step}`, |
| 196 | `ads=${offer.adsRequired}`, |
| 197 | ].join("&"); |
| 198 | |
| 199 | return new admob.RewardedAd({ |
| 200 | adUnitId: adUnitIdRewarded, |
| 201 | serverSideVerification: { |
| 202 | userId, |
| 203 | customData, |
| 204 | }, |
| 205 | }); |
| 206 | } |
| 207 | |
| 208 | function waitForRewardedResult(ad) { |
| 209 | return new Promise((resolve, reject) => { |
no test coverage detected