|
|
@ -126,8 +126,30 @@ Ext.define('Rambox.Application', { |
|
|
|
] |
|
|
|
] |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if ( process.platform !== 'win32' && process.platform !== 'darwin' ) { |
|
|
|
if ( process.platform !== 'win32' ) { |
|
|
|
fireRef.database().ref('config').on('value', function(snapshot) { |
|
|
|
this.checkUpdate(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( localStorage.getItem('locked') ) { |
|
|
|
|
|
|
|
console.info('Lock Rambox:', 'Enabled'); |
|
|
|
|
|
|
|
Ext.cq1('app-main').getController().showLockWindow(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remove spinner
|
|
|
|
|
|
|
|
Ext.get('spinner').destroy(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
,updateTotalNotifications: function( newValue, oldValue ) { |
|
|
|
|
|
|
|
newValue = parseInt(newValue); |
|
|
|
|
|
|
|
if ( newValue > 0 ) { |
|
|
|
|
|
|
|
document.title = 'Rambox (' + Rambox.util.Format.formatNumber(newValue) + ')'; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
document.title = 'Rambox'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
,checkUpdate: function(silence) { |
|
|
|
|
|
|
|
fireRef.database().ref('config').once('value', function(snapshot) { |
|
|
|
var appVersion = new Ext.Version(require('electron').remote.app.getVersion()); |
|
|
|
var appVersion = new Ext.Version(require('electron').remote.app.getVersion()); |
|
|
|
if ( appVersion.isLessThan(snapshot.val().latestVersion) ) { |
|
|
|
if ( appVersion.isLessThan(snapshot.val().latestVersion) ) { |
|
|
|
console.info('New version is available', snapshot.val().latestVersion); |
|
|
|
console.info('New version is available', snapshot.val().latestVersion); |
|
|
@ -161,27 +183,16 @@ Ext.define('Rambox.Application', { |
|
|
|
] |
|
|
|
] |
|
|
|
}); |
|
|
|
}); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} else if ( !silence ) { |
|
|
|
|
|
|
|
Ext.Msg.show({ |
|
|
|
console.info('Your version is the latest. No need to update.') |
|
|
|
title: 'You are up to date!' |
|
|
|
|
|
|
|
,message: 'You have the latest version of Rambox.' |
|
|
|
|
|
|
|
,icon: Ext.Msg.INFO |
|
|
|
|
|
|
|
,buttons: Ext.Msg.OK |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ( localStorage.getItem('locked') ) { |
|
|
|
console.info('Your version is the latest. No need to update.'); |
|
|
|
console.info('Lock Rambox:', 'Enabled'); |
|
|
|
}); |
|
|
|
Ext.cq1('app-main').getController().showLockWindow(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remove spinner
|
|
|
|
|
|
|
|
Ext.get('spinner').destroy(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
,updateTotalNotifications: function( newValue, oldValue ) { |
|
|
|
|
|
|
|
newValue = parseInt(newValue); |
|
|
|
|
|
|
|
if ( newValue > 0 ) { |
|
|
|
|
|
|
|
document.title = 'Rambox (' + Rambox.util.Format.formatNumber(newValue) + ')'; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
document.title = 'Rambox'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|