Skip to content

fix(WithdrawMoney): 修复快速连续点击导致异常滑动#278

Merged
1bananachicken merged 1 commit into
1bananachicken:devfrom
EeeMaoY:fix/withdraw-money
Jun 5, 2026
Merged

fix(WithdrawMoney): 修复快速连续点击导致异常滑动#278
1bananachicken merged 1 commit into
1bananachicken:devfrom
EeeMaoY:fix/withdraw-money

Conversation

@EeeMaoY
Copy link
Copy Markdown
Collaborator

@EeeMaoY EeeMaoY commented Jun 3, 2026

close #274

Summary by Sourcery

改进 WithdrawMoney 项目的选择逻辑,以避免在快速连续点击时出现错误滚动,并调整基于识别的项目收集方式。

Bug Fixes(错误修复):

  • 通过在执行点击操作前移动触摸点并添加短暂延迟,防止在快速点击时产生非预期的滑动手势。

Enhancements(增强改进):

  • 通过为上下位置分别使用不同的识别器来优化产品值的收集,并通过对合并结果进行排序来简化去重逻辑。
  • 在点击已选中项目时添加调试日志,以协助排查 WithdrawMoney 交互中的问题。
Original summary in English

Summary by Sourcery

Improve WithdrawMoney item selection to avoid erroneous scrolling on quick consecutive taps and adjust recognition-based item collection.

Bug Fixes:

  • Prevent unintended swipe gestures during rapid taps by moving the touch point before performing click actions and adding brief delays.

Enhancements:

  • Refine product value collection by using distinct recognizers for up/down positions and simplify de-duplication logic by sorting combined results.
  • Add debug logging when clicking selected items to aid troubleshooting of WithdrawMoney interactions.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Jun 3, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

优化 WithdrawMoney 条目选择逻辑,以避免在快速点击时出现非预期滑动;将向上/向下条目的识别逻辑分离;简化数值聚合逻辑;并为点击行为增加日志记录,同时更新相关的 pipeline JSON 配置。

WithdrawMoney 中 click_rect 更新后点击处理的时序图

sequenceDiagram
    actor User
    participant WithdrawMoneyChooseItem as WithdrawMoneyChooseItem
    participant controller as Controller

    User ->> WithdrawMoneyChooseItem: select_item
    WithdrawMoneyChooseItem ->> controller: post_touch_move(cx, cy)
    controller -->> WithdrawMoneyChooseItem: wait()
    WithdrawMoneyChooseItem ->> controller: post_touch_down(cx, cy)
    controller -->> WithdrawMoneyChooseItem: wait()
    WithdrawMoneyChooseItem ->> WithdrawMoneyChooseItem: time_sleep_0_05
    WithdrawMoneyChooseItem ->> controller: post_touch_up()
    controller -->> WithdrawMoneyChooseItem: wait()
    WithdrawMoneyChooseItem ->> WithdrawMoneyChooseItem: time_sleep_0_05
    WithdrawMoneyChooseItem ->> logger: debug(click value rect item_swipe)
Loading

WithdrawMoney 中更新后向上/向下条目选择流程图

flowchart TD
    A[Start WithdrawMoneyChooseItem] --> B[click_all_grey_backgrounds]
    B --> C[time_sleep_1]
    C --> D[collect_product_values WithdrawMoneyItemValueDown]
    D --> E["down_items = (value, rect, down)"]
    E --> F[run_act WithdrawMoneySwipeUp]
    F --> G[time_sleep_0_1]
    G --> H[collect_product_values WithdrawMoneyItemValueUp]
    H --> I["up_items = (value, rect, up)"]
    I --> J["all_items = down_items + up_items"]
    J --> K["sorted_items = sorted_by_value_desc"]
    K --> L["top5 = first_5"]
    L --> M["for each (value, rect, item_swipe) in top5"]
    M --> N{item_swipe != current_swipe}
    N -- Yes --> O[run_act WithdrawMoneySwipeUp_or_Down]
    O --> P[time_sleep_1]
    N -- No --> P
    P --> Q[_click_rect rect]
    Q --> R[logger debug]
    R --> S[time_sleep_0_5]
    S --> T[End]
Loading

File-Level Changes

Change Details Files
防止在点击条目矩形时产生非预期的滑动手势,并轻微提升点击稳定性。
  • touch_down 之前,先对目标中心点执行一次预点击的 touch_move,以稳定手势并避免被识别为滑动。
  • touch_up 之后增加一个短暂的延时睡眠,以降低快速连续点击时的不稳定性。
agent/custom/action/withdraw_money_choose_item.py
调整上下列表的商品数值识别与选择流程,并提升可观测性。
  • 将数值收集辅助函数泛化为接受识别名称,而不是使用固定的识别器。
  • 为位于下方和上方的条目引入不同的识别器,并分别构建带有滑动方向标记的 down_itemsup_items 列表。
  • 移除之前基于坐标和数值的去重逻辑,改为仅按数值从高到低对所有候选项排序,并选取前五个。
  • 缩短向上滑动动作后的延时,使其更贴合动画时长,并为每个被点击的条目增加调试日志,记录其数值、rect 和滑动方向。
