Browse Source

Improved Updater

Related #213
pull/291/merge
Ramiro Saenz 9 years ago
parent
commit
7f6ef18dbe
  1. 8
      app.js
  2. 6
      app/Application.js
  3. 1
      electron/updater.js

8
app.js

@ -29,9 +29,6 @@ const ipc = require('electron').ipcRenderer;
ipc.on('showAbout', function(event, message) { ipc.on('showAbout', function(event, message) {
!Ext.cq1('about') ? Ext.create('Rambox.view.main.About') : ''; !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() { ipc.on('autoUpdater:check-update', function() {
Rambox.app.checkUpdate(); Rambox.app.checkUpdate();
}); });
@ -60,16 +57,17 @@ ipc.on('autoUpdater:update-downloaded', function(e, releaseNotes, releaseName, r
'->' '->'
,{ ,{
xtype: 'label' xtype: 'label'
,html: '<b>New version is available!</b> ('+releaseName+')' ,html: '<b>New version ready to install ('+releaseName+')!</b> It will be installed the next time Rambox is relaunched.'
} }
,{ ,{
xtype: 'button' xtype: 'button'
,text: 'Install' ,text: 'Relaunch Now'
,handler: function(btn) { ipc.send('autoUpdater:quit-and-install'); } ,handler: function(btn) { ipc.send('autoUpdater:quit-and-install'); }
} }
,{ ,{
xtype: 'button' xtype: 'button'
,text: 'Changelog' ,text: 'Changelog'
,ui: 'decline'
,href: 'https://github.com/saenzramiro/rambox/releases/tag/'+releaseName ,href: 'https://github.com/saenzramiro/rambox/releases/tag/'+releaseName
} }
,'->' ,'->'

6
app/Application.js

@ -179,16 +179,19 @@ Ext.define('Rambox.Application', {
'->' '->'
,{ ,{
xtype: 'label' xtype: 'label'
,html: '<b>New version is available!</b> ('+snapshot.val().latestVersion+')' ,html: '<b>New version is available!</b> ('+snapshot.val().latestVersion+')' + ( process.platform === 'win32' ? ' Is downloading in the background and you will notify when is ready to install it.' : '' )
} }
,{ ,{
xtype: 'button' xtype: 'button'
,text: 'Download' ,text: 'Download'
,href: 'https://getrambox.herokuapp.com/download/'+process.platform+'_'+process.arch ,href: 'https://getrambox.herokuapp.com/download/'+process.platform+'_'+process.arch
,hidden: process.platform === 'win32'
} }
,{ ,{
xtype: 'button' xtype: 'button'
,text: 'Changelog' ,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 ,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; return;
} else if ( !silence ) { } else if ( !silence ) {
Ext.Msg.show({ Ext.Msg.show({

1
electron/updater.js

@ -9,6 +9,7 @@ const initialize = (window) => {
autoUpdater.on('checking-for-update', (event) => send('autoUpdater:checking-for-update:')); autoUpdater.on('checking-for-update', (event) => send('autoUpdater:checking-for-update:'));
autoUpdater.on('update-downloaded', (event, ...args) => send('autoUpdater:update-downloaded', ...args)); autoUpdater.on('update-downloaded', (event, ...args) => send('autoUpdater:update-downloaded', ...args));
ipcMain.on('autoUpdater:quit-and-install', (event) => autoUpdater.quitAndInstall()); ipcMain.on('autoUpdater:quit-and-install', (event) => autoUpdater.quitAndInstall());
ipcMain.on('autoUpdater:check-for-updates', (event) => autoUpdater.checkForUpdates());
webContents.on('did-finish-load', () => { webContents.on('did-finish-load', () => {
autoUpdater.setFeedURL(url); autoUpdater.setFeedURL(url);
autoUpdater.checkForUpdates(); autoUpdater.checkForUpdates();

Loading…
Cancel
Save