Skip to content

Commit

Permalink
fix: app update fails when opening quick ask (janhq#2467)
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-jan authored Mar 22, 2024
1 parent 419683d commit 36405fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion electron/handlers/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function handleAppUpdates() {
message: 'Would you like to download and install it now?',
buttons: ['Download', 'Later'],
})
trayManager.destroyCurrentTray()

if (action.response === 0) await autoUpdater.downloadUpdate()
})

Expand All @@ -38,6 +38,7 @@ export function handleAppUpdates() {
buttons: ['Restart', 'Later'],
})
if (action.response === 0) {
trayManager.destroyCurrentTray()
waitingToInstallVersion = _info?.version
autoUpdater.quitAndInstall()
}
Expand Down
4 changes: 2 additions & 2 deletions electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { getAppConfigurations, log } from '@janhq/core/node'
* IPC Handlers
**/
import { injectHandler } from './handlers/common'
import { handleAppUpdates } from './handlers/update'
import { handleAppUpdates, waitingToInstallVersion } from './handlers/update'
import { handleAppIPCs } from './handlers/native'

/**
Expand Down Expand Up @@ -96,7 +96,7 @@ app.once('quit', () => {

app.once('window-all-closed', () => {
// Feature Toggle for Quick Ask
if (getAppConfigurations().quick_ask) return
if (getAppConfigurations().quick_ask && !waitingToInstallVersion) return
cleanUpAndQuit()
})

Expand Down

0 comments on commit 36405fe

Please sign in to comment.