diff --git a/src/global/actions/ui/messages.ts b/src/global/actions/ui/messages.ts index 07e7fb5c4..6fb8da09d 100644 --- a/src/global/actions/ui/messages.ts +++ b/src/global/actions/ui/messages.ts @@ -637,8 +637,8 @@ addActionHandler('toggleMessageSelection', (global, actions, payload): ActionRet setGlobal(global); - if (selectTabState(global, tabId).shouldShowContextMenuHint) { - actions.disableContextMenuHint({ tabId }); + if (global.shouldShowContextMenuHint) { + actions.disableContextMenuHint(); actions.showNotification({ // eslint-disable-next-line max-len message: `To **edit** or **reply**, close this menu. Then ${IS_TOUCH_ENV ? 'long tap' : 'right click'} on a message.`, @@ -647,16 +647,15 @@ addActionHandler('toggleMessageSelection', (global, actions, payload): ActionRet } }); -addActionHandler('disableContextMenuHint', (global, actions, payload): ActionReturnType => { - const { tabId = getCurrentTabId() } = payload || {}; - - if (!selectTabState(global, tabId).shouldShowContextMenuHint) { +addActionHandler('disableContextMenuHint', (global): ActionReturnType => { + if (!global.shouldShowContextMenuHint) { return undefined; } - return updateTabState(global, { + return { + ...global, shouldShowContextMenuHint: false, - }, tabId); + }; }); addActionHandler('exitMessageSelectMode', (global, actions, payload): ActionReturnType => { diff --git a/src/global/cache.ts b/src/global/cache.ts index b53abad4a..9b509382b 100644 --- a/src/global/cache.ts +++ b/src/global/cache.ts @@ -342,6 +342,7 @@ export function serializeGlobal(global: T) { 'archiveSettings', 'mediaViewer', 'audioPlayer', + 'shouldShowContextMenuHint', ]), customEmojis: reduceCustomEmojis(global), users: reduceUsers(global), diff --git a/src/global/initialState.ts b/src/global/initialState.ts index d2707d341..1b9e5d2f9 100644 --- a/src/global/initialState.ts +++ b/src/global/initialState.ts @@ -15,6 +15,7 @@ export const INITIAL_GLOBAL_STATE: GlobalState = { passcode: {}, twoFaSettings: {}, isUpdateAvailable: false, + shouldShowContextMenuHint: true, audioPlayer: { lastPlaybackRate: DEFAULT_PLAYBACK_RATE, @@ -260,8 +261,6 @@ export const INITIAL_TAB_STATE: TabState = { activeReactions: {}, - shouldShowContextMenuHint: true, - activeDownloads: { byChatId: {}, }, diff --git a/src/global/types.ts b/src/global/types.ts index f80df0d99..0fc9b6e2a 100644 --- a/src/global/types.ts +++ b/src/global/types.ts @@ -421,8 +421,6 @@ export type TabState = { byChatId: Record; }; - shouldShowContextMenuHint?: boolean; - statistics: { byChatId: Record; currentMessage?: ApiMessageStatistics; @@ -558,6 +556,7 @@ export type GlobalState = { leftColumnWidth?: number; lastIsChatInfoShown?: boolean; initialUnreadNotifications?: number; + shouldShowContextMenuHint?: boolean; audioPlayer: { lastPlaybackRate: number; @@ -1393,7 +1392,7 @@ export interface ActionPayloads { selectedAt?: number; } & WithTabId; closeHistoryCalendar: WithTabId | undefined; - disableContextMenuHint: WithTabId | undefined; + disableContextMenuHint: undefined; focusNextReply: WithTabId | undefined; openMessageLanguageModal: {