@@ -5,31 +5,46 @@ import { t } from 'i18next'
5
5
import { showDialogBoxModalAuto } from './dialog/dialog'
6
6
import { logError , LogPrefix } from './logger'
7
7
import { windowIcon } from './constants/paths'
8
- import { isLinux } from './constants/environment'
8
+ import { autoUpdateSupported } from './constants/environment'
9
9
10
10
autoUpdater . autoDownload = false
11
11
autoUpdater . autoInstallOnAppQuit = false
12
12
13
13
async function showAutoupdateDialog ( ) {
14
- if ( isLinux ) {
15
- return
16
- }
14
+ let messageDetail
15
+ let buttons
17
16
18
- const { response } = await dialog . showMessageBox ( {
19
- title : t ( 'box.info.update.title' , 'Heroic Games Launcher' ) ,
20
- message : t ( 'box.info.update.message' , 'There is a new Version available!' ) ,
21
- detail : t (
17
+ if ( autoUpdateSupported ) {
18
+ messageDetail = t (
22
19
'box.info.update.detail' ,
23
20
'Do you want to download the update in the background?'
24
- ) ,
25
-
26
- icon : nativeImage . createFromPath ( windowIcon ) ,
27
- buttons : [
21
+ )
22
+ buttons = [
28
23
t ( 'box.update' , 'Update' ) ,
29
24
t ( 'box.postpone' , 'Postpone' ) ,
30
25
t ( 'box.changelog' , 'Changelog' )
31
26
]
27
+ } else {
28
+ messageDetail = t (
29
+ 'box.info.update.detailNoAutoupdate' ,
30
+ 'Automatic updates are not supported for your packaging format. Please use your package manager to update.'
31
+ )
32
+ buttons = [ t ( 'box.ok' ) , t ( 'box.changelog' , 'Changelog' ) ]
33
+ }
34
+
35
+ let { response } = await dialog . showMessageBox ( {
36
+ title : t ( 'box.info.update.title' , 'Heroic Games Launcher' ) ,
37
+ message : t ( 'box.info.update.message' , 'There is a new Version available!' ) ,
38
+ detail : messageDetail ,
39
+
40
+ icon : nativeImage . createFromPath ( windowIcon ) ,
41
+ buttons
32
42
} )
43
+
44
+ // "Ok" button becomes "Postpone" (to just close the dialog), "Changelog" gets
45
+ // the correct index (1 -> 2)
46
+ if ( ! autoUpdateSupported ) response ++
47
+
33
48
if ( response === 0 ) {
34
49
autoUpdater . downloadUpdate ( )
35
50
}
0 commit comments