agent/custom/action/withdraw_money_choose_item.py
更新 WithdrawMoney pipeline 配置,以匹配修订后的识别与交互行为。
  • 调整 WithdrawMoney pipeline JSON,以支持新的上下条目识别与交互流程。
  • 更新 WithdrawMoneyStatus pipeline JSON,使其与修改后的 WithdrawMoney 行为保持一致。
assets/resource/base/pipeline/WithdrawMoney/WithdrawMoney.json
assets/resource/base/pipeline/WithdrawMoney/WithdrawMoneyStatus.json

Assessment against linked issues

Issue Objective Addressed Explanation
#274 修复在领取收益流程中替换商品时,点击原有商品会导致界面异常滑动的问题。

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • 触发新的代码审查: 在 pull request 上评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审查评论。
  • 从审查评论生成 GitHub Issue: 在某条审查评论下回复,请求 Sourcery 基于该评论创建 issue。你也可以直接回复 @sourcery-ai issue 来从该评论创建 issue。
  • 生成 pull request 标题: 在 pull request 标题中任意位置写上 @sourcery-ai,即可随时生成标题。你也可以在 pull request 中评论 @sourcery-ai title 来(重新)生成标题。
  • 生成 pull request 摘要: 在 pull request 正文任意位置写上 @sourcery-ai summary,即可在对应位置生成 PR 摘要。你也可以在 pull request 中评论 @sourcery-ai summary 来随时(重新)生成摘要。
  • 生成审查者指南: 在 pull request 中评论 @sourcery-ai guide,即可随时(重新)生成审查者指南。
  • 一次性解决所有 Sourcery 评论: 在 pull request 中评论 @sourcery-ai resolve,即可标记所有 Sourcery 评论为已解决。适用于你已经处理完所有评论且不想再看到它们的情况。
  • 一次性忽略所有 Sourcery 审查: 在 pull request 中评论 @sourcery-ai dismiss,即可忽略所有现有的 Sourcery 审查记录。特别适用于你想从一次全新的审查开始——别忘了再评论 @sourcery-ai review 来触发新的审查!

Customizing Your Experience

访问你的 dashboard 以:

  • 启用或禁用审查功能,例如 Sourcery 自动生成的 pull request 摘要、审查者指南等。
  • 更改审查语言。
  • 添加、移除或编辑自定义审查指令。
  • 调整其他审查设置。

Getting Help

Original review guide in English
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Refines the WithdrawMoney item selection logic to avoid unintended swipes on rapid taps, separates up/down item recognition, simplifies value aggregation, and adds logging for tap actions, with associated pipeline JSON updates.

Sequence diagram for updated tap handling in WithdrawMoney click_rect

sequenceDiagram
    actor User
    participant WithdrawMoneyChooseItem as WithdrawMoneyChooseItem
    participant controller as Controller

    User ->> WithdrawMoneyChooseItem: select_item
    WithdrawMoneyChooseItem ->> controller: post_touch_move(cx, cy)
    controller -->> WithdrawMoneyChooseItem: wait()
    WithdrawMoneyChooseItem ->> controller: post_touch_down(cx, cy)
    controller -->> WithdrawMoneyChooseItem: wait()
    WithdrawMoneyChooseItem ->> WithdrawMoneyChooseItem: time_sleep_0_05
    WithdrawMoneyChooseItem ->> controller: post_touch_up()
    controller -->> WithdrawMoneyChooseItem: wait()
    WithdrawMoneyChooseItem ->> WithdrawMoneyChooseItem: time_sleep_0_05
    WithdrawMoneyChooseItem ->> logger: debug(click value rect item_swipe)
Loading

Flow diagram for updated up/down item selection in WithdrawMoney

flowchart TD
    A[Start WithdrawMoneyChooseItem] --> B[click_all_grey_backgrounds]
    B --> C[time_sleep_1]
    C --> D[collect_product_values WithdrawMoneyItemValueDown]
    D --> E["down_items = (value, rect, down)"]
    E --> F[run_act WithdrawMoneySwipeUp]
    F --> G[time_sleep_0_1]
    G --> H[collect_product_values WithdrawMoneyItemValueUp]
    H --> I["up_items = (value, rect, up)"]
    I --> J["all_items = down_items + up_items"]
    J --> K["sorted_items = sorted_by_value_desc"]
    K --> L["top5 = first_5"]
    L --> M["for each (value, rect, item_swipe) in top5"]
    M --> N{item_swipe != current_swipe}
    N -- Yes --> O[run_act WithdrawMoneySwipeUp_or_Down]
    O --> P[time_sleep_1]
    N -- No --> P
    P --> Q[_click_rect rect]
    Q --> R[logger debug]
    R --> S[time_sleep_0_5]
    S --> T[End]
