Skip to content

Commit

Permalink
Merge pull request #1455 from agalwood/hotfix/auto_update_20230427
Browse files Browse the repository at this point in the history
fix: app auto update failed
  • Loading branch information
agalwood authored Apr 27, 2023
2 parents 7e927fe + 71f4eee commit 77850da
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app-update.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
provider: generic
url: 'https://dl.motrix.app/release/'
url: 'https://dl.motrix.app/releases/'
2 changes: 1 addition & 1 deletion electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
"publish": [
{
"provider": "generic",
"url": "https://dl.motrix.app/release/"
"url": "https://dl.motrix.app/releases/"
},
{
"provider": "github"
Expand Down
7 changes: 7 additions & 0 deletions src/main/Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,13 @@ export default class Application extends EventEmitter {
win.setProgressBar(0)
})

this.updateManager.on('update-cancelled', (event) => {
this.menuManager.updateMenuItemEnabledState('app.check-for-updates', true)
this.trayManager.updateMenuItemEnabledState('app.check-for-updates', true)
const win = this.windowManager.getWindow('index')
win.setProgressBar(-1)
})

this.updateManager.on('will-updated', async (event) => {
this.windowManager.setWillQuit(true)
await this.stopAllSettled()
Expand Down
2 changes: 2 additions & 0 deletions src/main/core/UpdateManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ export default class UpdateManager extends EventEmitter {
}).then(({ response }) => {
if (response === 0) {
this.updater.downloadUpdate()
} else {
this.emit('update-cancelled', info)
}
})
}
Expand Down

0 comments on commit 77850da

Please sign in to comment.