diff --git a/native/chat/multimedia-message-tooltip-modal.react.js b/native/chat/multimedia-message-tooltip-modal.react.js --- a/native/chat/multimedia-message-tooltip-modal.react.js +++ b/native/chat/multimedia-message-tooltip-modal.react.js @@ -11,6 +11,7 @@ import type { VerticalBounds } from '../types/layout-types'; import { onPressReport } from './message-report-utils'; import MultimediaMessageTooltipButton from './multimedia-message-tooltip-button.react'; +import { onPressReact } from './reaction-message-utils'; import { navigateToSidebar } from './sidebar-navigation'; export type MultimediaMessageTooltipModalParams = TooltipParams<{ @@ -25,6 +26,11 @@ text: 'Thread', onPress: navigateToSidebar, }, + { + id: 'react', + text: '👍', + onPress: onPressReact, + }, { id: 'report', text: 'Report', diff --git a/native/chat/multimedia-message.react.js b/native/chat/multimedia-message.react.js --- a/native/chat/multimedia-message.react.js +++ b/native/chat/multimedia-message.react.js @@ -31,6 +31,7 @@ getMediaKey, multimediaMessageSendFailed, } from './multimedia-message-utils'; +import { useCanCreateReactionFromMessage } from './reaction-message-utils'; import { getMessageTooltipKey } from './utils'; type BaseProps = { @@ -47,6 +48,7 @@ +overlayContext: ?OverlayContextType, +chatContext: ?ChatContextType, +canCreateSidebarFromMessage: boolean, + +canCreateReactionFromMessage: boolean, }; type State = { +clickable: boolean, @@ -92,6 +94,10 @@ result.push('sidebar'); } + if (this.props.canCreateReactionFromMessage) { + result.push('react'); + } + if (!this.props.item.messageInfo.creator.isViewer) { result.push('report'); } @@ -192,6 +198,7 @@ overlayContext, chatContext, canCreateSidebarFromMessage, + canCreateReactionFromMessage, ...viewProps } = this.props; return ( @@ -233,6 +240,11 @@ props.item.threadInfo, props.item.messageInfo, ); + const canCreateReactionFromMessage = useCanCreateReactionFromMessage( + props.item.threadInfo, + props.item.messageInfo, + ); + return ( ); }, diff --git a/native/chat/robotext-message-tooltip-modal.react.js b/native/chat/robotext-message-tooltip-modal.react.js --- a/native/chat/robotext-message-tooltip-modal.react.js +++ b/native/chat/robotext-message-tooltip-modal.react.js @@ -8,6 +8,7 @@ type BaseTooltipProps, } from '../navigation/tooltip.react'; import type { ChatRobotextMessageInfoItemWithHeight } from '../types/chat-types'; +import { onPressReact } from './reaction-message-utils'; import RobotextMessageTooltipButton from './robotext-message-tooltip-button.react'; import { navigateToSidebar } from './sidebar-navigation'; @@ -22,6 +23,11 @@ text: 'Thread', onPress: navigateToSidebar, }, + { + id: 'react', + text: '👍', + onPress: onPressReact, + }, ], }; diff --git a/native/chat/robotext-message.react.js b/native/chat/robotext-message.react.js --- a/native/chat/robotext-message.react.js +++ b/native/chat/robotext-message.react.js @@ -21,6 +21,7 @@ import type { ChatNavigationProp } from './chat.react'; import { InlineSidebar } from './inline-sidebar.react'; import { InnerRobotextMessage } from './inner-robotext-message.react'; +import { useCanCreateReactionFromMessage } from './reaction-message-utils'; import { Timestamp } from './timestamp.react'; import { getMessageTooltipKey, useContentAndHeaderOpacity } from './utils'; @@ -79,12 +80,29 @@ item.threadInfo, item.messageInfo, ); + + const canCreateReactionFromMessage = useCanCreateReactionFromMessage( + item.threadInfo, + item.messageInfo, + ); + const visibleEntryIDs = React.useMemo(() => { + const result = []; + if (item.threadCreatedFromMessage || canCreateSidebarFromMessage) { - return ['sidebar']; + result.push('sidebar'); } - return []; - }, [item.threadCreatedFromMessage, canCreateSidebarFromMessage]); + + if (canCreateReactionFromMessage) { + result.push('react'); + } + + return result; + }, [ + item.threadCreatedFromMessage, + canCreateSidebarFromMessage, + canCreateReactionFromMessage, + ]); const openRobotextTooltipModal = React.useCallback( (x, y, width, height, pageX, pageY) => { diff --git a/native/chat/text-message-tooltip-modal.react.js b/native/chat/text-message-tooltip-modal.react.js --- a/native/chat/text-message-tooltip-modal.react.js +++ b/native/chat/text-message-tooltip-modal.react.js @@ -17,6 +17,7 @@ } from '../navigation/tooltip.react'; import type { ChatTextMessageInfoItemWithHeight } from '../types/chat-types'; import { onPressReport } from './message-report-utils'; +import { onPressReact } from './reaction-message-utils'; import { navigateToSidebar } from './sidebar-navigation'; import TextMessageTooltipButton from './text-message-tooltip-button.react'; @@ -53,6 +54,11 @@ onPress: navigateToSidebar, }, { id: 'copy', text: 'Copy', onPress: onPressCopy }, + { + id: 'react', + text: '👍', + onPress: onPressReact, + }, { id: 'report', text: 'Report', diff --git a/native/chat/text-message.react.js b/native/chat/text-message.react.js --- a/native/chat/text-message.react.js +++ b/native/chat/text-message.react.js @@ -29,6 +29,7 @@ MessagePressResponderContext, type MessagePressResponderContextType, } from './message-press-responder-context'; +import { useCanCreateReactionFromMessage } from './reaction-message-utils'; import textMessageSendFailed from './text-message-send-failed'; import { getMessageTooltipKey } from './utils'; @@ -45,6 +46,7 @@ ...BaseProps, // Redux state +canCreateSidebarFromMessage: boolean, + +canCreateReactionFromMessage: boolean, // withOverlayContext +overlayContext: ?OverlayContextType, // ChatContext @@ -75,6 +77,7 @@ chatContext, isLinkModalActive, canCreateSidebarFromMessage, + canCreateReactionFromMessage, ...viewProps } = this.props; @@ -144,6 +147,10 @@ result.push('sidebar'); } + if (this.props.canCreateReactionFromMessage) { + result.push('react'); + } + if (!this.props.item.messageInfo.creator.isViewer) { result.push('report'); } @@ -238,6 +245,10 @@ props.item.threadInfo, props.item.messageInfo, ); + const canCreateReactionFromMessage = useCanCreateReactionFromMessage( + props.item.threadInfo, + props.item.messageInfo, + ); React.useEffect(() => clearMarkdownContextData, [clearMarkdownContextData]); @@ -245,6 +256,7 @@