diff options
author | Stefan Malzner <stefan@adlk.io> | 2018-12-01 22:46:43 +0100 |
---|---|---|
committer | Stefan Malzner <stefan@adlk.io> | 2018-12-01 22:46:43 +0100 |
commit | 7a413cf6784bccb04e9378cb35e897dd37da384b (patch) | |
tree | dbcf3b2a47c5a90fbdd1ce3de5970902012cbd29 | |
parent | Downgrade electron-builder & electron-updater to electron@2 compatible versions (diff) | |
download | ferdium-app-7a413cf6784bccb04e9378cb35e897dd37da384b.tar.gz ferdium-app-7a413cf6784bccb04e9378cb35e897dd37da384b.tar.zst ferdium-app-7a413cf6784bccb04e9378cb35e897dd37da384b.zip |
Work with dev-app-update.yml & switch to debugger
-rw-r--r-- | src/electron/ipc-api/autoUpdate.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/electron/ipc-api/autoUpdate.js b/src/electron/ipc-api/autoUpdate.js index db5d9663e..9ccc89ea2 100644 --- a/src/electron/ipc-api/autoUpdate.js +++ b/src/electron/ipc-api/autoUpdate.js | |||
@@ -1,17 +1,17 @@ | |||
1 | import { app, ipcMain } from 'electron'; | 1 | import { app, ipcMain } from 'electron'; |
2 | import { autoUpdater } from 'electron-updater'; | 2 | import { autoUpdater } from 'electron-updater'; |
3 | import { isDevMode } from '../../environment.js'; | 3 | |
4 | const debug = require('debug')('Franz:ipcApi:autoUpdate'); | ||
4 | 5 | ||
5 | export default (params) => { | 6 | export default (params) => { |
6 | if (!isDevMode && (process.platform === 'darwin' || process.platform === 'win32')) { | 7 | if (process.platform === 'darwin' || process.platform === 'win32') { |
7 | // autoUpdater.setFeedURL(updateUrl); | ||
8 | ipcMain.on('autoUpdate', (event, args) => { | 8 | ipcMain.on('autoUpdate', (event, args) => { |
9 | try { | 9 | try { |
10 | autoUpdater.allowPrerelease = Boolean(params.settings.app.get('beta')); | 10 | autoUpdater.allowPrerelease = Boolean(params.settings.app.get('beta')); |
11 | if (args.action === 'check') { | 11 | if (args.action === 'check') { |
12 | autoUpdater.checkForUpdates(); | 12 | autoUpdater.checkForUpdates(); |
13 | } else if (args.action === 'install') { | 13 | } else if (args.action === 'install') { |
14 | console.log('install update'); | 14 | debug('install update'); |
15 | autoUpdater.quitAndInstall(); | 15 | autoUpdater.quitAndInstall(); |
16 | // we need to send a quit event | 16 | // we need to send a quit event |
17 | setTimeout(() => { | 17 | setTimeout(() => { |
@@ -25,12 +25,12 @@ export default (params) => { | |||
25 | }); | 25 | }); |
26 | 26 | ||
27 | autoUpdater.on('update-not-available', () => { | 27 | autoUpdater.on('update-not-available', () => { |
28 | console.log('update-not-available'); | 28 | debug('update-not-available'); |
29 | params.mainWindow.webContents.send('autoUpdate', { available: false }); | 29 | params.mainWindow.webContents.send('autoUpdate', { available: false }); |
30 | }); | 30 | }); |
31 | 31 | ||
32 | autoUpdater.on('update-available', () => { | 32 | autoUpdater.on('update-available', () => { |
33 | console.log('update-available'); | 33 | debug('update-available'); |
34 | params.mainWindow.webContents.send('autoUpdate', { available: true }); | 34 | params.mainWindow.webContents.send('autoUpdate', { available: true }); |
35 | }); | 35 | }); |
36 | 36 | ||
@@ -39,16 +39,16 @@ export default (params) => { | |||
39 | logMessage = `${logMessage} - Downloaded ${progressObj.percent}%`; | 39 | logMessage = `${logMessage} - Downloaded ${progressObj.percent}%`; |
40 | logMessage = `${logMessage} (${progressObj.transferred}/${progressObj.total})`; | 40 | logMessage = `${logMessage} (${progressObj.transferred}/${progressObj.total})`; |
41 | 41 | ||
42 | console.log(logMessage); | 42 | debug(logMessage); |
43 | }); | 43 | }); |
44 | 44 | ||
45 | autoUpdater.on('update-downloaded', () => { | 45 | autoUpdater.on('update-downloaded', () => { |
46 | console.log('update-downloaded'); | 46 | debug('update-downloaded'); |
47 | params.mainWindow.webContents.send('autoUpdate', { downloaded: true }); | 47 | params.mainWindow.webContents.send('autoUpdate', { downloaded: true }); |
48 | }); | 48 | }); |
49 | 49 | ||
50 | autoUpdater.on('error', () => { | 50 | autoUpdater.on('error', () => { |
51 | console.log('update-error'); | 51 | debug('update-error'); |
52 | params.mainWindow.webContents.send('autoUpdate', { error: true }); | 52 | params.mainWindow.webContents.send('autoUpdate', { error: true }); |
53 | }); | 53 | }); |
54 | } | 54 | } |