Commit 87ad0189 authored by Igor Stuev's avatar Igor Stuev Committed by GitHub

Merge pull request #1981 from blockscout/fe-1980

Adblock detect improvement
parents 5ea7590b 0b593902
......@@ -34,7 +34,11 @@ export default function useAdblockDetect() {
method: 'HEAD',
mode: 'no-cors',
cache: 'no-store',
}).catch(() => {
})
.then(() => {
cookies.set(cookies.NAMES.ADBLOCK_DETECTED, 'false', { expires: 1 });
})
.catch(() => {
cookies.set(cookies.NAMES.ADBLOCK_DETECTED, 'true', { expires: 1 });
});
}
......
......@@ -17,7 +17,7 @@ const DetailsSponsoredItem = ({ isLoading }: Props) => {
const isMobile = useIsMobile();
const hasAdblockCookie = cookies.get(cookies.NAMES.ADBLOCK_DETECTED);
if (!feature.isEnabled || hasAdblockCookie) {
if (!feature.isEnabled || hasAdblockCookie === 'true') {
return null;
}
......
......@@ -18,7 +18,7 @@ const AdBanner = ({ className, isLoading }: { className?: string; isLoading?: bo
const hasAdblockCookie = cookies.get(cookies.NAMES.ADBLOCK_DETECTED, useAppContext().cookies);
if (!feature.isEnabled || hasAdblockCookie || !provider) {
if (!feature.isEnabled || hasAdblockCookie === 'true' || !provider) {
return null;
}
......
......@@ -10,7 +10,7 @@ import CoinzillaTextAd from './CoinzillaTextAd';
const TextAd = ({ className }: {className?: string}) => {
const hasAdblockCookie = cookies.get(cookies.NAMES.ADBLOCK_DETECTED, useAppContext().cookies);
if (!config.features.adsText.isEnabled || hasAdblockCookie) {
if (!config.features.adsText.isEnabled || hasAdblockCookie === 'true') {
return null;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment