Message: Dynamically adapt to touch screen (#3456)

This commit is contained in:
Alexander Zinchuk 2023-07-05 13:15:44 +02:00
parent f7d1002312
commit 804809e737

View File

@ -29,7 +29,7 @@ import type { ObserveFn } from '../../../hooks/useIntersectionObserver';
import { useOnIntersect } from '../../../hooks/useIntersectionObserver'; import { useOnIntersect } from '../../../hooks/useIntersectionObserver';
import type { PinnedIntersectionChangedCallback } from '../hooks/usePinnedMessage'; import type { PinnedIntersectionChangedCallback } from '../hooks/usePinnedMessage';
import { IS_ANDROID, IS_TOUCH_ENV } from '../../../util/windowEnvironment'; import { IS_ANDROID } from '../../../util/windowEnvironment';
import { EMOJI_STATUS_LOOP_LIMIT, GENERAL_TOPIC_ID, IS_ELECTRON } from '../../../config'; import { EMOJI_STATUS_LOOP_LIMIT, GENERAL_TOPIC_ID, IS_ELECTRON } from '../../../config';
import { import {
selectAllowedMessageActions, selectAllowedMessageActions,
@ -384,7 +384,7 @@ const Message: FC<OwnProps & StateProps> = ({
const [isTranscriptionHidden, setTranscriptionHidden] = useState(false); const [isTranscriptionHidden, setTranscriptionHidden] = useState(false);
const [hasActiveStickerEffect, startStickerEffect, stopStickerEffect] = useFlag(); const [hasActiveStickerEffect, startStickerEffect, stopStickerEffect] = useFlag();
const { isMobile } = useAppLayout(); const { isMobile, isTouchScreen } = useAppLayout();
useOnIntersect(bottomMarkerRef, observeIntersectionForBottom); useOnIntersect(bottomMarkerRef, observeIntersectionForBottom);
@ -396,7 +396,7 @@ const Message: FC<OwnProps & StateProps> = ({
handleContextMenu: onContextMenu, handleContextMenu: onContextMenu,
handleContextMenuClose, handleContextMenuClose,
handleContextMenuHide, handleContextMenuHide,
} = useContextMenuHandlers(ref, IS_TOUCH_ENV && isInSelectMode, !IS_ELECTRON, IS_ANDROID); } = useContextMenuHandlers(ref, isTouchScreen && isInSelectMode, !IS_ELECTRON, IS_ANDROID);
useEffect(() => { useEffect(() => {
if (isContextMenuOpen) { if (isContextMenuOpen) {
@ -608,7 +608,7 @@ const Message: FC<OwnProps & StateProps> = ({
&& !noComments; && !noComments;
const withCommentButton = repliesThreadInfo && !isInDocumentGroupNotLast && messageListType === 'thread' const withCommentButton = repliesThreadInfo && !isInDocumentGroupNotLast && messageListType === 'thread'
&& !noComments; && !noComments;
const withQuickReactionButton = !IS_TOUCH_ENV && !phoneCall && !isInSelectMode && defaultReaction const withQuickReactionButton = !isTouchScreen && !phoneCall && !isInSelectMode && defaultReaction
&& !isInDocumentGroupNotLast; && !isInDocumentGroupNotLast;
const contentClassName = buildContentClassName(message, { const contentClassName = buildContentClassName(message, {