mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 13:39:22 +03:00
Automatic contacts syncronization (every 10m)
This commit is contained in:
parent
d476a6a3ac
commit
0ce7b03fd0
11 changed files with 336 additions and 258 deletions
|
|
@ -42,6 +42,12 @@ function RainLoopApp()
|
|||
RL.pub('interval.10m');
|
||||
}, 60000 * 10);
|
||||
|
||||
window.setTimeout(function () {
|
||||
window.setInterval(function () {
|
||||
RL.pub('interval.10m-after5m');
|
||||
}, 60000 * 10);
|
||||
}, 60000 * 5);
|
||||
|
||||
$.wakeUp(function () {
|
||||
RL.remote().jsVersion(function (sResult, oData) {
|
||||
if (Enums.StorageResultType.Success === sResult && oData && !oData.Result)
|
||||
|
|
@ -172,6 +178,41 @@ RainLoopApp.prototype.reloadMessageListHelper = function (bEmptyList)
|
|||
RL.reloadMessageList(bEmptyList);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Function} fResultFunc
|
||||
* @param {boolean=} bForce = false
|
||||
* @returns {boolean}
|
||||
*/
|
||||
RainLoopApp.prototype.contactsSync = function (fResultFunc, bForce)
|
||||
{
|
||||
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) {
|
||||
|
||||
oContacts.syncing(false);
|
||||
|
||||
if (fResultFunc)
|
||||
{
|
||||
fResultFunc(sResult, oData);
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
RainLoopApp.prototype.messagesMoveTrigger = function ()
|
||||
{
|
||||
var self = this;
|
||||
|
|
@ -1089,7 +1130,7 @@ RainLoopApp.prototype.bootstart = function ()
|
|||
RL.sub('interval.2m', function () {
|
||||
RL.folderInformation('INBOX');
|
||||
});
|
||||
|
||||
|
||||
RL.sub('interval.2m', function () {
|
||||
var sF = RL.data().currentFolderFullNameRaw();
|
||||
if ('INBOX' !== sF)
|
||||
|
|
@ -1110,6 +1151,14 @@ RainLoopApp.prototype.bootstart = function ()
|
|||
RL.folders();
|
||||
});
|
||||
|
||||
RL.sub('interval.10m-after5m', function () {
|
||||
RL.contactsSync();
|
||||
});
|
||||
|
||||
_.delay(function () {
|
||||
RL.contactsSync();
|
||||
}, 5000);
|
||||
|
||||
_.delay(function () {
|
||||
RL.folderInformationMultiply(true);
|
||||
}, 500);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue