feat: 全局规则自动禁用

This commit is contained in:
lisonge
2023-12-25 17:39:27 +08:00
parent 795102ad68
commit 2985909726
4 changed files with 88 additions and 64 deletions

View File

@@ -1,5 +1,22 @@
import apps from './rawApps';
import type { RawGlobalGroup } from './types';
const diabledAppIds = [
'com.android.systemui',
'com.miui.aod',
'com.miui.home',
'com.android.launcher.Launcher',
'com.bbk.launcher2.Launcher',
'com.huawei.android.launcher.unihome.UniHomeLauncher',
];
// 如果应用规则已有开屏广告一类的规则, 则在全局规则禁用此应用
diabledAppIds.push(
...apps
.filter((a) => a.groups.some((g) => g.name.startsWith('开屏广告')))
.map((a) => a.id),
);
const globalGroups: RawGlobalGroup[] = [
{
key: 0,
@@ -23,20 +40,7 @@ const globalGroups: RawGlobalGroup[] = [
action: 'clickCenter',
},
],
apps: [
{
id: 'com.android.systemui',
enable: false,
},
{
id: 'com.miui.aod',
enable: false,
},
{
id: 'com.miui.home',
enable: false,
},
],
apps: diabledAppIds.map((id) => ({ id, enable: false })),
},
];
export default globalGroups;