Skip to content

Commit

Permalink
[UX] Improve update Dialog (#3598)
Browse files Browse the repository at this point in the history
* Fix changelog button

* Fix changelog button

* update_package_json
  • Loading branch information
Mariaboni authored Mar 6, 2024
1 parent 4c0aba6 commit cada766
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
4 changes: 3 additions & 1 deletion public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"message": "Heroic cache cleared.",
"title": "Cache cleared"
},
"changelog": "Changelog",
"choose": "Choose",
"choose-egs-prefix": "Choose Prefix where EGS is installed",
"choose-gogdl-binary": "Select GOGDL Binary (needs restart)",
Expand Down Expand Up @@ -83,7 +84,6 @@
},
"info": {
"update": {
"changelog": "Open changelog",
"detail": "Do you want to download the update in the background?",
"message": "There is a new Version available!",
"message-finished": "Do you want to restart Heroic now?",
Expand All @@ -93,6 +93,7 @@
},
"no": "NO",
"ok": "OK",
"postpone": "Postpone",
"protocol": {
"install": {
"not_installed": "Currently not installed. Install it?"
Expand Down Expand Up @@ -126,6 +127,7 @@
"error": "Invalid Path",
"title": "Choose the saves directory"
},
"update": "Update",
"vcruntime": {
"install": {
"message": "The download links for the Visual C++ Runtimes have been opened. Please install both the x86 and x64 versions."
Expand Down
26 changes: 16 additions & 10 deletions src/backend/updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,34 @@ import { logError, LogPrefix } from './logger/logger'
autoUpdater.autoDownload = false
autoUpdater.autoInstallOnAppQuit = false

autoUpdater.on('update-available', async () => {
const { response, checkboxChecked } = await dialog.showMessageBox({
async function showAutoupdateDialog() {
const { response } = await dialog.showMessageBox({
title: t('box.info.update.title', 'Heroic Games Launcher'),
message: t('box.info.update.message', 'There is a new Version available!'),
detail: t(
'box.info.update.detail',
'Do you want to download the update in the background?'
),
checkboxLabel: t('box.info.update.changelog', 'Open changelog'),
checkboxChecked: false,

icon: nativeImage.createFromPath(icon),
buttons: [t('box.no'), t('box.yes')]
buttons: [
t('box.update', 'Update'),
t('box.postpone', 'Postpone'),
t('box.changelog', 'Changelog')
]
})
if (checkboxChecked) {
if (response === 0) {
autoUpdater.downloadUpdate()
}
if (response === 2) {
shell.openExternal(
'https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher/releases'
)
showAutoupdateDialog()
}
if (response === 1) {
autoUpdater.downloadUpdate()
}
})
}

autoUpdater.on('update-available', showAutoupdateDialog)
autoUpdater.on('update-downloaded', async () => {
const { response } = await dialog.showMessageBox({
title: t('box.info.update.title-finished', 'Update Finished'),
Expand Down

0 comments on commit cada766

Please sign in to comment.