snappymail/dev/Stores/User/Contact.js
djmaze aeb5275648 Improved boot.js with existing global window.rl
Put dev/Storage/Settings.js in boots.js global rl.settings
2020-09-04 12:05:17 +02:00

30 lines
1.1 KiB
JavaScript

import ko from 'ko';
class ContactUserStore {
constructor() {
this.contacts = ko.observableArray([]);
this.contacts.loading = ko.observable(false).extend({ throttle: 200 });
this.contacts.importing = ko.observable(false).extend({ throttle: 200 });
this.contacts.syncing = ko.observable(false).extend({ throttle: 200 });
this.contacts.exportingVcf = ko.observable(false).extend({ throttle: 200 });
this.contacts.exportingCsv = ko.observable(false).extend({ throttle: 200 });
this.allowContactsSync = ko.observable(false);
this.enableContactsSync = ko.observable(false);
this.contactsSyncUrl = ko.observable('');
this.contactsSyncUser = ko.observable('');
this.contactsSyncPass = ko.observable('');
}
populate() {
const settingsGet = rl.settings.get;
this.allowContactsSync(!!settingsGet('ContactsSyncIsAllowed'));
this.enableContactsSync(!!settingsGet('EnableContactsSync'));
this.contactsSyncUrl(settingsGet('ContactsSyncUrl'));
this.contactsSyncUser(settingsGet('ContactsSyncUser'));
this.contactsSyncPass(settingsGet('ContactsSyncPassword'));
}
}
export default new ContactUserStore();