Skip to content

Commit d01b6dc

Browse files
committed
fix
1 parent 4872337 commit d01b6dc

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/lib/adRewards.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import secureAdRewardState from "./secureAdRewardState";
44

55
const ONE_HOUR = 60 * 60 * 1000;
66
const MAX_TIMEOUT = 2_147_483_647;
7+
const REWARDED_RESULT_TIMEOUT_MS = 90 * 1000;
78

89
const OFFERS = [
910
{
@@ -219,16 +220,25 @@ function waitForRewardedResult(ad) {
219220
return new Promise((resolve, reject) => {
220221
let earned = false;
221222
let settled = false;
223+
const timeoutId = setTimeout(() => {
224+
fail(
225+
new Error(
226+
"Rewarded ad timed out before completion. Please try again.",
227+
),
228+
);
229+
}, REWARDED_RESULT_TIMEOUT_MS);
222230

223231
const finish = (result) => {
224232
if (settled) return;
225233
settled = true;
234+
clearTimeout(timeoutId);
226235
resolve(result);
227236
};
228237

229238
const fail = (error) => {
230239
if (settled) return;
231240
settled = true;
241+
clearTimeout(timeoutId);
232242
reject(
233243
error instanceof Error
234244
? error

src/lib/startAd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default async function startAd() {
1111

1212
if (BuildInfo.type === "debug") {
1313
adUnitIdBanner = "ca-app-pub-3940256099942544/6300978111"; // Test
14-
adUnitIdInterstitial = "ca-app-pub-3940256099942544/5224354917"; // Test
14+
adUnitIdInterstitial = "ca-app-pub-3940256099942544/1033173712"; // Test
1515
adUnitIdRewarded = "ca-app-pub-3940256099942544/5224354917"; // Test
1616
}
1717
}

0 commit comments

Comments
 (0)