fix app update

This commit is contained in:
SrGooglo 2024-01-25 23:36:42 +01:00
parent d50ef87a5f
commit abc65e6baa
3 changed files with 17 additions and 16 deletions

View File

@ -193,7 +193,7 @@ class ElectronApp {
for (const key in this.events) {
ipcMain.on(key, this.events[key])
}
app.on("second-instance", this.handleOnSecondInstance)
app.on("open-url", (event, url) => {
@ -240,25 +240,25 @@ class ElectronApp {
}
}
autoUpdater.on("update-available", (ev, info) => {
console.log(info)
})
autoUpdater.on("error", (ev, err) => {
console.error(err)
})
autoUpdater.on("update-downloaded", (ev, info) => {
console.log(info)
sendToRender("update-available", info)
})
await GoogleDriveAPI.init()
await this.createWindow()
if (!isDev) {
autoUpdater.on("update-available", (ev, info) => {
console.log(info)
})
autoUpdater.on("error", (ev, err) => {
console.error(err)
})
autoUpdater.on("update-downloaded", (ev, info) => {
console.log(info)
sendToRender("app:update_available", info)
})
await autoUpdater.checkForUpdates()
}
}

View File

@ -79,7 +79,7 @@ class App extends React.Component {
"new:message": (event, data) => {
antd.message[data.type || "info"](data.message)
},
"update-available": (event, data) => {
"app:update_available": (event, data) => {
this.onUpdateAvailable(data)
},
"pkg:update_available": (event, data) => {

View File

@ -29,6 +29,7 @@ const Header = (props) => {
size="small"
icon={<Icons.MdDownload />}
onClick={app.applyUpdate}
type="primary"
>
Update now
</antd.Button>