From 7f6ef18dbe259b87ec6c909d8deeb3700343db43 Mon Sep 17 00:00:00 2001 From: Ramiro Saenz Date: Wed, 31 Aug 2016 15:39:51 -0300 Subject: [PATCH] Improved Updater Related #213 --- app.js | 8 +++----- app/Application.js | 6 +++++- electron/updater.js | 1 + 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app.js b/app.js index d9db1688..f9111af7 100644 --- a/app.js +++ b/app.js @@ -29,9 +29,6 @@ const ipc = require('electron').ipcRenderer; ipc.on('showAbout', function(event, message) { !Ext.cq1('about') ? Ext.create('Rambox.view.main.About') : ''; }); -ipc.on('autoUpdater:checking-for-update:', function() { - Ext.Msg.wait('Please wait...', 'Checking for update'); -}); ipc.on('autoUpdater:check-update', function() { Rambox.app.checkUpdate(); }); @@ -60,16 +57,17 @@ ipc.on('autoUpdater:update-downloaded', function(e, releaseNotes, releaseName, r '->' ,{ xtype: 'label' - ,html: 'New version is available! ('+releaseName+')' + ,html: 'New version ready to install ('+releaseName+')! It will be installed the next time Rambox is relaunched.' } ,{ xtype: 'button' - ,text: 'Install' + ,text: 'Relaunch Now' ,handler: function(btn) { ipc.send('autoUpdater:quit-and-install'); } } ,{ xtype: 'button' ,text: 'Changelog' + ,ui: 'decline' ,href: 'https://github.com/saenzramiro/rambox/releases/tag/'+releaseName } ,'->' diff --git a/app/Application.js b/app/Application.js index 13696712..0aebaa06 100644 --- a/app/Application.js +++ b/app/Application.js @@ -179,16 +179,19 @@ Ext.define('Rambox.Application', { '->' ,{ xtype: 'label' - ,html: 'New version is available! ('+snapshot.val().latestVersion+')' + ,html: 'New version is available! ('+snapshot.val().latestVersion+')' + ( process.platform === 'win32' ? ' Is downloading in the background and you will notify when is ready to install it.' : '' ) } ,{ xtype: 'button' ,text: 'Download' ,href: 'https://getrambox.herokuapp.com/download/'+process.platform+'_'+process.arch + ,hidden: process.platform === 'win32' } ,{ xtype: 'button' ,text: 'Changelog' + ,ui: 'decline' + ,tooltip: 'Click here to see more information about the new version.' ,href: 'https://github.com/saenzramiro/rambox/releases/tag/'+snapshot.val().latestVersion } ,'->' @@ -200,6 +203,7 @@ Ext.define('Rambox.Application', { } ] }); + if ( process.platform === 'win32' ) ipc.send('autoUpdater:check-for-updates'); return; } else if ( !silence ) { Ext.Msg.show({ diff --git a/electron/updater.js b/electron/updater.js index 65d8938d..1967e110 100644 --- a/electron/updater.js +++ b/electron/updater.js @@ -9,6 +9,7 @@ const initialize = (window) => { autoUpdater.on('checking-for-update', (event) => send('autoUpdater:checking-for-update:')); autoUpdater.on('update-downloaded', (event, ...args) => send('autoUpdater:update-downloaded', ...args)); ipcMain.on('autoUpdater:quit-and-install', (event) => autoUpdater.quitAndInstall()); + ipcMain.on('autoUpdater:check-for-updates', (event) => autoUpdater.checkForUpdates()); webContents.on('did-finish-load', () => { autoUpdater.setFeedURL(url); autoUpdater.checkForUpdates();