mirror of
https://github.com/ILoveBingLu/CipherTalk.git
synced 2026-05-19 19:00:26 +08:00
fix: 发布 2.3.1 更新安装修复
This commit is contained in:
@@ -70,6 +70,7 @@ let logService: LogService | null = null
|
||||
|
||||
// 系统托盘实例
|
||||
let tray: Tray | null = null
|
||||
let isInstallingUpdate = false
|
||||
|
||||
// 聊天窗口实例
|
||||
let chatWindow: BrowserWindow | null = null
|
||||
@@ -221,6 +222,11 @@ function createWindow() {
|
||||
return
|
||||
}
|
||||
|
||||
if (isInstallingUpdate) {
|
||||
app.isQuitting = true
|
||||
return
|
||||
}
|
||||
|
||||
// 如果是真正退出应用,不阻止
|
||||
if (app.isQuitting) {
|
||||
return
|
||||
@@ -1325,6 +1331,7 @@ function registerIpcHandlers() {
|
||||
|
||||
ipcMain.handle('app:downloadAndInstall', async (event) => {
|
||||
const win = BrowserWindow.fromWebContents(event.sender)
|
||||
isInstallingUpdate = true
|
||||
|
||||
// 监听下载进度
|
||||
autoUpdater.on('download-progress', (progress) => {
|
||||
@@ -1333,12 +1340,14 @@ function registerIpcHandlers() {
|
||||
|
||||
// 下载完成后自动安装
|
||||
autoUpdater.on('update-downloaded', () => {
|
||||
app.isQuitting = true
|
||||
autoUpdater.quitAndInstall(false, true)
|
||||
})
|
||||
|
||||
try {
|
||||
await autoUpdater.downloadUpdate()
|
||||
} catch (error) {
|
||||
isInstallingUpdate = false
|
||||
console.error('下载更新失败:', error)
|
||||
throw error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user