Convert user stores to single object instances

Removed unused ContactUserStore.exportingCsv and ContactUserStore.exportingVcf
This commit is contained in:
djmaze 2021-03-10 22:41:35 +01:00
parent 914c6e8d14
commit 6a454ec624
46 changed files with 671 additions and 710 deletions

View file

@ -3,7 +3,7 @@ import ko from 'ko';
import { Capa, StorageResultType } from 'Common/Enums';
import { Settings } from 'Common/Globals';
import AccountStore from 'Stores/User/Account';
import { AccountUserStore } from 'Stores/User/Account';
import { IdentityUserStore } from 'Stores/User/Identity';
import Remote from 'Remote/User/Fetch';
@ -17,7 +17,8 @@ export class AccountsUserSettings {
this.allowAdditionalAccount = Settings.capa(Capa.AdditionalAccounts);
this.allowIdentities = Settings.capa(Capa.Identities);
this.accounts = AccountStore.accounts;
this.accounts = AccountUserStore.accounts;
this.loading = AccountUserStore.loading;
this.identities = IdentityUserStore;
this.accountForDeletion = ko.observable(null).deleteAccessHelper();
@ -80,7 +81,7 @@ export class AccountsUserSettings {
}
accountsAndIdentitiesAfterMove() {
Remote.accountsAndIdentitiesSortOrder(null, AccountStore.getEmailAddresses(), IdentityUserStore.getIDS());
Remote.accountsAndIdentitiesSortOrder(null, AccountUserStore.getEmailAddresses(), IdentityUserStore.getIDS());
}
onBuild(oDom) {

View file

@ -1,26 +1,26 @@
import ko from 'ko';
import AppStore from 'Stores/User/App';
import ContactStore from 'Stores/User/Contact';
import { AppUserStore } from 'Stores/User/App';
import { ContactUserStore } from 'Stores/User/Contact';
import Remote from 'Remote/User/Fetch';
export class ContactsUserSettings {
constructor() {
this.contactsAutosave = AppStore.contactsAutosave;
this.contactsAutosave = AppUserStore.contactsAutosave;
this.allowContactsSync = ContactStore.allowContactsSync;
this.enableContactsSync = ContactStore.enableContactsSync;
this.contactsSyncUrl = ContactStore.contactsSyncUrl;
this.contactsSyncUser = ContactStore.contactsSyncUser;
this.contactsSyncPass = ContactStore.contactsSyncPass;
this.allowContactsSync = ContactUserStore.allowSync;
this.enableContactsSync = ContactUserStore.enableSync;
this.contactsSyncUrl = ContactUserStore.syncUrl;
this.contactsSyncUser = ContactUserStore.syncUser;
this.contactsSyncPass = ContactUserStore.syncPass;
this.saveTrigger = ko
.computed(() =>
[
this.enableContactsSync() ? '1' : '0',
this.contactsSyncUrl(),
this.contactsSyncUser(),
this.contactsSyncPass()
ContactUserStore.enableSync() ? '1' : '0',
ContactUserStore.syncUrl(),
ContactUserStore.syncUser(),
ContactUserStore.syncPass()
].join('|')
)
.extend({ debounce: 500 });
@ -36,10 +36,10 @@ export class ContactsUserSettings {
this.saveTrigger.subscribe(() => {
Remote.saveContactsSyncData(
null,
this.enableContactsSync(),
this.contactsSyncUrl(),
this.contactsSyncUser(),
this.contactsSyncPass()
ContactUserStore.enableSync(),
ContactUserStore.syncUrl(),
ContactUserStore.syncUser(),
ContactUserStore.syncPass()
);
});
}

View file

@ -8,7 +8,7 @@ import { removeFolderFromCacheList } from 'Common/Cache';
import * as Local from 'Storage/Client';
import FolderStore from 'Stores/User/Folder';
import { FolderUserStore } from 'Stores/User/Folder';
import Remote from 'Remote/User/Fetch';
@ -19,16 +19,16 @@ import { FolderSystemPopupView } from 'View/Popup/FolderSystem';
export class FoldersUserSettings {
constructor() {
this.displaySpecSetting = FolderStore.displaySpecSetting;
this.folderList = FolderStore.folderList;
this.folderListOptimized = FolderStore.folderListOptimized;
this.folderListError = FolderStore.folderListError;
this.displaySpecSetting = FolderUserStore.displaySpecSetting;
this.folderList = FolderUserStore.folderList;
this.folderListOptimized = FolderUserStore.folderListOptimized;
this.folderListError = FolderUserStore.folderListError;
this.loading = ko.computed(() => {
const loading = FolderStore.foldersLoading(),
creating = FolderStore.foldersCreating(),
deleting = FolderStore.foldersDeleting(),
renaming = FolderStore.foldersRenaming();
const loading = FolderUserStore.foldersLoading(),
creating = FolderUserStore.foldersCreating(),
deleting = FolderUserStore.foldersDeleting(),
renaming = FolderUserStore.foldersRenaming();
return loading || creating || deleting || renaming;
});
@ -64,7 +64,7 @@ export class FoldersUserSettings {
}
onShow() {
FolderStore.folderListError('');
FolderUserStore.folderListError('');
}
/*
onBuild(oDom) {
@ -98,7 +98,7 @@ export class FoldersUserSettings {
Local.set(ClientSideKeyName.FoldersLashHash, '');
FolderStore.folderList.remove(fRemoveFolder);
FolderUserStore.folderList.remove(fRemoveFolder);
rl.app.foldersPromisesActionHelper(
Remote.folderDelete(folderToRemove.fullNameRaw),
@ -108,7 +108,7 @@ export class FoldersUserSettings {
removeFolderFromCacheList(folderToRemove.fullNameRaw);
}
} else if (0 < folderToRemove.privateMessageCountAll()) {
FolderStore.folderListError(getNotification(Notification.CantDeleteNonEmptyFolder));
FolderUserStore.folderListError(getNotification(Notification.CantDeleteNonEmptyFolder));
}
}

View file

@ -9,12 +9,12 @@ import { i18n, trigger as translatorTrigger, reload as translatorReload, convert
import { showScreenPopup } from 'Knoin/Knoin';
import AppStore from 'Stores/User/App';
import { AppUserStore } from 'Stores/User/App';
import { LanguageStore } from 'Stores/Language';
import SettingsStore from 'Stores/User/Settings';
import { SettingsUserStore } from 'Stores/User/Settings';
import { IdentityUserStore } from 'Stores/User/Identity';
import NotificationStore from 'Stores/User/Notification';
import MessageStore from 'Stores/User/Message';
import { NotificationUserStore } from 'Stores/User/Notification';
import { MessageUserStore } from 'Stores/User/Message';
import Remote from 'Remote/User/Fetch';
@ -25,23 +25,23 @@ export class GeneralUserSettings {
constructor() {
this.language = LanguageStore.language;
this.languages = LanguageStore.languages;
this.messagesPerPage = SettingsStore.messagesPerPage;
this.messagesPerPage = SettingsUserStore.messagesPerPage;
this.messagesPerPageArray = MESSAGES_PER_PAGE_VALUES;
this.editorDefaultType = SettingsStore.editorDefaultType;
this.layout = SettingsStore.layout;
this.editorDefaultType = SettingsUserStore.editorDefaultType;
this.layout = SettingsUserStore.layout;
this.enableSoundNotification = NotificationStore.enableSoundNotification;
this.enableSoundNotification = NotificationUserStore.enableSoundNotification;
this.enableDesktopNotification = NotificationStore.enableDesktopNotification;
this.isDesktopNotificationDenied = NotificationStore.isDesktopNotificationDenied;
this.enableDesktopNotification = NotificationUserStore.enableDesktopNotification;
this.isDesktopNotificationDenied = NotificationUserStore.isDesktopNotificationDenied;
this.showImages = SettingsStore.showImages;
this.removeColors = SettingsStore.removeColors;
this.useCheckboxesInList = SettingsStore.useCheckboxesInList;
this.threadsAllowed = AppStore.threadsAllowed;
this.useThreads = SettingsStore.useThreads;
this.replySameFolder = SettingsStore.replySameFolder;
this.showImages = SettingsUserStore.showImages;
this.removeColors = SettingsUserStore.removeColors;
this.useCheckboxesInList = SettingsUserStore.useCheckboxesInList;
this.threadsAllowed = AppUserStore.threadsAllowed;
this.useThreads = SettingsUserStore.useThreads;
this.replySameFolder = SettingsUserStore.replySameFolder;
this.allowLanguagesOnSettings = !!SettingsGet('AllowLanguagesOnSettings');
this.languageFullName = ko.computed(() => convertLangName(this.language()));
@ -93,11 +93,11 @@ export class GeneralUserSettings {
}
testSoundNotification() {
NotificationStore.playSoundNotification(true);
NotificationUserStore.playSoundNotification(true);
}
testSystemNotification() {
NotificationStore.displayDesktopNotification('SnappyMail', 'Test notification', { });
NotificationUserStore.displayDesktopNotification('SnappyMail', 'Test notification', { });
}
onBuild() {
@ -147,14 +147,14 @@ export class GeneralUserSettings {
).debounce(3000));
this.useThreads.subscribe((value) => {
MessageStore.messageList([]);
MessageUserStore.messageList([]);
Remote.saveSettings(null, {
'UseThreads': value ? 1 : 0
});
});
this.layout.subscribe((value) => {
MessageStore.messageList([]);
MessageUserStore.messageList([]);
Remote.saveSettings(f2, {
'Layout': value
});

View file

@ -2,8 +2,8 @@ import ko from 'ko';
import { delegateRunOnDestroy } from 'Common/UtilsUser';
import PgpStore from 'Stores/User/Pgp';
import SettingsStore from 'Stores/User/Settings';
import { PgpUserStore } from 'Stores/User/Pgp';
import { SettingsUserStore } from 'Stores/User/Settings';
import Remote from 'Remote/User/Fetch';
@ -15,13 +15,13 @@ import { ViewOpenPgpKeyPopupView } from 'View/Popup/ViewOpenPgpKey';
export class OpenPgpUserSettings {
constructor() {
this.openpgpkeys = PgpStore.openpgpkeys;
this.openpgpkeysPublic = PgpStore.openpgpkeysPublic;
this.openpgpkeysPrivate = PgpStore.openpgpkeysPrivate;
this.openpgpkeys = PgpUserStore.openpgpkeys;
this.openpgpkeysPublic = PgpUserStore.openpgpkeysPublic;
this.openpgpkeysPrivate = PgpUserStore.openpgpkeysPrivate;
this.openPgpKeyForDeletion = ko.observable(null).deleteAccessHelper();
this.allowDraftAutosave = SettingsStore.allowDraftAutosave;
this.allowDraftAutosave = SettingsUserStore.allowDraftAutosave;
}
addOpenPgpKey() {
@ -46,15 +46,15 @@ export class OpenPgpUserSettings {
if (openPgpKeyToRemove && openPgpKeyToRemove.deleteAccess()) {
this.openPgpKeyForDeletion(null);
if (openPgpKeyToRemove && PgpStore.openpgpKeyring) {
const findedItem = PgpStore.openpgpkeys.find(key => openPgpKeyToRemove === key);
if (openPgpKeyToRemove && PgpUserStore.openpgpKeyring) {
const findedItem = PgpUserStore.openpgpkeys.find(key => openPgpKeyToRemove === key);
if (findedItem) {
PgpStore.openpgpkeys.remove(findedItem);
PgpUserStore.openpgpkeys.remove(findedItem);
delegateRunOnDestroy(findedItem);
PgpStore.openpgpKeyring[findedItem.isPrivate ? 'privateKeys' : 'publicKeys'].removeForId(findedItem.guid);
PgpUserStore.openpgpKeyring[findedItem.isPrivate ? 'privateKeys' : 'publicKeys'].removeForId(findedItem.guid);
PgpStore.openpgpKeyring.store();
PgpUserStore.openpgpKeyring.store();
}
rl.app.reloadOpenPgpKeys();

View file

@ -7,7 +7,7 @@ import { i18n, trigger as translatorTrigger } from 'Common/Translator';
import { showScreenPopup } from 'Knoin/Knoin';
import SettinsStore from 'Stores/User/Settings';
import { SettingsUserStore } from 'Stores/User/Settings';
import Remote from 'Remote/User/Fetch';
@ -18,7 +18,7 @@ export class SecurityUserSettings {
this.capaAutoLogout = Settings.capa(Capa.AutoLogout);
this.capaTwoFactor = Settings.capa(Capa.TwoFactor);
this.autoLogout = SettinsStore.autoLogout;
this.autoLogout = SettingsUserStore.autoLogout;
this.autoLogout.trigger = ko.observable(SaveSettingsStep.Idle);
let i18nLogout = (key, params) => i18n('SETTINGS_SECURITY/AUTOLOGIN_' + key, params);

View file

@ -2,7 +2,7 @@ import ko from 'ko';
import { i18n } from 'Common/Translator';
import TemplateStore from 'Stores/User/Template';
import { TemplateUserStore } from 'Stores/User/Template';
import Remote from 'Remote/User/Fetch';
import { showScreenPopup } from 'Knoin/Knoin';
@ -11,10 +11,10 @@ import { TemplatePopupView } from 'View/Popup/Template';
export class TemplatesUserSettings {
constructor() {
this.templates = TemplateStore.templates;
this.templates = TemplateUserStore.templates;
this.processText = ko.computed(() =>
TemplateStore.templates.loading() ? i18n('SETTINGS_TEMPLETS/LOADING_PROCESS') : ''
TemplateUserStore.templates.loading() ? i18n('SETTINGS_TEMPLETS/LOADING_PROCESS') : ''
);
this.visibility = ko.computed(() => this.processText() ? 'visible' : 'hidden');