stream-chat-react-native-core 7.0.0-rc.8 → 7.0.0
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/README.md +1 -1
- package/lib/commonjs/components/Attachment/AudioAttachment.js +19 -9
- package/lib/commonjs/components/Attachment/AudioAttachment.js.map +1 -1
- package/lib/commonjs/components/Attachment/FileAttachmentGroup.js +3 -1
- package/lib/commonjs/components/Attachment/FileAttachmentGroup.js.map +1 -1
- package/lib/commonjs/components/Attachment/Gallery.js +16 -3
- package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
- package/lib/commonjs/components/Attachment/ImageReloadIndicator.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js +2 -2
- package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerItem.js +7 -24
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerItem.js.map +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteInput.js +2 -4
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteInput.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js +320 -310
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useChannelDataState.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js +2 -0
- package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useMessageListPagination.js +133 -147
- package/lib/commonjs/components/Channel/hooks/useMessageListPagination.js.map +1 -1
- package/lib/commonjs/components/Chat/Chat.js.map +1 -1
- package/lib/commonjs/components/KeyboardCompatibleView/KeyboardCompatibleView.js +8 -13
- package/lib/commonjs/components/KeyboardCompatibleView/KeyboardCompatibleView.js.map +1 -1
- package/lib/commonjs/components/Message/Message.js +14 -7
- package/lib/commonjs/components/Message/Message.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageFooter.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js +70 -54
- package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageStatus.js +14 -6
- package/lib/commonjs/components/Message/MessageSimple/MessageStatus.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageTextContainer.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js.map +1 -1
- package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js +3 -1
- package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js.map +1 -1
- package/lib/commonjs/components/Message/hooks/useMessageActionHandlers.js.map +1 -1
- package/lib/commonjs/components/Message/hooks/useMessageActions.js.map +1 -1
- package/lib/commonjs/components/MessageInput/FileUploadPreview.js +25 -39
- package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
- package/lib/commonjs/components/MessageInput/InputButtons.js +18 -15
- package/lib/commonjs/components/MessageInput/InputButtons.js.map +1 -1
- package/lib/commonjs/components/MessageInput/MessageInput.js +96 -74
- package/lib/commonjs/components/MessageInput/MessageInput.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js +2 -1
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js.map +1 -1
- package/lib/commonjs/components/MessageInput/hooks/useAudioController.js +4 -4
- package/lib/commonjs/components/MessageInput/hooks/useAudioController.js.map +1 -1
- package/lib/commonjs/components/MessageList/MessageList.js +281 -223
- package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
- package/lib/commonjs/components/MessageList/hooks/useMessageList.js +65 -48
- package/lib/commonjs/components/MessageList/hooks/useMessageList.js.map +1 -1
- package/lib/commonjs/components/MessageList/hooks/useShouldScrollToRecentOnNewOwnMessage.js.map +1 -1
- package/lib/commonjs/components/MessageList/utils/getGroupStyles.js +1 -1
- package/lib/commonjs/components/MessageList/utils/getGroupStyles.js.map +1 -1
- package/lib/commonjs/components/MessageList/utils/getLastReceivedMessage.js.map +1 -1
- package/lib/commonjs/components/MessageList/utils/getReadState.js +20 -0
- package/lib/commonjs/components/MessageList/utils/getReadState.js.map +1 -0
- package/lib/commonjs/components/MessageMenu/hooks/useFetchReactions.js.map +1 -1
- package/lib/commonjs/components/Poll/components/Button.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollResults/PollResultItem.js.map +1 -1
- package/lib/commonjs/components/Reply/Reply.js +2 -2
- package/lib/commonjs/components/Reply/Reply.js.map +1 -1
- package/lib/commonjs/components/Thread/components/ThreadFooterComponent.js +24 -6
- package/lib/commonjs/components/Thread/components/ThreadFooterComponent.js.map +1 -1
- package/lib/commonjs/components/ThreadList/ThreadListItem.js.map +1 -1
- package/lib/commonjs/components/UIComponents/BottomSheetModal.js +10 -6
- package/lib/commonjs/components/UIComponents/BottomSheetModal.js.map +1 -1
- package/lib/commonjs/components/index.js +15 -4
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/contexts/attachmentPickerContext/AttachmentPickerContext.js.map +1 -1
- package/lib/commonjs/contexts/channelsStateContext/useChannelState.js +5 -1
- package/lib/commonjs/contexts/channelsStateContext/useChannelState.js.map +1 -1
- package/lib/commonjs/contexts/debugContext/DebugContext.js.map +1 -1
- package/lib/commonjs/contexts/imageGalleryContext/ImageGalleryContext.js.map +1 -1
- package/lib/commonjs/contexts/messageContext/MessageContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +535 -523
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +7 -6
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js +37 -41
- package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/utils/utils.js +4 -4
- package/lib/commonjs/contexts/messageInputContext/utils/utils.js.map +1 -1
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/commonjs/contexts/pollContext/pollContext.js.map +1 -1
- package/lib/commonjs/contexts/suggestionsContext/SuggestionsContext.js +23 -14
- package/lib/commonjs/contexts/suggestionsContext/SuggestionsContext.js.map +1 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js +2 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/contexts/threadContext/ThreadContext.js.map +1 -1
- package/lib/commonjs/contexts/threadsContext/ThreadListItemContext.js.map +1 -1
- package/lib/commonjs/hooks/index.js +22 -0
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useAudioPlayer.js +60 -69
- package/lib/commonjs/hooks/useAudioPlayer.js.map +1 -1
- package/lib/commonjs/hooks/useStableCallback.js +13 -0
- package/lib/commonjs/hooks/useStableCallback.js.map +1 -0
- package/lib/commonjs/hooks/useTranslatedMessage.js.map +1 -1
- package/lib/commonjs/i18n/en.json +3 -0
- package/lib/commonjs/i18n/es.json +3 -0
- package/lib/commonjs/i18n/fr.json +3 -0
- package/lib/commonjs/i18n/he.json +3 -0
- package/lib/commonjs/i18n/hi.json +2 -0
- package/lib/commonjs/i18n/it.json +3 -0
- package/lib/commonjs/i18n/ja.json +1 -0
- package/lib/commonjs/i18n/ko.json +1 -0
- package/lib/commonjs/i18n/nl.json +2 -0
- package/lib/commonjs/i18n/pt-br.json +3 -0
- package/lib/commonjs/i18n/ru.json +4 -0
- package/lib/commonjs/i18n/tr.json +2 -0
- package/lib/commonjs/mock-builders/api/channelMocks.js.map +1 -1
- package/lib/commonjs/native.js.map +1 -1
- package/lib/commonjs/store/mappers/mapMessageToStorable.js.map +1 -1
- package/lib/commonjs/types/types.js.map +1 -1
- package/lib/commonjs/utils/compressImage.js +1 -1
- package/lib/commonjs/utils/compressImage.js.map +1 -1
- package/lib/commonjs/utils/removeReservedFields.js.map +1 -1
- package/lib/commonjs/utils/utils.js +17 -4
- package/lib/commonjs/utils/utils.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/AudioAttachment.js +19 -9
- package/lib/module/components/Attachment/AudioAttachment.js.map +1 -1
- package/lib/module/components/Attachment/FileAttachmentGroup.js +3 -1
- package/lib/module/components/Attachment/FileAttachmentGroup.js.map +1 -1
- package/lib/module/components/Attachment/Gallery.js +16 -3
- package/lib/module/components/Attachment/Gallery.js.map +1 -1
- package/lib/module/components/Attachment/ImageReloadIndicator.js.map +1 -1
- package/lib/module/components/AttachmentPicker/AttachmentPicker.js +2 -2
- package/lib/module/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerItem.js +7 -24
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerItem.js.map +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteInput.js +2 -4
- package/lib/module/components/AutoCompleteInput/AutoCompleteInput.js.map +1 -1
- package/lib/module/components/Channel/Channel.js +320 -310
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useChannelDataState.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateMessagesContext.js +2 -0
- package/lib/module/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
- package/lib/module/components/Channel/hooks/useMessageListPagination.js +133 -147
- package/lib/module/components/Channel/hooks/useMessageListPagination.js.map +1 -1
- package/lib/module/components/Chat/Chat.js.map +1 -1
- package/lib/module/components/KeyboardCompatibleView/KeyboardCompatibleView.js +8 -13
- package/lib/module/components/KeyboardCompatibleView/KeyboardCompatibleView.js.map +1 -1
- package/lib/module/components/Message/Message.js +14 -7
- package/lib/module/components/Message/Message.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageFooter.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageSimple.js +70 -54
- package/lib/module/components/Message/MessageSimple/MessageSimple.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageStatus.js +14 -6
- package/lib/module/components/Message/MessageSimple/MessageStatus.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageTextContainer.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/utils/renderText.js.map +1 -1
- package/lib/module/components/Message/hooks/useCreateMessageContext.js +3 -1
- package/lib/module/components/Message/hooks/useCreateMessageContext.js.map +1 -1
- package/lib/module/components/Message/hooks/useMessageActionHandlers.js.map +1 -1
- package/lib/module/components/Message/hooks/useMessageActions.js.map +1 -1
- package/lib/module/components/MessageInput/FileUploadPreview.js +25 -39
- package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
- package/lib/module/components/MessageInput/InputButtons.js +18 -15
- package/lib/module/components/MessageInput/InputButtons.js.map +1 -1
- package/lib/module/components/MessageInput/MessageInput.js +96 -74
- package/lib/module/components/MessageInput/MessageInput.js.map +1 -1
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js +2 -1
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js.map +1 -1
- package/lib/module/components/MessageInput/hooks/useAudioController.js +4 -4
- package/lib/module/components/MessageInput/hooks/useAudioController.js.map +1 -1
- package/lib/module/components/MessageList/MessageList.js +281 -223
- package/lib/module/components/MessageList/MessageList.js.map +1 -1
- package/lib/module/components/MessageList/hooks/useMessageList.js +65 -48
- package/lib/module/components/MessageList/hooks/useMessageList.js.map +1 -1
- package/lib/module/components/MessageList/hooks/useShouldScrollToRecentOnNewOwnMessage.js.map +1 -1
- package/lib/module/components/MessageList/utils/getGroupStyles.js +1 -1
- package/lib/module/components/MessageList/utils/getGroupStyles.js.map +1 -1
- package/lib/module/components/MessageList/utils/getLastReceivedMessage.js.map +1 -1
- package/lib/module/components/MessageList/utils/getReadState.js +20 -0
- package/lib/module/components/MessageList/utils/getReadState.js.map +1 -0
- package/lib/module/components/MessageMenu/hooks/useFetchReactions.js.map +1 -1
- package/lib/module/components/Poll/components/Button.js.map +1 -1
- package/lib/module/components/Poll/components/PollResults/PollResultItem.js.map +1 -1
- package/lib/module/components/Reply/Reply.js +2 -2
- package/lib/module/components/Reply/Reply.js.map +1 -1
- package/lib/module/components/Thread/components/ThreadFooterComponent.js +24 -6
- package/lib/module/components/Thread/components/ThreadFooterComponent.js.map +1 -1
- package/lib/module/components/ThreadList/ThreadListItem.js.map +1 -1
- package/lib/module/components/UIComponents/BottomSheetModal.js +10 -6
- package/lib/module/components/UIComponents/BottomSheetModal.js.map +1 -1
- package/lib/module/components/index.js +15 -4
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/contexts/attachmentPickerContext/AttachmentPickerContext.js.map +1 -1
- package/lib/module/contexts/channelsStateContext/useChannelState.js +5 -1
- package/lib/module/contexts/channelsStateContext/useChannelState.js.map +1 -1
- package/lib/module/contexts/debugContext/DebugContext.js.map +1 -1
- package/lib/module/contexts/imageGalleryContext/ImageGalleryContext.js.map +1 -1
- package/lib/module/contexts/messageContext/MessageContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js +535 -523
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +7 -6
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js +37 -41
- package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
- package/lib/module/contexts/messageInputContext/utils/utils.js +4 -4
- package/lib/module/contexts/messageInputContext/utils/utils.js.map +1 -1
- package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/module/contexts/pollContext/pollContext.js.map +1 -1
- package/lib/module/contexts/suggestionsContext/SuggestionsContext.js +23 -14
- package/lib/module/contexts/suggestionsContext/SuggestionsContext.js.map +1 -1
- package/lib/module/contexts/themeContext/utils/theme.js +2 -1
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/contexts/threadContext/ThreadContext.js.map +1 -1
- package/lib/module/contexts/threadsContext/ThreadListItemContext.js.map +1 -1
- package/lib/module/hooks/index.js +22 -0
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useAudioPlayer.js +60 -69
- package/lib/module/hooks/useAudioPlayer.js.map +1 -1
- package/lib/module/hooks/useStableCallback.js +13 -0
- package/lib/module/hooks/useStableCallback.js.map +1 -0
- package/lib/module/hooks/useTranslatedMessage.js.map +1 -1
- package/lib/module/i18n/en.json +3 -0
- package/lib/module/i18n/es.json +3 -0
- package/lib/module/i18n/fr.json +3 -0
- package/lib/module/i18n/he.json +3 -0
- package/lib/module/i18n/hi.json +2 -0
- package/lib/module/i18n/it.json +3 -0
- package/lib/module/i18n/ja.json +1 -0
- package/lib/module/i18n/ko.json +1 -0
- package/lib/module/i18n/nl.json +2 -0
- package/lib/module/i18n/pt-br.json +3 -0
- package/lib/module/i18n/ru.json +4 -0
- package/lib/module/i18n/tr.json +2 -0
- package/lib/module/mock-builders/api/channelMocks.js.map +1 -1
- package/lib/module/native.js.map +1 -1
- package/lib/module/store/mappers/mapMessageToStorable.js.map +1 -1
- package/lib/module/types/types.js.map +1 -1
- package/lib/module/utils/compressImage.js +1 -1
- package/lib/module/utils/compressImage.js.map +1 -1
- package/lib/module/utils/removeReservedFields.js.map +1 -1
- package/lib/module/utils/utils.js +17 -4
- package/lib/module/utils/utils.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Attachment/AudioAttachment.d.ts +2 -2
- package/lib/typescript/components/Attachment/AudioAttachment.d.ts.map +1 -1
- package/lib/typescript/components/Attachment/FileAttachmentGroup.d.ts.map +1 -1
- package/lib/typescript/components/Attachment/Gallery.d.ts +3 -3
- package/lib/typescript/components/Attachment/Gallery.d.ts.map +1 -1
- package/lib/typescript/components/Attachment/ImageReloadIndicator.d.ts +4 -3
- package/lib/typescript/components/Attachment/ImageReloadIndicator.d.ts.map +1 -1
- package/lib/typescript/components/AttachmentPicker/AttachmentPicker.d.ts.map +1 -1
- package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerItem.d.ts +2 -2
- package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerItem.d.ts.map +1 -1
- package/lib/typescript/components/AutoCompleteInput/AutoCompleteInput.d.ts +2 -3
- package/lib/typescript/components/AutoCompleteInput/AutoCompleteInput.d.ts.map +1 -1
- package/lib/typescript/components/Channel/Channel.d.ts +3 -4
- package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useChannelDataState.d.ts +2 -3
- package/lib/typescript/components/Channel/hooks/useChannelDataState.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateThreadContext.d.ts +6 -6
- package/lib/typescript/components/Channel/hooks/useCreateThreadContext.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useMessageListPagination.d.ts +3 -3
- package/lib/typescript/components/Channel/hooks/useMessageListPagination.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/hooks/useChannelPreviewData.d.ts +1 -1
- package/lib/typescript/components/ChannelPreview/hooks/useLatestMessagePreview.d.ts +1 -1
- package/lib/typescript/components/Chat/Chat.d.ts +0 -9
- package/lib/typescript/components/Chat/Chat.d.ts.map +1 -1
- package/lib/typescript/components/KeyboardCompatibleView/KeyboardCompatibleView.d.ts +3 -0
- package/lib/typescript/components/KeyboardCompatibleView/KeyboardCompatibleView.d.ts.map +1 -1
- package/lib/typescript/components/Message/Message.d.ts +4 -5
- package/lib/typescript/components/Message/Message.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageSimple/MessageFooter.d.ts +2 -3
- package/lib/typescript/components/Message/MessageSimple/MessageFooter.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageSimple/MessageSimple.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageSimple/MessageStatus.d.ts +1 -1
- package/lib/typescript/components/Message/MessageSimple/MessageStatus.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageSimple/MessageTextContainer.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageSimple/utils/renderText.d.ts +2 -2
- package/lib/typescript/components/Message/MessageSimple/utils/renderText.d.ts.map +1 -1
- package/lib/typescript/components/Message/hooks/useCreateMessageContext.d.ts +1 -1
- package/lib/typescript/components/Message/hooks/useCreateMessageContext.d.ts.map +1 -1
- package/lib/typescript/components/Message/hooks/useMessageActionHandlers.d.ts.map +1 -1
- package/lib/typescript/components/Message/hooks/useMessageActions.d.ts +2 -2
- package/lib/typescript/components/Message/hooks/useMessageActions.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/FileUploadPreview.d.ts +2 -4
- package/lib/typescript/components/MessageInput/FileUploadPreview.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/InputButtons.d.ts +1 -1
- package/lib/typescript/components/MessageInput/InputButtons.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/MessageInput.d.ts +1 -1
- package/lib/typescript/components/MessageInput/MessageInput.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/hooks/useAudioController.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/MessageList.d.ts +4 -4
- package/lib/typescript/components/MessageList/MessageList.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/MessageSystem.d.ts +2 -2
- package/lib/typescript/components/MessageList/MessageSystem.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/hooks/useMessageList.d.ts +14 -9
- package/lib/typescript/components/MessageList/hooks/useMessageList.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/hooks/useShouldScrollToRecentOnNewOwnMessage.d.ts +2 -2
- package/lib/typescript/components/MessageList/hooks/useShouldScrollToRecentOnNewOwnMessage.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/utils/getGroupStyles.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/utils/getLastReceivedMessage.d.ts +2 -2
- package/lib/typescript/components/MessageList/utils/getLastReceivedMessage.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/utils/getReadState.d.ts +9 -0
- package/lib/typescript/components/MessageList/utils/getReadState.d.ts.map +1 -0
- package/lib/typescript/components/MessageMenu/hooks/useFetchReactions.d.ts +2 -3
- package/lib/typescript/components/MessageMenu/hooks/useFetchReactions.d.ts.map +1 -1
- package/lib/typescript/components/Poll/components/Button.d.ts +2 -3
- package/lib/typescript/components/Poll/components/Button.d.ts.map +1 -1
- package/lib/typescript/components/Poll/components/PollResults/PollResultItem.d.ts +2 -3
- package/lib/typescript/components/Poll/components/PollResults/PollResultItem.d.ts.map +1 -1
- package/lib/typescript/components/Reply/Reply.d.ts.map +1 -1
- package/lib/typescript/components/Thread/components/ThreadFooterComponent.d.ts.map +1 -1
- package/lib/typescript/components/ThreadList/ThreadListItem.d.ts.map +1 -1
- package/lib/typescript/components/UIComponents/BottomSheetModal.d.ts.map +1 -1
- package/lib/typescript/components/index.d.ts +2 -1
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/contexts/attachmentPickerContext/AttachmentPickerContext.d.ts +3 -3
- package/lib/typescript/contexts/attachmentPickerContext/AttachmentPickerContext.d.ts.map +1 -1
- package/lib/typescript/contexts/channelsStateContext/useChannelState.d.ts.map +1 -1
- package/lib/typescript/contexts/debugContext/DebugContext.d.ts +2 -3
- package/lib/typescript/contexts/debugContext/DebugContext.d.ts.map +1 -1
- package/lib/typescript/contexts/imageGalleryContext/ImageGalleryContext.d.ts +3 -3
- package/lib/typescript/contexts/imageGalleryContext/ImageGalleryContext.d.ts.map +1 -1
- package/lib/typescript/contexts/messageContext/MessageContext.d.ts +6 -4
- package/lib/typescript/contexts/messageContext/MessageContext.d.ts.map +1 -1
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +13 -15
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts.map +1 -1
- package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
- package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts.map +1 -1
- package/lib/typescript/contexts/messageInputContext/hooks/useMessageDetailsForState.d.ts +3 -3
- package/lib/typescript/contexts/messageInputContext/hooks/useMessageDetailsForState.d.ts.map +1 -1
- package/lib/typescript/contexts/messageInputContext/utils/utils.d.ts +2 -2
- package/lib/typescript/contexts/messageInputContext/utils/utils.d.ts.map +1 -1
- package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +25 -21
- package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts.map +1 -1
- package/lib/typescript/contexts/pollContext/pollContext.d.ts +2 -3
- package/lib/typescript/contexts/pollContext/pollContext.d.ts.map +1 -1
- package/lib/typescript/contexts/suggestionsContext/SuggestionsContext.d.ts.map +1 -1
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +1 -0
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts.map +1 -1
- package/lib/typescript/contexts/threadContext/ThreadContext.d.ts +4 -5
- package/lib/typescript/contexts/threadContext/ThreadContext.d.ts.map +1 -1
- package/lib/typescript/contexts/threadsContext/ThreadListItemContext.d.ts +3 -4
- package/lib/typescript/contexts/threadsContext/ThreadListItemContext.d.ts.map +1 -1
- package/lib/typescript/hooks/index.d.ts +2 -0
- package/lib/typescript/hooks/index.d.ts.map +1 -1
- package/lib/typescript/hooks/useAudioPlayer.d.ts.map +1 -1
- package/lib/typescript/hooks/useStableCallback.d.ts +26 -0
- package/lib/typescript/hooks/useStableCallback.d.ts.map +1 -0
- package/lib/typescript/hooks/useTranslatedMessage.d.ts +59 -58
- package/lib/typescript/hooks/useTranslatedMessage.d.ts.map +1 -1
- package/lib/typescript/i18n/en.json +3 -0
- package/lib/typescript/i18n/es.json +3 -0
- package/lib/typescript/i18n/fr.json +3 -0
- package/lib/typescript/i18n/he.json +3 -0
- package/lib/typescript/i18n/hi.json +2 -0
- package/lib/typescript/i18n/it.json +3 -0
- package/lib/typescript/i18n/ja.json +1 -0
- package/lib/typescript/i18n/ko.json +1 -0
- package/lib/typescript/i18n/nl.json +2 -0
- package/lib/typescript/i18n/pt-br.json +3 -0
- package/lib/typescript/i18n/ru.json +4 -0
- package/lib/typescript/i18n/tr.json +2 -0
- package/lib/typescript/native.d.ts +8 -11
- package/lib/typescript/native.d.ts.map +1 -1
- package/lib/typescript/store/apis/insertReaction.d.ts +2 -2
- package/lib/typescript/store/apis/insertReaction.d.ts.map +1 -1
- package/lib/typescript/store/apis/updateMessage.d.ts +2 -2
- package/lib/typescript/store/apis/updateMessage.d.ts.map +1 -1
- package/lib/typescript/store/apis/updateReaction.d.ts +2 -2
- package/lib/typescript/store/apis/updateReaction.d.ts.map +1 -1
- package/lib/typescript/store/mappers/mapMessageToStorable.d.ts +2 -2
- package/lib/typescript/store/mappers/mapMessageToStorable.d.ts.map +1 -1
- package/lib/typescript/types/types.d.ts +28 -50
- package/lib/typescript/types/types.d.ts.map +1 -1
- package/lib/typescript/utils/compressImage.d.ts +2 -2
- package/lib/typescript/utils/compressImage.d.ts.map +1 -1
- package/lib/typescript/utils/i18n/Streami18n.d.ts +3 -0
- package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -1
- package/lib/typescript/utils/removeReservedFields.d.ts +2 -3
- package/lib/typescript/utils/removeReservedFields.d.ts.map +1 -1
- package/lib/typescript/utils/utils.d.ts +10 -10
- package/lib/typescript/utils/utils.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/components/Attachment/AudioAttachment.tsx +12 -6
- package/src/components/Attachment/FileAttachmentGroup.tsx +3 -1
- package/src/components/Attachment/Gallery.tsx +22 -7
- package/src/components/Attachment/ImageReloadIndicator.tsx +4 -5
- package/src/components/AttachmentPicker/AttachmentPicker.tsx +4 -10
- package/src/components/AttachmentPicker/components/AttachmentPickerItem.tsx +9 -37
- package/src/components/AutoCompleteInput/AutoCompleteInput.tsx +27 -23
- package/src/components/AutoCompleteInput/__tests__/AutoCompleteInput.test.js +12 -12
- package/src/components/Channel/Channel.tsx +423 -361
- package/src/components/Channel/__tests__/Channel.test.js +10 -3
- package/src/components/Channel/hooks/useChannelDataState.ts +2 -4
- package/src/components/Channel/hooks/useCreateMessagesContext.ts +2 -0
- package/src/components/Channel/hooks/useMessageListPagination.tsx +150 -150
- package/src/components/Chat/Chat.tsx +0 -9
- package/src/components/ImageGallery/__tests__/ImageGallery.test.tsx +8 -7
- package/src/components/ImageGallery/__tests__/ImageGalleryFooter.test.tsx +5 -4
- package/src/components/ImageGallery/__tests__/ImageGalleryHeader.test.tsx +5 -4
- package/src/components/ImageGallery/__tests__/ImageGalleryOverlay.test.tsx +3 -2
- package/src/components/KeyboardCompatibleView/KeyboardCompatibleView.tsx +12 -5
- package/src/components/Message/Message.tsx +16 -15
- package/src/components/Message/MessageSimple/MessageFooter.tsx +2 -3
- package/src/components/Message/MessageSimple/MessageSimple.tsx +112 -70
- package/src/components/Message/MessageSimple/MessageStatus.tsx +19 -17
- package/src/components/Message/MessageSimple/MessageTextContainer.tsx +3 -3
- package/src/components/Message/MessageSimple/__tests__/MessageStatus.test.js +11 -5
- package/src/components/Message/MessageSimple/__tests__/MessageTextContainer.test.tsx +5 -4
- package/src/components/Message/MessageSimple/utils/renderText.tsx +2 -3
- package/src/components/Message/hooks/useCreateMessageContext.ts +3 -0
- package/src/components/Message/hooks/useMessageActionHandlers.ts +1 -3
- package/src/components/Message/hooks/useMessageActions.tsx +4 -3
- package/src/components/MessageInput/FileUploadPreview.tsx +41 -70
- package/src/components/MessageInput/ImageUploadPreview.tsx +2 -2
- package/src/components/MessageInput/InputButtons.tsx +14 -10
- package/src/components/MessageInput/MessageInput.tsx +28 -30
- package/src/components/MessageInput/__tests__/FileUploadPreview.test.js +1 -1
- package/src/components/MessageInput/__tests__/MessageInput.test.js +3 -1
- package/src/components/MessageInput/components/AudioRecorder/AudioRecordingButton.tsx +1 -0
- package/src/components/MessageInput/hooks/useAudioController.tsx +6 -5
- package/src/components/MessageList/MessageList.tsx +253 -137
- package/src/components/MessageList/MessageSystem.tsx +2 -2
- package/src/components/MessageList/hooks/useMessageList.ts +82 -64
- package/src/components/MessageList/hooks/useShouldScrollToRecentOnNewOwnMessage.ts +2 -2
- package/src/components/MessageList/utils/getGroupStyles.ts +7 -5
- package/src/components/MessageList/utils/getLastReceivedMessage.ts +3 -3
- package/src/components/MessageList/utils/getReadState.ts +27 -0
- package/src/components/MessageMenu/__tests__/MessageUserReactions.test.tsx +2 -3
- package/src/components/MessageMenu/hooks/useFetchReactions.ts +2 -3
- package/src/components/Poll/components/Button.tsx +2 -4
- package/src/components/Poll/components/PollResults/PollResultItem.tsx +2 -3
- package/src/components/Reply/Reply.tsx +1 -2
- package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +318 -847
- package/src/components/Thread/components/ThreadFooterComponent.tsx +31 -9
- package/src/components/ThreadList/ThreadListItem.tsx +6 -4
- package/src/components/UIComponents/BottomSheetModal.tsx +11 -7
- package/src/components/index.ts +2 -1
- package/src/contexts/attachmentPickerContext/AttachmentPickerContext.tsx +5 -4
- package/src/contexts/channelsStateContext/useChannelState.ts +5 -1
- package/src/contexts/debugContext/DebugContext.tsx +2 -4
- package/src/contexts/imageGalleryContext/ImageGalleryContext.tsx +5 -4
- package/src/contexts/messageContext/MessageContext.tsx +6 -4
- package/src/contexts/messageInputContext/MessageInputContext.tsx +295 -262
- package/src/contexts/messageInputContext/__tests__/__snapshots__/sendMessage.test.tsx.snap +10 -6
- package/src/contexts/messageInputContext/__tests__/sendMessage.test.tsx +6 -5
- package/src/contexts/messageInputContext/__tests__/updateMessage.test.tsx +3 -5
- package/src/contexts/messageInputContext/__tests__/useMessageDetailsForState.test.tsx +14 -9
- package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +7 -3
- package/src/contexts/messageInputContext/hooks/useMessageDetailsForState.ts +37 -40
- package/src/contexts/messageInputContext/utils/utils.ts +6 -8
- package/src/contexts/messagesContext/MessagesContext.tsx +26 -20
- package/src/contexts/pollContext/pollContext.tsx +2 -4
- package/src/contexts/suggestionsContext/SuggestionsContext.tsx +33 -14
- package/src/contexts/themeContext/utils/theme.ts +2 -0
- package/src/contexts/threadContext/ThreadContext.tsx +4 -6
- package/src/contexts/threadsContext/ThreadListItemContext.tsx +3 -5
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useAudioPlayer.ts +37 -31
- package/src/hooks/useStableCallback.ts +37 -0
- package/src/hooks/useTranslatedMessage.ts +2 -2
- package/src/i18n/en.json +3 -0
- package/src/i18n/es.json +3 -0
- package/src/i18n/fr.json +3 -0
- package/src/i18n/he.json +3 -0
- package/src/i18n/hi.json +2 -0
- package/src/i18n/it.json +3 -0
- package/src/i18n/ja.json +1 -0
- package/src/i18n/ko.json +1 -0
- package/src/i18n/nl.json +2 -0
- package/src/i18n/pt-br.json +3 -0
- package/src/i18n/ru.json +4 -0
- package/src/i18n/tr.json +2 -0
- package/src/mock-builders/api/channelMocks.tsx +2 -8
- package/src/native.ts +13 -8
- package/src/store/apis/insertReaction.ts +2 -2
- package/src/store/apis/updateMessage.ts +2 -2
- package/src/store/apis/updateReaction.ts +2 -2
- package/src/store/mappers/mapMessageToStorable.ts +2 -2
- package/src/types/stream-chat-common-custom-data.d.ts +22 -22
- package/src/types/types.ts +35 -54
- package/src/utils/compressImage.ts +3 -4
- package/src/utils/removeReservedFields.ts +3 -5
- package/src/utils/utils.ts +25 -16
- package/src/version.json +1 -1
- package/lib/commonjs/components/MessageList/hooks/useLastReadData.js +0 -20
- package/lib/commonjs/components/MessageList/hooks/useLastReadData.js.map +0 -1
- package/lib/commonjs/components/MessageList/utils/getReadStates.js +0 -34
- package/lib/commonjs/components/MessageList/utils/getReadStates.js.map +0 -1
- package/lib/module/components/MessageList/hooks/useLastReadData.js +0 -20
- package/lib/module/components/MessageList/hooks/useLastReadData.js.map +0 -1
- package/lib/module/components/MessageList/utils/getReadStates.js +0 -34
- package/lib/module/components/MessageList/utils/getReadStates.js.map +0 -1
- package/lib/typescript/components/MessageList/hooks/useLastReadData.d.ts +0 -12
- package/lib/typescript/components/MessageList/hooks/useLastReadData.d.ts.map +0 -1
- package/lib/typescript/components/MessageList/utils/getReadStates.d.ts +0 -5
- package/lib/typescript/components/MessageList/utils/getReadStates.d.ts.map +0 -1
- package/src/components/MessageList/hooks/useLastReadData.ts +0 -29
- package/src/components/MessageList/utils/getReadStates.ts +0 -55
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { Alert } from 'react-native';
|
|
2
2
|
|
|
3
|
-
import type { MessageResponse } from 'stream-chat';
|
|
4
|
-
|
|
5
3
|
import type { ChannelContextValue } from '../../../contexts/channelContext/ChannelContext';
|
|
6
4
|
import type { ChatContextValue } from '../../../contexts/chatContext/ChatContext';
|
|
7
5
|
import type { MessageContextValue } from '../../../contexts/messageContext/MessageContext';
|
|
@@ -62,7 +60,7 @@ export const useMessageActionHandlers = ({
|
|
|
62
60
|
{ style: 'cancel', text: t('Cancel') },
|
|
63
61
|
{
|
|
64
62
|
onPress: async () => {
|
|
65
|
-
await deleteMessage(message
|
|
63
|
+
await deleteMessage(message);
|
|
66
64
|
},
|
|
67
65
|
style: 'destructive',
|
|
68
66
|
text: t('Delete'),
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
import { LocalMessage } from 'stream-chat';
|
|
4
|
+
|
|
3
5
|
import { useMessageActionHandlers } from './useMessageActionHandlers';
|
|
4
6
|
|
|
5
7
|
import type { ChannelContextValue } from '../../../contexts/channelContext/ChannelContext';
|
|
@@ -27,7 +29,6 @@ import {
|
|
|
27
29
|
import { removeReservedFields } from '../../../utils/removeReservedFields';
|
|
28
30
|
import { MessageStatusTypes } from '../../../utils/utils';
|
|
29
31
|
|
|
30
|
-
import type { MessageType } from '../../MessageList/hooks/useMessageList';
|
|
31
32
|
import type { MessageActionType } from '../../MessageMenu/MessageActionListItem';
|
|
32
33
|
|
|
33
34
|
export type MessageActionsHookProps = Pick<
|
|
@@ -60,7 +61,7 @@ export type MessageActionsHookProps = Pick<
|
|
|
60
61
|
Pick<ThreadContextValue, 'openThread'> &
|
|
61
62
|
Pick<MessageContextValue, 'dismissOverlay' | 'message'> &
|
|
62
63
|
Pick<TranslationContextValue, 't'> & {
|
|
63
|
-
onThreadSelect?: (message:
|
|
64
|
+
onThreadSelect?: (message: LocalMessage) => void;
|
|
64
65
|
};
|
|
65
66
|
|
|
66
67
|
export const useMessageActions = ({
|
|
@@ -293,7 +294,7 @@ export const useMessageActions = ({
|
|
|
293
294
|
dismissOverlay();
|
|
294
295
|
const messageWithoutReservedFields = removeReservedFields(message);
|
|
295
296
|
if (handleRetry) {
|
|
296
|
-
handleRetry(messageWithoutReservedFields as
|
|
297
|
+
handleRetry(messageWithoutReservedFields as LocalMessage);
|
|
297
298
|
}
|
|
298
299
|
|
|
299
300
|
await handleResendMessage();
|
|
@@ -17,7 +17,7 @@ import { useTranslationContext } from '../../contexts/translationContext/Transla
|
|
|
17
17
|
import { Close } from '../../icons/Close';
|
|
18
18
|
import { Warning } from '../../icons/Warning';
|
|
19
19
|
import { isSoundPackageAvailable } from '../../native';
|
|
20
|
-
import type { FileUpload } from '../../types/types';
|
|
20
|
+
import type { AudioUpload, FileUpload } from '../../types/types';
|
|
21
21
|
import { getTrimmedAttachmentTitle } from '../../utils/getTrimmedAttachmentTitle';
|
|
22
22
|
import {
|
|
23
23
|
getDurationLabelFromDuration,
|
|
@@ -123,26 +123,49 @@ const UnsupportedFileTypeOrFileSizeIndicator = ({
|
|
|
123
123
|
);
|
|
124
124
|
};
|
|
125
125
|
|
|
126
|
-
type
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
export type FileUploadPreviewProps = Partial<
|
|
127
|
+
Pick<
|
|
128
|
+
MessageInputContextValue,
|
|
129
|
+
'fileUploads' | 'removeFile' | 'uploadFile' | 'setFileUploads' | 'AudioAttachmentUploadPreview'
|
|
130
|
+
>
|
|
129
131
|
> &
|
|
130
|
-
Pick<MessagesContextValue, 'FileAttachmentIcon'
|
|
131
|
-
Pick<ChatContextValue, 'enableOfflineSupport'
|
|
132
|
+
Partial<Pick<MessagesContextValue, 'FileAttachmentIcon'>> &
|
|
133
|
+
Partial<Pick<ChatContextValue, 'enableOfflineSupport'>>;
|
|
132
134
|
|
|
133
|
-
|
|
135
|
+
/**
|
|
136
|
+
* FileUploadPreview
|
|
137
|
+
* UI Component to preview the files set for upload
|
|
138
|
+
*/
|
|
139
|
+
export const FileUploadPreview = (props: FileUploadPreviewProps) => {
|
|
134
140
|
const {
|
|
135
|
-
AudioAttachmentUploadPreview,
|
|
136
|
-
enableOfflineSupport,
|
|
137
|
-
FileAttachmentIcon,
|
|
138
|
-
fileUploads,
|
|
139
|
-
removeFile,
|
|
140
|
-
uploadFile,
|
|
141
|
+
AudioAttachmentUploadPreview: propAudioAttachmentUploadPreview,
|
|
142
|
+
enableOfflineSupport: propEnableOfflineSupport,
|
|
143
|
+
FileAttachmentIcon: propFileAttachmentIcon,
|
|
144
|
+
fileUploads: propFileUploads,
|
|
145
|
+
removeFile: propRemoveFile,
|
|
146
|
+
uploadFile: propUploadFile,
|
|
141
147
|
} = props;
|
|
142
148
|
|
|
143
|
-
const
|
|
149
|
+
const { enableOfflineSupport: contextEnableOfflineSupport } = useChatContext();
|
|
150
|
+
const {
|
|
151
|
+
AudioAttachmentUploadPreview: contextAudioAttachmentUploadPreview,
|
|
152
|
+
fileUploads: contextFileUploads,
|
|
153
|
+
removeFile: contextRemoveFile,
|
|
154
|
+
uploadFile: contextUploadFile,
|
|
155
|
+
} = useMessageInputContext();
|
|
156
|
+
const { FileAttachmentIcon: contextFileAttachmentIcon } = useMessagesContext();
|
|
144
157
|
|
|
145
|
-
const
|
|
158
|
+
const enableOfflineSupport = propEnableOfflineSupport ?? contextEnableOfflineSupport;
|
|
159
|
+
const AudioAttachmentUploadPreview =
|
|
160
|
+
propAudioAttachmentUploadPreview ?? contextAudioAttachmentUploadPreview;
|
|
161
|
+
const fileUploads = propFileUploads ?? contextFileUploads;
|
|
162
|
+
const removeFile = propRemoveFile ?? contextRemoveFile;
|
|
163
|
+
const uploadFile = propUploadFile ?? contextUploadFile;
|
|
164
|
+
const FileAttachmentIcon = propFileAttachmentIcon ?? contextFileAttachmentIcon;
|
|
165
|
+
|
|
166
|
+
const [filesToDisplay, setFilesToDisplay] = useState<AudioUpload[]>([]);
|
|
167
|
+
|
|
168
|
+
const flatListRef = useRef<FlatList<AudioUpload> | null>(null);
|
|
146
169
|
const [flatListWidth, setFlatListWidth] = useState(0);
|
|
147
170
|
|
|
148
171
|
useEffect(() => {
|
|
@@ -207,9 +230,9 @@ const FileUploadPreviewWithContext = (props: FileUploadPreviewPropsWithContext)
|
|
|
207
230
|
},
|
|
208
231
|
} = useTheme();
|
|
209
232
|
|
|
210
|
-
const renderItem = ({ item }: { item:
|
|
233
|
+
const renderItem = ({ item }: { item: AudioUpload }) => {
|
|
211
234
|
const indicatorType = getIndicatorTypeForFileState(item.state, enableOfflineSupport);
|
|
212
|
-
const isAudio = item.file.
|
|
235
|
+
const isAudio = item.file.type?.startsWith('audio/');
|
|
213
236
|
|
|
214
237
|
return (
|
|
215
238
|
<>
|
|
@@ -241,7 +264,7 @@ const FileUploadPreviewWithContext = (props: FileUploadPreviewPropsWithContext)
|
|
|
241
264
|
]}
|
|
242
265
|
>
|
|
243
266
|
<View style={styles.fileIcon}>
|
|
244
|
-
<FileAttachmentIcon mimeType={item.file.
|
|
267
|
+
<FileAttachmentIcon mimeType={item.file.type} />
|
|
245
268
|
</View>
|
|
246
269
|
<View style={[styles.fileTextContainer, fileTextContainer]}>
|
|
247
270
|
<Text
|
|
@@ -317,56 +340,4 @@ const FileUploadPreviewWithContext = (props: FileUploadPreviewPropsWithContext)
|
|
|
317
340
|
) : null;
|
|
318
341
|
};
|
|
319
342
|
|
|
320
|
-
const areEqual = (
|
|
321
|
-
prevProps: FileUploadPreviewPropsWithContext,
|
|
322
|
-
nextProps: FileUploadPreviewPropsWithContext,
|
|
323
|
-
) => {
|
|
324
|
-
const { fileUploads: prevFileUploads } = prevProps;
|
|
325
|
-
const { fileUploads: nextFileUploads } = nextProps;
|
|
326
|
-
|
|
327
|
-
return (
|
|
328
|
-
prevFileUploads.length === nextFileUploads.length &&
|
|
329
|
-
prevFileUploads.every(
|
|
330
|
-
(prevFileUpload, index) =>
|
|
331
|
-
prevFileUpload.state === nextFileUploads[index].state &&
|
|
332
|
-
prevFileUpload.paused === nextFileUploads[index].paused &&
|
|
333
|
-
prevFileUpload.progress === nextFileUploads[index].progress &&
|
|
334
|
-
prevFileUpload.duration === nextFileUploads[index].duration,
|
|
335
|
-
)
|
|
336
|
-
);
|
|
337
|
-
};
|
|
338
|
-
|
|
339
|
-
const MemoizedFileUploadPreview = React.memo(
|
|
340
|
-
FileUploadPreviewWithContext,
|
|
341
|
-
areEqual,
|
|
342
|
-
) as typeof FileUploadPreviewWithContext;
|
|
343
|
-
|
|
344
|
-
export type FileUploadPreviewProps = Partial<FileUploadPreviewPropsWithContext>;
|
|
345
|
-
|
|
346
|
-
/**
|
|
347
|
-
* FileUploadPreview
|
|
348
|
-
* UI Component to preview the files set for upload
|
|
349
|
-
*/
|
|
350
|
-
export const FileUploadPreview = (props: FileUploadPreviewProps) => {
|
|
351
|
-
const { enableOfflineSupport } = useChatContext();
|
|
352
|
-
const { AudioAttachmentUploadPreview, fileUploads, removeFile, setFileUploads, uploadFile } =
|
|
353
|
-
useMessageInputContext();
|
|
354
|
-
const { FileAttachmentIcon } = useMessagesContext();
|
|
355
|
-
|
|
356
|
-
return (
|
|
357
|
-
<MemoizedFileUploadPreview
|
|
358
|
-
{...{
|
|
359
|
-
AudioAttachmentUploadPreview,
|
|
360
|
-
FileAttachmentIcon,
|
|
361
|
-
fileUploads,
|
|
362
|
-
removeFile,
|
|
363
|
-
setFileUploads,
|
|
364
|
-
uploadFile,
|
|
365
|
-
}}
|
|
366
|
-
{...{ enableOfflineSupport }}
|
|
367
|
-
{...props}
|
|
368
|
-
/>
|
|
369
|
-
);
|
|
370
|
-
};
|
|
371
|
-
|
|
372
343
|
FileUploadPreview.displayName = 'FileUploadPreview{messageInput{fileUploadPreview}}';
|
|
@@ -20,7 +20,7 @@ import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
|
20
20
|
import { useTranslationContext } from '../../contexts/translationContext/TranslationContext';
|
|
21
21
|
import { Close } from '../../icons/Close';
|
|
22
22
|
import { Warning } from '../../icons/Warning';
|
|
23
|
-
import type {
|
|
23
|
+
import type { FileUpload } from '../../types/types';
|
|
24
24
|
import { getIndicatorTypeForFileState, ProgressIndicatorTypes } from '../../utils/utils';
|
|
25
25
|
|
|
26
26
|
const IMAGE_PREVIEW_SIZE = 100;
|
|
@@ -81,7 +81,7 @@ type ImageUploadPreviewPropsWithContext = Pick<
|
|
|
81
81
|
|
|
82
82
|
export type ImageUploadPreviewProps = Partial<ImageUploadPreviewPropsWithContext>;
|
|
83
83
|
|
|
84
|
-
type ImageUploadPreviewItem = { index: number; item:
|
|
84
|
+
type ImageUploadPreviewItem = { index: number; item: FileUpload };
|
|
85
85
|
|
|
86
86
|
export const UnsupportedImageTypeIndicator = ({
|
|
87
87
|
indicatorType,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
2
|
import { StyleSheet, View } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import {
|
|
@@ -23,12 +23,12 @@ export type InputButtonsWithContextProps = Pick<
|
|
|
23
23
|
| 'hasCommands'
|
|
24
24
|
| 'hasFilePicker'
|
|
25
25
|
| 'hasImagePicker'
|
|
26
|
+
| 'hasText'
|
|
26
27
|
| 'MoreOptionsButton'
|
|
27
28
|
| 'openCommandsPicker'
|
|
28
29
|
| 'selectedPicker'
|
|
29
30
|
| 'setShowMoreOptions'
|
|
30
31
|
| 'showMoreOptions'
|
|
31
|
-
| 'text'
|
|
32
32
|
| 'toggleAttachmentPicker'
|
|
33
33
|
>;
|
|
34
34
|
|
|
@@ -41,11 +41,11 @@ export const InputButtonsWithContext = (props: InputButtonsWithContextProps) =>
|
|
|
41
41
|
hasCommands,
|
|
42
42
|
hasFilePicker,
|
|
43
43
|
hasImagePicker,
|
|
44
|
+
hasText,
|
|
44
45
|
MoreOptionsButton,
|
|
45
46
|
openCommandsPicker,
|
|
46
47
|
setShowMoreOptions,
|
|
47
48
|
showMoreOptions,
|
|
48
|
-
text,
|
|
49
49
|
} = props;
|
|
50
50
|
|
|
51
51
|
const {
|
|
@@ -54,6 +54,10 @@ export const InputButtonsWithContext = (props: InputButtonsWithContextProps) =>
|
|
|
54
54
|
},
|
|
55
55
|
} = useTheme();
|
|
56
56
|
|
|
57
|
+
const handleShowMoreOptions = useCallback(() => {
|
|
58
|
+
setShowMoreOptions(true);
|
|
59
|
+
}, [setShowMoreOptions]);
|
|
60
|
+
|
|
57
61
|
const ownCapabilities = useOwnCapabilitiesContext();
|
|
58
62
|
|
|
59
63
|
if (giphyActive) {
|
|
@@ -61,7 +65,7 @@ export const InputButtonsWithContext = (props: InputButtonsWithContextProps) =>
|
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
return !showMoreOptions && (hasCameraPicker || hasImagePicker || hasFilePicker) && hasCommands ? (
|
|
64
|
-
<MoreOptionsButton handleOnPress={
|
|
68
|
+
<MoreOptionsButton handleOnPress={handleShowMoreOptions} />
|
|
65
69
|
) : (
|
|
66
70
|
<>
|
|
67
71
|
{(hasCameraPicker || hasImagePicker || hasFilePicker) && ownCapabilities.uploadFile && (
|
|
@@ -71,7 +75,7 @@ export const InputButtonsWithContext = (props: InputButtonsWithContextProps) =>
|
|
|
71
75
|
<AttachButton />
|
|
72
76
|
</View>
|
|
73
77
|
)}
|
|
74
|
-
{hasCommands && !
|
|
78
|
+
{hasCommands && !hasText && (
|
|
75
79
|
<View style={commandsButtonContainer}>
|
|
76
80
|
<CommandsButton handleOnPress={openCommandsPicker} />
|
|
77
81
|
</View>
|
|
@@ -90,9 +94,9 @@ const areEqual = (
|
|
|
90
94
|
hasCommands: prevHasCommands,
|
|
91
95
|
hasFilePicker: prevHasFilePicker,
|
|
92
96
|
hasImagePicker: prevHasImagePicker,
|
|
97
|
+
hasText: prevHasText,
|
|
93
98
|
selectedPicker: prevSelectedPicker,
|
|
94
99
|
showMoreOptions: prevShowMoreOptions,
|
|
95
|
-
text: prevText,
|
|
96
100
|
} = prevProps;
|
|
97
101
|
|
|
98
102
|
const {
|
|
@@ -101,9 +105,9 @@ const areEqual = (
|
|
|
101
105
|
hasCommands: nextHasCommands,
|
|
102
106
|
hasFilePicker: nextHasFilePicker,
|
|
103
107
|
hasImagePicker: nextHasImagePicker,
|
|
108
|
+
hasText: nextHasText,
|
|
104
109
|
selectedPicker: nextSelectedPicker,
|
|
105
110
|
showMoreOptions: nextShowMoreOptions,
|
|
106
|
-
text: nextText,
|
|
107
111
|
} = nextProps;
|
|
108
112
|
|
|
109
113
|
if (prevHasCameraPicker !== nextHasCameraPicker) {
|
|
@@ -130,7 +134,7 @@ const areEqual = (
|
|
|
130
134
|
return false;
|
|
131
135
|
}
|
|
132
136
|
|
|
133
|
-
if (
|
|
137
|
+
if (prevHasText !== nextHasText) {
|
|
134
138
|
return false;
|
|
135
139
|
}
|
|
136
140
|
|
|
@@ -155,12 +159,12 @@ export const InputButtons = (props: InputButtonsProps) => {
|
|
|
155
159
|
hasCommands,
|
|
156
160
|
hasFilePicker,
|
|
157
161
|
hasImagePicker,
|
|
162
|
+
hasText,
|
|
158
163
|
MoreOptionsButton,
|
|
159
164
|
openCommandsPicker,
|
|
160
165
|
selectedPicker,
|
|
161
166
|
setShowMoreOptions,
|
|
162
167
|
showMoreOptions,
|
|
163
|
-
text,
|
|
164
168
|
toggleAttachmentPicker,
|
|
165
169
|
} = useMessageInputContext();
|
|
166
170
|
|
|
@@ -174,12 +178,12 @@ export const InputButtons = (props: InputButtonsProps) => {
|
|
|
174
178
|
hasCommands,
|
|
175
179
|
hasFilePicker,
|
|
176
180
|
hasImagePicker,
|
|
181
|
+
hasText,
|
|
177
182
|
MoreOptionsButton,
|
|
178
183
|
openCommandsPicker,
|
|
179
184
|
selectedPicker,
|
|
180
185
|
setShowMoreOptions,
|
|
181
186
|
showMoreOptions,
|
|
182
|
-
text,
|
|
183
187
|
toggleAttachmentPicker,
|
|
184
188
|
}}
|
|
185
189
|
{...props}
|
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
isImageMediaLibraryAvailable,
|
|
62
62
|
NativeHandlers,
|
|
63
63
|
} from '../../native';
|
|
64
|
-
import
|
|
64
|
+
import { compressedImageURI } from '../../utils/compressImage';
|
|
65
65
|
import { AIStates, useAIState } from '../AITypingIndicatorView';
|
|
66
66
|
import { AutoCompleteInput } from '../AutoCompleteInput/AutoCompleteInput';
|
|
67
67
|
import { CreatePoll } from '../Poll/CreatePollContent';
|
|
@@ -109,7 +109,7 @@ type MessageInputPropsWithContext = Pick<
|
|
|
109
109
|
'AttachmentPickerSelectionBar'
|
|
110
110
|
> &
|
|
111
111
|
Pick<ChatContextValue, 'isOnline'> &
|
|
112
|
-
Pick<ChannelContextValue, 'members' | 'threadList' | 'watchers'> &
|
|
112
|
+
Pick<ChannelContextValue, 'channel' | 'members' | 'threadList' | 'watchers'> &
|
|
113
113
|
Pick<
|
|
114
114
|
MessageInputContextValue,
|
|
115
115
|
| 'additionalTextInputProps'
|
|
@@ -129,6 +129,7 @@ type MessageInputPropsWithContext = Pick<
|
|
|
129
129
|
| 'clearEditingState'
|
|
130
130
|
| 'clearQuotedMessageState'
|
|
131
131
|
| 'closeAttachmentPicker'
|
|
132
|
+
| 'compressImageQuality'
|
|
132
133
|
| 'editing'
|
|
133
134
|
| 'FileUploadPreview'
|
|
134
135
|
| 'fileUploads'
|
|
@@ -195,8 +196,10 @@ const MessageInputWithContext = (props: MessageInputPropsWithContext) => {
|
|
|
195
196
|
AudioRecordingLockIndicator,
|
|
196
197
|
AudioRecordingPreview,
|
|
197
198
|
AutoCompleteSuggestionList,
|
|
199
|
+
channel,
|
|
198
200
|
closeAttachmentPicker,
|
|
199
201
|
closePollCreationDialog,
|
|
202
|
+
compressImageQuality,
|
|
200
203
|
cooldownEndsAt,
|
|
201
204
|
CooldownTimer,
|
|
202
205
|
CreatePollContent,
|
|
@@ -347,7 +350,7 @@ const MessageInputWithContext = (props: MessageInputPropsWithContext) => {
|
|
|
347
350
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
348
351
|
}, [imagesForInput, imageUploadsLength]);
|
|
349
352
|
|
|
350
|
-
const uploadImagesHandler = () => {
|
|
353
|
+
const uploadImagesHandler = async () => {
|
|
351
354
|
const imageToUpload = selectedImages.find((selectedImage) => {
|
|
352
355
|
const uploadedImage = imageUploads.find(
|
|
353
356
|
(imageUpload) =>
|
|
@@ -357,7 +360,11 @@ const MessageInputWithContext = (props: MessageInputPropsWithContext) => {
|
|
|
357
360
|
});
|
|
358
361
|
|
|
359
362
|
if (imageToUpload) {
|
|
360
|
-
|
|
363
|
+
const compressedImage = await compressedImageURI(imageToUpload, compressImageQuality);
|
|
364
|
+
uploadNewImage({
|
|
365
|
+
...imageToUpload,
|
|
366
|
+
uri: compressedImage,
|
|
367
|
+
});
|
|
361
368
|
}
|
|
362
369
|
};
|
|
363
370
|
|
|
@@ -455,16 +462,7 @@ const MessageInputWithContext = (props: MessageInputPropsWithContext) => {
|
|
|
455
462
|
/**
|
|
456
463
|
* User is editing some message which contains image attachments.
|
|
457
464
|
**/
|
|
458
|
-
setSelectedImages(
|
|
459
|
-
imageUploads
|
|
460
|
-
.map((imageUpload) => ({
|
|
461
|
-
height: imageUpload.file.height,
|
|
462
|
-
source: imageUpload.file.source,
|
|
463
|
-
uri: imageUpload.url || imageUpload.file.uri,
|
|
464
|
-
width: imageUpload.file.width,
|
|
465
|
-
}))
|
|
466
|
-
.filter(Boolean) as Asset[],
|
|
467
|
-
);
|
|
465
|
+
setSelectedImages(imageUploads.map((imageUpload) => imageUpload.file));
|
|
468
466
|
}
|
|
469
467
|
}
|
|
470
468
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -489,15 +487,7 @@ const MessageInputWithContext = (props: MessageInputPropsWithContext) => {
|
|
|
489
487
|
/**
|
|
490
488
|
* User is editing some message which contains video attachments.
|
|
491
489
|
**/
|
|
492
|
-
setSelectedFiles(
|
|
493
|
-
fileUploads.map((fileUpload) => ({
|
|
494
|
-
duration: fileUpload.file.duration,
|
|
495
|
-
mimeType: fileUpload.file.mimeType,
|
|
496
|
-
name: fileUpload.file.name,
|
|
497
|
-
size: fileUpload.file.size,
|
|
498
|
-
uri: fileUpload.file.uri,
|
|
499
|
-
})),
|
|
500
|
-
);
|
|
490
|
+
setSelectedFiles(fileUploads.map((fileUpload) => fileUpload.file));
|
|
501
491
|
}
|
|
502
492
|
}
|
|
503
493
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -743,7 +733,6 @@ const MessageInputWithContext = (props: MessageInputPropsWithContext) => {
|
|
|
743
733
|
})),
|
|
744
734
|
};
|
|
745
735
|
|
|
746
|
-
const { channel } = useChannelContext();
|
|
747
736
|
const { aiState } = useAIState(channel);
|
|
748
737
|
|
|
749
738
|
const stopGenerating = useCallback(() => channel?.stopAIResponse(), [channel]);
|
|
@@ -857,9 +846,8 @@ const MessageInputWithContext = (props: MessageInputPropsWithContext) => {
|
|
|
857
846
|
|
|
858
847
|
{shouldDisplayStopAIGeneration ? (
|
|
859
848
|
<StopMessageStreamingButton onPress={stopGenerating} />
|
|
860
|
-
) : (
|
|
861
|
-
|
|
862
|
-
(cooldownRemainingSeconds ? (
|
|
849
|
+
) : isSendingButtonVisible() ? (
|
|
850
|
+
cooldownRemainingSeconds ? (
|
|
863
851
|
<CooldownTimer seconds={cooldownRemainingSeconds} />
|
|
864
852
|
) : (
|
|
865
853
|
<View style={[styles.sendButtonContainer, sendButtonContainer]}>
|
|
@@ -867,8 +855,8 @@ const MessageInputWithContext = (props: MessageInputPropsWithContext) => {
|
|
|
867
855
|
disabled={sending.current || !isValidMessage() || (giphyActive && !isOnline)}
|
|
868
856
|
/>
|
|
869
857
|
</View>
|
|
870
|
-
)
|
|
871
|
-
)}
|
|
858
|
+
)
|
|
859
|
+
) : null}
|
|
872
860
|
{audioRecordingEnabled && isAudioRecorderAvailable() && !micLocked && (
|
|
873
861
|
<GestureDetector gesture={panGestureMic}>
|
|
874
862
|
<Animated.View
|
|
@@ -954,6 +942,7 @@ const areEqual = (
|
|
|
954
942
|
asyncMessagesSlideToCancelDistance: prevAsyncMessagesSlideToCancelDistance,
|
|
955
943
|
asyncUploads: prevAsyncUploads,
|
|
956
944
|
audioRecordingEnabled: prevAsyncMessagesEnabled,
|
|
945
|
+
channel: prevChannel,
|
|
957
946
|
closePollCreationDialog: prevClosePollCreationDialog,
|
|
958
947
|
editing: prevEditing,
|
|
959
948
|
fileUploads: prevFileUploads,
|
|
@@ -979,6 +968,7 @@ const areEqual = (
|
|
|
979
968
|
asyncMessagesSlideToCancelDistance: nextAsyncMessagesSlideToCancelDistance,
|
|
980
969
|
asyncUploads: nextAsyncUploads,
|
|
981
970
|
audioRecordingEnabled: nextAsyncMessagesEnabled,
|
|
971
|
+
channel: nextChannel,
|
|
982
972
|
closePollCreationDialog: nextClosePollCreationDialog,
|
|
983
973
|
editing: nextEditing,
|
|
984
974
|
fileUploads: nextFileUploads,
|
|
@@ -1022,6 +1012,11 @@ const areEqual = (
|
|
|
1022
1012
|
return false;
|
|
1023
1013
|
}
|
|
1024
1014
|
|
|
1015
|
+
const channelEqual = prevChannel.cid === nextChannel.cid;
|
|
1016
|
+
if (!channelEqual) {
|
|
1017
|
+
return false;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1025
1020
|
const asyncMessagesLockDistanceEqual =
|
|
1026
1021
|
prevAsyncMessagesLockDistance === nextAsyncMessagesLockDistance;
|
|
1027
1022
|
if (!asyncMessagesLockDistanceEqual) {
|
|
@@ -1151,7 +1146,7 @@ export const MessageInput = (props: MessageInputProps) => {
|
|
|
1151
1146
|
const { isOnline } = useChatContext();
|
|
1152
1147
|
const ownCapabilities = useOwnCapabilitiesContext();
|
|
1153
1148
|
|
|
1154
|
-
const { members, threadList, watchers } = useChannelContext();
|
|
1149
|
+
const { channel, members, threadList, watchers } = useChannelContext();
|
|
1155
1150
|
|
|
1156
1151
|
const {
|
|
1157
1152
|
additionalTextInputProps,
|
|
@@ -1171,6 +1166,7 @@ export const MessageInput = (props: MessageInputProps) => {
|
|
|
1171
1166
|
clearQuotedMessageState,
|
|
1172
1167
|
closeAttachmentPicker,
|
|
1173
1168
|
closePollCreationDialog,
|
|
1169
|
+
compressImageQuality,
|
|
1174
1170
|
cooldownEndsAt,
|
|
1175
1171
|
CooldownTimer,
|
|
1176
1172
|
CreatePollContent,
|
|
@@ -1254,10 +1250,12 @@ export const MessageInput = (props: MessageInputProps) => {
|
|
|
1254
1250
|
AutoCompleteSuggestionHeader,
|
|
1255
1251
|
AutoCompleteSuggestionItem,
|
|
1256
1252
|
AutoCompleteSuggestionList,
|
|
1253
|
+
channel,
|
|
1257
1254
|
clearEditingState,
|
|
1258
1255
|
clearQuotedMessageState,
|
|
1259
1256
|
closeAttachmentPicker,
|
|
1260
1257
|
closePollCreationDialog,
|
|
1258
|
+
compressImageQuality,
|
|
1261
1259
|
cooldownEndsAt,
|
|
1262
1260
|
CooldownTimer,
|
|
1263
1261
|
CreatePollContent,
|
|
@@ -332,8 +332,8 @@ describe('FileUploadPreview', () => {
|
|
|
332
332
|
const fileUploads = [
|
|
333
333
|
generateFileUploadPreview({
|
|
334
334
|
id: 'file-upload-id-1',
|
|
335
|
-
mimeType: 'audio/mp3',
|
|
336
335
|
state: FileState.UPLOADED,
|
|
336
|
+
type: 'audio/mp3',
|
|
337
337
|
}),
|
|
338
338
|
];
|
|
339
339
|
const removeFile = jest.fn();
|
|
@@ -129,7 +129,9 @@ describe('MessageInput', () => {
|
|
|
129
129
|
);
|
|
130
130
|
|
|
131
131
|
// Both for files and for images triggered in one test itself.
|
|
132
|
-
|
|
132
|
+
await waitFor(() => {
|
|
133
|
+
expect(Alert.alert).toHaveBeenCalledTimes(4);
|
|
134
|
+
});
|
|
133
135
|
});
|
|
134
136
|
|
|
135
137
|
it('should start the audio recorder on long press and cleanup on unmount', async () => {
|
|
@@ -10,7 +10,8 @@ import {
|
|
|
10
10
|
RecordingStatus,
|
|
11
11
|
SoundReturnType,
|
|
12
12
|
} from '../../../native';
|
|
13
|
-
import { File
|
|
13
|
+
import type { File } from '../../../types/types';
|
|
14
|
+
import { FileTypes } from '../../../types/types';
|
|
14
15
|
import { resampleWaveformData } from '../utils/audioSampling';
|
|
15
16
|
import { normalizeAudioLevel } from '../utils/normalizeAudioLevel';
|
|
16
17
|
|
|
@@ -267,18 +268,18 @@ export const useAudioController = () => {
|
|
|
267
268
|
|
|
268
269
|
const file: File = {
|
|
269
270
|
duration: durationInSeconds,
|
|
270
|
-
mimeType: 'audio/aac',
|
|
271
271
|
name: `audio_recording_${date}.aac`,
|
|
272
|
-
|
|
272
|
+
size: 0,
|
|
273
|
+
type: 'audio/aac',
|
|
273
274
|
uri: typeof recording !== 'string' ? (recording?.getURI() as string) : (recording as string),
|
|
274
275
|
waveform_data: resampledWaveformData,
|
|
275
276
|
};
|
|
276
277
|
|
|
277
278
|
if (multiSendEnabled) {
|
|
278
|
-
await uploadNewFile(file);
|
|
279
|
+
await uploadNewFile(file, FileTypes.VoiceRecording);
|
|
279
280
|
} else {
|
|
280
281
|
// FIXME: cannot call handleSubmit() directly as the function has stale reference to file uploads
|
|
281
|
-
await uploadNewFile(file);
|
|
282
|
+
await uploadNewFile(file, FileTypes.VoiceRecording);
|
|
282
283
|
setIsScheduleForSubmit(true);
|
|
283
284
|
}
|
|
284
285
|
resetState();
|