Skip to content

✨ feat: 更新进度展示优化#870

Merged
imsyy merged 2 commits into
devfrom
dev-update
Feb 12, 2026
Merged

✨ feat: 更新进度展示优化#870
imsyy merged 2 commits into
devfrom
dev-update

Conversation

@imsyy
Copy link
Copy Markdown
Member

@imsyy imsyy commented Feb 11, 2026

No description provided.

Copilot AI review requested due to automatic review settings February 11, 2026 10:20
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @imsyy, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求旨在优化应用程序的更新流程和用户体验。通过将更新的下载和安装步骤解耦,并引入全局状态管理来跟踪更新进度,用户现在可以更直观地了解更新状态,并在下载完成后选择手动安装。这不仅提升了用户对更新过程的控制感,也使得更新提示和交互更加友好和清晰。

Highlights

  • 更新流程优化: 将更新下载和安装分离,用户现在可以手动触发安装,而非自动安装。
  • 全局更新状态管理: 引入 Pinia 状态管理,统一管理应用更新的可用性、下载进度和状态。
  • 导航栏更新提示: 在导航栏中添加了新的更新按钮,根据更新状态(有新版本、下载中、已下载)动态显示提示和进度。
  • 更新弹窗改进: 更新弹窗现在能更清晰地展示下载进度,并在下载完成后提供“立即安装”选项。
Changelog
  • electron/main/ipc/ipc-update.ts
    • 引入并处理了新的 installUpdate IPC 事件。
  • electron/main/update/index.ts
    • quitAndInstall 逻辑封装到独立的 installUpdate 函数中,不再自动安装更新。
  • src/components/Layout/Nav.vue
    • 添加了动态更新按钮和相关逻辑,以在导航栏显示更新状态。
  • src/components/List/CommentList.vue
    • 调整了评论列表项的背景颜色样式。
  • src/components/Modal/UpdateApp.vue
    • 重构了更新弹窗,以利用全局状态管理显示下载进度和安装选项。
  • src/stores/status.ts
    • 扩展了状态存储,新增了多个用于跟踪更新状态的属性。
  • src/utils/initIpc.ts
    • 集中处理了 Electron IPC 更新事件,并根据事件更新全局状态存储。
Activity
  • 此拉取请求没有提供任何人工活动(评论、审查)。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

该 PR 优化了 Electron 客户端的软件更新流程与进度展示:将更新状态沉淀到全局 statusStore,支持在导航栏展示“有更新/下载进度/已就绪”,并将“下载完成后自动安装”改为“用户确认后安装”。

Changes:

  • 新增全局更新状态(是否有更新、更新信息、下载中/已下载、下载进度)并由 IPC 统一维护
  • 更新弹窗改为基于全局状态展示下载进度与“立即安装”入口,移除弹窗内重复 IPC 监听
  • Electron 主进程更新逻辑从“下载完成立即安装”调整为显式 IPC 触发安装

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/utils/initIpc.ts 在渲染进程集中监听更新相关 IPC,并写入全局更新状态
src/stores/status.ts 扩展 StatusState,增加更新可用/下载状态/进度等字段
src/components/Modal/UpdateApp.vue 更新弹窗 UI:展示下载进度与“立即安装”,移除局部 IPC 监听
src/components/Layout/Nav.vue 新增“有更新”导航栏按钮与动态提示文案
electron/main/update/index.ts 下载完成不再自动安装,新增 installUpdate() 显式安装入口
electron/main/ipc/ipc-update.ts 新增 install-update IPC 通道调用 installUpdate()
src/components/List/CommentList.vue 使用 --main-cover-color 变量调整评论气泡背景色

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

