snappymail/dev/Stores/User/Contact.js

34 lines
1.2 KiB
JavaScript
Raw Normal View History

2015-02-22 06:00:51 +08:00
import ko from 'ko';
2016-08-24 06:17:50 +08:00
import {Magics} from 'Common/Enums';
import * as Settings from 'Storage/Settings';
2016-06-30 08:02:45 +08:00
class ContactUserStore
2016-06-30 08:02:45 +08:00
{
constructor() {
this.contacts = ko.observableArray([]);
2016-08-24 06:17:50 +08:00
this.contacts.loading = ko.observable(false).extend({throttle: Magics.Time200ms});
this.contacts.importing = ko.observable(false).extend({throttle: Magics.Time200ms});
this.contacts.syncing = ko.observable(false).extend({throttle: Magics.Time200ms});
this.contacts.exportingVcf = ko.observable(false).extend({throttle: Magics.Time200ms});
this.contacts.exportingCsv = ko.observable(false).extend({throttle: Magics.Time200ms});
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() {
this.allowContactsSync(!!Settings.settingsGet('ContactsSyncIsAllowed'));
this.enableContactsSync(!!Settings.settingsGet('EnableContactsSync'));
2016-06-30 08:02:45 +08:00
this.contactsSyncUrl(Settings.settingsGet('ContactsSyncUrl'));
this.contactsSyncUser(Settings.settingsGet('ContactsSyncUser'));
this.contactsSyncPass(Settings.settingsGet('ContactsSyncPassword'));
}
}
2016-06-30 08:02:45 +08:00
export default new ContactUserStore();