Profile Info: Save state for multi-tabs (#2434)
This commit is contained in:
parent
fa7971a6a0
commit
6c4acf8935
@ -87,6 +87,7 @@ addActionHandler('openChatWithInfo', (global, actions, payload): ActionReturnTyp
|
||||
...selectTabState(global, tabId),
|
||||
isChatInfoShown: true,
|
||||
}, tabId);
|
||||
global = { ...global, lastIsChatInfoShown: true };
|
||||
setGlobal(global);
|
||||
|
||||
actions.openChat({ ...payload, tabId });
|
||||
|
||||
@ -26,9 +26,12 @@ const MAX_STORED_EMOJIS = 8 * 4; // Represents four rows of recent emojis
|
||||
|
||||
addActionHandler('toggleChatInfo', (global, actions, payload): ActionReturnType => {
|
||||
const { force, tabId = getCurrentTabId() } = payload || {};
|
||||
return updateTabState(global, {
|
||||
isChatInfoShown: force !== undefined ? force : !selectTabState(global, tabId).isChatInfoShown,
|
||||
}, tabId);
|
||||
const isChatInfoShown = force !== undefined ? force : !selectTabState(global, tabId).isChatInfoShown;
|
||||
|
||||
global = updateTabState(global, { isChatInfoShown }, tabId);
|
||||
global = { ...global, lastIsChatInfoShown: isChatInfoShown };
|
||||
|
||||
return global;
|
||||
});
|
||||
|
||||
addActionHandler('setLeftColumnWidth', (global, actions, payload): ActionReturnType => {
|
||||
|
||||
@ -384,6 +384,7 @@ export function serializeGlobal<T extends GlobalState>(global: T) {
|
||||
'serviceNotifications',
|
||||
'attachmentSettings',
|
||||
'leftColumnWidth',
|
||||
'lastIsChatInfoShown',
|
||||
]),
|
||||
customEmojis: reduceCustomEmojis(global),
|
||||
users: reduceUsers(global),
|
||||
|
||||
@ -48,6 +48,7 @@ addActionHandler('init', (global, actions, payload): ActionReturnType => {
|
||||
|
||||
const initialTabState = cloneDeep(INITIAL_TAB_STATE);
|
||||
initialTabState.id = tabId;
|
||||
initialTabState.isChatInfoShown = Boolean(global.lastIsChatInfoShown);
|
||||
global = {
|
||||
...global,
|
||||
byTabId: {
|
||||
|
||||
@ -534,6 +534,7 @@ export type GlobalState = {
|
||||
serverTimeOffset: number;
|
||||
blurredTabTokens: number[];
|
||||
leftColumnWidth?: number;
|
||||
lastIsChatInfoShown?: boolean;
|
||||
initialUnreadNotifications?: number;
|
||||
notificationIndex?: number;
|
||||
allNotificationsCount?: number;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user