enhance(client): hidden ads when canHideAds is true

This commit is contained in:
syuilo 2023-02-03 14:03:34 +09:00
parent 01778e11dc
commit 88c3957085
2 changed files with 1 additions and 13 deletions

View file

@ -11,7 +11,6 @@
<div>Ads by {{ host }}</div> <div>Ads by {{ host }}</div>
<!--<MkButton class="button" primary>{{ $ts._ad.like }}</MkButton>--> <!--<MkButton class="button" primary>{{ $ts._ad.like }}</MkButton>-->
<MkButton v-if="chosen.ratio !== 0" :class="$style.menuButton" @click="reduceFrequency">{{ $ts._ad.reduceFrequencyOfThisAd }}</MkButton> <MkButton v-if="chosen.ratio !== 0" :class="$style.menuButton" @click="reduceFrequency">{{ $ts._ad.reduceFrequencyOfThisAd }}</MkButton>
<MkButton v-if="$i && $i.policies.canHideAds" :class="$style.menuButton" @click="hide">{{ $ts._ad.hide }}</MkButton>
<button class="_textButton" @click="toggleMenu">{{ $ts._ad.back }}</button> <button class="_textButton" @click="toggleMenu">{{ $ts._ad.back }}</button>
</div> </div>
</div> </div>
@ -83,7 +82,7 @@ const choseAd = (): Ad | null => {
}; };
const chosen = ref(choseAd()); const chosen = ref(choseAd());
let shouldHide = $ref(chosen.value && $i && $i.policies.canHideAds && defaultStore.state.hiddenAds.includes(chosen.value.id)); const shouldHide = $ref($i && $i.policies.canHideAds);
function reduceFrequency(): void { function reduceFrequency(): void {
if (chosen.value == null) return; if (chosen.value == null) return;
@ -93,13 +92,6 @@ function reduceFrequency(): void {
chosen.value = choseAd(); chosen.value = choseAd();
showMenu.value = false; showMenu.value = false;
} }
function hide() {
if (chosen.value == null) return;
defaultStore.push('hiddenAds', chosen.value.id);
os.success();
shouldHide = true;
}
</script> </script>
<style lang="scss" module> <style lang="scss" module>

View file

@ -86,10 +86,6 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'account', where: 'account',
default: [] as string[], default: [] as string[],
}, },
hiddenAds: {
where: 'account',
default: [] as string[],
},
menu: { menu: {
where: 'deviceAccount', where: 'deviceAccount',