2015-02-22 06:00:51 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
import ko from 'ko';
|
2016-08-24 06:17:50 +08:00
|
|
|
import {Magics} from 'Common/Enums';
|
2016-08-17 06:01:20 +08:00
|
|
|
import * as Settings from 'Storage/Settings';
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
class ContactUserStore
|
2016-06-30 08:02:45 +08:00
|
|
|
{
|
2016-08-17 06:01:20 +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
|
|
|
|
2016-08-17 06:01:20 +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
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
populate() {
|
|
|
|
this.allowContactsSync(!!Settings.settingsGet('ContactsSyncIsAllowed'));
|
|
|
|
this.enableContactsSync(!!Settings.settingsGet('EnableContactsSync'));
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +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
|
|
|
|
2016-09-13 04:50:21 +08:00
|
|
|
export default new ContactUserStore();
|