fix: added warning for manual download on failed auto updates, simplified window lifecycle

This commit is contained in:
kangfenmao 2025-01-20 13:56:25 +08:00
parent a6833d5994
commit 713d6dba8f
2 changed files with 13 additions and 18 deletions

View File

@ -87,3 +87,4 @@ releaseInfo:
Gemini 安全设置更新 @magicdmer
智能体页面性能优化 @magicdmer
修复 WebDAV 不能自动备份问题
⚠️ 如果不能自动更新,请手动下载安装包

View File

@ -14,7 +14,6 @@ export class WindowService {
private static instance: WindowService | null = null
private mainWindow: BrowserWindow | null = null
private miniWindow: BrowserWindow | null = null
private isQuitting: boolean = false
private wasFullScreen: boolean = false
private selectionMenuWindow: BrowserWindow | null = null
private lastSelectedText: string = ''
@ -199,30 +198,25 @@ export class WindowService {
}
private setupWindowLifecycleEvents(mainWindow: BrowserWindow) {
// 监听应用退出事件
app.on('before-quit', () => {
this.isQuitting = true
})
mainWindow.on('close', (event) => {
const notInTray = !configManager.getTray()
// 如果已经触发退出,直接退出
if (app.isQuitting) {
return app.quit()
}
// Windows and Linux
// 没有开启托盘且是Windows或Linux系统直接退出
const notInTray = !configManager.getTray()
if ((isWin || isLinux) && notInTray) {
return app.quit()
}
// Mac
if (!this.isQuitting) {
if (this.wasFullScreen) {
// 如果是全屏状态,直接退出
this.isQuitting = true
app.quit()
} else {
event.preventDefault()
mainWindow.hide()
}
// 如果是全屏状态,直接退出
if (this.wasFullScreen) {
return app.quit()
}
event.preventDefault()
mainWindow.hide()
})
}