mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-12-17 20:46:59 +01:00
Block notifications
This commit is contained in:
@@ -5,6 +5,7 @@ import { Toast } from "./toast";
|
||||
import { PrefKey } from "@/enums/pref-keys";
|
||||
import { getPref, setPref } from "./settings-storages/global-settings-storage";
|
||||
import { LocalDb } from "./local-db/local-db";
|
||||
import { BlockFeature } from "@/enums/pref-values";
|
||||
|
||||
/**
|
||||
* Check for update
|
||||
@@ -155,3 +156,19 @@ export function clearAllData() {
|
||||
|
||||
alert(t('clear-data-success'));
|
||||
}
|
||||
|
||||
export function blockAllNotifications() {
|
||||
const blockFeatures = getPref<BlockFeature[]>(PrefKey.BLOCK_FEATURES);
|
||||
const blockAll = [BlockFeature.FRIENDS, BlockFeature.NOTIFICATIONS_ACHIEVEMENTS, BlockFeature.NOTIFICATIONS_INVITES].every(value => blockFeatures.includes(value));
|
||||
return blockAll;
|
||||
}
|
||||
|
||||
export function blockSomeNotifications() {
|
||||
const blockFeatures = getPref<BlockFeature[]>(PrefKey.BLOCK_FEATURES);
|
||||
if (blockAllNotifications()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const blockSome = [BlockFeature.FRIENDS, BlockFeature.NOTIFICATIONS_ACHIEVEMENTS, BlockFeature.NOTIFICATIONS_INVITES].some(value => blockFeatures.includes(value));
|
||||
return blockSome;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user