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