Browse Source

New Version notification

Check if there is a new version and notify the user.
pull/116/head
Ramiro Saenz 9 years ago
parent
commit
4beeb389e6
  1. 39
      app/Application.js

39
app/Application.js

@ -103,6 +103,45 @@ Ext.define('Rambox.Application', {
] ]
}); });
fireRef.database().ref('config').on('value', function(snapshot) {
var appVersion = new Ext.Version(require('electron').remote.app.getVersion());
if ( appVersion.isLessThan(snapshot.val().latestVersion) ) {
console.info('New version is available', snapshot.val().latestVersion);
var newVersionTB = Ext.cq1('app-main').addDocked({
xtype: 'toolbar'
,dock: 'top'
,ui: 'newversion'
,items: [
'->'
,{
xtype: 'label'
,html: '<b>New version is available!</b> ('+snapshot.val().latestVersion+')'
}
,{
xtype: 'button'
,text: 'Download'
,href: 'https://getrambox.herokuapp.com/download'
}
,{
xtype: 'button'
,text: 'Changelog'
,href: 'https://github.com/saenzramiro/rambox/releases/tag/'+snapshot.val().latestVersion
}
,'->'
,{
glyph: 'xf00d@FontAwesome'
,baseCls: ''
,style: 'cursor:pointer;'
,handler: function(btn) { Ext.cq1('app-main').removeDocked(btn.up('toolbar'), true); }
}
]
});
return;
}
console.info('Your version is the latest. No need to update.')
});
// Remove spinner // Remove spinner
Ext.get('spinner').destroy(); Ext.get('spinner').destroy();
} }

Loading…
Cancel
Save