mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-04-26 09:20:18 +08:00
新增更新中心模块,支持管理 APM 和传统 deb 软件更新任务 - 添加更新任务队列管理、状态跟踪和日志记录功能 - 实现更新项忽略配置持久化存储 - 新增更新确认对话框和迁移提示 - 优化主窗口关闭时的任务保护机制 - 添加单元测试覆盖核心逻辑
16 lines
501 B
TypeScript
16 lines
501 B
TypeScript
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";
|