do silent auto update on each startup

This commit is contained in:
Tankred Hase 2013-11-09 00:30:45 +01:00
parent 23a53e6a3f
commit 415c0abbff
3 changed files with 7 additions and 21 deletions

View File

@ -40,17 +40,15 @@ define(function(require) {
} }
}; };
self.checkForUpdate = function(callback) { self.checkForUpdate = function() {
if (!chrome || !chrome.runtime || !chrome.runtime.onUpdateAvailable) { if (!chrome || !chrome.runtime || !chrome.runtime.onUpdateAvailable) {
return; return;
} }
// check for update and restart on confirmation // check for update and restart
chrome.runtime.onUpdateAvailable.addListener(function(details) { chrome.runtime.onUpdateAvailable.addListener(function(details) {
callback(function() { console.log("Updating to version " + details.version);
console.log("Updating to version " + details.version); chrome.runtime.reload();
chrome.runtime.reload();
});
}); });
chrome.runtime.requestUpdateCheck(function(status) { chrome.runtime.requestUpdateCheck(function(status) {
if (status === "update_found") { if (status === "update_found") {

View File

@ -16,6 +16,9 @@ define(function(require) {
return; return;
} }
// check for app update
appController.checkForUpdate();
// login to imap // login to imap
initializeUser(); initializeUser();
}); });

View File

@ -125,21 +125,6 @@ define(function(require) {
// Start // Start
// //
function onUpdateAvailable(doUpdate) {
$scope.state.dialog = {
open: true,
title: 'Update available',
message: 'Would you like to update the application now?',
callback: function(confirm) {
if (confirm) {
doUpdate();
}
}
};
}
// check for app update
appController.checkForUpdate(onUpdateAvailable);
// init folders // init folders
initFolders(function(folders) { initFolders(function(folders) {
$scope.folders = folders; $scope.folders = folders;