snappymail/dev/Stores/User/Contact.js

33 lines
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
2020-10-27 18:09:24 +08:00
ko.addObservablesTo(this, {
allowContactsSync: false,
enableContactsSync: false,
contactsSyncUrl: '',
contactsSyncUser: '',
contactsSyncPass: ''
});
}
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();