Skip to content

fix: 战报先显示并在后台完成串流收尾#25

Merged
qiin2333 merged 2 commits into
masterfrom
fix/instant-stream-report-exit
May 11, 2026
Merged

fix: 战报先显示并在后台完成串流收尾#25
qiin2333 merged 2 commits into
masterfrom
fix/instant-stream-report-exit

Conversation

@qiin2333
Copy link
Copy Markdown
Contributor

@qiin2333 qiin2333 commented May 11, 2026

Summary

  • show the stream report immediately when disconnecting or quitting a session
  • move stream stop, game quit, and background task cleanup to background shutdown flow
  • wait for pending shutdown before leaving the report page to avoid returning too early
  • refactor duplicated exit helpers for lock-screen send and async cleanup handling

Validation

  • editor diagnostics for entry/src/main/ets/pages/StreamPage.ets passed
  • hvigorw assembleHap --mode module -p product=default --no-daemon passed

Summary by CodeRabbit

  • 重构
    • 优化了流结束时的用户界面响应速度和可靠性
    • 改进了流关闭期间的状态转换和资源管理,在生成报告时提供更好的反馈体验

Review Change Stack

- 退出串流时先显示战报,再后台停止串流和后台保活
- 退出游戏时先显示战报,再后台执行 quitGame 与锁屏等待
- 关闭战报前等待后台收尾,避免返回过早
- 抽取锁屏/等待/后台任务辅助方法,简化退出流程
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 11, 2026

Warning

Rate limit exceeded

@qiin2333 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 53 minutes and 9 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1d5c4305-7e49-404c-ad3c-27bb9a471c18

📥 Commits

Reviewing files that changed from the base of the PR and between 1eba2df and cec4376.

📒 Files selected for processing (1)
  • entry/src/main/ets/pages/StreamPage.ets
📝 Walkthrough

概览

StreamPage 的流关闭逻辑被重构为解耦UI回收与后台停止/退出工作。新增待机状态追踪防止重复调用,报告启用时立即恢复UI控制权,实际停止工作在后台并发执行。

变更

流关闭流程解耦重构

Layer / File(s) 摘要
关闭状态管理
entry/src/main/ets/pages/StreamPage.ets
添加 pendingStreamShutdownpendingStreamShutdownLabel 字段追踪进行中的关闭,序列化并发流程。
UI控制权恢复
entry/src/main/ets/pages/StreamPage.ets
prepareStreamEndUiImmediate() 立即取消USB提示、重置输入、停止鼠标拦截、恢复指针;prepareStreamEndUi() 增加背景清理。
后台执行和等待机制
entry/src/main/ets/pages/StreamPage.ets
runStreamShutdownInBackground() 异步执行关闭并清除状态;runDetachedAsyncTask() 提供通用异步火忘助手;waitForPendingStreamShutdown() 显示进度并等待。
报告关闭流程集成
entry/src/main/ets/pages/StreamPage.ets
closeStreamReportAndReturn() 在返回前等待待机关闭完成,确保同步。
主要关闭流程
entry/src/main/ets/pages/StreamPage.ets
stopStreaming()quitGameAndReturn() 重构为守卫待机状态,立即恢复UI,报告启用时后台运行,禁用时火忘后台任务。

审查工作量估计

🎯 4 (复杂) | ⏱️ ~50 分钟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确总结了主要变更:将战报显示改为立即显示,并将串流收尾操作移至后台执行。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/instant-stream-report-exit

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
entry/src/main/ets/pages/StreamPage.ets (1)

767-772: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

断开/退游前先关闭菜单对话框。

现在这两个回调直接进入“先显示战报”的流程,但没有先关掉 gameMenuDialogController。页面不再立刻离开后,菜单可能继续压在战报上层,挡住点击。

♻️ 建议修改
      onDisconnect: () => {
+        this.gameMenuDialogController?.close();
        this.stopStreaming();
      },
      onQuitGame: () => {
+        this.gameMenuDialogController?.close();
        this.quitGameAndReturn();
      },
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@entry/src/main/ets/pages/StreamPage.ets` around lines 767 - 772, 在
onDisconnect 和 onQuitGame 回调里,在执行 stopStreaming() / quitGameAndReturn()
之前先关闭菜单对话框:调用页面上的 gameMenuDialogController 的关闭方法(例如
close()/dismiss()/closeDialog(),取决于该控制器实现),确保在调用 this.stopStreaming() 和
this.quitGameAndReturn() 之前等待或同步执行关闭操作以避免菜单仍然覆盖战报或阻挡点击。
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@entry/src/main/ets/pages/StreamPage.ets`:
- Around line 1454-1458: closeStreamReportAndReturn currently can be entered
concurrently from onBackPress and StreamSessionReport.onClose, causing multiple
router.back() calls; add a one-time guard boolean (e.g.
this.isClosingStreamReport) checked at the start of closeStreamReportAndReturn
and set to true immediately so subsequent calls return early, and only clear the
flag if the exit fails (or leave it true if navigation succeeds) to ensure
router.back() is invoked exactly once; update closeStreamReportAndReturn and any
call sites (onBackPress, StreamSessionReport.onClose) to rely on this guard.

---

Outside diff comments:
In `@entry/src/main/ets/pages/StreamPage.ets`:
- Around line 767-772: 在 onDisconnect 和 onQuitGame 回调里,在执行 stopStreaming() /
quitGameAndReturn() 之前先关闭菜单对话框:调用页面上的 gameMenuDialogController 的关闭方法(例如
close()/dismiss()/closeDialog(),取决于该控制器实现),确保在调用 this.stopStreaming() 和
this.quitGameAndReturn() 之前等待或同步执行关闭操作以避免菜单仍然覆盖战报或阻挡点击。
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 05cf455d-d706-4993-b38c-c92c032f4461

📥 Commits

Reviewing files that changed from the base of the PR and between 213d6d2 and 1eba2df.

📒 Files selected for processing (1)
  • entry/src/main/ets/pages/StreamPage.ets

Comment thread entry/src/main/ets/pages/StreamPage.ets
@qiin2333 qiin2333 merged commit 41a1c0a into master May 11, 2026
2 checks passed
@qiin2333 qiin2333 deleted the fix/instant-stream-report-exit branch May 11, 2026 07:49
qiin2333 added a commit that referenced this pull request May 12, 2026
补 v770 changelog 中遗漏的 PR #24 (手柄提示与体感) 和 PR #25 (战报退出
顺序) 优化,以及 PR #26 中自定义按键剪贴板权限门控的用户感知改动。
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.

1 participant