Skip to content

Commit

Permalink
feat: 全局规则-更新提示 (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
aoguai committed Feb 6, 2024
1 parent bf2cd54 commit f429c89
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 123 deletions.
15 changes: 0 additions & 15 deletions src/apps/bin.mt.plus.ts

This file was deleted.

17 changes: 1 addition & 16 deletions src/apps/com.able.wisdomtree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { defineAppConfig } from '../types';
export default defineAppConfig({
id: 'com.able.wisdomtree',
name: '知到',
deprecatedKeys: [1],
deprecatedKeys: [1, 3],
groups: [
{
enable: false,
Expand All @@ -21,20 +21,5 @@ export default defineAppConfig({
'https://i.gkd.li/import/13695447',
],
},
{
enable: false,
key: 3,
name: '更新提示-升级提醒',
desc: '自动点击忽略。',
quickFind: true,
matchTime: 10000,
actionMaximum: 1,
resetMatch: 'app',
rules: '[text="更新"] -n [text="忽略"]',
snapshotUrls: [
'https://i.gkd.li/import/13458796',
'https://i.gkd.li/import/13797285',
],
},
],
});
18 changes: 0 additions & 18 deletions src/apps/com.android.providers.downloads.ui.ts

This file was deleted.

11 changes: 1 addition & 10 deletions src/apps/com.baidu.netdisk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { defineAppConfig } from '../types';
export default defineAppConfig({
id: 'com.baidu.netdisk',
name: '百度网盘',
deprecatedKeys: [0, 3, 10, 11],
deprecatedKeys: [0, 3, 6, 10, 11],
groups: [
{
key: 1,
Expand Down Expand Up @@ -61,15 +61,6 @@ export default defineAppConfig({
'@ImageView[id="com.baidu.netdisk:id/close_btn"] + ImageView[id="com.baidu.netdisk:id/bg_image"]',
snapshotUrls: 'https://i.gkd.li/import/12648987',
},
{
key: 6,
name: '更新提示-更新弹窗',
quickFind: true,
actionMaximum: 1,
resetMatch: 'app',
rules: '[text="立即更新"] -n [text="下次再说"]', //使用ID会导致误触(例如删除确认https://i.gkd.li/import/13069049)
snapshotUrls: 'https://i.gkd.li/import/12863984',
},
{
key: 7,
name: '通知提示-续费横幅提示',
Expand Down
12 changes: 1 addition & 11 deletions src/apps/com.taobao.idlefish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { defineAppConfig } from '../types';
export default defineAppConfig({
id: 'com.taobao.idlefish',
name: '闲鱼',
deprecatedKeys: [3],
groups: [
{
key: 1,
Expand All @@ -22,16 +23,5 @@ export default defineAppConfig({
'@Button[text="取消"] <<n FrameLayout >n TextView[text*="手机信息"]',
snapshotUrls: 'https://i.gkd.li/import/13620277',
},
{
key: 3,
name: '更新提示-更新提示',
quickFind: true,
matchTime: 10000,
actionMaximum: 1,
resetMatch: 'app',
activityIds: 'com.taobao.idlefish.maincontainer.activity.MainActivity',
rules: '[text="立即升级"] -2 [text="暂不升级"]',
snapshotUrls: 'https://i.gkd.li/import/13832272',
},
],
});
17 changes: 1 addition & 16 deletions src/apps/com.unionpay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,8 @@ import { defineAppConfig } from '../types';
export default defineAppConfig({
id: 'com.unionpay',
name: '云闪付',
deprecatedKeys: [1],
groups: [
{
key: 1,
name: '更新提示-更新弹窗',
enable: false,
matchTime: 10000,
actionMaximum: 1,
resetMatch: 'app',
quickFind: true,
activityIds: ['com.unionpay.base.UPDialog'],
rules: [
{
matches: '@[text="稍候再说"] + [text="立即更新"]',
snapshotUrls: 'https://i.gkd.li/import/12727278',
},
],
},
{
key: 2,
name: '分段广告-支付完成界面广告卡片',
Expand Down
15 changes: 0 additions & 15 deletions src/apps/com.xiaomi.account.ts

This file was deleted.

11 changes: 1 addition & 10 deletions src/apps/com.xuexiaoyi.xxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { defineAppConfig } from '../types';
export default defineAppConfig({
id: 'com.xuexiaoyi.xxy',
name: '学小易',
deprecatedKeys: [10],
groups: [
{
key: 1,
Expand Down Expand Up @@ -69,15 +70,5 @@ export default defineAppConfig({
},
],
},
{
key: 10,
name: '更新提示-升级弹窗',
desc: '自动点击以后再说。',
enable: false,
activityIds: 'com.xuexiaoyi.entrance.main.MainActivity',
quickFind: true,
rules: '[text="立即体验"] + [text="以后再说"]',
snapshotUrls: 'https://i.gkd.li/import/13203105',
},
],
});
84 changes: 72 additions & 12 deletions src/globalGroups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,71 @@ import apps from './rawApps';
import type { RawGlobalGroup } from './types';
import { OPEN_AD_ORDER } from './utils';

const diabledAppIds = [
'com.android.systemui', // 通知栏界面
const diabledAppIds: string[] = [
'com.android.systemui', // 通知栏界面/下拉开关/控制中心
'com.android.settings', // 系统设置

'com.miui.aod', // miui 锁屏界面
'miui.systemui.plugin', // miui 状态栏界面
'com.android.mms', // 短信/信息
'com.android.phone', // 拨号
'com.android.incallui', // 通话
'com.android.contacts', // 联系人/电话簿
'com.android.providers.Telephony', // 电话和短信存储
'com.android.phone.recorder', // 录音
'com.android.soundrecorder', // 录音机
'com.android.server.telecom', // 来电拒接短信服务

// 在一些常见的应用中禁用
'com.tencent.mm', // 微信
'li.songe.gkd',

// 小米系
'com.miui.aod', // miui 锁屏界面
'miui.systemui.plugin', // miui 状态栏界面
'com.miui.securityadd', // 系统服务组件

// 华为系
'com.huawei.android.launcher', // 桌面
'com.huawei.mediacontroller', // 音频播控中心

// 荣耀系
'com.hihonor.android.launcher', // 桌面

// OPPO 系
'com.oppo.launcher', // 桌面

// VIVO 系
'com.bbk.launcher2', // 桌面

// 一加系
'net.oneplus.launcher', // 桌面

// 三星系
'com.sec.android.app.launcher', // 桌面

// https://github.com/gkd-kit/gkd/issues/451
'mark.via',
'com.mycompany.app.soulbrowser',
'com.mmbox.xbrowser',
];

// 如果应用规则已有开屏广告一类的规则, 则在全局规则禁用此应用
diabledAppIds.push(
...apps
function filterAppsByGroup(apps: any[], groupNamePrefix: string): string[] {
return apps
.filter((a) =>
a.groups.some((g) => g.name.startsWith('开屏广告') && g.enable !== false),
a.groups.some(
(g: { name: string; enable: boolean }) =>
g.name.startsWith(groupNamePrefix) && g.enable !== false,
),
)
.map((a) => a.id),
);
.map((a) => a.id);
}

const uniqueAppIdsAd = new Set([
...diabledAppIds,
...filterAppsByGroup(apps, '开屏广告'),
]);
const uniqueAppIdsUp = new Set([
...diabledAppIds,
...filterAppsByGroup(apps, '更新提示'),
]);

const globalGroups: RawGlobalGroup[] = [
{
Expand All @@ -50,7 +90,27 @@ const globalGroups: RawGlobalGroup[] = [
'[childCount=0][visibleToUser=true][(text.length<10&&(text*="跳过"||text*="跳過"||text*="skip"||text*="Skip")) || id$="tt_splash_skip_btn" || vid*="skip" || vid*="Skip" || (vid*="count" && vid*="down" && vid!*="download") || desc*="跳过" || desc*="skip"]',
},
],
apps: diabledAppIds.map((id) => ({ id, enable: false })),
// 将 Set 转换为数组,并设置 enable 为 false
apps: [...uniqueAppIdsAd].map((id) => ({ id, enable: false })),
},
{
key: 1,
name: '更新提示',
order: OPEN_AD_ORDER,
actionMaximum: 2,
matchTime: 10000,
resetMatch: 'app',
actionCdKey: 0,
actionMaximumKey: 0,
rules: [
{
key: 0,
matches:
'[childCount=0][visibleToUser=true][text$="更新"||text$="升级"||text$="体验"||text$="升級"||text$="體驗"||text$="Update"||text$="Upgrade"||text$="Experience"] <n * > [childCount=0][visibleToUser=true][text$="再说"||text="忽略"||text^="暂不"||text="取消"||text$="再說"||text$="暫不"||text$="Later"||text="Ignore"||text^="Not now"||text="Cancel"]',
},
],
// 将 Set 转换为数组,并设置 enable 为 false
apps: [...uniqueAppIdsUp].map((id) => ({ id, enable: false })),
},
];
export default globalGroups;

0 comments on commit f429c89

Please sign in to comment.