Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
reloadRewarded = async () => {
if (!(await AdMobRewarded.getIsReadyAsync())) {
let isRewardedReady = false;
try {
await AdMobRewarded.requestAdAsync({
servePersonalizedAds: this.state.servePersonalizedAds,
});
isRewardedReady = true;
} catch (e) {
if (e.code === 'E_AD_ALREADY_LOADED') {
isRewardedReady = true;
} else {
console.warn('AdMobRewarded.requestAdAsync', e);
}
} finally {
this.setState({ isRewardedReady });
}
}