mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-05 23:47:03 +03:00
Prepare some code for cleaner account switching without reload
This commit is contained in:
parent
15ae0380ba
commit
b057c4083e
3 changed files with 37 additions and 26 deletions
|
|
@ -674,18 +674,6 @@ class AppUser extends AbstractApp {
|
||||||
Local.set(ClientSideKeyName.ExpandedFolders, aExpandedList);
|
Local.set(ClientSideKeyName.ExpandedFolders, aExpandedList);
|
||||||
}
|
}
|
||||||
|
|
||||||
initLeftSideLayoutResizer() {
|
|
||||||
const left = elementById('rl-left'),
|
|
||||||
right = elementById('rl-right'),
|
|
||||||
fToggle = () =>
|
|
||||||
setLayoutResizer(left, right, ClientSideKeyName.FolderListSize,
|
|
||||||
(ThemeStore.isMobile() || leftPanelDisabled()) ? 0 : 'Width');
|
|
||||||
if (left && right) {
|
|
||||||
fToggle();
|
|
||||||
leftPanelDisabled.subscribe(fToggle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} link
|
* @param {string} link
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
|
|
@ -755,7 +743,7 @@ class AppUser extends AbstractApp {
|
||||||
|
|
||||||
ContactUserStore.init();
|
ContactUserStore.init();
|
||||||
|
|
||||||
this.accountsAndIdentities(true);
|
this.accountsAndIdentities();
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const cF = FolderUserStore.currentFolderFullNameRaw();
|
const cF = FolderUserStore.currentFolderFullNameRaw();
|
||||||
|
|
@ -791,7 +779,18 @@ class AppUser extends AbstractApp {
|
||||||
);
|
);
|
||||||
SettingsUserStore.delayLogout();
|
SettingsUserStore.delayLogout();
|
||||||
|
|
||||||
setTimeout(() => this.initLeftSideLayoutResizer(), 1);
|
// initLeftSideLayoutResizer
|
||||||
|
setTimeout(() => {
|
||||||
|
const left = elementById('rl-left'),
|
||||||
|
right = elementById('rl-right'),
|
||||||
|
fToggle = () =>
|
||||||
|
setLayoutResizer(left, right, ClientSideKeyName.FolderListSize,
|
||||||
|
(ThemeStore.isMobile() || leftPanelDisabled()) ? 0 : 'Width');
|
||||||
|
if (left && right) {
|
||||||
|
fToggle();
|
||||||
|
leftPanelDisabled.subscribe(fToggle);
|
||||||
|
}
|
||||||
|
}, 1);
|
||||||
|
|
||||||
setInterval(this.reloadTime(), 60000);
|
setInterval(this.reloadTime(), 60000);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,20 +7,21 @@ let FOLDERS_CACHE = {},
|
||||||
FOLDERS_UID_NEXT_CACHE = {},
|
FOLDERS_UID_NEXT_CACHE = {},
|
||||||
MESSAGE_FLAGS_CACHE = {},
|
MESSAGE_FLAGS_CACHE = {},
|
||||||
NEW_MESSAGE_CACHE = {},
|
NEW_MESSAGE_CACHE = {},
|
||||||
|
REQUESTED_MESSAGE_CACHE = {},
|
||||||
inboxFolderName = 'INBOX';
|
inboxFolderName = 'INBOX';
|
||||||
|
|
||||||
const REQUESTED_MESSAGE_CACHE = {};
|
|
||||||
|
|
||||||
export const
|
export const
|
||||||
/**
|
/**
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
clear = () => {
|
clearCache = () => {
|
||||||
FOLDERS_CACHE = {};
|
FOLDERS_CACHE = {};
|
||||||
FOLDERS_NAME_CACHE = {};
|
FOLDERS_NAME_CACHE = {};
|
||||||
FOLDERS_HASH_CACHE = {};
|
FOLDERS_HASH_CACHE = {};
|
||||||
FOLDERS_UID_NEXT_CACHE = {};
|
FOLDERS_UID_NEXT_CACHE = {};
|
||||||
MESSAGE_FLAGS_CACHE = {};
|
MESSAGE_FLAGS_CACHE = {};
|
||||||
|
NEW_MESSAGE_CACHE = {};
|
||||||
|
REQUESTED_MESSAGE_CACHE = {};
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
import { AppUserStore } from 'Stores/User/App';
|
import { AppUserStore } from 'Stores/User/App';
|
||||||
import { AccountUserStore } from 'Stores/User/Account';
|
import { AccountUserStore } from 'Stores/User/Account';
|
||||||
import { MessageUserStore } from 'Stores/User/Message';
|
import { MessageUserStore } from 'Stores/User/Message';
|
||||||
|
//import { FolderUserStore } from 'Stores/User/Folder';
|
||||||
|
|
||||||
import { Capa, Scope } from 'Common/Enums';
|
import { Capa, Scope } from 'Common/Enums';
|
||||||
import { settings } from 'Common/Links';
|
import { /*root,*/ settings } from 'Common/Links';
|
||||||
|
|
||||||
import { showScreenPopup } from 'Knoin/Knoin';
|
import { showScreenPopup } from 'Knoin/Knoin';
|
||||||
import { AbstractViewRight } from 'Knoin/AbstractViews';
|
import { AbstractViewRight } from 'Knoin/AbstractViews';
|
||||||
|
|
@ -12,13 +13,13 @@ import { KeyboardShortcutsHelpPopupView } from 'View/Popup/KeyboardShortcutsHelp
|
||||||
import { AccountPopupView } from 'View/Popup/Account';
|
import { AccountPopupView } from 'View/Popup/Account';
|
||||||
import { ContactsPopupView } from 'View/Popup/Contacts';
|
import { ContactsPopupView } from 'View/Popup/Contacts';
|
||||||
|
|
||||||
import { doc, Settings, leftPanelDisabled } from 'Common/Globals';
|
import { doc, Settings/*, SettingsGet*/, leftPanelDisabled } from 'Common/Globals';
|
||||||
|
|
||||||
import { ThemeStore } from 'Stores/Theme';
|
import { ThemeStore } from 'Stores/Theme';
|
||||||
|
|
||||||
import Remote from 'Remote/User/Fetch';
|
import Remote from 'Remote/User/Fetch';
|
||||||
import { getNotification } from 'Common/Translator';
|
import { getNotification } from 'Common/Translator';
|
||||||
//import { FolderUserStore } from 'Stores/User/Folder';
|
//import { clearCache } from 'Common/Cache';
|
||||||
|
|
||||||
export class SystemDropDownUserView extends AbstractViewRight {
|
export class SystemDropDownUserView extends AbstractViewRight {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
@ -61,13 +62,23 @@ export class SystemDropDownUserView extends AbstractViewRight {
|
||||||
showScreenPopup(AccountPopupView, [account]);
|
showScreenPopup(AccountPopupView, [account]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/*
|
/* // Not working yet
|
||||||
// This does not work yet:
|
|
||||||
FolderUserStore.folderList([]);
|
|
||||||
MessageUserStore.list([]);
|
|
||||||
Object.entries(oData.Result).forEach((key, value) => rl.settings.set(key, value));
|
Object.entries(oData.Result).forEach((key, value) => rl.settings.set(key, value));
|
||||||
3. reload Folders = Remote.foldersReload
|
clearCache();
|
||||||
4. Change to INBOX = reload MessageList
|
// MessageUserStore.setMessage();
|
||||||
|
// MessageUserStore.purgeMessageBodyCache();
|
||||||
|
// MessageUserStore.hideMessageBodies();
|
||||||
|
MessageUserStore.list([]);
|
||||||
|
// FolderUserStore.folderList([]);
|
||||||
|
Remote.foldersReload(value => {
|
||||||
|
if (value) {
|
||||||
|
value = SettingsGet('StartupUrl');
|
||||||
|
rl.route.setHash(root(value), true);
|
||||||
|
// 4. Change to INBOX = reload MessageList
|
||||||
|
// MessageUserStore.setMessageList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AccountUserStore.loading(false);
|
||||||
*/
|
*/
|
||||||
// rl.route.reload();
|
// rl.route.reload();
|
||||||
location.reload();
|
location.reload();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue