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),
|
...selectTabState(global, tabId),
|
||||||
isChatInfoShown: true,
|
isChatInfoShown: true,
|
||||||
}, tabId);
|
}, tabId);
|
||||||
|
global = { ...global, lastIsChatInfoShown: true };
|
||||||
setGlobal(global);
|
setGlobal(global);
|
||||||
|
|
||||||
actions.openChat({ ...payload, tabId });
|
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 => {
|
addActionHandler('toggleChatInfo', (global, actions, payload): ActionReturnType => {
|
||||||
const { force, tabId = getCurrentTabId() } = payload || {};
|
const { force, tabId = getCurrentTabId() } = payload || {};
|
||||||
return updateTabState(global, {
|
const isChatInfoShown = force !== undefined ? force : !selectTabState(global, tabId).isChatInfoShown;
|
||||||
isChatInfoShown: force !== undefined ? force : !selectTabState(global, tabId).isChatInfoShown,
|
|
||||||
}, tabId);
|
global = updateTabState(global, { isChatInfoShown }, tabId);
|
||||||
|
global = { ...global, lastIsChatInfoShown: isChatInfoShown };
|
||||||
|
|
||||||
|
return global;
|
||||||
});
|
});
|
||||||
|
|
||||||
addActionHandler('setLeftColumnWidth', (global, actions, payload): ActionReturnType => {
|
addActionHandler('setLeftColumnWidth', (global, actions, payload): ActionReturnType => {
|
||||||
|
|||||||
@ -384,6 +384,7 @@ export function serializeGlobal<T extends GlobalState>(global: T) {
|
|||||||
'serviceNotifications',
|
'serviceNotifications',
|
||||||
'attachmentSettings',
|
'attachmentSettings',
|
||||||
'leftColumnWidth',
|
'leftColumnWidth',
|
||||||
|
'lastIsChatInfoShown',
|
||||||
]),
|
]),
|
||||||
customEmojis: reduceCustomEmojis(global),
|
customEmojis: reduceCustomEmojis(global),
|
||||||
users: reduceUsers(global),
|
users: reduceUsers(global),
|
||||||
|
|||||||
@ -48,6 +48,7 @@ addActionHandler('init', (global, actions, payload): ActionReturnType => {
|
|||||||
|
|
||||||
const initialTabState = cloneDeep(INITIAL_TAB_STATE);
|
const initialTabState = cloneDeep(INITIAL_TAB_STATE);
|
||||||
initialTabState.id = tabId;
|
initialTabState.id = tabId;
|
||||||
|
initialTabState.isChatInfoShown = Boolean(global.lastIsChatInfoShown);
|
||||||
global = {
|
global = {
|
||||||
...global,
|
...global,
|
||||||
byTabId: {
|
byTabId: {
|
||||||
|
|||||||
@ -534,6 +534,7 @@ export type GlobalState = {
|
|||||||
serverTimeOffset: number;
|
serverTimeOffset: number;
|
||||||
blurredTabTokens: number[];
|
blurredTabTokens: number[];
|
||||||
leftColumnWidth?: number;
|
leftColumnWidth?: number;
|
||||||
|
lastIsChatInfoShown?: boolean;
|
||||||
initialUnreadNotifications?: number;
|
initialUnreadNotifications?: number;
|
||||||
notificationIndex?: number;
|
notificationIndex?: number;
|
||||||
allNotificationsCount?: number;
|
allNotificationsCount?: number;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user