This commit is contained in:
the-djmaze 2022-04-16 11:01:24 +02:00
parent 7bbc53c8af
commit 0a49027840
64 changed files with 239 additions and 123 deletions

View file

@ -2,6 +2,7 @@ import ko from 'ko';
import { koComputable } from 'External/ko';
import { SettingsGet } from 'Common/Globals';
import { i18n, trigger as translatorTrigger } from 'Common/Translator';
import { ContactUserStore } from 'Stores/User/Contact';
import Remote from 'Remote/User/Fetch';
@ -10,14 +11,24 @@ export class UserSettingsContacts /*extends AbstractViewSettings*/ {
this.contactsAutosave = ko.observable(!!SettingsGet('ContactsAutosave'));
this.allowContactsSync = ContactUserStore.allowSync;
this.enableContactsSync = ContactUserStore.enableSync;
this.contactsSyncUrl = ContactUserStore.syncUrl;
this.contactsSyncUser = ContactUserStore.syncUser;
this.contactsSyncPass = ContactUserStore.syncPass;
this.syncMode = ContactUserStore.syncMode;
this.syncUrl = ContactUserStore.syncUrl;
this.syncUser = ContactUserStore.syncUser;
this.syncPass = ContactUserStore.syncPass;
const i18nSyncMode = key => i18n('SETTINGS_CONTACTS/SYNC_' + key);
this.syncModeOptions = koComputable(() => {
translatorTrigger();
return [
{ id: 0, name: i18nSyncMode('NO') },
{ id: 1, name: i18nSyncMode('YES') },
{ id: 2, name: i18nSyncMode('READ') },
];
});
this.saveTrigger = koComputable(() =>
[
ContactUserStore.enableSync() ? '1' : '0',
ContactUserStore.syncMode(),
ContactUserStore.syncUrl(),
ContactUserStore.syncUser(),
ContactUserStore.syncPass()
@ -31,7 +42,7 @@ export class UserSettingsContacts /*extends AbstractViewSettings*/ {
this.saveTrigger.subscribe(() =>
Remote.request('SaveContactsSyncData', null, {
Enable: ContactUserStore.enableSync() ? 1 : 0,
Mode: ContactUserStore.syncMode(),
Url: ContactUserStore.syncUrl(),
User: ContactUserStore.syncUser(),
Password: ContactUserStore.syncPass()