const startDownload = async () => {
downloadStatus.value = true;
// 开始下载更新
const startDownload = () => {
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

startDownload() 这里只发送了 IPC,但没有立刻把 statusStore.updateDownloading 置为 true。在首个 download-progress 事件到来前按钮不会进入 loading,用户可能重复点击触发多次下载请求,且 UI 反馈会延迟。建议在发送 IPC 前先根据当前状态(已下载/下载中)做一次 guard,并在开始下载时立即更新 store 的下载中状态(必要时也可清零进度)。

Suggested change
const startDownload = () => {
const startDownload = () => {
// 已在下载中或已下载完成时直接返回,避免重复触发
if ((statusStore as any).updateDownloading || (statusStore as any).updateDownloaded) {
return;
}
// 立即更新下载中状态,让按钮立刻进入 loading 状态
(statusStore as any).updateDownloading = true;

Copilot uses AI. Check for mistakes.
Comment thread src/utils/initIpc.ts
Comment on lines 142 to +146
window.electron.ipcRenderer.on("update-available", (_, info) => {
const isManualCheck = statusStore.updateCheck;
closeUpdateStatus();
openUpdateApp(info);
statusStore.updateAvailable = true;
statusStore.updateInfo = info;
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

这里把更新信息写入 store,但在 update-not-available / update-error 分支并没有清理 updateAvailable / updateInfo / 下载状态。若之前已检测到更新,之后切换更新通道再检查且返回“无更新”,Nav 的更新按钮和旧的 updateInfo 可能会一直保留。建议把更新相关字段的重置逻辑集中到一个方法里,并在“无更新/错误”时也调用以避免状态残留。

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

本次更新对应用的更新机制进行了重构,优化了进度展示。主要改动包括:

  1. 将更新的下载与安装过程分离,让用户可以自主选择安装时机。
  2. 通过 Pinia store (statusStore) 集中管理更新状态,这是一种良好的架构实践。
  3. 在导航栏增加了更新状态的展示,并优化了更新弹窗的触发逻辑(仅在手动检查时弹出),提升了用户体验。
  4. 将 IPC 事件监听逻辑从 Vue 组件中移至全局初始化文件 initIpc.ts,使组件代码更清晰,并修复了潜在的事件监听器重复注册问题。

整体来看,这是一次很棒的改进。我只发现了一个关于下载进度显示不一致的小问题,并在代码中提出了建议。

Comment on lines +30 to +34
{{
statusStore.updateDownloading
? `下载中 ${statusStore.updateDownloadProgress}%`
: "立即更新"
}}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

下载进度的显示方式与导航栏不一致。在导航栏中(Nav.vue),进度被四舍五入为整数(例如 25%),而在此处会显示小数(例如 25.3%)。建议统一为整数,以保持 UI 的一致性和简洁性。

        {{
          statusStore.updateDownloading
            ? `下载中 ${Math.round(statusStore.updateDownloadProgress)}%`
            : "立即更新"
        }}

@imsyy
Copy link
Copy Markdown
Member Author

imsyy commented Feb 12, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

本次 PR 对应用的更新流程进行了重构和优化。主要改动包括:

  • 将更新通道(稳定版/测试版)的设置持久化到 electron-store,使得主进程可以正确读取该配置。
  • 更新检查逻辑不再通过 IPC 传递通道信息,而是直接从 store 中读取。
  • 更新下载完成后不再自动安装,而是通过前端 UI 触发,给予用户更多控制权。
  • 引入了 statusStore 来集中管理更新状态(如是否有可用更新、下载进度、是否下载完成等),并在导航栏和更新弹窗中展示这些状态,提升了用户体验。
  • 代码结构上,将更新相关的状态管理和 IPC 事件处理逻辑更加集中,提高了可维护性。

整体来看,这是一次非常棒的改进。我发现了一个小问题,请查看具体的评论。

import { isElectron } from "@/utils/env";
import { openExcludeComment } from "@/utils/modal";
import { sendRegisterProtocol } from "@/utils/protocol";
import { SettingConfig } from "@/types/settings";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

此文件中的 refcomputedh 函数被使用,但相关的 import { ref, computed, h } from 'vue' 语句被意外移除了,这会导致运行时错误。请将该导入语句加回来。

Suggested change
import { SettingConfig } from "@/types/settings";
import { SettingConfig } from "@/types/settings";
import { ref, computed, h } from "vue";

@imsyy imsyy merged commit 812e39c into dev Feb 12, 2026
4 checks passed
@apoint123 apoint123 deleted the dev-update branch February 22, 2026 08:50
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