Skip to content

Commit 82a1246

Browse files
committed
adblock alert inside adsense component
1 parent 58a65d8 commit 82a1246

5 files changed

Lines changed: 21 additions & 29 deletions

File tree

MM.WEB/Modules/Index.razor

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -525,21 +525,6 @@
525525
//https://developer.apple.com/app-store/review/guidelines/#link-to-other-purchase-methods
526526
SubscriptionAllowed = _iosAllowedCountries.ContainsKey(country);
527527
}
528-
529-
_ = DetectAdBlockAsync();
530-
}
531-
532-
private async Task DetectAdBlockAsync()
533-
{
534-
var blocked = await JsRuntime.Utils().IsAdBlocked();
535-
536-
if (blocked)
537-
{
538-
await InvokeAsync(async () =>
539-
{
540-
await ShowWarning(GlobalTranslations.AdBlockerDetected);
541-
});
542-
}
543528
}
544529

545530
private double GetPhaseValue(int phase)

MM.WEB/Shared/GoogleAdSense.razor

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,24 @@
5959
}
6060
}
6161

62+
protected override async Task ProcessComponentData()
63+
{
64+
_ = DetectAdBlockAsync();
65+
}
66+
67+
private async Task DetectAdBlockAsync()
68+
{
69+
var blocked = await JsRuntime.Utils().IsAdBlocked();
70+
71+
if (blocked)
72+
{
73+
await InvokeAsync(async () =>
74+
{
75+
await ShowWarning(GlobalTranslations.AdBlockerDetected);
76+
});
77+
}
78+
}
79+
6280
private async Task OpenSubscription()
6381
{
6482
await DialogService.SubscriptionPopup();

MM.WEB/wwwroot/index.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5145928155833172" crossorigin="anonymous"></script>
2929
<script async src="https://www.googletagmanager.com/gtag/js?id=G-P7B5BSBS9S"></script>
3030

31-
<script async src="https://fundingchoicesmessages.google.com/i/pub-5145928155833172?ers=1"></script>
32-
<script>(function () { function signalGooglefcPresent() { if (!window.frames['googlefcPresent']) { if (document.body) { const iframe = document.createElement('iframe'); iframe.style = 'width: 0; height: 0; border: none; z-index: -1000; left: -1000px; top: -1000px;'; iframe.style.display = 'none'; iframe.name = 'googlefcPresent'; document.body.appendChild(iframe); } else { setTimeout(signalGooglefcPresent, 0); } } } signalGooglefcPresent(); })();</script>
33-
3431
<script src="https://js.sentry-cdn.com/ed1ba47e2afd2ee2d3425e67475ac829.min.js" crossorigin="anonymous"></script>
3532
<script src="package/swiper/swiper-bundle.min.js"></script> <!--12.0.3-->
3633
<script src="package/webtonative/webtonative.min.js"></script> <!--https://docs.webtonative.com/javascript-apis/getting-started - 1.0.91-->

MM.WEB/wwwroot/js/app-version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const appVersion = '2026.05.13'
1+
export const appVersion = '2026.05.14'

MM.WEB/wwwroot/js/utils.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -297,15 +297,7 @@ export const environment = {
297297
'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js'
298298
);
299299

300-
if (!googlesyndication) {
301-
return true;
302-
}
303-
304-
const fundingchoicesmessages = await environment.testUrl(
305-
'https://fundingchoicesmessages.google.com/i/pub-5145928155833172?ers=1'
306-
);
307-
308-
return !fundingchoicesmessages;
300+
return !googlesyndication;
309301
}
310302
};
311303

@@ -434,4 +426,4 @@ window.checkUpdateReady = async function () {
434426
if (!navigator.serviceWorker) return false;
435427
const reg = await navigator.serviceWorker.ready;
436428
return !!reg.waiting;
437-
};
429+
};

0 commit comments

Comments
 (0)