mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 05:29:20 +03:00
Convert user stores to single object instances
Removed unused ContactUserStore.exportingCsv and ContactUserStore.exportingVcf
This commit is contained in:
parent
914c6e8d14
commit
6a454ec624
46 changed files with 671 additions and 710 deletions
|
|
@ -4,63 +4,59 @@ import { Focused } from 'Common/EnumsUser';
|
|||
import { keyScope, leftPanelDisabled, Settings, SettingsGet } from 'Common/Globals';
|
||||
import { ThemeStore } from 'Stores/Theme';
|
||||
|
||||
class AppUserStore {
|
||||
constructor() {
|
||||
ko.addObservablesTo(this, {
|
||||
currentAudio: '',
|
||||
export const AppUserStore = {
|
||||
attachmentsActions: ko.observableArray(),
|
||||
|
||||
focusedState: Focused.None,
|
||||
devEmail: '',
|
||||
devPassword: '',
|
||||
|
||||
projectHash: '',
|
||||
threadsAllowed: false,
|
||||
populate: () => {
|
||||
AppUserStore.projectHash(SettingsGet('ProjectHash'));
|
||||
|
||||
composeInEdit: false,
|
||||
AppUserStore.contactsAutosave(!!SettingsGet('ContactsAutosave'));
|
||||
AppUserStore.useLocalProxyForExternalImages(!!SettingsGet('UseLocalProxyForExternalImages'));
|
||||
|
||||
contactsAutosave: false,
|
||||
useLocalProxyForExternalImages: false,
|
||||
|
||||
contactsIsAllowed: false
|
||||
});
|
||||
|
||||
this.focusedState.subscribe(value => {
|
||||
switch (value) {
|
||||
case Focused.MessageList:
|
||||
keyScope(KeyState.MessageList);
|
||||
ThemeStore.isMobile() && leftPanelDisabled(true);
|
||||
break;
|
||||
case Focused.MessageView:
|
||||
keyScope(KeyState.MessageView);
|
||||
ThemeStore.isMobile() && leftPanelDisabled(true);
|
||||
break;
|
||||
case Focused.FolderList:
|
||||
keyScope(KeyState.FolderList);
|
||||
ThemeStore.isMobile() && leftPanelDisabled(false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
this.attachmentsActions = ko.observableArray();
|
||||
|
||||
this.devEmail = '';
|
||||
this.devPassword = '';
|
||||
}
|
||||
|
||||
populate() {
|
||||
this.projectHash(SettingsGet('ProjectHash'));
|
||||
|
||||
this.contactsAutosave(!!SettingsGet('ContactsAutosave'));
|
||||
this.useLocalProxyForExternalImages(!!SettingsGet('UseLocalProxyForExternalImages'));
|
||||
|
||||
this.contactsIsAllowed(!!SettingsGet('ContactsIsAllowed'));
|
||||
AppUserStore.contactsIsAllowed(!!SettingsGet('ContactsIsAllowed'));
|
||||
|
||||
const attachmentsActions = Settings.app('attachmentsActions');
|
||||
this.attachmentsActions(Array.isNotEmpty(attachmentsActions) ? attachmentsActions : []);
|
||||
AppUserStore.attachmentsActions(Array.isNotEmpty(attachmentsActions) ? attachmentsActions : []);
|
||||
|
||||
this.devEmail = SettingsGet('DevEmail');
|
||||
this.devPassword = SettingsGet('DevPassword');
|
||||
AppUserStore.devEmail = SettingsGet('DevEmail');
|
||||
AppUserStore.devPassword = SettingsGet('DevPassword');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default new AppUserStore();
|
||||
ko.addObservablesTo(AppUserStore, {
|
||||
currentAudio: '',
|
||||
|
||||
focusedState: Focused.None,
|
||||
|
||||
projectHash: '',
|
||||
threadsAllowed: false,
|
||||
|
||||
composeInEdit: false,
|
||||
|
||||
contactsAutosave: false,
|
||||
useLocalProxyForExternalImages: false,
|
||||
|
||||
contactsIsAllowed: false
|
||||
});
|
||||
|
||||
AppUserStore.focusedState.subscribe(value => {
|
||||
switch (value) {
|
||||
case Focused.MessageList:
|
||||
keyScope(KeyState.MessageList);
|
||||
ThemeStore.isMobile() && leftPanelDisabled(true);
|
||||
break;
|
||||
case Focused.MessageView:
|
||||
keyScope(KeyState.MessageView);
|
||||
ThemeStore.isMobile() && leftPanelDisabled(true);
|
||||
break;
|
||||
case Focused.FolderList:
|
||||
keyScope(KeyState.FolderList);
|
||||
ThemeStore.isMobile() && leftPanelDisabled(false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue