Added contacts.sync_interval = 20 setting in application.ini (Closed #150)

This commit is contained in:
RainLoop Team 2014-05-07 01:35:12 +04:00
parent d08689759d
commit 40d2548a53
14 changed files with 22 additions and 89 deletions

View file

@ -180,24 +180,16 @@ RainLoopApp.prototype.reloadMessageListHelper = function (bEmptyList)
/**
* @param {Function} fResultFunc
* @param {boolean=} bForce = false
* @returns {boolean}
*/
RainLoopApp.prototype.contactsSync = function (fResultFunc, bForce)
RainLoopApp.prototype.contactsSync = function (fResultFunc)
{
var oContacts = RL.data().contacts;
if (oContacts.importing() || oContacts.syncing() || !RL.data().enableContactsSync() || !RL.data().allowContactsSync())
{
oContacts.skipNextSync = false;
return false;
}
if (oContacts.skipNextSync && !bForce)
{
oContacts.skipNextSync = false;
return false;
}
oContacts.syncing(true);
RL.remote().contactsSync(function (sResult, oData) {
@ -1011,6 +1003,7 @@ RainLoopApp.prototype.bootstart = function ()
var
sCustomLoginLink = '',
sJsHash = RL.settingsGet('JsHash'),
iContactsSyncInterval = Utils.pInt(RL.settingsGet('ContactsSyncInterval')),
bGoogle = RL.settingsGet('AllowGoogleSocial'),
bFacebook = RL.settingsGet('AllowFacebookSocial'),
bTwitter = RL.settingsGet('AllowTwitterSocial')
@ -1151,9 +1144,12 @@ RainLoopApp.prototype.bootstart = function ()
RL.folders();
});
RL.sub('interval.10m-after5m', function () {
iContactsSyncInterval = 5 <= iContactsSyncInterval ? iContactsSyncInterval : 20;
iContactsSyncInterval = 320 >= iContactsSyncInterval ? iContactsSyncInterval : 320;
window.setInterval(function () {
RL.contactsSync();
});
}, iContactsSyncInterval * 60000 + 5000);
_.delay(function () {
RL.contactsSync();

View file

@ -90,8 +90,6 @@ function WebMailDataStorage()
this.contacts.exportingVcf = ko.observable(false).extend({'throttle': 200});
this.contacts.exportingCsv = ko.observable(false).extend({'throttle': 200});
this.contacts.skipNextSync = false;
this.allowContactsSync = ko.observable(false);
this.enableContactsSync = ko.observable(false);
this.contactsSyncUrl = ko.observable('');

View file

@ -312,9 +312,7 @@ function PopupsContactsViewModel()
}
self.reloadContactList(true);
}, true);
this.contacts.skipNextSync = true;
});
}, function () {
return !this.contacts.syncing() && !this.contacts.importing();