Loading

File-Level Changes

Change Details Files
Prevent unintended swipe gestures when clicking item rectangles and slightly increase tap stability.
  • Add a pre-click touch_move to the target center point before touch_down to stabilize the gesture and avoid being interpreted as a swipe.
  • Add a small post-click sleep delay after touch_up to reduce flakiness on rapid consecutive taps.
agent/custom/action/withdraw_money_choose_item.py
Adjust product-value recognition and selection flow for up/down lists and improve observability.
  • Generalize the value collection helper to accept a recognition name instead of using a fixed recognizer.
  • Introduce distinct recognizers for items in down and up positions and build separate down_items and up_items lists with swipe direction annotations.
  • Remove the previous coordinate- and value-based de-duplication logic and instead sort all candidates purely by value descending, then select the top five.
  • Shorten the delay after the swipe-up action to better match animation timing and add debug logging for each clicked item with its value, rect, and swipe direction.
agent/custom/action/withdraw_money_choose_item.py
Update WithdrawMoney pipeline configuration to align with the revised recognition/interaction behavior.
  • Adjust WithdrawMoney pipeline JSON to support the new up/down item recognition and interaction flow.
  • Update WithdrawMoneyStatus pipeline JSON to stay consistent with the modified WithdrawMoney behavior.
assets/resource/base/pipeline/WithdrawMoney/WithdrawMoney.json
assets/resource/base/pipeline/WithdrawMoney/WithdrawMoneyStatus.json

Assessment against linked issues

Issue Objective Addressed Explanation
#274 修复在领取收益流程中替换商品时,点击原有商品会导致界面异常滑动的问题。

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - 我在这里给出一些总体反馈:

  • 从基于值去重改成简单地拼接 down_itemsup_items 之后,具有相同数值但位置不同的同一条目现在可能会被点击两次;如果这不是预期行为,建议在排序之前重新引入一个基于位置或数值的去重步骤。
  • WithdrawMoneySwipeUp 之后的 0.1 秒 sleep 对于 UI 动画来说看起来有点紧;如果需要兼容多种设备或帧率,可能值得把这个延迟做成可配置,或者稍微加长一些,以避免间歇性的识别问题。
  • _click_rect 中新增的时间常量(两个 0.05 秒的 sleep)目前属于“魔法数字”;可以考虑把它们提取成具名常量,或者加一条简短注释说明这些数值是如何选取的,以便日后更容易调优。
面向 AI 代理的提示
Please address the comments from this code review:

## Overall Comments
- 从基于值去重改成简单地拼接 `down_items``up_items` 之后,具有相同数值但位置不同的同一条目现在可能会被点击两次;如果这不是预期行为,建议在排序之前重新引入一个基于位置或数值的去重步骤。
- `WithdrawMoneySwipeUp` 之后的 0.1 秒 sleep 对于 UI 动画来说看起来有点紧;如果需要兼容多种设备或帧率,可能值得把这个延迟做成可配置,或者稍微加长一些,以避免间歇性的识别问题。
- `_click_rect` 中新增的时间常量(两个 0.05 秒的 sleep)目前属于“魔法数字”;可以考虑把它们提取成具名常量,或者加一条简短注释说明这些数值是如何选取的,以便日后更容易调优。

Sourcery 对开源项目免费——如果你觉得我们的评审有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据这些反馈改进后续的评审。
Original comment in English

Hey - I've left some high level feedback:

  • By switching from value-based de-duplication to simply concatenating down_items and up_items, the same item with identical value and different positions may now be clicked twice; if that’s unintended, consider reintroducing a positional or value-based de-duplication step before sorting.
  • The 0.1-second sleep after WithdrawMoneySwipeUp looks quite tight for UI animations; if you’re targeting a variety of devices or frame rates, it may be worth making this delay configurable or slightly longer to avoid intermittent recognition issues.
  • The new timing constants in _click_rect (two 0.05-second sleeps) are currently “magic numbers”; consider extracting them into named constants or adding a brief comment explaining how they were chosen to make future tuning easier.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- By switching from value-based de-duplication to simply concatenating `down_items` and `up_items`, the same item with identical value and different positions may now be clicked twice; if that’s unintended, consider reintroducing a positional or value-based de-duplication step before sorting.
- The 0.1-second sleep after `WithdrawMoneySwipeUp` looks quite tight for UI animations; if you’re targeting a variety of devices or frame rates, it may be worth making this delay configurable or slightly longer to avoid intermittent recognition issues.
- The new timing constants in `_click_rect` (two 0.05-second sleeps) are currently “magic numbers”; consider extracting them into named constants or adding a brief comment explaining how they were chosen to make future tuning easier.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@1bananachicken 1bananachicken merged commit 5b1d65e into 1bananachicken:dev Jun 5, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

领取收益替换商品时,点击原有商品异常滑动

2 participants