@droppii-org/chat-mobile 0.2.6 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/module/components/AttachmentPreview.js +250 -0
- package/lib/module/components/AttachmentPreview.js.map +1 -0
- package/lib/module/components/MediaViewer/index.js +2 -0
- package/lib/module/components/MediaViewer/index.js.map +1 -0
- package/lib/module/components/MediaViewerModal.js +57 -0
- package/lib/module/components/MediaViewerModal.js.map +1 -0
- package/lib/module/components/MergedImageGrid.js +173 -0
- package/lib/module/components/MergedImageGrid.js.map +1 -0
- package/lib/module/components/ThreadCard/AvatarSection.js +4 -4
- package/lib/module/components/ThreadCard/AvatarSection.js.map +1 -1
- package/lib/module/components/ThreadCard/NamePrefixIcon.js +13 -16
- package/lib/module/components/ThreadCard/NamePrefixIcon.js.map +1 -1
- package/lib/module/components/ThreadCard/ThreadCard.js +13 -33
- package/lib/module/components/ThreadCard/ThreadCard.js.map +1 -1
- package/lib/module/components/ThreadCard/thread-card.utils.js +80 -4
- package/lib/module/components/ThreadCard/thread-card.utils.js.map +1 -1
- package/lib/module/components/messages/fileMessage/index.js +26 -0
- package/lib/module/components/messages/fileMessage/index.js.map +1 -0
- package/lib/module/components/messages/imageMessage/index.js +118 -0
- package/lib/module/components/messages/imageMessage/index.js.map +1 -0
- package/lib/module/components/messages/linkMessage/index.js +122 -0
- package/lib/module/components/messages/linkMessage/index.js.map +1 -0
- package/lib/module/components/messages/mergedMessage/index.js +37 -0
- package/lib/module/components/messages/mergedMessage/index.js.map +1 -0
- package/lib/module/components/messages/styles.js +41 -0
- package/lib/module/components/messages/styles.js.map +1 -0
- package/lib/module/components/messages/textMessage/index.js +38 -0
- package/lib/module/components/messages/textMessage/index.js.map +1 -0
- package/lib/module/components/messages/types.js +14 -0
- package/lib/module/components/messages/types.js.map +1 -0
- package/lib/module/components/messages/videoMessage/index.js +110 -0
- package/lib/module/components/messages/videoMessage/index.js.map +1 -0
- package/lib/module/config/api-endpoints.js +66 -0
- package/lib/module/config/api-endpoints.js.map +1 -0
- package/lib/module/config/attachment-priority.js +81 -0
- package/lib/module/config/attachment-priority.js.map +1 -0
- package/lib/module/config/configuration.js +50 -0
- package/lib/module/config/configuration.js.map +1 -0
- package/lib/module/config/index.js +22 -0
- package/lib/module/config/index.js.map +1 -0
- package/lib/module/context/ChatContext.js +7 -6
- package/lib/module/context/ChatContext.js.map +1 -1
- package/lib/module/core/index.js +19 -1
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/core/useChatListener.js +0 -14
- package/lib/module/core/useChatListener.js.map +1 -1
- package/lib/module/hooks/message/useSendMessage.js +106 -0
- package/lib/module/hooks/message/useSendMessage.js.map +1 -0
- package/lib/module/hooks/useChatMessages.js +36 -121
- package/lib/module/hooks/useChatMessages.js.map +1 -1
- package/lib/module/hooks/useConversationList.js +29 -17
- package/lib/module/hooks/useConversationList.js.map +1 -1
- package/lib/module/hooks/useImageAttachment.js +263 -0
- package/lib/module/hooks/useImageAttachment.js.map +1 -0
- package/lib/module/hooks/useLinkPreview/useLinkPreview.js +3 -2
- package/lib/module/hooks/useLinkPreview/useLinkPreview.js.map +1 -1
- package/lib/module/hooks/useMediaViewer.js +24 -0
- package/lib/module/hooks/useMediaViewer.js.map +1 -0
- package/lib/module/hooks/useSendAttachment.js +182 -0
- package/lib/module/hooks/useSendAttachment.js.map +1 -0
- package/lib/module/hooks/useVideoAttachment.js +251 -0
- package/lib/module/hooks/useVideoAttachment.js.map +1 -0
- package/lib/module/index.js +13 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/screens/MediaView/VideoPlayer.js +177 -0
- package/lib/module/screens/MediaView/VideoPlayer.js.map +1 -0
- package/lib/module/screens/MediaView/index.js +264 -0
- package/lib/module/screens/MediaView/index.js.map +1 -0
- package/lib/module/screens/chat-detail/ChatComposer.js +190 -196
- package/lib/module/screens/chat-detail/ChatComposer.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatDetail.js +106 -71
- package/lib/module/screens/chat-detail/ChatDetail.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatDetailHeader.js +5 -8
- package/lib/module/screens/chat-detail/ChatDetailHeader.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatLinkPreview.js +1 -1
- package/lib/module/screens/chat-detail/ChatLinkPreview.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatListLegend.js +5 -15
- package/lib/module/screens/chat-detail/ChatListLegend.js.map +1 -1
- package/lib/module/screens/chat-detail/components/ChatInputActions.js +51 -0
- package/lib/module/screens/chat-detail/components/ChatInputActions.js.map +1 -0
- package/lib/module/screens/chat-detail/components/ChatMessageInput.js +93 -0
- package/lib/module/screens/chat-detail/components/ChatMessageInput.js.map +1 -0
- package/lib/module/screens/chat-detail/conversationHeader.utils.js +7 -9
- package/lib/module/screens/chat-detail/conversationHeader.utils.js.map +1 -1
- package/lib/module/screens/chat-detail/hooks/useAttachmentSendHandler.js +221 -0
- package/lib/module/screens/chat-detail/hooks/useAttachmentSendHandler.js.map +1 -0
- package/lib/module/screens/chat-detail/hooks/useChatComposerAnimation.js +114 -0
- package/lib/module/screens/chat-detail/hooks/useChatComposerAnimation.js.map +1 -0
- package/lib/module/screens/chat-detail/hooks/useChatComposerState.js +26 -0
- package/lib/module/screens/chat-detail/hooks/useChatComposerState.js.map +1 -0
- package/lib/module/screens/chat-detail/index.js +0 -1
- package/lib/module/screens/chat-detail/index.js.map +1 -1
- package/lib/module/screens/chat-detail/legend/LegendChatMessage.js +32 -25
- package/lib/module/screens/chat-detail/legend/LegendChatMessage.js.map +1 -1
- package/lib/module/screens/chat-detail/legend/messageTypes.js +15 -0
- package/lib/module/screens/chat-detail/legend/messageTypes.js.map +1 -0
- package/lib/module/screens/inbox/MessagesTab.js.map +1 -1
- package/lib/module/services/attachmentHandlers/fileAttachmentHandler.js +61 -0
- package/lib/module/services/attachmentHandlers/fileAttachmentHandler.js.map +1 -0
- package/lib/module/services/attachmentHandlers/imageAttachmentHandler.js +54 -0
- package/lib/module/services/attachmentHandlers/imageAttachmentHandler.js.map +1 -0
- package/lib/module/services/attachmentHandlers/index.js +12 -0
- package/lib/module/services/attachmentHandlers/index.js.map +1 -0
- package/lib/module/services/attachmentHandlers/videoAttachmentHandler.js +85 -0
- package/lib/module/services/attachmentHandlers/videoAttachmentHandler.js.map +1 -0
- package/lib/module/services/attachmentOrchestrator.js +225 -0
- package/lib/module/services/attachmentOrchestrator.js.map +1 -0
- package/lib/module/services/auth.js +35 -0
- package/lib/module/services/auth.js.map +1 -0
- package/lib/module/services/endpoints.js +20 -1
- package/lib/module/services/endpoints.js.map +1 -1
- package/lib/module/services/imageUpload.js +126 -0
- package/lib/module/services/imageUpload.js.map +1 -0
- package/lib/module/store/conversation.js +1 -1
- package/lib/module/store/conversation.js.map +1 -1
- package/lib/module/store/message.js +45 -0
- package/lib/module/store/message.js.map +1 -0
- package/lib/module/translation/resources/i18n.js +22 -2
- package/lib/module/translation/resources/i18n.js.map +1 -1
- package/lib/module/types/attachment.js +2 -0
- package/lib/module/types/attachment.js.map +1 -0
- package/lib/module/types/attachmentHandler.js +20 -0
- package/lib/module/types/attachmentHandler.js.map +1 -0
- package/lib/module/types/chat.js +2 -7
- package/lib/module/types/chat.js.map +1 -1
- package/lib/module/types/imageUpload.js +2 -0
- package/lib/module/types/imageUpload.js.map +1 -0
- package/lib/module/types/message.js +1 -0
- package/lib/module/types/message.js.map +1 -1
- package/lib/module/utils/chatImageDimens.js +148 -0
- package/lib/module/utils/chatImageDimens.js.map +1 -0
- package/lib/module/utils/conversation.js +34 -13
- package/lib/module/utils/conversation.js.map +1 -1
- package/lib/module/utils/device.js +65 -0
- package/lib/module/utils/device.js.map +1 -0
- package/lib/module/utils/imageUrlOptimizer.js +41 -0
- package/lib/module/utils/imageUrlOptimizer.js.map +1 -0
- package/lib/module/utils/imageUtils.js +69 -0
- package/lib/module/utils/imageUtils.js.map +1 -0
- package/lib/module/utils/legendListMessage.js +0 -3
- package/lib/module/utils/legendListMessage.js.map +1 -1
- package/lib/module/utils/message.js +5 -8
- package/lib/module/utils/message.js.map +1 -1
- package/lib/module/utils/resolveMessageType.js +3 -0
- package/lib/module/utils/resolveMessageType.js.map +1 -1
- package/lib/module/utils/ui.js +17 -0
- package/lib/module/utils/ui.js.map +1 -0
- package/lib/module/utils/url.js +3 -3
- package/lib/module/utils/url.js.map +1 -1
- package/lib/module/utils/videoThumbnail.js +62 -0
- package/lib/module/utils/videoThumbnail.js.map +1 -0
- package/lib/typescript/src/components/AttachmentPreview.d.ts +28 -0
- package/lib/typescript/src/components/AttachmentPreview.d.ts.map +1 -0
- package/lib/typescript/src/components/MediaViewer/index.d.ts +1 -0
- package/lib/typescript/src/components/MediaViewer/index.d.ts.map +1 -0
- package/lib/typescript/src/components/MediaViewerModal.d.ts +10 -0
- package/lib/typescript/src/components/MediaViewerModal.d.ts.map +1 -0
- package/lib/typescript/src/components/MergedImageGrid.d.ts +16 -0
- package/lib/typescript/src/components/MergedImageGrid.d.ts.map +1 -0
- package/lib/typescript/src/components/ThreadCard/AvatarSection.d.ts +2 -2
- package/lib/typescript/src/components/ThreadCard/AvatarSection.d.ts.map +1 -1
- package/lib/typescript/src/components/ThreadCard/NamePrefixIcon.d.ts +3 -4
- package/lib/typescript/src/components/ThreadCard/NamePrefixIcon.d.ts.map +1 -1
- package/lib/typescript/src/components/ThreadCard/ThreadCard.d.ts.map +1 -1
- package/lib/typescript/src/components/ThreadCard/thread-card.utils.d.ts.map +1 -1
- package/lib/typescript/src/components/messages/fileMessage/index.d.ts +3 -0
- package/lib/typescript/src/components/messages/fileMessage/index.d.ts.map +1 -0
- package/lib/typescript/src/components/messages/imageMessage/index.d.ts +3 -0
- package/lib/typescript/src/components/messages/imageMessage/index.d.ts.map +1 -0
- package/lib/typescript/src/components/messages/linkMessage/index.d.ts +9 -0
- package/lib/typescript/src/components/messages/linkMessage/index.d.ts.map +1 -0
- package/lib/typescript/src/components/messages/mergedMessage/index.d.ts +3 -0
- package/lib/typescript/src/components/messages/mergedMessage/index.d.ts.map +1 -0
- package/lib/typescript/src/components/messages/styles.d.ts +36 -0
- package/lib/typescript/src/components/messages/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/messages/textMessage/index.d.ts +9 -0
- package/lib/typescript/src/components/messages/textMessage/index.d.ts.map +1 -0
- package/lib/typescript/src/components/messages/types.d.ts +10 -0
- package/lib/typescript/src/components/messages/types.d.ts.map +1 -0
- package/lib/typescript/src/components/messages/videoMessage/index.d.ts +3 -0
- package/lib/typescript/src/components/messages/videoMessage/index.d.ts.map +1 -0
- package/lib/typescript/src/config/api-endpoints.d.ts +40 -0
- package/lib/typescript/src/config/api-endpoints.d.ts.map +1 -0
- package/lib/typescript/src/config/attachment-priority.d.ts +31 -0
- package/lib/typescript/src/config/attachment-priority.d.ts.map +1 -0
- package/lib/typescript/src/config/configuration.d.ts +30 -0
- package/lib/typescript/src/config/configuration.d.ts.map +1 -0
- package/lib/typescript/src/config/index.d.ts +15 -0
- package/lib/typescript/src/config/index.d.ts.map +1 -0
- package/lib/typescript/src/context/ChatContext.d.ts +1 -1
- package/lib/typescript/src/context/ChatContext.d.ts.map +1 -1
- package/lib/typescript/src/core/index.d.ts +13 -1
- package/lib/typescript/src/core/index.d.ts.map +1 -1
- package/lib/typescript/src/core/useChatListener.d.ts.map +1 -1
- package/lib/typescript/src/hooks/message/useSendMessage.d.ts +12 -0
- package/lib/typescript/src/hooks/message/useSendMessage.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useChatMessages.d.ts +0 -1
- package/lib/typescript/src/hooks/useChatMessages.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useConversationList.d.ts +2 -1
- package/lib/typescript/src/hooks/useConversationList.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useImageAttachment.d.ts +20 -0
- package/lib/typescript/src/hooks/useImageAttachment.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useLinkPreview/useLinkPreview.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useMediaViewer.d.ts +13 -0
- package/lib/typescript/src/hooks/useMediaViewer.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useSendAttachment.d.ts +59 -0
- package/lib/typescript/src/hooks/useSendAttachment.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useVideoAttachment.d.ts +29 -0
- package/lib/typescript/src/hooks/useVideoAttachment.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +14 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/screens/MediaView/VideoPlayer.d.ts +12 -0
- package/lib/typescript/src/screens/MediaView/VideoPlayer.d.ts.map +1 -0
- package/lib/typescript/src/screens/MediaView/index.d.ts +11 -0
- package/lib/typescript/src/screens/MediaView/index.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatDetailHeader.d.ts +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatDetailHeader.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatListLegend.d.ts +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatListLegend.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/components/ChatInputActions.d.ts +8 -0
- package/lib/typescript/src/screens/chat-detail/components/ChatInputActions.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/components/ChatMessageInput.d.ts +15 -0
- package/lib/typescript/src/screens/chat-detail/components/ChatMessageInput.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/conversationHeader.utils.d.ts +1 -1
- package/lib/typescript/src/screens/chat-detail/conversationHeader.utils.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/hooks/useAttachmentSendHandler.d.ts +23 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useAttachmentSendHandler.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerAnimation.d.ts +15 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerAnimation.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerState.d.ts +13 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerState.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/index.d.ts +0 -2
- package/lib/typescript/src/screens/chat-detail/index.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts +3 -3
- package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/legend/messageTypes.d.ts +13 -0
- package/lib/typescript/src/screens/chat-detail/legend/messageTypes.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/types.d.ts +10 -8
- package/lib/typescript/src/screens/chat-detail/types.d.ts.map +1 -1
- package/lib/typescript/src/services/attachmentHandlers/fileAttachmentHandler.d.ts +22 -0
- package/lib/typescript/src/services/attachmentHandlers/fileAttachmentHandler.d.ts.map +1 -0
- package/lib/typescript/src/services/attachmentHandlers/imageAttachmentHandler.d.ts +3 -0
- package/lib/typescript/src/services/attachmentHandlers/imageAttachmentHandler.d.ts.map +1 -0
- package/lib/typescript/src/services/attachmentHandlers/index.d.ts +5 -0
- package/lib/typescript/src/services/attachmentHandlers/index.d.ts.map +1 -0
- package/lib/typescript/src/services/attachmentHandlers/videoAttachmentHandler.d.ts +31 -0
- package/lib/typescript/src/services/attachmentHandlers/videoAttachmentHandler.d.ts.map +1 -0
- package/lib/typescript/src/services/attachmentOrchestrator.d.ts +5 -0
- package/lib/typescript/src/services/attachmentOrchestrator.d.ts.map +1 -0
- package/lib/typescript/src/services/auth.d.ts +19 -0
- package/lib/typescript/src/services/auth.d.ts.map +1 -0
- package/lib/typescript/src/services/endpoints.d.ts +11 -1
- package/lib/typescript/src/services/endpoints.d.ts.map +1 -1
- package/lib/typescript/src/services/imageUpload.d.ts +7 -0
- package/lib/typescript/src/services/imageUpload.d.ts.map +1 -0
- package/lib/typescript/src/store/message.d.ts +3 -0
- package/lib/typescript/src/store/message.d.ts.map +1 -0
- package/lib/typescript/src/translation/resources/i18n.d.ts.map +1 -1
- package/lib/typescript/src/types/attachment.d.ts +72 -0
- package/lib/typescript/src/types/attachment.d.ts.map +1 -0
- package/lib/typescript/src/types/attachmentHandler.d.ts +13 -0
- package/lib/typescript/src/types/attachmentHandler.d.ts.map +1 -0
- package/lib/typescript/src/types/chat.d.ts +28 -27
- package/lib/typescript/src/types/chat.d.ts.map +1 -1
- package/lib/typescript/src/types/common.d.ts +1 -0
- package/lib/typescript/src/types/common.d.ts.map +1 -1
- package/lib/typescript/src/types/imageUpload.d.ts +26 -0
- package/lib/typescript/src/types/imageUpload.d.ts.map +1 -0
- package/lib/typescript/src/types/message.d.ts +1 -0
- package/lib/typescript/src/types/message.d.ts.map +1 -1
- package/lib/typescript/src/utils/chatImageDimens.d.ts +34 -0
- package/lib/typescript/src/utils/chatImageDimens.d.ts.map +1 -0
- package/lib/typescript/src/utils/conversation.d.ts +3 -2
- package/lib/typescript/src/utils/conversation.d.ts.map +1 -1
- package/lib/typescript/src/utils/device.d.ts +7 -0
- package/lib/typescript/src/utils/device.d.ts.map +1 -0
- package/lib/typescript/src/utils/imageUrlOptimizer.d.ts +12 -0
- package/lib/typescript/src/utils/imageUrlOptimizer.d.ts.map +1 -0
- package/lib/typescript/src/utils/imageUtils.d.ts +9 -0
- package/lib/typescript/src/utils/imageUtils.d.ts.map +1 -0
- package/lib/typescript/src/utils/legendListMessage.d.ts +0 -2
- package/lib/typescript/src/utils/legendListMessage.d.ts.map +1 -1
- package/lib/typescript/src/utils/message.d.ts.map +1 -1
- package/lib/typescript/src/utils/resolveMessageType.d.ts.map +1 -1
- package/lib/typescript/src/utils/ui.d.ts +13 -0
- package/lib/typescript/src/utils/ui.d.ts.map +1 -0
- package/lib/typescript/src/utils/url.d.ts +1 -1
- package/lib/typescript/src/utils/url.d.ts.map +1 -1
- package/lib/typescript/src/utils/videoThumbnail.d.ts +16 -0
- package/lib/typescript/src/utils/videoThumbnail.d.ts.map +1 -0
- package/package.json +15 -3
- package/src/components/AttachmentPreview.tsx +304 -0
- package/src/components/MediaViewer/index.tsx +0 -0
- package/src/components/MediaViewerModal.tsx +70 -0
- package/src/components/MergedImageGrid.tsx +238 -0
- package/src/components/ThreadCard/AvatarSection.tsx +5 -8
- package/src/components/ThreadCard/NamePrefixIcon.tsx +27 -38
- package/src/components/ThreadCard/ThreadCard.tsx +16 -30
- package/src/components/ThreadCard/thread-card.utils.ts +95 -4
- package/src/components/messages/fileMessage/index.tsx +30 -0
- package/src/components/messages/imageMessage/index.tsx +137 -0
- package/src/components/messages/linkMessage/index.tsx +162 -0
- package/src/components/messages/mergedMessage/index.tsx +45 -0
- package/src/components/messages/styles.ts +39 -0
- package/src/components/messages/textMessage/index.tsx +53 -0
- package/src/components/messages/types.ts +22 -0
- package/src/components/messages/videoMessage/index.tsx +120 -0
- package/src/config/api-endpoints.ts +72 -0
- package/src/config/attachment-priority.ts +93 -0
- package/src/config/configuration.ts +50 -0
- package/src/config/index.ts +19 -0
- package/src/context/ChatContext.tsx +12 -4
- package/src/core/index.ts +25 -1
- package/src/core/useChatListener.ts +0 -21
- package/src/hooks/message/useSendMessage.ts +143 -0
- package/src/hooks/useChatMessages.ts +69 -161
- package/src/hooks/useConversationList.ts +34 -16
- package/src/hooks/useImageAttachment.ts +348 -0
- package/src/hooks/useLinkPreview/useLinkPreview.ts +3 -2
- package/src/hooks/useMediaViewer.ts +32 -0
- package/src/hooks/useSendAttachment.ts +295 -0
- package/src/hooks/useVideoAttachment.ts +334 -0
- package/src/index.tsx +13 -1
- package/src/screens/MediaView/VideoPlayer.tsx +211 -0
- package/src/screens/MediaView/index.tsx +327 -0
- package/src/screens/chat-detail/ChatComposer.tsx +206 -271
- package/src/screens/chat-detail/ChatDetail.tsx +164 -104
- package/src/screens/chat-detail/ChatDetailHeader.tsx +4 -10
- package/src/screens/chat-detail/ChatLinkPreview.tsx +1 -1
- package/src/screens/chat-detail/ChatListLegend.tsx +10 -13
- package/src/screens/chat-detail/components/ChatInputActions.tsx +71 -0
- package/src/screens/chat-detail/components/ChatMessageInput.tsx +127 -0
- package/src/screens/chat-detail/conversationHeader.utils.ts +11 -14
- package/src/screens/chat-detail/hooks/useAttachmentSendHandler.ts +291 -0
- package/src/screens/chat-detail/hooks/useChatComposerAnimation.ts +184 -0
- package/src/screens/chat-detail/hooks/useChatComposerState.ts +40 -0
- package/src/screens/chat-detail/index.ts +0 -2
- package/src/screens/chat-detail/legend/LegendChatMessage.tsx +44 -39
- package/src/screens/chat-detail/legend/messageTypes.tsx +13 -0
- package/src/screens/chat-detail/types.ts +11 -9
- package/src/screens/inbox/MessagesTab.tsx +1 -1
- package/src/services/attachmentHandlers/fileAttachmentHandler.ts +78 -0
- package/src/services/attachmentHandlers/imageAttachmentHandler.ts +54 -0
- package/src/services/attachmentHandlers/index.ts +10 -0
- package/src/services/attachmentHandlers/videoAttachmentHandler.ts +114 -0
- package/src/services/attachmentOrchestrator.ts +300 -0
- package/src/services/auth.ts +34 -0
- package/src/services/endpoints.ts +24 -1
- package/src/services/imageUpload.ts +162 -0
- package/src/store/conversation.ts +1 -1
- package/src/store/message.ts +44 -0
- package/src/translation/resources/i18n.ts +22 -2
- package/src/types/attachment.ts +85 -0
- package/src/types/attachmentHandler.ts +31 -0
- package/src/types/chat.ts +31 -30
- package/src/types/common.ts +1 -0
- package/src/types/imageUpload.ts +28 -0
- package/src/types/message.ts +1 -0
- package/src/utils/chatImageDimens.ts +178 -0
- package/src/utils/conversation.ts +44 -17
- package/src/utils/device.ts +73 -0
- package/src/utils/imageUrlOptimizer.ts +56 -0
- package/src/utils/imageUtils.ts +76 -0
- package/src/utils/legendListMessage.ts +0 -5
- package/src/utils/message.ts +10 -12
- package/src/utils/resolveMessageType.ts +2 -0
- package/src/utils/ui.ts +19 -0
- package/src/utils/url.ts +3 -3
- package/src/utils/videoThumbnail.ts +85 -0
- package/lib/module/screens/chat-detail/ChatList.js +0 -147
- package/lib/module/screens/chat-detail/ChatList.js.map +0 -1
- package/lib/module/screens/chat-detail/ChatTextBubble.js +0 -62
- package/lib/module/screens/chat-detail/ChatTextBubble.js.map +0 -1
- package/lib/module/screens/chat-detail/legend/message-types.js +0 -122
- package/lib/module/screens/chat-detail/legend/message-types.js.map +0 -1
- package/lib/module/screens/chat-detail/messages/ChatMessageBubble.js +0 -24
- package/lib/module/screens/chat-detail/messages/ChatMessageBubble.js.map +0 -1
- package/lib/module/screens/chat-detail/messages/types.js +0 -4
- package/lib/module/screens/chat-detail/messages/types.js.map +0 -1
- package/lib/typescript/src/screens/chat-detail/ChatList.d.ts +0 -3
- package/lib/typescript/src/screens/chat-detail/ChatList.d.ts.map +0 -1
- package/lib/typescript/src/screens/chat-detail/ChatTextBubble.d.ts +0 -3
- package/lib/typescript/src/screens/chat-detail/ChatTextBubble.d.ts.map +0 -1
- package/lib/typescript/src/screens/chat-detail/legend/message-types.d.ts +0 -12
- package/lib/typescript/src/screens/chat-detail/legend/message-types.d.ts.map +0 -1
- package/lib/typescript/src/screens/chat-detail/messages/ChatMessageBubble.d.ts +0 -3
- package/lib/typescript/src/screens/chat-detail/messages/ChatMessageBubble.d.ts.map +0 -1
- package/lib/typescript/src/screens/chat-detail/messages/types.d.ts +0 -13
- package/lib/typescript/src/screens/chat-detail/messages/types.d.ts.map +0 -1
- package/src/screens/chat-detail/ChatList.tsx +0 -190
- package/src/screens/chat-detail/ChatTextBubble.tsx +0 -73
- package/src/screens/chat-detail/legend/message-types.tsx +0 -149
- package/src/screens/chat-detail/messages/ChatMessageBubble.tsx +0 -23
- package/src/screens/chat-detail/messages/types.ts +0 -14
|
@@ -1,51 +1,39 @@
|
|
|
1
|
-
import { memo, useCallback, useEffect, useMemo
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
Platform,
|
|
5
|
-
StyleSheet,
|
|
6
|
-
TextInput,
|
|
7
|
-
type NativeSyntheticEvent,
|
|
8
|
-
type TextInputContentSizeChangeEventData,
|
|
9
|
-
} from 'react-native';
|
|
10
|
-
import Reanimated, {
|
|
11
|
-
runOnJS,
|
|
12
|
-
useAnimatedReaction,
|
|
13
|
-
useAnimatedStyle,
|
|
14
|
-
useSharedValue,
|
|
15
|
-
withTiming,
|
|
16
|
-
} from 'react-native-reanimated';
|
|
17
|
-
import {
|
|
18
|
-
useKeyboardState,
|
|
19
|
-
useReanimatedKeyboardAnimation,
|
|
20
|
-
} from 'react-native-keyboard-controller';
|
|
1
|
+
import { memo, useCallback, useEffect, useMemo } from 'react';
|
|
2
|
+
import { Platform, StyleSheet } from 'react-native';
|
|
3
|
+
import Reanimated from 'react-native-reanimated';
|
|
21
4
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
22
|
-
import { KContainer,
|
|
23
|
-
import { ChatQuickActions } from './ChatQuickActions';
|
|
24
|
-
import { ChatAttachmentPanel } from './ChatAttachmentPanel';
|
|
25
|
-
import { ChatLinkPreview } from './ChatLinkPreview';
|
|
26
|
-
import { getAttachmentPanelHeight } from './constants';
|
|
27
|
-
import type { ChatComposerProps } from './types';
|
|
28
|
-
import { useLinkPreview } from '../../hooks/useLinkPreview/useLinkPreview';
|
|
5
|
+
import { KContainer, KColors, KImage } from '@droppii/libs';
|
|
29
6
|
|
|
30
|
-
const ACCESSORY_ANIMATION_MS = 250;
|
|
31
|
-
const ACCESSORY_SETTLE_MS = 150;
|
|
32
7
|
const IS_IOS = Platform.OS === 'ios';
|
|
33
|
-
const INPUT_FONT_SIZE = 16;
|
|
34
8
|
const INPUT_LINE_HEIGHT = 22.4;
|
|
35
|
-
const INPUT_MAX_HEIGHT = INPUT_LINE_HEIGHT * 5;
|
|
36
|
-
// Android's onContentSizeChange includes paddingVertical (4*2=8) in reported height
|
|
37
9
|
const WRAPPED_HEIGHT_THRESHOLD = IS_IOS
|
|
38
10
|
? INPUT_LINE_HEIGHT + 4
|
|
39
11
|
: INPUT_LINE_HEIGHT + 12;
|
|
40
12
|
|
|
13
|
+
import { ChatQuickActions } from './ChatQuickActions';
|
|
14
|
+
import { ChatAttachmentPanel } from './ChatAttachmentPanel';
|
|
15
|
+
import { ChatLinkPreview } from './ChatLinkPreview';
|
|
16
|
+
import { ChatMessageInput } from './components/ChatMessageInput';
|
|
17
|
+
import { AttachmentPreview } from '../../components/AttachmentPreview';
|
|
18
|
+
|
|
19
|
+
import { getAttachmentPanelHeight } from './constants';
|
|
20
|
+
import type { ChatComposerProps } from './types';
|
|
21
|
+
import { useLinkPreview } from '../../hooks/useLinkPreview/useLinkPreview';
|
|
22
|
+
import { useImageAttachment } from '../../hooks/useImageAttachment';
|
|
23
|
+
import { useSendAttachment } from '../../hooks/useSendAttachment';
|
|
24
|
+
import { useChatComposerState } from './hooks/useChatComposerState';
|
|
25
|
+
import { useChatComposerAnimation } from './hooks/useChatComposerAnimation';
|
|
26
|
+
import { useAttachmentSendHandler } from './hooks/useAttachmentSendHandler';
|
|
27
|
+
import { isVideoFromPicker } from '../../utils/imageUtils';
|
|
28
|
+
|
|
41
29
|
export const ChatComposer = memo(
|
|
42
30
|
({
|
|
43
31
|
value,
|
|
44
32
|
placeholder = 'Nhập tin nhắn...',
|
|
45
33
|
onChangeText,
|
|
46
34
|
onSend,
|
|
47
|
-
|
|
48
|
-
onPressEmoji,
|
|
35
|
+
onMessageSent,
|
|
36
|
+
onPressEmoji: _onPressEmoji,
|
|
49
37
|
showQuickActions = true,
|
|
50
38
|
quickActions,
|
|
51
39
|
attachmentActions,
|
|
@@ -56,14 +44,10 @@ export const ChatComposer = memo(
|
|
|
56
44
|
renderAttachmentAction,
|
|
57
45
|
attachmentColumns,
|
|
58
46
|
}: ChatComposerProps) => {
|
|
59
|
-
const hasAttachmentActions = !!attachmentActions?.length;
|
|
60
|
-
const inputRef = useRef<TextInput>(null);
|
|
61
|
-
const isSwitchingToAttachmentRef = useRef(false);
|
|
62
|
-
const [isAttachmentOpen, setIsAttachmentOpen] = useState(false);
|
|
63
|
-
const [isInputFocused, setIsInputFocused] = useState(false);
|
|
64
|
-
const [isInputWrapped, setIsInputWrapped] = useState(false);
|
|
65
47
|
const insets = useSafeAreaInsets();
|
|
48
|
+
const hasAttachmentActions = !!attachmentActions?.length;
|
|
66
49
|
|
|
50
|
+
// Link preview
|
|
67
51
|
const {
|
|
68
52
|
isVisible: showLinkPreview,
|
|
69
53
|
metadata: urlMetadata,
|
|
@@ -71,10 +55,58 @@ export const ChatComposer = memo(
|
|
|
71
55
|
dismiss: handleDismissPreview,
|
|
72
56
|
} = useLinkPreview(value);
|
|
73
57
|
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
|
|
58
|
+
// Image attachment
|
|
59
|
+
const {
|
|
60
|
+
selectedImages,
|
|
61
|
+
isImagePreviewVisible,
|
|
62
|
+
handleImageAttach,
|
|
63
|
+
handleImageRemove,
|
|
64
|
+
clearAllImages,
|
|
65
|
+
} = useImageAttachment();
|
|
66
|
+
|
|
67
|
+
// Send attachment
|
|
68
|
+
const { send: sendAttachments } = useSendAttachment();
|
|
69
|
+
|
|
70
|
+
// Callback to send text message (with optional preview link)
|
|
71
|
+
// This is used when sending text after attachments
|
|
72
|
+
const handleSendText = useCallback(
|
|
73
|
+
(text: string, previewMetadata?: any) => {
|
|
74
|
+
// Send with the captured text and preview metadata
|
|
75
|
+
// Note: ChatDetail's handleSend will read currentInput, but for text sent
|
|
76
|
+
// after attachments, we want to use the captured text instead
|
|
77
|
+
// So we pass it via a special handling in the metadata
|
|
78
|
+
const metadataWithText = previewMetadata
|
|
79
|
+
? { ...previewMetadata, _capturedText: text }
|
|
80
|
+
: undefined;
|
|
81
|
+
onSend?.(metadataWithText);
|
|
82
|
+
},
|
|
83
|
+
[onSend]
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
// Attachment send handler
|
|
87
|
+
const { handleSend: handleAttachmentSend } = useAttachmentSendHandler({
|
|
88
|
+
selectedImages,
|
|
89
|
+
sendAttachments,
|
|
90
|
+
clearAllImages,
|
|
91
|
+
onSend,
|
|
92
|
+
onMessageSent,
|
|
93
|
+
textMessage: (value ?? '').trim(),
|
|
94
|
+
urlMetadata: showLinkPreview ? urlMetadata : undefined,
|
|
95
|
+
onSendText: handleSendText,
|
|
96
|
+
});
|
|
77
97
|
|
|
98
|
+
// Composer state
|
|
99
|
+
const {
|
|
100
|
+
isAttachmentOpen,
|
|
101
|
+
setIsAttachmentOpen,
|
|
102
|
+
isInputFocused,
|
|
103
|
+
setIsInputFocused,
|
|
104
|
+
setIsInputWrapped,
|
|
105
|
+
isMultilineInput,
|
|
106
|
+
inputRef,
|
|
107
|
+
} = useChatComposerState(value as string);
|
|
108
|
+
|
|
109
|
+
// Panel height calculation
|
|
78
110
|
const panelHeight = useMemo(
|
|
79
111
|
() =>
|
|
80
112
|
hasAttachmentActions
|
|
@@ -86,194 +118,119 @@ export const ChatComposer = memo(
|
|
|
86
118
|
[attachmentActions, attachmentColumns, hasAttachmentActions]
|
|
87
119
|
);
|
|
88
120
|
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
panelHeightSV.value = panelHeight;
|
|
96
|
-
}, [panelHeight, panelHeightSV]);
|
|
97
|
-
|
|
98
|
-
const openAttachment = useCallback(() => {
|
|
99
|
-
attachmentHeightSV.value = withTiming(panelHeight, {
|
|
100
|
-
duration: ACCESSORY_ANIMATION_MS,
|
|
121
|
+
// Animation
|
|
122
|
+
const { accessorySlotStyle, toggleAttachmentVisibility, closeAttachment } =
|
|
123
|
+
useChatComposerAnimation({
|
|
124
|
+
isAttachmentOpen,
|
|
125
|
+
panelHeight,
|
|
126
|
+
onAttachmentOpenChange: setIsAttachmentOpen,
|
|
101
127
|
});
|
|
102
|
-
setIsAttachmentOpen(true);
|
|
103
|
-
}, [attachmentHeightSV, panelHeight]);
|
|
104
|
-
|
|
105
|
-
const closeAttachment = useCallback(() => {
|
|
106
|
-
attachmentHeightSV.value = withTiming(0, {
|
|
107
|
-
duration: ACCESSORY_ANIMATION_MS,
|
|
108
|
-
});
|
|
109
|
-
setIsAttachmentOpen(false);
|
|
110
|
-
}, [attachmentHeightSV]);
|
|
111
|
-
|
|
112
|
-
const finishKeyboardToAttachmentSwitch = useCallback(() => {
|
|
113
|
-
if (!isSwitchingToAttachmentRef.current) {
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
isSwitchingToAttachmentRef.current = false;
|
|
118
|
-
isKeyboardToAttachmentSwitchSV.value = false;
|
|
119
128
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
attachmentHeightSV.value = targetHeight;
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
attachmentHeightSV.value = withTiming(targetHeight, {
|
|
129
|
-
duration: ACCESSORY_SETTLE_MS,
|
|
130
|
-
});
|
|
131
|
-
}, [
|
|
132
|
-
attachmentHeightSV,
|
|
133
|
-
isKeyboardToAttachmentSwitchSV,
|
|
134
|
-
panelHeightSV,
|
|
135
|
-
switchKeyboardHeightSV,
|
|
136
|
-
]);
|
|
137
|
-
|
|
138
|
-
useEffect(() => {
|
|
139
|
-
if (!isKeyboardVisible && isSwitchingToAttachmentRef.current) {
|
|
140
|
-
finishKeyboardToAttachmentSwitch();
|
|
141
|
-
}
|
|
142
|
-
}, [finishKeyboardToAttachmentSwitch, isKeyboardVisible]);
|
|
143
|
-
|
|
144
|
-
useAnimatedReaction(
|
|
145
|
-
() => ({
|
|
146
|
-
switching: isKeyboardToAttachmentSwitchSV.value,
|
|
147
|
-
progress: keyboardProgress.value,
|
|
148
|
-
}),
|
|
149
|
-
(current, previous) => {
|
|
150
|
-
if (
|
|
151
|
-
current.switching &&
|
|
152
|
-
current.progress === 0 &&
|
|
153
|
-
(previous?.progress ?? 1) > 0
|
|
154
|
-
) {
|
|
155
|
-
runOnJS(finishKeyboardToAttachmentSwitch)();
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
[finishKeyboardToAttachmentSwitch]
|
|
129
|
+
// Check if any attachments are currently uploading
|
|
130
|
+
const isUploadingAttachments = useMemo(
|
|
131
|
+
() => selectedImages.some((img: any) => img.isUploading),
|
|
132
|
+
[selectedImages]
|
|
159
133
|
);
|
|
160
134
|
|
|
161
|
-
|
|
162
|
-
if (isSwitchingToAttachmentRef.current) {
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
if (isKeyboardVisible && isAttachmentOpen) {
|
|
167
|
-
closeAttachment();
|
|
168
|
-
}
|
|
169
|
-
}, [closeAttachment, isAttachmentOpen, isKeyboardVisible]);
|
|
170
|
-
|
|
171
|
-
const accessorySlotStyle = useAnimatedStyle(() => {
|
|
172
|
-
if (isKeyboardToAttachmentSwitchSV.value) {
|
|
173
|
-
return {
|
|
174
|
-
height: switchKeyboardHeightSV.value * (1 - keyboardProgress.value),
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
return {
|
|
179
|
-
height: attachmentHeightSV.value,
|
|
180
|
-
};
|
|
181
|
-
});
|
|
182
|
-
|
|
135
|
+
// Send handler - includes attachment and preview link features
|
|
183
136
|
const handleSend = useCallback(() => {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
137
|
+
const hasAttachments = selectedImages.length > 0;
|
|
138
|
+
const hasText = (value ?? '').trim().length > 0;
|
|
139
|
+
// Only send metadata if preview is CURRENTLY visible (user didn't dismiss it)
|
|
140
|
+
const previewMetadata = showLinkPreview ? urlMetadata : undefined;
|
|
141
|
+
const hasPreview = !!previewMetadata;
|
|
142
|
+
|
|
143
|
+
// Prevent sending while files are uploading
|
|
144
|
+
if (isUploadingAttachments) {
|
|
145
|
+
console.warn(
|
|
146
|
+
'[ChatComposer] Cannot send message while files are uploading'
|
|
147
|
+
);
|
|
189
148
|
return;
|
|
190
149
|
}
|
|
191
150
|
|
|
192
|
-
|
|
193
|
-
|
|
151
|
+
// Validate: must have at least one of: attachments, text, or preview link
|
|
152
|
+
if (!hasAttachments && !hasText && !hasPreview) {
|
|
153
|
+
console.warn(
|
|
154
|
+
'[ChatComposer] No attachments, text, or preview link to send'
|
|
155
|
+
);
|
|
194
156
|
return;
|
|
195
157
|
}
|
|
196
158
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
159
|
+
if (hasAttachments) {
|
|
160
|
+
// Send attachments (+ text if present, handled in attachment handler)
|
|
161
|
+
handleAttachmentSend();
|
|
162
|
+
} else {
|
|
163
|
+
// Send text/preview link only
|
|
164
|
+
console.log('[ChatComposer] handleSend - text message:', {
|
|
165
|
+
hasText,
|
|
166
|
+
hasPreview,
|
|
167
|
+
previewUrl: previewMetadata?.url,
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
onSend?.(previewMetadata);
|
|
207
171
|
}
|
|
208
|
-
|
|
209
|
-
openAttachment();
|
|
210
172
|
}, [
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
openAttachment,
|
|
219
|
-
switchKeyboardHeightSV,
|
|
173
|
+
onSend,
|
|
174
|
+
urlMetadata,
|
|
175
|
+
showLinkPreview,
|
|
176
|
+
selectedImages,
|
|
177
|
+
handleAttachmentSend,
|
|
178
|
+
value,
|
|
179
|
+
isUploadingAttachments,
|
|
220
180
|
]);
|
|
221
181
|
|
|
222
182
|
const handleInputFocus = useCallback(() => {
|
|
223
183
|
setIsInputFocused(true);
|
|
224
|
-
|
|
225
|
-
if (
|
|
226
|
-
|
|
184
|
+
// Close attachment panel with animation when input is focused
|
|
185
|
+
if (isAttachmentOpen) {
|
|
186
|
+
closeAttachment();
|
|
227
187
|
}
|
|
228
|
-
|
|
229
|
-
closeAttachment();
|
|
230
|
-
}, [closeAttachment, isAttachmentOpen]);
|
|
188
|
+
}, [closeAttachment, isAttachmentOpen, setIsInputFocused]);
|
|
231
189
|
|
|
232
190
|
const handleInputBlur = useCallback(() => {
|
|
233
191
|
setIsInputFocused(false);
|
|
234
|
-
}, []);
|
|
192
|
+
}, [setIsInputFocused]);
|
|
193
|
+
|
|
194
|
+
const handleChangeText = useCallback(
|
|
195
|
+
(text?: string) => {
|
|
196
|
+
onChangeText?.(text);
|
|
197
|
+
},
|
|
198
|
+
[onChangeText]
|
|
199
|
+
);
|
|
235
200
|
|
|
236
201
|
const handleInputContentSizeChange = useCallback(
|
|
237
|
-
(event:
|
|
202
|
+
(event: any) => {
|
|
238
203
|
const { height } = event.nativeEvent.contentSize;
|
|
239
204
|
setIsInputWrapped(height > WRAPPED_HEIGHT_THRESHOLD);
|
|
240
205
|
},
|
|
241
|
-
[]
|
|
206
|
+
[setIsInputWrapped]
|
|
242
207
|
);
|
|
243
208
|
|
|
244
|
-
|
|
245
|
-
if (!value) {
|
|
246
|
-
return false;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
return value.includes('\n') || isInputWrapped;
|
|
250
|
-
}, [isInputWrapped, value]);
|
|
251
|
-
|
|
209
|
+
// Reset wrapped state when value is cleared
|
|
252
210
|
useEffect(() => {
|
|
253
211
|
if (!value) {
|
|
254
212
|
setIsInputWrapped(false);
|
|
255
213
|
}
|
|
256
|
-
}, [value]);
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
[onPressEmoji]
|
|
214
|
+
}, [value, setIsInputWrapped]);
|
|
215
|
+
|
|
216
|
+
// Attachment action handler
|
|
217
|
+
const handleAttachmentActionInternal = useCallback(
|
|
218
|
+
async (action: any) => {
|
|
219
|
+
if (action.id === 'gallery') {
|
|
220
|
+
await handleImageAttach();
|
|
221
|
+
} else {
|
|
222
|
+
onAttachmentAction?.(action);
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
[onAttachmentAction, handleImageAttach]
|
|
269
226
|
);
|
|
270
227
|
|
|
228
|
+
// Input row padding
|
|
271
229
|
const inputRowStyle = useMemo(
|
|
272
230
|
() => ({
|
|
273
|
-
paddingBottom:
|
|
274
|
-
isAttachmentOpen || isKeyboardVisible ? 8 : insets.bottom + 12,
|
|
231
|
+
paddingBottom: isAttachmentOpen ? 8 : insets.bottom + 12,
|
|
275
232
|
}),
|
|
276
|
-
[insets.bottom, isAttachmentOpen
|
|
233
|
+
[insets.bottom, isAttachmentOpen]
|
|
277
234
|
);
|
|
278
235
|
|
|
279
236
|
return (
|
|
@@ -286,13 +243,39 @@ export const ChatComposer = memo(
|
|
|
286
243
|
renderQuickActions={renderQuickActions}
|
|
287
244
|
/>
|
|
288
245
|
|
|
289
|
-
{showLinkPreview
|
|
246
|
+
{showLinkPreview && (
|
|
290
247
|
<ChatLinkPreview
|
|
291
248
|
metadata={urlMetadata}
|
|
292
249
|
isLoading={isMetadataLoading}
|
|
293
250
|
onDismiss={handleDismissPreview}
|
|
294
251
|
/>
|
|
295
|
-
)
|
|
252
|
+
)}
|
|
253
|
+
|
|
254
|
+
<AttachmentPreview
|
|
255
|
+
visible={isImagePreviewVisible}
|
|
256
|
+
attachments={selectedImages.map((img: any) => {
|
|
257
|
+
const isVideo = isVideoFromPicker(img.image);
|
|
258
|
+
return {
|
|
259
|
+
type: isVideo ? ('video' as const) : ('image' as const),
|
|
260
|
+
metadata: {
|
|
261
|
+
path: img.image.path,
|
|
262
|
+
filename: img.image.filename,
|
|
263
|
+
size: img.image.size,
|
|
264
|
+
width: img.image.width,
|
|
265
|
+
height: img.image.height,
|
|
266
|
+
...(isVideo && { duration: (img.image as any).duration }),
|
|
267
|
+
},
|
|
268
|
+
uploadProgress: img.uploadProgress,
|
|
269
|
+
error: img.error,
|
|
270
|
+
isUploading: img.isUploading,
|
|
271
|
+
uploadedUrl: img.uploadedUrl,
|
|
272
|
+
...(isVideo && { thumbnailUrl: img.thumbnailUrl }),
|
|
273
|
+
};
|
|
274
|
+
})}
|
|
275
|
+
onRemove={(type, index) => {
|
|
276
|
+
handleImageRemove(index);
|
|
277
|
+
}}
|
|
278
|
+
/>
|
|
296
279
|
|
|
297
280
|
<KContainer.View
|
|
298
281
|
row
|
|
@@ -302,9 +285,9 @@ export const ChatComposer = memo(
|
|
|
302
285
|
paddingB="0.75rem"
|
|
303
286
|
style={inputRowStyle}
|
|
304
287
|
>
|
|
305
|
-
{hasAttachmentActions
|
|
288
|
+
{hasAttachmentActions && (
|
|
306
289
|
<KContainer.Touchable
|
|
307
|
-
onPress={
|
|
290
|
+
onPress={toggleAttachmentVisibility}
|
|
308
291
|
center
|
|
309
292
|
br="round"
|
|
310
293
|
>
|
|
@@ -318,65 +301,35 @@ export const ChatComposer = memo(
|
|
|
318
301
|
}
|
|
319
302
|
/>
|
|
320
303
|
</KContainer.Touchable>
|
|
321
|
-
)
|
|
322
|
-
|
|
323
|
-
<
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
: KColors.palette.gray.w100
|
|
336
|
-
}
|
|
337
|
-
background={KColors.white}
|
|
338
|
-
paddingL="0.75rem"
|
|
339
|
-
style={styles.inputContainer}
|
|
340
|
-
>
|
|
341
|
-
<KContainer.View marginR="0.75rem">
|
|
342
|
-
<KImage.VectorIcons
|
|
343
|
-
name="chat-suggest-o"
|
|
344
|
-
size={24}
|
|
345
|
-
color={KColors.gray.normal}
|
|
346
|
-
/>
|
|
347
|
-
</KContainer.View>
|
|
348
|
-
|
|
349
|
-
<TextInput
|
|
350
|
-
ref={inputRef}
|
|
351
|
-
placeholder={placeholder}
|
|
352
|
-
placeholderTextColor={KColors.palette.gray.w200}
|
|
353
|
-
value={value}
|
|
354
|
-
onChangeText={onChangeText}
|
|
355
|
-
onFocus={handleInputFocus}
|
|
356
|
-
onBlur={handleInputBlur}
|
|
357
|
-
onContentSizeChange={handleInputContentSizeChange}
|
|
358
|
-
multiline
|
|
359
|
-
blurOnSubmit={false}
|
|
360
|
-
scrollEnabled
|
|
361
|
-
allowFontScaling={false}
|
|
362
|
-
underlineColorAndroid={KColors.transparent}
|
|
363
|
-
selectionColor={KColors.selector}
|
|
364
|
-
textAlignVertical={isMultilineInput ? 'top' : 'center'}
|
|
365
|
-
style={[styles.textInput]}
|
|
366
|
-
/>
|
|
367
|
-
|
|
368
|
-
{renderEmojiNode()}
|
|
369
|
-
</KContainer.View>
|
|
370
|
-
</KContainer.View>
|
|
304
|
+
)}
|
|
305
|
+
|
|
306
|
+
<ChatMessageInput
|
|
307
|
+
value={value as string}
|
|
308
|
+
placeholder={placeholder}
|
|
309
|
+
onChangeText={handleChangeText}
|
|
310
|
+
onFocus={handleInputFocus}
|
|
311
|
+
onBlur={handleInputBlur}
|
|
312
|
+
onContentSizeChange={handleInputContentSizeChange}
|
|
313
|
+
isInputFocused={isInputFocused}
|
|
314
|
+
isMultilineInput={isMultilineInput}
|
|
315
|
+
// onEmojiPress={onPressEmoji}
|
|
316
|
+
inputRef={inputRef}
|
|
317
|
+
/>
|
|
371
318
|
|
|
372
319
|
<KContainer.Touchable
|
|
373
|
-
onPress={handleSend}
|
|
320
|
+
onPress={isUploadingAttachments ? undefined : handleSend}
|
|
321
|
+
pointerEvents={isUploadingAttachments ? 'none' : 'auto'}
|
|
374
322
|
width={40}
|
|
375
323
|
height={40}
|
|
376
324
|
center
|
|
377
325
|
br="round"
|
|
378
|
-
background={
|
|
326
|
+
background={
|
|
327
|
+
isUploadingAttachments
|
|
328
|
+
? KColors.palette.gray.w400
|
|
329
|
+
: KColors.palette.primary.w400
|
|
330
|
+
}
|
|
379
331
|
marginL="0.75rem"
|
|
332
|
+
opacity={isUploadingAttachments ? 0.6 : 1}
|
|
380
333
|
>
|
|
381
334
|
<KImage.VectorIcons
|
|
382
335
|
name="send"
|
|
@@ -387,7 +340,7 @@ export const ChatComposer = memo(
|
|
|
387
340
|
</KContainer.Touchable>
|
|
388
341
|
</KContainer.View>
|
|
389
342
|
|
|
390
|
-
{hasAttachmentActions
|
|
343
|
+
{hasAttachmentActions && (
|
|
391
344
|
<Reanimated.View
|
|
392
345
|
style={[styles.accessorySlot, accessorySlotStyle]}
|
|
393
346
|
pointerEvents={isAttachmentOpen ? 'auto' : 'none'}
|
|
@@ -395,11 +348,11 @@ export const ChatComposer = memo(
|
|
|
395
348
|
<ChatAttachmentPanel
|
|
396
349
|
actions={attachmentActions}
|
|
397
350
|
columns={attachmentColumns}
|
|
398
|
-
onActionPress={
|
|
351
|
+
onActionPress={handleAttachmentActionInternal}
|
|
399
352
|
renderAction={renderAttachmentAction}
|
|
400
353
|
/>
|
|
401
354
|
</Reanimated.View>
|
|
402
|
-
)
|
|
355
|
+
)}
|
|
403
356
|
</KContainer.View>
|
|
404
357
|
);
|
|
405
358
|
}
|
|
@@ -412,22 +365,4 @@ const styles = StyleSheet.create({
|
|
|
412
365
|
overflow: 'hidden',
|
|
413
366
|
backgroundColor: KColors.palette.gray.w25,
|
|
414
367
|
},
|
|
415
|
-
inputWrapper: {
|
|
416
|
-
overflow: 'hidden',
|
|
417
|
-
},
|
|
418
|
-
inputContainer: {
|
|
419
|
-
borderRadius: KSpacingValue['1.25rem'],
|
|
420
|
-
minHeight: 48,
|
|
421
|
-
paddingVertical: KSpacingValue['0.25rem'],
|
|
422
|
-
},
|
|
423
|
-
textInput: {
|
|
424
|
-
flex: 1,
|
|
425
|
-
maxHeight: INPUT_MAX_HEIGHT,
|
|
426
|
-
fontSize: INPUT_FONT_SIZE,
|
|
427
|
-
lineHeight: INPUT_LINE_HEIGHT,
|
|
428
|
-
color: KColors.palette.gray.w900,
|
|
429
|
-
paddingVertical: IS_IOS ? 0 : 4,
|
|
430
|
-
paddingHorizontal: IS_IOS ? 2 : 0,
|
|
431
|
-
includeFontPadding: false,
|
|
432
|
-
},
|
|
433
368
|
});
|