Skip to content

[UX] Improve update Dialog #3598

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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