2021-03-16 23:06:16 +08:00
|
|
|
import { Scope } from 'Common/Enums';
|
|
|
|
import { keyScope, leftPanelDisabled, SettingsGet } from 'Common/Globals';
|
2021-03-16 17:59:47 +08:00
|
|
|
import { addObservablesTo } from 'Common/Utils';
|
2021-02-17 03:12:23 +08:00
|
|
|
import { ThemeStore } from 'Stores/Theme';
|
2020-09-04 18:05:17 +08:00
|
|
|
|
2021-03-11 05:41:35 +08:00
|
|
|
export const AppUserStore = {
|
2021-03-17 17:05:22 +08:00
|
|
|
allowContacts: () => !!SettingsGet('ContactsIsAllowed')
|
2021-03-11 05:41:35 +08:00
|
|
|
};
|
|
|
|
|
2021-03-16 17:59:47 +08:00
|
|
|
addObservablesTo(AppUserStore, {
|
2021-03-16 23:06:16 +08:00
|
|
|
focusedState: Scope.None,
|
2021-03-11 05:41:35 +08:00
|
|
|
|
|
|
|
threadsAllowed: false,
|
|
|
|
|
2021-03-17 17:05:22 +08:00
|
|
|
composeInEdit: false
|
2021-03-11 05:41:35 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
AppUserStore.focusedState.subscribe(value => {
|
|
|
|
switch (value) {
|
2021-03-16 23:06:16 +08:00
|
|
|
case Scope.MessageList:
|
|
|
|
case Scope.MessageView:
|
|
|
|
case Scope.FolderList:
|
|
|
|
keyScope(value);
|
|
|
|
ThemeStore.isMobile() && leftPanelDisabled(Scope.FolderList !== value);
|
2021-03-11 05:41:35 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
});
|