gkd-kit / gkd

基于无障碍,高级选择器,订阅规则的自定义屏幕点击 Android 应用 | An Android APP with custom screen tapping based on Accessibility, Advanced Selectors, and Subscription Rules
https://gkd.li
GNU General Public License v3.0
22.18k stars 1.12k forks source link

[BUG] anyMatches部分情况下不触发规则 #765

Closed AIsouler closed 4 days ago

AIsouler commented 1 week ago

日志文件

https://f.gkd.li/17629780

BUG描述(文字/截图/视频)

使用如下规则,第二个选择器可匹配上节点,但是不触发规则

{
  id: 'com.mihoyo.hyperion',
  name: '米游社',
  groups: [
    {
      key: 8,
      name: '功能类-米游自动签到测试',
      desc: '包含崩坏3、绝区零、原神、星穹铁道',
      forcedTime: 10000,
      activityIds: '.web2.MiHoYoWebActivity',
      rules: [
        {
          key: 0,
          name: '点击签到',
          anyMatches: [
            '[text$="每日签到"] >4 View[childCount=11] > @View[childCount=3][visibleToUser=true] > Image[index=0][text!=null]',
            '[text="《崩坏:星穹铁道》签到福利"] >4 View > View + TextView[visibleToUser=true]', // 星穹铁道
          ],
          exampleUrls: 'https://e.gkd.li/53d22dc7-b368-46c0-85d2-fe132b0832a9',
          snapshotUrls: [
            'https://i.gkd.li/i/17611613', // 星穹铁道签到前
            'https://i.gkd.li/i/14967627', // 签到节点 clickable=false
          ],
          excludeSnapshotUrls: [
            'https://i.gkd.li/i/17611617', // 星穹铁道签到后 无法排除匹配
          ],
        },
      ],
    },
  ],
}

anyMatches: [
  '[text$="每日签到"] >4 View[childCount=11] > @View[childCount=3][visibleToUser=true] > Image[index=0][text!=null]',
  '[text="《崩坏:星穹铁道》签到福利"] >4 View > View + TextView[visibleToUser=true]', // 星穹铁道
],

替换成以下任意一个皆可触发规则

matches: [
   '[text="《崩坏:星穹铁道》签到福利"] >4 View > View + TextView[visibleToUser=true]', // 星穹铁道
],
anyMatches: [
   '[text="《崩坏:星穹铁道》签到福利"] >4 View > View + TextView[visibleToUser=true]', // 星穹铁道
],
anyMatches: [
  '[text="《崩坏:星穹铁道》签到福利"] >4 View > View + TextView[visibleToUser=true]', // 星穹铁道
  '[text$="每日签到"] >4 View[childCount=11] > @View[childCount=3][visibleToUser=true] > Image[index=0][text!=null]',
],

期望行为(文字/截图/视频)

anyMatches匹配任意其中一个选择器

实际行为(文字/截图/视频)

anyMatches只匹配第一个选择器

lisonge commented 4 days ago

https://github.com/gkd-kit/gkd/releases