(fix) refactored to code

pull/91/merge
Ludovic Marcotte 2015-07-30 14:51:14 -04:00
parent af7fb1c6ee
commit 85f4efab46
3 changed files with 15 additions and 20 deletions

View File

@ -173,6 +173,19 @@ String.prototype.asCSSIdentifier = function() {
return newString;
};
String.prototype.timeInterval = function () {
var interval;
if (this == "once_per_hour")
interval = 3600;
else if (this == "every_minute")
interval = 60;
else {
interval = parseInt(this.substr(6)) * 60;
}
return interval;
};
Date.prototype.stringWithSeparator = function(separator) {
var month = '' + (this.getMonth() + 1);
var day = '' + this.getDate();

View File

@ -103,17 +103,8 @@
Preferences.ready().then(function() {
var refreshViewCheck = Preferences.defaults.SOGoRefreshViewCheck;
if (refreshViewCheck && refreshViewCheck != 'manually') {
var interval;
if (refreshViewCheck == "once_per_hour")
interval = 3600;
else if (refreshViewCheck == "every_minute")
interval = 60;
else {
interval = parseInt(refreshViewCheck.substr(6)) * 60;
}
var f = angular.bind(vm.selectedFolder, AddressBook.prototype.$reload);
$timeout(f, interval*1000);
$timeout(f, refreshViewCheck.timeInterval()*1000);
}
});
}

View File

@ -92,17 +92,8 @@
Preferences.ready().then(function() {
var refreshViewCheck = Preferences.defaults.SOGoRefreshViewCheck;
if (refreshViewCheck && refreshViewCheck != 'manually') {
var interval;
if (refreshViewCheck == "once_per_hour")
interval = 3600;
else if (refreshViewCheck == "every_minute")
interval = 60;
else {
interval = parseInt(refreshViewCheck.substr(6)) * 60;
}
var f = angular.bind(vm.selectedFolder, Mailbox.prototype.$filter);
$timeout(f, interval*1000);
$timeout(f, refreshViewCheck.timeInterval()*1000);
}
});
}