diff --git a/native/chat/chat-item-height-measurer.react.js b/native/chat/chat-item-height-measurer.react.js --- a/native/chat/chat-item-height-measurer.react.js +++ b/native/chat/chat-item-height-measurer.react.js @@ -102,6 +102,7 @@ pendingUploads, reactions: item.reactions, hasBeenEdited: item.hasBeenEdited, + isPinned: item.isPinned, ...sizes, }; } @@ -128,6 +129,7 @@ contentHeight: height, reactions: item.reactions, hasBeenEdited: item.hasBeenEdited, + isPinned: item.isPinned, }; } invariant( 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 @@ -5,6 +5,7 @@ import { useOnPressReport } from './message-report-utils.js'; import MultimediaMessageTooltipButton from './multimedia-message-tooltip-button.react.js'; import { useAnimatedNavigateToSidebar } from './sidebar-navigation.js'; +import CommIcon from '../components/comm-icon.react.js'; import SWMansionIcon from '../components/swmansion-icon.react.js'; import { createTooltip, @@ -25,6 +26,16 @@ ): React.Node { const { route, tooltipItem: TooltipItem } = props; + const onPressTogglePin = React.useCallback(() => {}, []); + const renderPinIcon = React.useCallback( + style => , + [], + ); + const renderUnpinIcon = React.useCallback( + style => , + [], + ); + const onPressSidebar = useAnimatedNavigateToSidebar(route.params.item); const renderSidebarIcon = React.useCallback( style => ( @@ -41,6 +52,20 @@ return ( <> + + ); }); 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 @@ -67,6 +67,16 @@ [], ); + const onPressTogglePin = React.useCallback(() => {}, []); + const renderPinIcon = React.useCallback( + style => , + [], + ); + const renderUnpinIcon = React.useCallback( + style => , + [], + ); + const onPressCopy = React.useCallback(() => { Clipboard.setString(text); setTimeout(confirmCopy); @@ -105,6 +115,20 @@ renderIcon={renderEditIcon} key="edit" /> + + { message: ?React.ElementRef; @@ -81,6 +82,7 @@ canCreateSidebarFromMessage, canEditMessage, shouldRenderEditButton, + canTogglePins, ...viewProps } = this.props; @@ -147,6 +149,10 @@ result.push('edit'); } + if (this.props.canTogglePins) { + this.props.item.isPinned ? result.push('unpin') : result.push('pin'); + } + if ( this.props.item.threadCreatedFromMessage || this.props.canCreateSidebarFromMessage @@ -256,6 +262,11 @@ props.item.messageInfo, ); + const canTogglePins = threadHasPermission( + props.item.threadInfo, + threadPermissions.MANAGE_PINS, + ); + React.useEffect(() => clearMarkdownContextData, [clearMarkdownContextData]); return ( @@ -267,6 +278,7 @@ isLinkModalActive={isLinkModalActive} canEditMessage={canEditMessage} shouldRenderEditButton={shouldRenderEditButton} + canTogglePins={canTogglePins} /> ); }); diff --git a/native/types/chat-types.js b/native/types/chat-types.js --- a/native/types/chat-types.js +++ b/native/types/chat-types.js @@ -39,6 +39,7 @@ +threadCreatedFromMessage: ?ThreadInfo, +reactions: ReactionInfo, +hasBeenEdited: ?boolean, + +isPinned: ?boolean, }; export type MultimediaContentSizes = { @@ -60,6 +61,7 @@ +pendingUploads: ?MessagePendingUploads, +reactions: ReactionInfo, +hasBeenEdited: ?boolean, + +isPinned: ?boolean, }; export type ChatMessageInfoItemWithHeight =