@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,13 +1,17 @@
|
|
|
1
|
-
import { memo, useState, useCallback, useEffect, useMemo } from 'react';
|
|
1
|
+
import { memo, useState, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
2
2
|
import { Platform, StyleSheet } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { KeyboardAvoidingView } from 'react-native-keyboard-controller';
|
|
5
5
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
6
6
|
import { KContainer } from '@droppii/libs';
|
|
7
|
+
import { useNavigation } from '@react-navigation/native';
|
|
7
8
|
import { useChatMessages } from '../../hooks/useChatMessages';
|
|
9
|
+
import {
|
|
10
|
+
MediaViewerModal,
|
|
11
|
+
type MediaViewerModalHandle,
|
|
12
|
+
} from '../../components/MediaViewerModal';
|
|
8
13
|
import { useConversation, useConversationStore } from '../../store';
|
|
9
14
|
import ChatDetailHeader from './ChatDetailHeader';
|
|
10
|
-
import { ChatList } from './ChatList';
|
|
11
15
|
import { ChatListLegend } from './ChatListLegend';
|
|
12
16
|
import { ChatComposer } from './ChatComposer';
|
|
13
17
|
import {
|
|
@@ -20,8 +24,14 @@ import {
|
|
|
20
24
|
getConversationTitle,
|
|
21
25
|
shouldShowAddMember,
|
|
22
26
|
} from './conversationHeader.utils';
|
|
23
|
-
import {
|
|
24
|
-
|
|
27
|
+
import type {
|
|
28
|
+
ChatDetailProps,
|
|
29
|
+
DChatQuickAction,
|
|
30
|
+
DChatAttachmentAction,
|
|
31
|
+
} from './types';
|
|
32
|
+
import { useSendMessage } from '../../hooks/message/useSendMessage';
|
|
33
|
+
import type { IUrlMetadata } from '../../types/common';
|
|
34
|
+
import { useMessageStore } from '../../store/message';
|
|
25
35
|
|
|
26
36
|
const ChatDetail = memo(
|
|
27
37
|
({
|
|
@@ -31,8 +41,7 @@ const ChatDetail = memo(
|
|
|
31
41
|
subtitle,
|
|
32
42
|
avatarUri,
|
|
33
43
|
avatarFullName,
|
|
34
|
-
|
|
35
|
-
chatCategory,
|
|
44
|
+
peerType,
|
|
36
45
|
applicationType,
|
|
37
46
|
showAddMember,
|
|
38
47
|
getSubtitle,
|
|
@@ -43,9 +52,7 @@ const ChatDetail = memo(
|
|
|
43
52
|
onPressAvatar,
|
|
44
53
|
renderChat,
|
|
45
54
|
showQuickActions = true,
|
|
46
|
-
showAttachmentActions = true,
|
|
47
55
|
quickActions,
|
|
48
|
-
getQuickActions,
|
|
49
56
|
inputValue,
|
|
50
57
|
inputPlaceholder,
|
|
51
58
|
onChangeInput,
|
|
@@ -59,14 +66,46 @@ const ChatDetail = memo(
|
|
|
59
66
|
renderAttachmentAction,
|
|
60
67
|
attachmentColumns,
|
|
61
68
|
}: ChatDetailProps) => {
|
|
62
|
-
const
|
|
69
|
+
const navigation = useNavigation();
|
|
70
|
+
const [internalInput, setInternalInput] = useState<string>('');
|
|
71
|
+
const mediaViewerRef = useRef<MediaViewerModalHandle>(null);
|
|
63
72
|
const conversation = useConversation(conversationId);
|
|
73
|
+
// const user = conversation?.peer;
|
|
74
|
+
|
|
75
|
+
// Default handlers when props not provided
|
|
76
|
+
const handleBackDefault = useCallback(() => {
|
|
77
|
+
navigation.goBack();
|
|
78
|
+
}, [navigation]);
|
|
79
|
+
|
|
80
|
+
const quickActionsDefault = useMemo<DChatQuickAction[]>(
|
|
81
|
+
() =>
|
|
82
|
+
DEFAULT_Chat_QUICK_ACTIONS.map((action) => ({
|
|
83
|
+
...action,
|
|
84
|
+
onPress: () => {
|
|
85
|
+
console.log('[quick-action]', action.id);
|
|
86
|
+
},
|
|
87
|
+
})),
|
|
88
|
+
[]
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
const attachmentActionsDefault = useMemo<DChatAttachmentAction[]>(
|
|
92
|
+
() =>
|
|
93
|
+
DEFAULT_ATTACHMENT_ACTIONS.map((action) => ({
|
|
94
|
+
...action,
|
|
95
|
+
onPress: () => {
|
|
96
|
+
console.log('[attachment-action]', action.id);
|
|
97
|
+
},
|
|
98
|
+
})),
|
|
99
|
+
[]
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
const { sendMessage } = useSendMessage();
|
|
103
|
+
const { pushNewMessage } = useMessageStore();
|
|
64
104
|
|
|
65
105
|
const {
|
|
66
106
|
messages,
|
|
67
107
|
currentUserId,
|
|
68
108
|
onLoadEarlier,
|
|
69
|
-
sendTextMessage,
|
|
70
109
|
isLoading,
|
|
71
110
|
isLoadingEarlier,
|
|
72
111
|
hasMoreEarlier,
|
|
@@ -75,6 +114,21 @@ const ChatDetail = memo(
|
|
|
75
114
|
enabled,
|
|
76
115
|
});
|
|
77
116
|
|
|
117
|
+
// Callback for attachment messages - add them to the message list
|
|
118
|
+
const handleAttachmentMessageSent = useCallback(
|
|
119
|
+
(message: any) => {
|
|
120
|
+
if (__DEV__)
|
|
121
|
+
console.log('[ChatDetail] Attachment message received:', {
|
|
122
|
+
clientMsgID: message?.clientMsgID,
|
|
123
|
+
contentType: message?.contentType,
|
|
124
|
+
});
|
|
125
|
+
if (message) {
|
|
126
|
+
pushNewMessage(message);
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
[pushNewMessage]
|
|
130
|
+
);
|
|
131
|
+
|
|
78
132
|
useEffect(() => {
|
|
79
133
|
useConversationStore.getState().setCurrentConversation(conversationId);
|
|
80
134
|
}, [conversationId]);
|
|
@@ -83,8 +137,7 @@ const ChatDetail = memo(
|
|
|
83
137
|
const resolvedAvatarUri =
|
|
84
138
|
avatarUri ?? getConversationAvatarUri(conversation);
|
|
85
139
|
const resolvedAvatarFullName = avatarFullName ?? resolvedTitle;
|
|
86
|
-
const
|
|
87
|
-
const resolvedChatCategory = chatCategory ?? conversation?.chatCategory;
|
|
140
|
+
const resolvedPeerType = peerType;
|
|
88
141
|
const resolvedApplicationType =
|
|
89
142
|
applicationType ?? conversation?.applicationType;
|
|
90
143
|
const resolvedShowAddMember =
|
|
@@ -101,74 +154,70 @@ const ChatDetail = memo(
|
|
|
101
154
|
return getConversationSubtitle(conversation);
|
|
102
155
|
}, [conversation, getSubtitle, subtitle]);
|
|
103
156
|
|
|
104
|
-
const
|
|
105
|
-
if (!showQuickActions) {
|
|
106
|
-
return undefined;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (quickActions) {
|
|
110
|
-
return quickActions;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (getQuickActions && conversation) {
|
|
114
|
-
return getQuickActions(conversation);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return DEFAULT_Chat_QUICK_ACTIONS;
|
|
118
|
-
}, [conversation, getQuickActions, quickActions, showQuickActions]);
|
|
119
|
-
|
|
120
|
-
const resolvedAttachmentActions = useMemo(() => {
|
|
121
|
-
if (!showAttachmentActions) {
|
|
122
|
-
return undefined;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return attachmentActions ?? DEFAULT_ATTACHMENT_ACTIONS;
|
|
126
|
-
}, [attachmentActions, showAttachmentActions]);
|
|
127
|
-
const [variant, setVariant] = useState<'gifted' | 'legend'>(
|
|
128
|
-
() => getFeatureFlag('CHAT_LIST_VARIANT') as 'gifted' | 'legend'
|
|
129
|
-
);
|
|
157
|
+
const currentInput = inputValue ?? internalInput;
|
|
130
158
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
const
|
|
134
|
-
| 'gifted'
|
|
135
|
-
| 'legend';
|
|
136
|
-
setVariant(newVariant);
|
|
137
|
-
});
|
|
138
|
-
return unsubscribe;
|
|
139
|
-
}, []);
|
|
140
|
-
|
|
141
|
-
const handleChangeInput = useCallback(
|
|
142
|
-
(text: string) => {
|
|
159
|
+
const handleChangeText = useCallback(
|
|
160
|
+
(text?: string) => {
|
|
161
|
+
const newText = text ?? '';
|
|
143
162
|
if (onChangeInput) {
|
|
144
|
-
onChangeInput(
|
|
145
|
-
|
|
163
|
+
onChangeInput(newText);
|
|
164
|
+
} else {
|
|
165
|
+
setInternalInput(newText);
|
|
146
166
|
}
|
|
147
|
-
setInternalInput(text);
|
|
148
167
|
},
|
|
149
168
|
[onChangeInput]
|
|
150
169
|
);
|
|
151
170
|
|
|
152
|
-
const
|
|
171
|
+
const handleSend = useCallback(
|
|
172
|
+
async (urlMetadata?: any) => {
|
|
173
|
+
// Support captured text passed from attachment handler
|
|
174
|
+
const capturedText = (urlMetadata as any)?._capturedText;
|
|
175
|
+
const cleanMetadata = capturedText
|
|
176
|
+
? (({ _capturedText, ...rest }) => rest)(urlMetadata)
|
|
177
|
+
: (urlMetadata as IUrlMetadata);
|
|
153
178
|
|
|
154
|
-
|
|
155
|
-
const text = currentInput.trim();
|
|
156
|
-
if (!text) {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
179
|
+
const text = (capturedText || currentInput).trim();
|
|
159
180
|
|
|
160
|
-
|
|
161
|
-
|
|
181
|
+
// Validate: must have text OR preview metadata (text is optional if preview exists)
|
|
182
|
+
// If metadata exists, trust it (useLinkPreview is responsible for validity)
|
|
183
|
+
if (!text && !cleanMetadata) {
|
|
184
|
+
if (__DEV__)
|
|
185
|
+
console.warn('[ChatDetail] No text or preview link to send');
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
162
188
|
|
|
163
|
-
if
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
189
|
+
// Log if metadata seems incomplete
|
|
190
|
+
if (cleanMetadata && !cleanMetadata.url) {
|
|
191
|
+
if (__DEV__)
|
|
192
|
+
console.warn(
|
|
193
|
+
'[ChatDetail] Preview metadata missing URL - check useLinkPreview'
|
|
194
|
+
);
|
|
167
195
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
196
|
+
|
|
197
|
+
try {
|
|
198
|
+
await sendMessage({
|
|
199
|
+
files: [],
|
|
200
|
+
plainText: text,
|
|
201
|
+
urlMetadata: cleanMetadata || undefined,
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
// Clear input after successful send
|
|
205
|
+
if (onChangeInput) {
|
|
206
|
+
onChangeInput('');
|
|
207
|
+
} else {
|
|
208
|
+
setInternalInput('');
|
|
209
|
+
}
|
|
210
|
+
} catch (error) {
|
|
211
|
+
if (__DEV__)
|
|
212
|
+
console.error('[ChatDetail] Failed to send message:', {
|
|
213
|
+
error,
|
|
214
|
+
text: text.substring(0, 50),
|
|
215
|
+
hasPreview: !!cleanMetadata,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
[currentInput, onChangeInput, sendMessage]
|
|
220
|
+
);
|
|
172
221
|
|
|
173
222
|
const insets = useSafeAreaInsets();
|
|
174
223
|
|
|
@@ -179,15 +228,20 @@ const ChatDetail = memo(
|
|
|
179
228
|
subtitle={resolvedSubtitle}
|
|
180
229
|
avatarUri={resolvedAvatarUri}
|
|
181
230
|
avatarFullName={resolvedAvatarFullName}
|
|
182
|
-
|
|
183
|
-
chatCategory={resolvedChatCategory}
|
|
231
|
+
peerType={resolvedPeerType}
|
|
184
232
|
applicationType={resolvedApplicationType}
|
|
185
233
|
showAddMember={resolvedShowAddMember}
|
|
186
|
-
onBack={onBack}
|
|
187
|
-
onPressSearch={
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
234
|
+
onBack={onBack ?? handleBackDefault}
|
|
235
|
+
onPressSearch={
|
|
236
|
+
onPressSearch ?? (() => console.log('[onPressSearch]'))
|
|
237
|
+
}
|
|
238
|
+
onPressAddMember={
|
|
239
|
+
onPressAddMember ?? (() => console.log('[onPressAddMember]'))
|
|
240
|
+
}
|
|
241
|
+
onPressMenu={onPressMenu ?? (() => console.log('[onPressMenu]'))}
|
|
242
|
+
onPressAvatar={
|
|
243
|
+
onPressAvatar ?? (() => console.log('[onPressAvatar]'))
|
|
244
|
+
}
|
|
191
245
|
/>
|
|
192
246
|
|
|
193
247
|
<KeyboardAvoidingView
|
|
@@ -198,46 +252,52 @@ const ChatDetail = memo(
|
|
|
198
252
|
default: 0,
|
|
199
253
|
})}
|
|
200
254
|
>
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
messages={messages}
|
|
214
|
-
currentUserId={currentUserId}
|
|
215
|
-
renderChat={renderChat}
|
|
216
|
-
onLoadEarlier={onLoadEarlier}
|
|
217
|
-
isLoading={isLoading}
|
|
218
|
-
isLoadingEarlier={isLoadingEarlier}
|
|
219
|
-
hasMoreEarlier={hasMoreEarlier}
|
|
220
|
-
/>
|
|
221
|
-
)}
|
|
255
|
+
<ChatListLegend
|
|
256
|
+
messages={messages}
|
|
257
|
+
currentUserId={currentUserId}
|
|
258
|
+
renderChat={renderChat}
|
|
259
|
+
onLoadEarlier={onLoadEarlier}
|
|
260
|
+
isLoading={isLoading}
|
|
261
|
+
isLoadingEarlier={isLoadingEarlier}
|
|
262
|
+
hasMoreEarlier={hasMoreEarlier}
|
|
263
|
+
onMediaPress={(items, index) => {
|
|
264
|
+
mediaViewerRef.current?.show(items, index);
|
|
265
|
+
}}
|
|
266
|
+
/>
|
|
222
267
|
|
|
223
268
|
<ChatComposer
|
|
224
269
|
value={currentInput}
|
|
225
270
|
placeholder={inputPlaceholder}
|
|
226
|
-
onChangeText={
|
|
271
|
+
onChangeText={handleChangeText}
|
|
227
272
|
onSend={handleSend}
|
|
228
|
-
|
|
229
|
-
|
|
273
|
+
onMessageSent={handleAttachmentMessageSent}
|
|
274
|
+
onPressAttach={
|
|
275
|
+
onPressAttach ?? (() => console.log('[onPressAttach]'))
|
|
276
|
+
}
|
|
277
|
+
onPressEmoji={onPressEmoji ?? (() => console.log('[onPressEmoji]'))}
|
|
230
278
|
showQuickActions={showQuickActions}
|
|
231
|
-
quickActions={
|
|
232
|
-
attachmentActions={
|
|
233
|
-
onQuickActionPress={
|
|
234
|
-
|
|
279
|
+
quickActions={quickActions ?? quickActionsDefault}
|
|
280
|
+
attachmentActions={attachmentActions ?? attachmentActionsDefault}
|
|
281
|
+
onQuickActionPress={
|
|
282
|
+
onQuickActionPress ??
|
|
283
|
+
((action: DChatQuickAction) => {
|
|
284
|
+
console.log('[onQuickActionPress]', action.id, action.meta);
|
|
285
|
+
})
|
|
286
|
+
}
|
|
287
|
+
onAttachmentAction={
|
|
288
|
+
onAttachmentAction ??
|
|
289
|
+
((action: DChatAttachmentAction) => {
|
|
290
|
+
console.log('[onAttachmentAction]', action.id, action.meta);
|
|
291
|
+
})
|
|
292
|
+
}
|
|
235
293
|
renderQuickAction={renderQuickAction}
|
|
236
294
|
renderQuickActions={renderQuickActions}
|
|
237
295
|
renderAttachmentAction={renderAttachmentAction}
|
|
238
296
|
attachmentColumns={attachmentColumns}
|
|
239
297
|
/>
|
|
240
298
|
</KeyboardAvoidingView>
|
|
299
|
+
|
|
300
|
+
<MediaViewerModal ref={mediaViewerRef} />
|
|
241
301
|
</KContainer.Page>
|
|
242
302
|
);
|
|
243
303
|
}
|
|
@@ -16,8 +16,7 @@ const ChatDetailHeader = memo(
|
|
|
16
16
|
subtitle,
|
|
17
17
|
avatarUri,
|
|
18
18
|
avatarFullName,
|
|
19
|
-
|
|
20
|
-
chatCategory,
|
|
19
|
+
peerType,
|
|
21
20
|
applicationType,
|
|
22
21
|
showAddMember = false,
|
|
23
22
|
onBack,
|
|
@@ -81,17 +80,13 @@ const ChatDetailHeader = memo(
|
|
|
81
80
|
<AvatarSection
|
|
82
81
|
avatar={avatarUri ?? null}
|
|
83
82
|
fullName={avatarFullName ?? title}
|
|
84
|
-
|
|
83
|
+
peerType={peerType}
|
|
85
84
|
applicationType={applicationType}
|
|
86
|
-
chatType={chatType}
|
|
87
85
|
/>
|
|
88
86
|
|
|
89
87
|
<KContainer.View flex marginL="0.5rem">
|
|
90
88
|
<KContainer.View row alignItems>
|
|
91
|
-
<NamePrefixIcon
|
|
92
|
-
chatCategory={chatCategory}
|
|
93
|
-
chatType={chatType}
|
|
94
|
-
/>
|
|
89
|
+
<NamePrefixIcon peerType={peerType} />
|
|
95
90
|
<KLabel.Text
|
|
96
91
|
typo="TextLgBold"
|
|
97
92
|
color={KColors.gray.dark}
|
|
@@ -117,9 +112,8 @@ const ChatDetailHeader = memo(
|
|
|
117
112
|
[
|
|
118
113
|
avatarFullName,
|
|
119
114
|
avatarUri,
|
|
120
|
-
|
|
115
|
+
peerType,
|
|
121
116
|
applicationType,
|
|
122
|
-
chatType,
|
|
123
117
|
onBack,
|
|
124
118
|
onPressAvatar,
|
|
125
119
|
subtitle,
|
|
@@ -47,7 +47,7 @@ export const ChatLinkPreview = memo(
|
|
|
47
47
|
</KLabel.Text>
|
|
48
48
|
</KContainer.View>
|
|
49
49
|
<KContainer.Touchable onPress={onDismiss} style={styles.right}>
|
|
50
|
-
<KImage.VectorIcons name="close" size={16} />
|
|
50
|
+
<KImage.VectorIcons name="close-o" size={16} />
|
|
51
51
|
</KContainer.Touchable>
|
|
52
52
|
</KContainer.View>
|
|
53
53
|
);
|
|
@@ -26,17 +26,8 @@ export const ChatListLegend = memo(
|
|
|
26
26
|
onLoadNewer,
|
|
27
27
|
isLoadingNewer,
|
|
28
28
|
hasMoreNewer,
|
|
29
|
+
onMediaPress,
|
|
29
30
|
}: ChatListProps) => {
|
|
30
|
-
if (__DEV__) {
|
|
31
|
-
console.log('[LegendList] Props:', {
|
|
32
|
-
hasMoreEarlier,
|
|
33
|
-
isLoadingEarlier,
|
|
34
|
-
hasMoreNewer,
|
|
35
|
-
isLoadingNewer,
|
|
36
|
-
messagesCount: messages.length,
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
31
|
// Precompute all message data in single pass (O(n))
|
|
41
32
|
const messageDataMap = useMemo(
|
|
42
33
|
() => precomputeLegendListData(messages),
|
|
@@ -97,7 +88,7 @@ export const ChatListLegend = memo(
|
|
|
97
88
|
return null; // Shouldn't happen if logic is consistent
|
|
98
89
|
}
|
|
99
90
|
|
|
100
|
-
const { dayStart,
|
|
91
|
+
const { dayStart, createdAt } = messageData;
|
|
101
92
|
|
|
102
93
|
return (
|
|
103
94
|
<>
|
|
@@ -116,9 +107,9 @@ export const ChatListLegend = memo(
|
|
|
116
107
|
) : (
|
|
117
108
|
<LegendChatMessage
|
|
118
109
|
message={message}
|
|
119
|
-
messageType={messageType}
|
|
120
110
|
isOutgoing={isOutgoing}
|
|
121
111
|
createdAtTime={createdAt}
|
|
112
|
+
onMediaPress={onMediaPress}
|
|
122
113
|
/>
|
|
123
114
|
)}
|
|
124
115
|
</KContainer.View>
|
|
@@ -136,7 +127,13 @@ export const ChatListLegend = memo(
|
|
|
136
127
|
);
|
|
137
128
|
}
|
|
138
129
|
},
|
|
139
|
-
[
|
|
130
|
+
[
|
|
131
|
+
currentUserId,
|
|
132
|
+
renderChat,
|
|
133
|
+
messageDataMap,
|
|
134
|
+
handleItemLayout,
|
|
135
|
+
onMediaPress,
|
|
136
|
+
]
|
|
140
137
|
);
|
|
141
138
|
|
|
142
139
|
const maintainScrollConfig = useMemo(
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
import { KContainer, KImage, KColors } from '@droppii/libs';
|
|
4
|
+
|
|
5
|
+
export interface ChatInputActionsProps {
|
|
6
|
+
onSend: () => void;
|
|
7
|
+
onAttachmentToggle: () => void;
|
|
8
|
+
hasAttachmentActions: boolean;
|
|
9
|
+
isAttachmentOpen: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const ChatInputActions = memo(
|
|
13
|
+
({
|
|
14
|
+
onSend,
|
|
15
|
+
onAttachmentToggle,
|
|
16
|
+
hasAttachmentActions,
|
|
17
|
+
isAttachmentOpen,
|
|
18
|
+
}: ChatInputActionsProps) => {
|
|
19
|
+
return (
|
|
20
|
+
<>
|
|
21
|
+
{hasAttachmentActions && (
|
|
22
|
+
<KContainer.Touchable
|
|
23
|
+
onPress={onAttachmentToggle}
|
|
24
|
+
center
|
|
25
|
+
br="round"
|
|
26
|
+
style={styles.attachmentButton}
|
|
27
|
+
>
|
|
28
|
+
<KImage.VectorIcons
|
|
29
|
+
name={isAttachmentOpen ? 'close-circle-o' : 'plus-circle-o'}
|
|
30
|
+
size={24}
|
|
31
|
+
color={
|
|
32
|
+
isAttachmentOpen
|
|
33
|
+
? KColors.palette.primary.w400
|
|
34
|
+
: KColors.palette.gray.w600
|
|
35
|
+
}
|
|
36
|
+
/>
|
|
37
|
+
</KContainer.Touchable>
|
|
38
|
+
)}
|
|
39
|
+
|
|
40
|
+
<KContainer.Touchable
|
|
41
|
+
onPress={onSend}
|
|
42
|
+
width={40}
|
|
43
|
+
height={40}
|
|
44
|
+
center
|
|
45
|
+
br="round"
|
|
46
|
+
background={KColors.palette.primary.w400}
|
|
47
|
+
marginL="0.75rem"
|
|
48
|
+
style={styles.sendButton}
|
|
49
|
+
>
|
|
50
|
+
<KImage.VectorIcons
|
|
51
|
+
name="send"
|
|
52
|
+
provider="MaterialCommunityIcons"
|
|
53
|
+
size={20}
|
|
54
|
+
color={KColors.white}
|
|
55
|
+
/>
|
|
56
|
+
</KContainer.Touchable>
|
|
57
|
+
</>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
ChatInputActions.displayName = 'ChatInputActions';
|
|
63
|
+
|
|
64
|
+
const styles = StyleSheet.create({
|
|
65
|
+
attachmentButton: {
|
|
66
|
+
// Touchable styling handled by KContainer
|
|
67
|
+
},
|
|
68
|
+
sendButton: {
|
|
69
|
+
// Touchable styling handled by KContainer
|
|
70
|
+
},
|
|
71
|
+
});
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { memo, useCallback } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Platform,
|
|
4
|
+
StyleSheet,
|
|
5
|
+
TextInput,
|
|
6
|
+
type NativeSyntheticEvent,
|
|
7
|
+
type TextInputContentSizeChangeEventData,
|
|
8
|
+
} from 'react-native';
|
|
9
|
+
import { KContainer, KImage, KColors, KSpacingValue } from '@droppii/libs';
|
|
10
|
+
|
|
11
|
+
const INPUT_FONT_SIZE = 16;
|
|
12
|
+
const INPUT_LINE_HEIGHT = 22.4;
|
|
13
|
+
const INPUT_MAX_HEIGHT = INPUT_LINE_HEIGHT * 5;
|
|
14
|
+
const IS_IOS = Platform.OS === 'ios';
|
|
15
|
+
|
|
16
|
+
export interface ChatMessageInputProps {
|
|
17
|
+
value?: string;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
onChangeText: (text?: string) => void;
|
|
20
|
+
onFocus: () => void;
|
|
21
|
+
onBlur: () => void;
|
|
22
|
+
onContentSizeChange: (
|
|
23
|
+
event: NativeSyntheticEvent<TextInputContentSizeChangeEventData>
|
|
24
|
+
) => void;
|
|
25
|
+
isInputFocused: boolean;
|
|
26
|
+
isMultilineInput: boolean;
|
|
27
|
+
onEmojiPress?: () => void;
|
|
28
|
+
inputRef: React.RefObject<TextInput>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const ChatMessageInput = memo(
|
|
32
|
+
({
|
|
33
|
+
value,
|
|
34
|
+
placeholder = 'Nhập tin nhắn...',
|
|
35
|
+
onChangeText,
|
|
36
|
+
onFocus,
|
|
37
|
+
onBlur,
|
|
38
|
+
onContentSizeChange,
|
|
39
|
+
isInputFocused,
|
|
40
|
+
isMultilineInput,
|
|
41
|
+
onEmojiPress,
|
|
42
|
+
inputRef,
|
|
43
|
+
}: ChatMessageInputProps) => {
|
|
44
|
+
const renderEmojiNode = useCallback(
|
|
45
|
+
() => (
|
|
46
|
+
<KContainer.Touchable marginR="0.5rem" onPress={onEmojiPress}>
|
|
47
|
+
<KImage.VectorIcons
|
|
48
|
+
name="sticker-o"
|
|
49
|
+
size={24}
|
|
50
|
+
color={KColors.gray.normal}
|
|
51
|
+
/>
|
|
52
|
+
</KContainer.Touchable>
|
|
53
|
+
),
|
|
54
|
+
[onEmojiPress]
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<KContainer.View flex marginL="0.75rem" style={styles.inputWrapper}>
|
|
59
|
+
<KContainer.View
|
|
60
|
+
row
|
|
61
|
+
alignItems={isMultilineInput ? 'flex-end' : 'center'}
|
|
62
|
+
brW={1}
|
|
63
|
+
brC={
|
|
64
|
+
isInputFocused
|
|
65
|
+
? KColors.palette.primary.w400
|
|
66
|
+
: KColors.palette.gray.w100
|
|
67
|
+
}
|
|
68
|
+
background={KColors.white}
|
|
69
|
+
paddingL="0.75rem"
|
|
70
|
+
style={styles.inputContainer}
|
|
71
|
+
>
|
|
72
|
+
<KContainer.View marginR="0.75rem">
|
|
73
|
+
<KImage.VectorIcons
|
|
74
|
+
name="chat-suggest-o"
|
|
75
|
+
size={24}
|
|
76
|
+
color={KColors.gray.normal}
|
|
77
|
+
/>
|
|
78
|
+
</KContainer.View>
|
|
79
|
+
|
|
80
|
+
<TextInput
|
|
81
|
+
ref={inputRef}
|
|
82
|
+
placeholder={placeholder}
|
|
83
|
+
placeholderTextColor={KColors.palette.gray.w200}
|
|
84
|
+
value={value}
|
|
85
|
+
onChangeText={onChangeText}
|
|
86
|
+
onFocus={onFocus}
|
|
87
|
+
onBlur={onBlur}
|
|
88
|
+
onContentSizeChange={onContentSizeChange}
|
|
89
|
+
multiline
|
|
90
|
+
blurOnSubmit={false}
|
|
91
|
+
scrollEnabled
|
|
92
|
+
allowFontScaling={false}
|
|
93
|
+
underlineColorAndroid={KColors.transparent}
|
|
94
|
+
selectionColor={KColors.selector}
|
|
95
|
+
textAlignVertical={isMultilineInput ? 'top' : 'center'}
|
|
96
|
+
style={[styles.textInput]}
|
|
97
|
+
/>
|
|
98
|
+
|
|
99
|
+
{renderEmojiNode()}
|
|
100
|
+
</KContainer.View>
|
|
101
|
+
</KContainer.View>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
ChatMessageInput.displayName = 'ChatMessageInput';
|
|
107
|
+
|
|
108
|
+
const styles = StyleSheet.create({
|
|
109
|
+
inputWrapper: {
|
|
110
|
+
overflow: 'hidden',
|
|
111
|
+
},
|
|
112
|
+
inputContainer: {
|
|
113
|
+
borderRadius: KSpacingValue['1.25rem'],
|
|
114
|
+
minHeight: 48,
|
|
115
|
+
paddingVertical: KSpacingValue['0.25rem'],
|
|
116
|
+
},
|
|
117
|
+
textInput: {
|
|
118
|
+
flex: 1,
|
|
119
|
+
maxHeight: INPUT_MAX_HEIGHT,
|
|
120
|
+
fontSize: INPUT_FONT_SIZE,
|
|
121
|
+
lineHeight: INPUT_LINE_HEIGHT,
|
|
122
|
+
color: KColors.palette.gray.w900,
|
|
123
|
+
paddingVertical: IS_IOS ? 0 : 4,
|
|
124
|
+
paddingHorizontal: IS_IOS ? 2 : 0,
|
|
125
|
+
includeFontPadding: false,
|
|
126
|
+
},
|
|
127
|
+
});
|