mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-04-26 09:20:18 +08:00
feat(update-center): 实现集中式软件更新中心功能
新增更新中心模块,支持管理 APM 和传统 deb 软件更新任务 - 添加更新任务队列管理、状态跟踪和日志记录功能 - 实现更新项忽略配置持久化存储 - 新增更新确认对话框和迁移提示 - 优化主窗口关闭时的任务保护机制 - 添加单元测试覆盖核心逻辑
This commit is contained in:
15
electron/main/window-close-guard.ts
Normal file
15
electron/main/window-close-guard.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
export interface MainWindowCloseGuardState {
|
||||
installTaskCount: number;
|
||||
hasRunningUpdateCenterTasks: boolean;
|
||||
}
|
||||
|
||||
export type MainWindowCloseAction = "hide" | "destroy";
|
||||
|
||||
export const shouldPreventMainWindowClose = (
|
||||
state: MainWindowCloseGuardState,
|
||||
): boolean => state.installTaskCount > 0 || state.hasRunningUpdateCenterTasks;
|
||||
|
||||
export const getMainWindowCloseAction = (
|
||||
state: MainWindowCloseGuardState,
|
||||
): MainWindowCloseAction =>
|
||||
shouldPreventMainWindowClose(state) ? "hide" : "destroy";
|
||||
Reference in New Issue
Block a user