mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 04:29:21 +03:00
Simplify handling of ContactsSync settings
This commit is contained in:
parent
4a2dcbc1f7
commit
867b7081f6
3 changed files with 18 additions and 26 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import ko from 'ko';
|
||||
import { SettingsGet } from 'Common/Globals';
|
||||
import { pInt } from 'Common/Utils';
|
||||
import { koComputable, addObservablesTo, koArrayWithDestroy } from 'External/ko';
|
||||
import Remote from 'Remote/User/Fetch';
|
||||
|
||||
|
|
@ -51,16 +50,14 @@ ContactUserStore.sync = fResultFunc => {
|
|||
};
|
||||
|
||||
ContactUserStore.init = () => {
|
||||
let value = !!SettingsGet('ContactsSyncIsAllowed');
|
||||
ContactUserStore.allowSync(value);
|
||||
if (value) {
|
||||
ContactUserStore.syncMode(SettingsGet('ContactsSyncMode'));
|
||||
ContactUserStore.syncUrl(SettingsGet('ContactsSyncUrl'));
|
||||
ContactUserStore.syncUser(SettingsGet('ContactsSyncUser'));
|
||||
ContactUserStore.syncPass(SettingsGet('ContactsSyncPassword'));
|
||||
let config = SettingsGet('ContactsSync');
|
||||
ContactUserStore.allowSync(!!config);
|
||||
if (config) {
|
||||
ContactUserStore.syncMode(config.Mode);
|
||||
ContactUserStore.syncUrl(config.Url);
|
||||
ContactUserStore.syncUser(config.User);
|
||||
ContactUserStore.syncPass(config.Password);
|
||||
setTimeout(ContactUserStore.sync, 10000);
|
||||
value = pInt(SettingsGet('ContactsSyncInterval'));
|
||||
value = 5 <= value ? (320 >= value ? value : 320) : 20;
|
||||
setInterval(ContactUserStore.sync, value * 60000 + 5000);
|
||||
setInterval(ContactUserStore.sync, config.Interval * 60000 + 5000);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue