snappymail/dev/Stores/User/App.js
djmaze eff92c3152 Cleanup AppUserStore
Simplify KeyState/Focused as Scope enum
2021-03-16 16:06:16 +01:00

33 lines
747 B
JavaScript

import { Scope } from 'Common/Enums';
import { keyScope, leftPanelDisabled, SettingsGet } from 'Common/Globals';
import { addObservablesTo } from 'Common/Utils';
import { ThemeStore } from 'Stores/Theme';
export const AppUserStore = {
populate: () => {
AppUserStore.contactsIsAllowed(!!SettingsGet('ContactsIsAllowed'));
}
};
addObservablesTo(AppUserStore, {
currentAudio: '',
focusedState: Scope.None,
threadsAllowed: false,
composeInEdit: false,
contactsIsAllowed: false
});
AppUserStore.focusedState.subscribe(value => {
switch (value) {
case Scope.MessageList:
case Scope.MessageView:
case Scope.FolderList:
keyScope(value);
ThemeStore.isMobile() && leftPanelDisabled(Scope.FolderList !== value);
break;
}
});