diff options
Diffstat (limited to 'src/electron/ipc-api/autoUpdate.ts')
-rw-r--r-- | src/electron/ipc-api/autoUpdate.ts | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/electron/ipc-api/autoUpdate.ts b/src/electron/ipc-api/autoUpdate.ts index e6b805edc..aed87455e 100644 --- a/src/electron/ipc-api/autoUpdate.ts +++ b/src/electron/ipc-api/autoUpdate.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { app, ipcMain, BrowserWindow } from 'electron'; | 1 | import { ipcMain, BrowserWindow } from 'electron'; |
2 | import { autoUpdater } from 'electron-updater'; | 2 | import { autoUpdater } from 'electron-updater'; |
3 | import { isMac, isWindows } from '../../environment'; | 3 | import { isMac, isWindows } from '../../environment'; |
4 | 4 | ||
@@ -18,14 +18,6 @@ export default (params: { mainWindow: BrowserWindow; settings: any }) => { | |||
18 | autoUpdater.allowPrerelease = Boolean( | 18 | autoUpdater.allowPrerelease = Boolean( |
19 | params.settings.app.get('beta'), | 19 | params.settings.app.get('beta'), |
20 | ); | 20 | ); |
21 | autoUpdater.channel = autoUpdater.allowPrerelease ? 'beta' : 'latest'; | ||
22 | |||
23 | if (params.settings.app.get('nightly')) { | ||
24 | autoUpdater.allowPrerelease = Boolean( | ||
25 | params.settings.app.get('nightly'), | ||
26 | ); | ||
27 | autoUpdater.channel = 'alpha'; | ||
28 | } | ||
29 | 21 | ||
30 | if (args.action === 'check') { | 22 | if (args.action === 'check') { |
31 | debug('checking for update'); | 23 | debug('checking for update'); |
@@ -33,14 +25,9 @@ export default (params: { mainWindow: BrowserWindow; settings: any }) => { | |||
33 | } else if (args.action === 'install') { | 25 | } else if (args.action === 'install') { |
34 | debug('installing update'); | 26 | debug('installing update'); |
35 | autoUpdater.quitAndInstall(); | 27 | autoUpdater.quitAndInstall(); |
36 | // we need to send a quit event | ||
37 | setTimeout(() => { | ||
38 | app.quit(); | ||
39 | }, 20); | ||
40 | } | 28 | } |
41 | } catch (error) { | 29 | } catch (error) { |
42 | console.error(error); | 30 | event.sender.send('autoUpdate', { error }); |
43 | event.sender.send('autoUpdate', { error: true }); | ||
44 | } | 31 | } |
45 | } | 32 | } |
46 | }); | 33 | }); |
@@ -74,9 +61,9 @@ export default (params: { mainWindow: BrowserWindow; settings: any }) => { | |||
74 | params.mainWindow.webContents.send('autoUpdate', { downloaded: true }); | 61 | params.mainWindow.webContents.send('autoUpdate', { downloaded: true }); |
75 | }); | 62 | }); |
76 | 63 | ||
77 | autoUpdater.on('error', () => { | 64 | autoUpdater.on('error', error => { |
78 | debug('update-error'); | 65 | debug('update-error'); |
79 | params.mainWindow.webContents.send('autoUpdate', { error: true }); | 66 | params.mainWindow.webContents.send('autoUpdate', { error }); |
80 | }); | 67 | }); |
81 | } | 68 | } |
82 | }; | 69 | }; |