mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-14 21:02:49 +00:00
perf: 优化客户端升级
This commit is contained in:
parent
a09f2038ee
commit
b78d92b387
13
electron/electron.js
vendored
13
electron/electron.js
vendored
@ -187,7 +187,7 @@ function createMainWindow() {
|
|||||||
/**
|
/**
|
||||||
* 创建更新程序子进程
|
* 创建更新程序子进程
|
||||||
*/
|
*/
|
||||||
function createUpdaterWindow(loadingTip) {
|
function createUpdaterWindow(updateTitle) {
|
||||||
// 检查平台是否支持
|
// 检查平台是否支持
|
||||||
if (!['darwin', 'win32'].includes(process.platform)) {
|
if (!['darwin', 'win32'].includes(process.platform)) {
|
||||||
return;
|
return;
|
||||||
@ -228,7 +228,7 @@ function createUpdaterWindow(loadingTip) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 创建锁文件
|
// 创建锁文件
|
||||||
fs.writeFileSync(updaterLockFile, loadingTip || '');
|
fs.writeFileSync(updaterLockFile, Date.now().toString());
|
||||||
|
|
||||||
// 启动子进程,传入锁文件路径作为第一个参数
|
// 启动子进程,传入锁文件路径作为第一个参数
|
||||||
const child = spawn(updaterPath, [updaterLockFile], {
|
const child = spawn(updaterPath, [updaterLockFile], {
|
||||||
@ -238,7 +238,7 @@ function createUpdaterWindow(loadingTip) {
|
|||||||
env: {
|
env: {
|
||||||
...process.env,
|
...process.env,
|
||||||
ELECTRON_RUN_AS_NODE: '1',
|
ELECTRON_RUN_AS_NODE: '1',
|
||||||
UPDATER_LOCK_FILE: updaterLockFile
|
UPDATER_TITLE: updateTitle || ''
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1304,12 +1304,15 @@ ipcMain.on('updateQuitAndInstall', (event, args) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// 启动更新子窗口
|
// 启动更新子窗口
|
||||||
createUpdaterWindow(args.loadingTip)
|
createUpdaterWindow(args.updateTitle)
|
||||||
|
|
||||||
|
// 隐藏主窗口
|
||||||
|
mainWindow.hide()
|
||||||
|
|
||||||
// 退出并安装更新
|
// 退出并安装更新
|
||||||
setTimeout(_ => {
|
setTimeout(_ => {
|
||||||
autoUpdater.quitAndInstall(true, true)
|
autoUpdater.quitAndInstall(true, true)
|
||||||
}, 1000)
|
}, 300)
|
||||||
})
|
})
|
||||||
|
|
||||||
//================================================================
|
//================================================================
|
||||||
|
|||||||
@ -219,7 +219,7 @@ export default {
|
|||||||
this.updateIng = true
|
this.updateIng = true
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.$Electron.sendMessage('updateQuitAndInstall', {
|
this.$Electron.sendMessage('updateQuitAndInstall', {
|
||||||
loadingTip: this.$L('正在安装更新,请稍候...')
|
updateTitle: this.$L('正在安装更新,请稍候...')
|
||||||
})
|
})
|
||||||
}, 301)
|
}, 301)
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user