snappymail/dev/Stores/User/Contact.js

31 lines
1.1 KiB
JavaScript
Raw Normal View History

import ko from 'ko';
2016-06-30 08:02:45 +08:00
2019-07-05 03:19:24 +08:00
class ContactUserStore {
constructor() {
this.contacts = ko.observableArray([]);
2020-08-14 04:58:41 +08:00
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 });
2016-06-30 08:02:45 +08:00
this.allowContactsSync = ko.observable(false);
this.enableContactsSync = ko.observable(false);
this.contactsSyncUrl = ko.observable('');
this.contactsSyncUser = ko.observable('');
this.contactsSyncPass = ko.observable('');
}
2016-06-30 08:02:45 +08:00
populate() {
const settingsGet = rl.settings.get;
this.allowContactsSync(!!settingsGet('ContactsSyncIsAllowed'));
this.enableContactsSync(!!settingsGet('EnableContactsSync'));
2016-06-30 08:02:45 +08:00
this.contactsSyncUrl(settingsGet('ContactsSyncUrl'));
this.contactsSyncUser(settingsGet('ContactsSyncUser'));
this.contactsSyncPass(settingsGet('ContactsSyncPassword'));
}
}
2016-06-30 08:02:45 +08:00
export default new ContactUserStore();