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();

View file

@ -1,5 +1,6 @@
<?php
define('APP_INDEX_ROOT_FILE', __FILE__);
define('APP_INDEX_ROOT_PATH', str_replace('\\', '/', rtrim(dirname(__FILE__), '\\/').'/'));
$sCustomDataPath = '';

View file

@ -1022,6 +1022,7 @@ class Actions
$aResult['ContactsIsAllowed'] = $oAddressBookProvider->IsActive();
$aResult['ContactsSharingIsAllowed'] = $oAddressBookProvider->IsSharingAllowed();
$aResult['ContactsSyncIsAllowed'] = (bool) $oConfig->Get('contacts', 'allow_sync', false);
$aResult['ContactsSyncInterval'] = (int) $oConfig->Get('contacts', 'sync_interval', 20);
$aResult['EnableContactsSync'] = false;
$aResult['ContactsSyncUrl'] = '';

View file

@ -88,6 +88,7 @@ class Application extends \RainLoop\Config\AbstractConfig
'enable' => array(false, 'Enable contacts'),
'allow_sharing' => array(true),
'allow_sync' => array(false),
'sync_interval' => array(20),
'type' => array('sqlite', ''),
'pdo_dsn' => array('mysql:host=127.0.0.1;port=3306;dbname=rainloop', ''),
'pdo_user' => array('root', ''),

View file

@ -10015,9 +10015,7 @@ function PopupsContactsViewModel()
}
self.reloadContactList(true);
}, true);
this.contacts.skipNextSync = true;
});
}, function () {
return !this.contacts.syncing() && !this.contacts.importing();
@ -15213,8 +15211,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('');
@ -18752,24 +18748,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) {
@ -19583,6 +19571,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')
@ -19723,9 +19712,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();

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -1,54 +0,0 @@
// MAIN
@main-color: #333;
@main-background-color: #eee;
@main-background-image: "images/background.jpg";
// LOADING
@loading-color: #000;
// LOGIN
@login-color: #eee;
@login-background-color: #757575;
@login-rgba-background-color: rgba(0,0,0,0.5);
@login-box-shadow: none;
@login-border: none;
@login-border-radius: 7px;
// MENU
@dropdown-menu-color: #333;
@dropdown-menu-background-color: #fff;
@dropdown-menu-hover-background-color: #757575;
@dropdown-menu-hover-color: #eee;
@dropdown-menu-disable-color: #999;
// FOLDERS
@folders-color: #333;
@folders-disabled-color: #999;
@folders-selected-color: #eee;
@folders-selected-background-color: #757575;
@folders-selected-rgba-background-color: rgba(0,0,0,0.5);
@folders-focused-color: #eee;
@folders-focused-background-color: #757575;
@folders-focused-rgba-background-color: rgba(0,0,0,0.7);
@folders-hover-color: #eee;
@folders-hover-background-color: #757575;
@folders-hover-rgba-background-color: rgba(0,0,0,0.5);
@folders-drop-color: #eee;
@folders-drop-background-color: #757575;
@folders-drop-rgba-background-color: rgba(0,0,0,0.5);
// SETTINGS
@settings-menu-color: #333;
@settings-menu-disabled-color: #999;
@settings-menu-selected-color: #eee;
@settings-menu-selected-background-color: #757575;
@settings-menu-selected-rgba-background-color: rgba(0,0,0,0.5);
@settings-menu-hover-color: #eee;
@settings-menu-hover-background-color: #757575;
@settings-menu-hover-rgba-background-color: rgba(0,0,0,0.5);
// MESSAGE LIST
@message-list-toolbar-background-color: #eee;
@message-list-toolbar-gradient-start: #f4f4f4;
@message-list-toolbar-gradient-end: #dfdfdf;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 961 B

View file