Context Menu Hint: Fix hint showing up on page reload (#2916)
This commit is contained in:
parent
e7d70ccda6
commit
52b3e0f1a4
@ -637,8 +637,8 @@ addActionHandler('toggleMessageSelection', (global, actions, payload): ActionRet
|
|||||||
|
|
||||||
setGlobal(global);
|
setGlobal(global);
|
||||||
|
|
||||||
if (selectTabState(global, tabId).shouldShowContextMenuHint) {
|
if (global.shouldShowContextMenuHint) {
|
||||||
actions.disableContextMenuHint({ tabId });
|
actions.disableContextMenuHint();
|
||||||
actions.showNotification({
|
actions.showNotification({
|
||||||
// eslint-disable-next-line max-len
|
// 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.`,
|
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 => {
|
addActionHandler('disableContextMenuHint', (global): ActionReturnType => {
|
||||||
const { tabId = getCurrentTabId() } = payload || {};
|
if (!global.shouldShowContextMenuHint) {
|
||||||
|
|
||||||
if (!selectTabState(global, tabId).shouldShowContextMenuHint) {
|
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
return updateTabState(global, {
|
return {
|
||||||
|
...global,
|
||||||
shouldShowContextMenuHint: false,
|
shouldShowContextMenuHint: false,
|
||||||
}, tabId);
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
addActionHandler('exitMessageSelectMode', (global, actions, payload): ActionReturnType => {
|
addActionHandler('exitMessageSelectMode', (global, actions, payload): ActionReturnType => {
|
||||||
|
|||||||
@ -342,6 +342,7 @@ export function serializeGlobal<T extends GlobalState>(global: T) {
|
|||||||
'archiveSettings',
|
'archiveSettings',
|
||||||
'mediaViewer',
|
'mediaViewer',
|
||||||
'audioPlayer',
|
'audioPlayer',
|
||||||
|
'shouldShowContextMenuHint',
|
||||||
]),
|
]),
|
||||||
customEmojis: reduceCustomEmojis(global),
|
customEmojis: reduceCustomEmojis(global),
|
||||||
users: reduceUsers(global),
|
users: reduceUsers(global),
|
||||||
|
|||||||
@ -15,6 +15,7 @@ export const INITIAL_GLOBAL_STATE: GlobalState = {
|
|||||||
passcode: {},
|
passcode: {},
|
||||||
twoFaSettings: {},
|
twoFaSettings: {},
|
||||||
isUpdateAvailable: false,
|
isUpdateAvailable: false,
|
||||||
|
shouldShowContextMenuHint: true,
|
||||||
|
|
||||||
audioPlayer: {
|
audioPlayer: {
|
||||||
lastPlaybackRate: DEFAULT_PLAYBACK_RATE,
|
lastPlaybackRate: DEFAULT_PLAYBACK_RATE,
|
||||||
@ -260,8 +261,6 @@ export const INITIAL_TAB_STATE: TabState = {
|
|||||||
|
|
||||||
activeReactions: {},
|
activeReactions: {},
|
||||||
|
|
||||||
shouldShowContextMenuHint: true,
|
|
||||||
|
|
||||||
activeDownloads: {
|
activeDownloads: {
|
||||||
byChatId: {},
|
byChatId: {},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -421,8 +421,6 @@ export type TabState = {
|
|||||||
byChatId: Record<string, number[]>;
|
byChatId: Record<string, number[]>;
|
||||||
};
|
};
|
||||||
|
|
||||||
shouldShowContextMenuHint?: boolean;
|
|
||||||
|
|
||||||
statistics: {
|
statistics: {
|
||||||
byChatId: Record<string, ApiChannelStatistics | ApiGroupStatistics>;
|
byChatId: Record<string, ApiChannelStatistics | ApiGroupStatistics>;
|
||||||
currentMessage?: ApiMessageStatistics;
|
currentMessage?: ApiMessageStatistics;
|
||||||
@ -558,6 +556,7 @@ export type GlobalState = {
|
|||||||
leftColumnWidth?: number;
|
leftColumnWidth?: number;
|
||||||
lastIsChatInfoShown?: boolean;
|
lastIsChatInfoShown?: boolean;
|
||||||
initialUnreadNotifications?: number;
|
initialUnreadNotifications?: number;
|
||||||
|
shouldShowContextMenuHint?: boolean;
|
||||||
|
|
||||||
audioPlayer: {
|
audioPlayer: {
|
||||||
lastPlaybackRate: number;
|
lastPlaybackRate: number;
|
||||||
@ -1393,7 +1392,7 @@ export interface ActionPayloads {
|
|||||||
selectedAt?: number;
|
selectedAt?: number;
|
||||||
} & WithTabId;
|
} & WithTabId;
|
||||||
closeHistoryCalendar: WithTabId | undefined;
|
closeHistoryCalendar: WithTabId | undefined;
|
||||||
disableContextMenuHint: WithTabId | undefined;
|
disableContextMenuHint: undefined;
|
||||||
focusNextReply: WithTabId | undefined;
|
focusNextReply: WithTabId | undefined;
|
||||||
|
|
||||||
openMessageLanguageModal: {
|
openMessageLanguageModal: {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user