stream-chat-react-native-core 6.0.0-rc.8 → 6.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/AITypingIndicatorView/AITypingIndicatorView.js +53 -0
- package/lib/commonjs/components/AITypingIndicatorView/AITypingIndicatorView.js.map +1 -0
- package/lib/commonjs/components/AITypingIndicatorView/hooks/useAIState.js +59 -0
- package/lib/commonjs/components/AITypingIndicatorView/hooks/useAIState.js.map +1 -0
- package/lib/commonjs/components/AITypingIndicatorView/index.js +26 -0
- package/lib/commonjs/components/AITypingIndicatorView/index.js.map +1 -0
- package/lib/commonjs/components/Attachment/AudioAttachment.js +27 -22
- package/lib/commonjs/components/Attachment/AudioAttachment.js.map +1 -1
- package/lib/commonjs/components/Attachment/Gallery.js +3 -1
- package/lib/commonjs/components/Attachment/Gallery.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 +37 -133
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerItem.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js +6 -4
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js +483 -1056
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useChannelDataState.js +174 -0
- package/lib/commonjs/components/Channel/hooks/useChannelDataState.js.map +1 -0
- package/lib/commonjs/components/Channel/hooks/useCreateChannelContext.js +0 -6
- package/lib/commonjs/components/Channel/hooks/useCreateChannelContext.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -0
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js +4 -0
- package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreatePaginatedMessageListContext.js +3 -3
- package/lib/commonjs/components/Channel/hooks/useCreatePaginatedMessageListContext.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useMessageListPagination.js +324 -0
- package/lib/commonjs/components/Channel/hooks/useMessageListPagination.js.map +1 -0
- package/lib/commonjs/components/ChannelList/Skeleton.js +7 -3
- package/lib/commonjs/components/ChannelList/Skeleton.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js +85 -45
- package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreview.js +17 -91
- package/lib/commonjs/components/ChannelPreview/ChannelPreview.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessenger.js +3 -24
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessenger.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewMutedStatus.js +2 -2
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewMutedStatus.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewData.js +121 -0
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewData.js.map +1 -0
- package/lib/commonjs/components/ChannelPreview/hooks/useIsChannelMuted.js +35 -0
- package/lib/commonjs/components/ChannelPreview/hooks/useIsChannelMuted.js.map +1 -0
- package/lib/commonjs/components/Chat/Chat.js +5 -1
- package/lib/commonjs/components/Chat/Chat.js.map +1 -1
- package/lib/commonjs/components/Chat/hooks/useAppSettings.js +15 -9
- package/lib/commonjs/components/Chat/hooks/useAppSettings.js.map +1 -1
- package/lib/commonjs/components/Chat/hooks/useCreateChatContext.js +2 -0
- package/lib/commonjs/components/Chat/hooks/useCreateChatContext.js.map +1 -1
- package/lib/commonjs/components/Chat/hooks/useIsOnline.js +0 -4
- package/lib/commonjs/components/Chat/hooks/useIsOnline.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/ImageGallery.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js +46 -46
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js +3 -4
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/hooks/useAnimatedGalleryStyle.js +2 -2
- package/lib/commonjs/components/ImageGallery/hooks/useAnimatedGalleryStyle.js.map +1 -1
- package/lib/commonjs/components/Message/Message.js +7 -0
- package/lib/commonjs/components/Message/Message.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js +17 -4
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageFooter.js +15 -6
- package/lib/commonjs/components/Message/MessageSimple/MessageFooter.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/StreamingMessageView.js +36 -0
- package/lib/commonjs/components/Message/MessageSimple/StreamingMessageView.js.map +1 -0
- package/lib/commonjs/components/Message/MessageSimple/utils/generateMarkdownText.js +9 -1
- package/lib/commonjs/components/Message/MessageSimple/utils/generateMarkdownText.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js +209 -23
- package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js.map +1 -1
- package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js +2 -0
- package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js.map +1 -1
- package/lib/commonjs/components/Message/hooks/useStreamingMessage.js +43 -0
- package/lib/commonjs/components/Message/hooks/useStreamingMessage.js.map +1 -0
- package/lib/commonjs/components/MessageInput/MessageInput.js +41 -21
- package/lib/commonjs/components/MessageInput/MessageInput.js.map +1 -1
- package/lib/commonjs/components/MessageInput/StopMessageStreamingButton.js +39 -0
- package/lib/commonjs/components/MessageInput/StopMessageStreamingButton.js.map +1 -0
- package/lib/commonjs/components/MessageList/MessageList.js +74 -73
- package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
- package/lib/commonjs/components/MessageList/ScrollToBottomButton.js +1 -1
- package/lib/commonjs/components/MessageList/ScrollToBottomButton.js.map +1 -1
- package/lib/commonjs/components/MessageList/hooks/useMessageList.js.map +1 -1
- package/lib/commonjs/components/MessageList/utils/getReadStates.js.map +1 -1
- package/lib/commonjs/components/MessageMenu/MessageUserReactions.js +1 -1
- package/lib/commonjs/components/MessageMenu/MessageUserReactions.js.map +1 -1
- package/lib/commonjs/components/MessageMenu/MessageUserReactionsItem.js +4 -2
- package/lib/commonjs/components/MessageMenu/MessageUserReactionsItem.js.map +1 -1
- package/lib/commonjs/components/MessageMenu/hooks/useFetchReactions.js +3 -2
- package/lib/commonjs/components/MessageMenu/hooks/useFetchReactions.js.map +1 -1
- package/lib/commonjs/components/Poll/CreatePollContent.js +14 -9
- package/lib/commonjs/components/Poll/CreatePollContent.js.map +1 -1
- package/lib/commonjs/components/Poll/Poll.js +2 -8
- package/lib/commonjs/components/Poll/Poll.js.map +1 -1
- package/lib/commonjs/components/Poll/components/Button.js +9 -474
- package/lib/commonjs/components/Poll/components/Button.js.map +1 -1
- package/lib/commonjs/components/Poll/components/CreatePollIcon.js +2 -2
- package/lib/commonjs/components/Poll/components/CreatePollIcon.js.map +1 -1
- package/lib/commonjs/components/Poll/components/CreatePollOptions.js +9 -4
- package/lib/commonjs/components/Poll/components/CreatePollOptions.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollAnswersList.js +99 -26
- package/lib/commonjs/components/Poll/components/PollAnswersList.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollButtons.js +291 -0
- package/lib/commonjs/components/Poll/components/PollButtons.js.map +1 -0
- package/lib/commonjs/components/Poll/components/PollInputDialog.js +14 -4
- package/lib/commonjs/components/Poll/components/PollInputDialog.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollModalHeader.js +7 -1
- package/lib/commonjs/components/Poll/components/PollModalHeader.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollOption.js +88 -6
- package/lib/commonjs/components/Poll/components/PollOption.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollResults/PollOptionFullResults.js +2 -2
- package/lib/commonjs/components/Poll/components/PollResults/PollOptionFullResults.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollResults/PollResultItem.js +62 -67
- package/lib/commonjs/components/Poll/components/PollResults/PollResultItem.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollResults/PollVote.js +89 -0
- package/lib/commonjs/components/Poll/components/PollResults/PollVote.js.map +1 -0
- package/lib/commonjs/components/Poll/components/index.js +11 -0
- package/lib/commonjs/components/Poll/components/index.js.map +1 -1
- package/lib/commonjs/components/ThreadList/ThreadList.js +0 -3
- package/lib/commonjs/components/ThreadList/ThreadList.js.map +1 -1
- package/lib/commonjs/components/UIComponents/BottomSheetModal.js +11 -5
- package/lib/commonjs/components/UIComponents/BottomSheetModal.js.map +1 -1
- package/lib/commonjs/components/index.js +66 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/contexts/channelContext/ChannelContext.js.map +1 -1
- package/lib/commonjs/contexts/channelsStateContext/ChannelsStateContext.js +0 -35
- package/lib/commonjs/contexts/channelsStateContext/ChannelsStateContext.js.map +1 -1
- package/lib/commonjs/contexts/channelsStateContext/useChannelState.js +7 -84
- package/lib/commonjs/contexts/channelsStateContext/useChannelState.js.map +1 -1
- package/lib/commonjs/contexts/chatContext/ChatContext.js.map +1 -1
- package/lib/commonjs/contexts/messageContext/MessageContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +4 -2
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +2 -0
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/commonjs/contexts/paginatedMessageListContext/PaginatedMessageListContext.js.map +1 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js +15 -0
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/i18n/en.json +2 -0
- package/lib/commonjs/i18n/es.json +2 -0
- package/lib/commonjs/i18n/fr.json +2 -0
- package/lib/commonjs/i18n/he.json +2 -0
- package/lib/commonjs/i18n/hi.json +2 -0
- package/lib/commonjs/i18n/it.json +2 -0
- package/lib/commonjs/i18n/ja.json +2 -0
- package/lib/commonjs/i18n/ko.json +2 -0
- package/lib/commonjs/i18n/nl.json +2 -0
- package/lib/commonjs/i18n/pt-br.json +2 -0
- package/lib/commonjs/i18n/ru.json +2 -0
- package/lib/commonjs/i18n/tr.json +2 -0
- package/lib/commonjs/mock-builders/event/notificationChannelMutesUpdated.js +14 -0
- package/lib/commonjs/mock-builders/event/notificationChannelMutesUpdated.js.map +1 -0
- package/lib/commonjs/mock-builders/event/notificationMarkRead.js +14 -0
- package/lib/commonjs/mock-builders/event/notificationMarkRead.js.map +1 -0
- package/lib/commonjs/mock-builders/event/notificationMarkUnread.js +17 -0
- package/lib/commonjs/mock-builders/event/notificationMarkUnread.js.map +1 -0
- package/lib/commonjs/mock-builders/generator/channel.js +1 -0
- package/lib/commonjs/mock-builders/generator/channel.js.map +1 -1
- package/lib/commonjs/store/SqliteClient.js +11 -2
- package/lib/commonjs/store/SqliteClient.js.map +1 -1
- package/lib/commonjs/utils/getTrimmedAttachmentTitle.js +8 -2
- package/lib/commonjs/utils/getTrimmedAttachmentTitle.js.map +1 -1
- package/lib/commonjs/utils/utils.js +3 -2
- package/lib/commonjs/utils/utils.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/AITypingIndicatorView/AITypingIndicatorView.js +53 -0
- package/lib/module/components/AITypingIndicatorView/AITypingIndicatorView.js.map +1 -0
- package/lib/module/components/AITypingIndicatorView/hooks/useAIState.js +59 -0
- package/lib/module/components/AITypingIndicatorView/hooks/useAIState.js.map +1 -0
- package/lib/module/components/AITypingIndicatorView/index.js +26 -0
- package/lib/module/components/AITypingIndicatorView/index.js.map +1 -0
- package/lib/module/components/Attachment/AudioAttachment.js +27 -22
- package/lib/module/components/Attachment/AudioAttachment.js.map +1 -1
- package/lib/module/components/Attachment/Gallery.js +3 -1
- package/lib/module/components/Attachment/Gallery.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 +37 -133
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerItem.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js +6 -4
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js.map +1 -1
- package/lib/module/components/Channel/Channel.js +483 -1056
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useChannelDataState.js +174 -0
- package/lib/module/components/Channel/hooks/useChannelDataState.js.map +1 -0
- package/lib/module/components/Channel/hooks/useCreateChannelContext.js +0 -6
- package/lib/module/components/Channel/hooks/useCreateChannelContext.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -0
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateMessagesContext.js +4 -0
- package/lib/module/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreatePaginatedMessageListContext.js +3 -3
- package/lib/module/components/Channel/hooks/useCreatePaginatedMessageListContext.js.map +1 -1
- package/lib/module/components/Channel/hooks/useMessageListPagination.js +324 -0
- package/lib/module/components/Channel/hooks/useMessageListPagination.js.map +1 -0
- package/lib/module/components/ChannelList/Skeleton.js +7 -3
- package/lib/module/components/ChannelList/Skeleton.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js +85 -45
- package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreview.js +17 -91
- package/lib/module/components/ChannelPreview/ChannelPreview.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewMessenger.js +3 -24
- package/lib/module/components/ChannelPreview/ChannelPreviewMessenger.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewMutedStatus.js +2 -2
- package/lib/module/components/ChannelPreview/ChannelPreviewMutedStatus.js.map +1 -1
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewData.js +121 -0
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewData.js.map +1 -0
- package/lib/module/components/ChannelPreview/hooks/useIsChannelMuted.js +35 -0
- package/lib/module/components/ChannelPreview/hooks/useIsChannelMuted.js.map +1 -0
- package/lib/module/components/Chat/Chat.js +5 -1
- package/lib/module/components/Chat/Chat.js.map +1 -1
- package/lib/module/components/Chat/hooks/useAppSettings.js +15 -9
- package/lib/module/components/Chat/hooks/useAppSettings.js.map +1 -1
- package/lib/module/components/Chat/hooks/useCreateChatContext.js +2 -0
- package/lib/module/components/Chat/hooks/useCreateChatContext.js.map +1 -1
- package/lib/module/components/Chat/hooks/useIsOnline.js +0 -4
- package/lib/module/components/Chat/hooks/useIsOnline.js.map +1 -1
- package/lib/module/components/ImageGallery/ImageGallery.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js +46 -46
- package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js +3 -4
- package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js.map +1 -1
- package/lib/module/components/ImageGallery/hooks/useAnimatedGalleryStyle.js +2 -2
- package/lib/module/components/ImageGallery/hooks/useAnimatedGalleryStyle.js.map +1 -1
- package/lib/module/components/Message/Message.js +7 -0
- package/lib/module/components/Message/Message.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageContent.js +17 -4
- package/lib/module/components/Message/MessageSimple/MessageContent.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageFooter.js +15 -6
- package/lib/module/components/Message/MessageSimple/MessageFooter.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/StreamingMessageView.js +36 -0
- package/lib/module/components/Message/MessageSimple/StreamingMessageView.js.map +1 -0
- package/lib/module/components/Message/MessageSimple/utils/generateMarkdownText.js +9 -1
- package/lib/module/components/Message/MessageSimple/utils/generateMarkdownText.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/utils/renderText.js +209 -23
- package/lib/module/components/Message/MessageSimple/utils/renderText.js.map +1 -1
- package/lib/module/components/Message/hooks/useCreateMessageContext.js +2 -0
- package/lib/module/components/Message/hooks/useCreateMessageContext.js.map +1 -1
- package/lib/module/components/Message/hooks/useStreamingMessage.js +43 -0
- package/lib/module/components/Message/hooks/useStreamingMessage.js.map +1 -0
- package/lib/module/components/MessageInput/MessageInput.js +41 -21
- package/lib/module/components/MessageInput/MessageInput.js.map +1 -1
- package/lib/module/components/MessageInput/StopMessageStreamingButton.js +39 -0
- package/lib/module/components/MessageInput/StopMessageStreamingButton.js.map +1 -0
- package/lib/module/components/MessageList/MessageList.js +74 -73
- package/lib/module/components/MessageList/MessageList.js.map +1 -1
- package/lib/module/components/MessageList/ScrollToBottomButton.js +1 -1
- package/lib/module/components/MessageList/ScrollToBottomButton.js.map +1 -1
- package/lib/module/components/MessageList/hooks/useMessageList.js.map +1 -1
- package/lib/module/components/MessageList/utils/getReadStates.js.map +1 -1
- package/lib/module/components/MessageMenu/MessageUserReactions.js +1 -1
- package/lib/module/components/MessageMenu/MessageUserReactions.js.map +1 -1
- package/lib/module/components/MessageMenu/MessageUserReactionsItem.js +4 -2
- package/lib/module/components/MessageMenu/MessageUserReactionsItem.js.map +1 -1
- package/lib/module/components/MessageMenu/hooks/useFetchReactions.js +3 -2
- package/lib/module/components/MessageMenu/hooks/useFetchReactions.js.map +1 -1
- package/lib/module/components/Poll/CreatePollContent.js +14 -9
- package/lib/module/components/Poll/CreatePollContent.js.map +1 -1
- package/lib/module/components/Poll/Poll.js +2 -8
- package/lib/module/components/Poll/Poll.js.map +1 -1
- package/lib/module/components/Poll/components/Button.js +9 -474
- package/lib/module/components/Poll/components/Button.js.map +1 -1
- package/lib/module/components/Poll/components/CreatePollIcon.js +2 -2
- package/lib/module/components/Poll/components/CreatePollIcon.js.map +1 -1
- package/lib/module/components/Poll/components/CreatePollOptions.js +9 -4
- package/lib/module/components/Poll/components/CreatePollOptions.js.map +1 -1
- package/lib/module/components/Poll/components/PollAnswersList.js +99 -26
- package/lib/module/components/Poll/components/PollAnswersList.js.map +1 -1
- package/lib/module/components/Poll/components/PollButtons.js +291 -0
- package/lib/module/components/Poll/components/PollButtons.js.map +1 -0
- package/lib/module/components/Poll/components/PollInputDialog.js +14 -4
- package/lib/module/components/Poll/components/PollInputDialog.js.map +1 -1
- package/lib/module/components/Poll/components/PollModalHeader.js +7 -1
- package/lib/module/components/Poll/components/PollModalHeader.js.map +1 -1
- package/lib/module/components/Poll/components/PollOption.js +88 -6
- package/lib/module/components/Poll/components/PollOption.js.map +1 -1
- package/lib/module/components/Poll/components/PollResults/PollOptionFullResults.js +2 -2
- package/lib/module/components/Poll/components/PollResults/PollOptionFullResults.js.map +1 -1
- package/lib/module/components/Poll/components/PollResults/PollResultItem.js +62 -67
- package/lib/module/components/Poll/components/PollResults/PollResultItem.js.map +1 -1
- package/lib/module/components/Poll/components/PollResults/PollVote.js +89 -0
- package/lib/module/components/Poll/components/PollResults/PollVote.js.map +1 -0
- package/lib/module/components/Poll/components/index.js +11 -0
- package/lib/module/components/Poll/components/index.js.map +1 -1
- package/lib/module/components/ThreadList/ThreadList.js +0 -3
- package/lib/module/components/ThreadList/ThreadList.js.map +1 -1
- package/lib/module/components/UIComponents/BottomSheetModal.js +11 -5
- package/lib/module/components/UIComponents/BottomSheetModal.js.map +1 -1
- package/lib/module/components/index.js +66 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/contexts/channelContext/ChannelContext.js.map +1 -1
- package/lib/module/contexts/channelsStateContext/ChannelsStateContext.js +0 -35
- package/lib/module/contexts/channelsStateContext/ChannelsStateContext.js.map +1 -1
- package/lib/module/contexts/channelsStateContext/useChannelState.js +7 -84
- package/lib/module/contexts/channelsStateContext/useChannelState.js.map +1 -1
- package/lib/module/contexts/chatContext/ChatContext.js.map +1 -1
- package/lib/module/contexts/messageContext/MessageContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js +4 -2
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +2 -0
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/module/contexts/paginatedMessageListContext/PaginatedMessageListContext.js.map +1 -1
- package/lib/module/contexts/themeContext/utils/theme.js +15 -0
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/i18n/en.json +2 -0
- package/lib/module/i18n/es.json +2 -0
- package/lib/module/i18n/fr.json +2 -0
- package/lib/module/i18n/he.json +2 -0
- package/lib/module/i18n/hi.json +2 -0
- package/lib/module/i18n/it.json +2 -0
- package/lib/module/i18n/ja.json +2 -0
- package/lib/module/i18n/ko.json +2 -0
- package/lib/module/i18n/nl.json +2 -0
- package/lib/module/i18n/pt-br.json +2 -0
- package/lib/module/i18n/ru.json +2 -0
- package/lib/module/i18n/tr.json +2 -0
- package/lib/module/mock-builders/event/notificationChannelMutesUpdated.js +14 -0
- package/lib/module/mock-builders/event/notificationChannelMutesUpdated.js.map +1 -0
- package/lib/module/mock-builders/event/notificationMarkRead.js +14 -0
- package/lib/module/mock-builders/event/notificationMarkRead.js.map +1 -0
- package/lib/module/mock-builders/event/notificationMarkUnread.js +17 -0
- package/lib/module/mock-builders/event/notificationMarkUnread.js.map +1 -0
- package/lib/module/mock-builders/generator/channel.js +1 -0
- package/lib/module/mock-builders/generator/channel.js.map +1 -1
- package/lib/module/store/SqliteClient.js +11 -2
- package/lib/module/store/SqliteClient.js.map +1 -1
- package/lib/module/utils/getTrimmedAttachmentTitle.js +8 -2
- package/lib/module/utils/getTrimmedAttachmentTitle.js.map +1 -1
- package/lib/module/utils/utils.js +3 -2
- package/lib/module/utils/utils.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/AITypingIndicatorView/AITypingIndicatorView.d.ts +11 -0
- package/lib/typescript/components/AITypingIndicatorView/AITypingIndicatorView.d.ts.map +1 -0
- package/lib/typescript/components/AITypingIndicatorView/hooks/useAIState.d.ts +18 -0
- package/lib/typescript/components/AITypingIndicatorView/hooks/useAIState.d.ts.map +1 -0
- package/lib/typescript/components/AITypingIndicatorView/index.d.ts +3 -0
- package/lib/typescript/components/AITypingIndicatorView/index.d.ts.map +1 -0
- package/lib/typescript/components/Attachment/AudioAttachment.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.map +1 -1
- package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerSelectionBar.d.ts.map +1 -1
- package/lib/typescript/components/Channel/Channel.d.ts +7 -6
- package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useChannelDataState.d.ts +75 -0
- package/lib/typescript/components/Channel/hooks/useChannelDataState.d.ts.map +1 -0
- package/lib/typescript/components/Channel/hooks/useCreateChannelContext.d.ts +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateChannelContext.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +128 -1
- package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useCreatePaginatedMessageListContext.d.ts +1 -1
- package/lib/typescript/components/Channel/hooks/useCreatePaginatedMessageListContext.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useMessageListPagination.d.ts +28 -0
- package/lib/typescript/components/Channel/hooks/useMessageListPagination.d.ts.map +1 -0
- package/lib/typescript/components/ChannelList/Skeleton.d.ts.map +1 -1
- package/lib/typescript/components/ChannelList/hooks/usePaginatedChannels.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/ChannelPreview.d.ts +1 -2
- package/lib/typescript/components/ChannelPreview/ChannelPreview.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/ChannelPreviewMessenger.d.ts +2 -0
- package/lib/typescript/components/ChannelPreview/ChannelPreviewMessenger.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/ChannelPreviewMutedStatus.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/hooks/useChannelPreviewData.d.ts +8 -0
- package/lib/typescript/components/ChannelPreview/hooks/useChannelPreviewData.d.ts.map +1 -0
- package/lib/typescript/components/ChannelPreview/hooks/useIsChannelMuted.d.ts +8 -0
- package/lib/typescript/components/ChannelPreview/hooks/useIsChannelMuted.d.ts.map +1 -0
- package/lib/typescript/components/Chat/Chat.d.ts +7 -1
- package/lib/typescript/components/Chat/Chat.d.ts.map +1 -1
- package/lib/typescript/components/Chat/hooks/useAppSettings.d.ts.map +1 -1
- package/lib/typescript/components/Chat/hooks/useCreateChatContext.d.ts +1 -1
- package/lib/typescript/components/Chat/hooks/useCreateChatContext.d.ts.map +1 -1
- package/lib/typescript/components/Chat/hooks/useIsOnline.d.ts.map +1 -1
- package/lib/typescript/components/ImageGallery/ImageGallery.d.ts.map +1 -1
- package/lib/typescript/components/Message/Message.d.ts +1 -1
- package/lib/typescript/components/Message/Message.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageSimple/MessageContent.d.ts +1 -1
- package/lib/typescript/components/Message/MessageSimple/MessageContent.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageSimple/MessageFooter.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageSimple/StreamingMessageView.d.ts +12 -0
- package/lib/typescript/components/Message/MessageSimple/StreamingMessageView.d.ts.map +1 -0
- package/lib/typescript/components/Message/MessageSimple/utils/generateMarkdownText.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageSimple/utils/renderText.d.ts +16 -1
- 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/useStreamingMessage.d.ts +17 -0
- package/lib/typescript/components/Message/hooks/useStreamingMessage.d.ts.map +1 -0
- 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/StopMessageStreamingButton.d.ts +10 -0
- package/lib/typescript/components/MessageInput/StopMessageStreamingButton.d.ts.map +1 -0
- package/lib/typescript/components/MessageList/MessageList.d.ts +1 -1
- package/lib/typescript/components/MessageList/MessageList.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/hooks/useMessageList.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/utils/getReadStates.d.ts +1 -1
- package/lib/typescript/components/MessageList/utils/getReadStates.d.ts.map +1 -1
- package/lib/typescript/components/MessageMenu/MessageUserReactionsItem.d.ts.map +1 -1
- package/lib/typescript/components/MessageMenu/hooks/useFetchReactions.d.ts +3 -2
- package/lib/typescript/components/MessageMenu/hooks/useFetchReactions.d.ts.map +1 -1
- package/lib/typescript/components/Poll/Poll.d.ts +0 -1
- package/lib/typescript/components/Poll/Poll.d.ts.map +1 -1
- package/lib/typescript/components/Poll/components/Button.d.ts +0 -17
- package/lib/typescript/components/Poll/components/Button.d.ts.map +1 -1
- package/lib/typescript/components/Poll/components/CreatePollOptions.d.ts.map +1 -1
- package/lib/typescript/components/Poll/components/PollAnswersList.d.ts +2 -0
- package/lib/typescript/components/Poll/components/PollAnswersList.d.ts.map +1 -1
- package/lib/typescript/components/Poll/components/PollButtons.d.ts +10 -0
- package/lib/typescript/components/Poll/components/PollButtons.d.ts.map +1 -0
- package/lib/typescript/components/Poll/components/PollInputDialog.d.ts.map +1 -1
- package/lib/typescript/components/Poll/components/PollOption.d.ts +2 -0
- package/lib/typescript/components/Poll/components/PollOption.d.ts.map +1 -1
- package/lib/typescript/components/Poll/components/PollResults/PollResultItem.d.ts +11 -4
- package/lib/typescript/components/Poll/components/PollResults/PollResultItem.d.ts.map +1 -1
- package/lib/typescript/components/Poll/components/PollResults/PollVote.d.ts +6 -0
- package/lib/typescript/components/Poll/components/PollResults/PollVote.d.ts.map +1 -0
- package/lib/typescript/components/Poll/components/index.d.ts +1 -0
- package/lib/typescript/components/Poll/components/index.d.ts.map +1 -1
- package/lib/typescript/components/ThreadList/ThreadList.d.ts.map +1 -1
- package/lib/typescript/components/UIComponents/BottomSheetModal.d.ts.map +1 -1
- package/lib/typescript/components/index.d.ts +6 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/contexts/channelContext/ChannelContext.d.ts +27 -37
- package/lib/typescript/contexts/channelContext/ChannelContext.d.ts.map +1 -1
- package/lib/typescript/contexts/channelsStateContext/ChannelsStateContext.d.ts +0 -16
- package/lib/typescript/contexts/channelsStateContext/ChannelsStateContext.d.ts.map +1 -1
- package/lib/typescript/contexts/channelsStateContext/useChannelState.d.ts +7 -13
- package/lib/typescript/contexts/channelsStateContext/useChannelState.d.ts.map +1 -1
- package/lib/typescript/contexts/chatContext/ChatContext.d.ts +2 -1
- package/lib/typescript/contexts/chatContext/ChatContext.d.ts.map +1 -1
- package/lib/typescript/contexts/messageContext/MessageContext.d.ts +4 -0
- package/lib/typescript/contexts/messageContext/MessageContext.d.ts.map +1 -1
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +2 -1
- 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/messagesContext/MessagesContext.d.ts +8 -4
- package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts.map +1 -1
- package/lib/typescript/contexts/paginatedMessageListContext/PaginatedMessageListContext.d.ts +17 -16
- package/lib/typescript/contexts/paginatedMessageListContext/PaginatedMessageListContext.d.ts.map +1 -1
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +16 -1
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts.map +1 -1
- package/lib/typescript/i18n/en.json +2 -0
- package/lib/typescript/i18n/es.json +2 -0
- package/lib/typescript/i18n/fr.json +2 -0
- package/lib/typescript/i18n/he.json +2 -0
- package/lib/typescript/i18n/hi.json +2 -0
- package/lib/typescript/i18n/it.json +2 -0
- package/lib/typescript/i18n/ja.json +2 -0
- package/lib/typescript/i18n/ko.json +2 -0
- package/lib/typescript/i18n/nl.json +2 -0
- package/lib/typescript/i18n/pt-br.json +2 -0
- package/lib/typescript/i18n/ru.json +2 -0
- package/lib/typescript/i18n/tr.json +2 -0
- package/lib/typescript/store/SqliteClient.d.ts.map +1 -1
- package/lib/typescript/types/types.d.ts +3 -0
- package/lib/typescript/types/types.d.ts.map +1 -1
- package/lib/typescript/utils/getTrimmedAttachmentTitle.d.ts.map +1 -1
- package/lib/typescript/utils/i18n/Streami18n.d.ts +2 -0
- package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -1
- package/lib/typescript/utils/utils.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/components/AITypingIndicatorView/AITypingIndicatorView.tsx +50 -0
- package/src/components/AITypingIndicatorView/hooks/useAIState.ts +68 -0
- package/src/components/AITypingIndicatorView/index.ts +2 -0
- package/src/components/Attachment/AudioAttachment.tsx +20 -19
- package/src/components/Attachment/Gallery.tsx +1 -1
- package/src/components/AttachmentPicker/AttachmentPicker.tsx +7 -2
- package/src/components/AttachmentPicker/components/AttachmentPickerItem.tsx +16 -32
- package/src/components/AttachmentPicker/components/AttachmentPickerSelectionBar.tsx +3 -5
- package/src/components/Channel/Channel.tsx +262 -835
- package/src/components/Channel/__tests__/Channel.test.js +244 -13
- package/src/components/Channel/__tests__/useMessageListPagination.test.js +419 -0
- package/src/components/Channel/hooks/useChannelDataState.ts +235 -0
- package/src/components/Channel/hooks/useCreateChannelContext.ts +0 -6
- package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +2 -0
- package/src/components/Channel/hooks/useCreateMessagesContext.ts +4 -0
- package/src/components/Channel/hooks/useCreatePaginatedMessageListContext.ts +3 -10
- package/src/components/Channel/hooks/useMessageListPagination.tsx +246 -0
- package/src/components/ChannelList/Skeleton.tsx +9 -1
- package/src/components/ChannelList/hooks/usePaginatedChannels.ts +37 -30
- package/src/components/ChannelPreview/ChannelPreview.tsx +28 -107
- package/src/components/ChannelPreview/ChannelPreviewMessenger.tsx +5 -15
- package/src/components/ChannelPreview/ChannelPreviewMutedStatus.tsx +2 -7
- package/src/components/ChannelPreview/__tests__/ChannelPreview.test.tsx +226 -10
- package/src/components/ChannelPreview/hooks/__tests__/useChannelPreviewDisplayName.test.tsx +1 -1
- package/src/components/ChannelPreview/hooks/__tests__/useChannelPreviewMuted.test.tsx +62 -0
- package/src/components/ChannelPreview/hooks/useChannelPreviewData.ts +138 -0
- package/src/components/ChannelPreview/hooks/useIsChannelMuted.ts +29 -0
- package/src/components/Chat/Chat.tsx +11 -2
- package/src/components/Chat/hooks/__tests__/useAppSettings.test.tsx +1 -0
- package/src/components/Chat/hooks/useAppSettings.ts +2 -0
- package/src/components/Chat/hooks/useCreateChatContext.ts +2 -0
- package/src/components/Chat/hooks/useIsOnline.ts +0 -5
- package/src/components/ImageGallery/ImageGallery.tsx +1 -0
- package/src/components/ImageGallery/components/ImageGalleryFooter.tsx +32 -32
- package/src/components/ImageGallery/components/ImageGalleryHeader.tsx +5 -6
- package/src/components/ImageGallery/hooks/useAnimatedGalleryStyle.tsx +2 -2
- package/src/components/Message/Message.tsx +16 -2
- package/src/components/Message/MessageSimple/MessageContent.tsx +22 -2
- package/src/components/Message/MessageSimple/MessageFooter.tsx +16 -5
- package/src/components/Message/MessageSimple/StreamingMessageView.tsx +34 -0
- package/src/components/Message/MessageSimple/utils/generateMarkdownText.ts +15 -1
- package/src/components/Message/MessageSimple/utils/renderText.tsx +207 -3
- package/src/components/Message/hooks/useCreateMessageContext.ts +2 -0
- package/src/components/Message/hooks/useStreamingMessage.ts +54 -0
- package/src/components/MessageInput/MessageInput.tsx +38 -20
- package/src/components/MessageInput/StopMessageStreamingButton.tsx +34 -0
- package/src/components/MessageInput/__tests__/MessageInput.test.js +116 -2
- package/src/components/MessageList/MessageList.tsx +53 -85
- package/src/components/MessageList/ScrollToBottomButton.tsx +1 -1
- package/src/components/MessageList/__tests__/MessageList.test.js +174 -2
- package/src/components/MessageList/__tests__/ScrollToBottomButton.test.js +3 -3
- package/src/components/MessageList/__tests__/__snapshots__/ScrollToBottomButton.test.js.snap +1 -1
- package/src/components/MessageList/hooks/useMessageList.ts +2 -5
- package/src/components/MessageList/utils/getReadStates.ts +3 -2
- package/src/components/MessageMenu/MessageUserReactions.tsx +1 -1
- package/src/components/MessageMenu/MessageUserReactionsItem.tsx +4 -2
- package/src/components/MessageMenu/hooks/useFetchReactions.ts +6 -3
- package/src/components/Poll/CreatePollContent.tsx +4 -4
- package/src/components/Poll/Poll.tsx +1 -20
- package/src/components/Poll/components/Button.tsx +8 -420
- package/src/components/Poll/components/CreatePollIcon.tsx +1 -1
- package/src/components/Poll/components/CreatePollOptions.tsx +9 -4
- package/src/components/Poll/components/PollAnswersList.tsx +66 -3
- package/src/components/Poll/components/PollButtons.tsx +241 -0
- package/src/components/Poll/components/PollInputDialog.tsx +9 -6
- package/src/components/Poll/components/PollModalHeader.tsx +3 -3
- package/src/components/Poll/components/PollOption.tsx +74 -4
- package/src/components/Poll/components/PollResults/PollOptionFullResults.tsx +1 -1
- package/src/components/Poll/components/PollResults/PollResultItem.tsx +68 -52
- package/src/components/Poll/components/PollResults/PollVote.tsx +68 -0
- package/src/components/Poll/components/index.ts +1 -0
- package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +37 -4
- package/src/components/ThreadList/ThreadList.tsx +0 -2
- package/src/components/UIComponents/BottomSheetModal.tsx +7 -3
- package/src/components/index.ts +7 -0
- package/src/contexts/channelContext/ChannelContext.tsx +35 -37
- package/src/contexts/channelsStateContext/ChannelsStateContext.tsx +1 -67
- package/src/contexts/channelsStateContext/useChannelState.ts +6 -108
- package/src/contexts/chatContext/ChatContext.tsx +2 -1
- package/src/contexts/messageContext/MessageContext.tsx +4 -0
- package/src/contexts/messageInputContext/MessageInputContext.tsx +5 -1
- package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +2 -0
- package/src/contexts/messagesContext/MessagesContext.tsx +8 -3
- package/src/contexts/paginatedMessageListContext/PaginatedMessageListContext.tsx +17 -16
- package/src/contexts/themeContext/utils/theme.ts +30 -1
- package/src/i18n/en.json +2 -0
- package/src/i18n/es.json +2 -0
- package/src/i18n/fr.json +2 -0
- package/src/i18n/he.json +2 -0
- package/src/i18n/hi.json +2 -0
- package/src/i18n/it.json +2 -0
- package/src/i18n/ja.json +2 -0
- package/src/i18n/ko.json +2 -0
- package/src/i18n/nl.json +2 -0
- package/src/i18n/pt-br.json +2 -0
- package/src/i18n/ru.json +2 -0
- package/src/i18n/tr.json +2 -0
- package/src/mock-builders/event/notificationChannelMutesUpdated.js +7 -0
- package/src/mock-builders/event/notificationMarkRead.js +7 -0
- package/src/mock-builders/event/notificationMarkUnread.js +9 -0
- package/src/mock-builders/generator/channel.ts +1 -0
- package/src/store/SqliteClient.ts +5 -1
- package/src/types/types.ts +3 -0
- package/src/utils/getTrimmedAttachmentTitle.ts +10 -2
- package/src/utils/utils.ts +5 -2
- package/src/version.json +1 -1
|
@@ -33,7 +33,21 @@ export const generateMarkdownText = (text?: string) => {
|
|
|
33
33
|
resultText = resultText.replace(mentionsRegex, `@${displayLink}`);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
// Escape the " and ' characters, except in code blocks where we deem this allowed.
|
|
37
|
+
resultText = resultText.replace(/(```[\s\S]*?```|`.*?`)|[<"'>]/g, (match, code) => {
|
|
38
|
+
if (code) return code;
|
|
39
|
+
return `\\${match}`;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// Remove whitespaces that come directly after newlines except in code blocks where we deem this allowed.
|
|
43
|
+
resultText = resultText.replace(/(```[\s\S]*?```|`.*?`)|\n[ ]{2,}/g, (_, code) => {
|
|
44
|
+
if (code) return code;
|
|
45
|
+
return '\n';
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Always replace \n``` with \n\n``` to force the markdown state machine to treat it as a separate block. Otherwise, code blocks inside of list
|
|
49
|
+
// items for example were broken. We clean up the code block closing state within the rendering itself.
|
|
50
|
+
resultText = resultText.replace(/\n```/g, '\n\n```');
|
|
37
51
|
|
|
38
52
|
return resultText;
|
|
39
53
|
};
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
import React, { PropsWithChildren } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import React, { PropsWithChildren, ReactNode, useCallback, useMemo } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
GestureResponderEvent,
|
|
4
|
+
Linking,
|
|
5
|
+
Platform,
|
|
6
|
+
Text,
|
|
7
|
+
TextProps,
|
|
8
|
+
View,
|
|
9
|
+
ViewProps,
|
|
10
|
+
} from 'react-native';
|
|
11
|
+
|
|
12
|
+
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
4
13
|
// @ts-expect-error
|
|
5
14
|
import Markdown from 'react-native-markdown-package';
|
|
15
|
+
import Animated, { clamp, scrollTo, useAnimatedRef, useSharedValue } from 'react-native-reanimated';
|
|
6
16
|
|
|
7
17
|
import {
|
|
8
18
|
DefaultRules,
|
|
@@ -26,7 +36,64 @@ import type { DefaultStreamChatGenerics } from '../../../../types/types';
|
|
|
26
36
|
import { escapeRegExp } from '../../../../utils/utils';
|
|
27
37
|
import type { MessageType } from '../../../MessageList/hooks/useMessageList';
|
|
28
38
|
|
|
39
|
+
export const MarkdownReactiveScrollView = ({ children }: { children: ReactNode }) => {
|
|
40
|
+
const scrollViewRef = useAnimatedRef<Animated.ScrollView>();
|
|
41
|
+
const contentWidth = useSharedValue(0);
|
|
42
|
+
const visibleContentWidth = useSharedValue(0);
|
|
43
|
+
const offsetBeforeScroll = useSharedValue(0);
|
|
44
|
+
|
|
45
|
+
const panGesture = Gesture.Pan()
|
|
46
|
+
.activeOffsetX([-5, 5])
|
|
47
|
+
.onUpdate((event) => {
|
|
48
|
+
const { translationX } = event;
|
|
49
|
+
|
|
50
|
+
scrollTo(scrollViewRef, offsetBeforeScroll.value - translationX, 0, false);
|
|
51
|
+
})
|
|
52
|
+
.onEnd((event) => {
|
|
53
|
+
const { translationX } = event;
|
|
54
|
+
|
|
55
|
+
const velocityEffect = event.velocityX * 0.3;
|
|
56
|
+
|
|
57
|
+
const finalPosition = clamp(
|
|
58
|
+
offsetBeforeScroll.value - translationX - velocityEffect,
|
|
59
|
+
0,
|
|
60
|
+
contentWidth.value - visibleContentWidth.value,
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
offsetBeforeScroll.value = finalPosition;
|
|
64
|
+
|
|
65
|
+
scrollTo(scrollViewRef, finalPosition, 0, true);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<View style={{ width: '100%' }}>
|
|
70
|
+
<GestureDetector gesture={panGesture}>
|
|
71
|
+
<Animated.ScrollView
|
|
72
|
+
contentContainerStyle={{ flexGrow: 1 }}
|
|
73
|
+
horizontal
|
|
74
|
+
nestedScrollEnabled={true}
|
|
75
|
+
onContentSizeChange={(width) => {
|
|
76
|
+
contentWidth.value = width;
|
|
77
|
+
}}
|
|
78
|
+
onLayout={(e) => {
|
|
79
|
+
visibleContentWidth.value = e.nativeEvent.layout.width;
|
|
80
|
+
}}
|
|
81
|
+
ref={scrollViewRef}
|
|
82
|
+
scrollEnabled={false}
|
|
83
|
+
>
|
|
84
|
+
{children}
|
|
85
|
+
</Animated.ScrollView>
|
|
86
|
+
</GestureDetector>
|
|
87
|
+
</View>
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
|
|
29
91
|
const defaultMarkdownStyles: MarkdownStyle = {
|
|
92
|
+
codeBlock: {
|
|
93
|
+
fontFamily: Platform.OS === 'ios' ? 'Courier' : 'Monospace',
|
|
94
|
+
fontWeight: '500',
|
|
95
|
+
marginVertical: 8,
|
|
96
|
+
},
|
|
30
97
|
inlineCode: {
|
|
31
98
|
fontSize: 13,
|
|
32
99
|
padding: 3,
|
|
@@ -60,6 +127,26 @@ const defaultMarkdownStyles: MarkdownStyle = {
|
|
|
60
127
|
marginBottom: 8,
|
|
61
128
|
marginTop: 8,
|
|
62
129
|
},
|
|
130
|
+
table: {
|
|
131
|
+
borderRadius: 3,
|
|
132
|
+
borderWidth: 1,
|
|
133
|
+
flex: 1,
|
|
134
|
+
flexDirection: 'row',
|
|
135
|
+
},
|
|
136
|
+
tableHeader: {
|
|
137
|
+
flexDirection: 'row',
|
|
138
|
+
justifyContent: 'space-around',
|
|
139
|
+
},
|
|
140
|
+
tableHeaderCell: {
|
|
141
|
+
fontWeight: '500',
|
|
142
|
+
},
|
|
143
|
+
tableRow: {
|
|
144
|
+
alignItems: 'center',
|
|
145
|
+
justifyContent: 'space-around',
|
|
146
|
+
},
|
|
147
|
+
tableRowCell: {
|
|
148
|
+
flex: 1,
|
|
149
|
+
},
|
|
63
150
|
};
|
|
64
151
|
|
|
65
152
|
const mentionsParseFunction: ParseFunction = (capture, parse, state) => ({
|
|
@@ -113,6 +200,13 @@ export const renderText = <
|
|
|
113
200
|
color: colors.accent_blue,
|
|
114
201
|
...markdownStyles?.autolink,
|
|
115
202
|
},
|
|
203
|
+
codeBlock: {
|
|
204
|
+
...defaultMarkdownStyles.codeBlock,
|
|
205
|
+
backgroundColor: colors.code_block,
|
|
206
|
+
color: colors.black,
|
|
207
|
+
padding: 8,
|
|
208
|
+
...markdownStyles?.codeBlock,
|
|
209
|
+
},
|
|
116
210
|
inlineCode: {
|
|
117
211
|
...defaultMarkdownStyles.inlineCode,
|
|
118
212
|
backgroundColor: colors.white_smoke,
|
|
@@ -125,6 +219,35 @@ export const renderText = <
|
|
|
125
219
|
color: colors.accent_blue,
|
|
126
220
|
...markdownStyles?.mentions,
|
|
127
221
|
},
|
|
222
|
+
table: {
|
|
223
|
+
...defaultMarkdownStyles.table,
|
|
224
|
+
borderColor: colors.grey_dark,
|
|
225
|
+
marginVertical: 8,
|
|
226
|
+
...markdownStyles?.table,
|
|
227
|
+
},
|
|
228
|
+
tableHeader: {
|
|
229
|
+
...defaultMarkdownStyles.tableHeader,
|
|
230
|
+
backgroundColor: colors.grey,
|
|
231
|
+
...markdownStyles?.tableHeader,
|
|
232
|
+
},
|
|
233
|
+
tableHeaderCell: {
|
|
234
|
+
...defaultMarkdownStyles.tableHeaderCell,
|
|
235
|
+
padding: 5,
|
|
236
|
+
...markdownStyles?.tableHeaderCell,
|
|
237
|
+
},
|
|
238
|
+
tableRow: {
|
|
239
|
+
...defaultMarkdownStyles.tableRow,
|
|
240
|
+
...markdownStyles?.tableRow,
|
|
241
|
+
},
|
|
242
|
+
tableRowCell: {
|
|
243
|
+
...defaultMarkdownStyles.tableRowCell,
|
|
244
|
+
borderColor: colors.grey_dark,
|
|
245
|
+
padding: 5,
|
|
246
|
+
...markdownStyles?.tableRowCell,
|
|
247
|
+
},
|
|
248
|
+
tableRowLast: {
|
|
249
|
+
...markdownStyles?.tableRowLast,
|
|
250
|
+
},
|
|
128
251
|
text: {
|
|
129
252
|
...defaultMarkdownStyles.text,
|
|
130
253
|
color: colors.black,
|
|
@@ -263,6 +386,18 @@ export const renderText = <
|
|
|
263
386
|
/>
|
|
264
387
|
);
|
|
265
388
|
|
|
389
|
+
const codeBlockReact: ReactNodeOutput = (node, _, state) => (
|
|
390
|
+
<MarkdownReactiveScrollView key={state.key}>
|
|
391
|
+
<Text style={styles.codeBlock}>{node?.content?.trim()}</Text>
|
|
392
|
+
</MarkdownReactiveScrollView>
|
|
393
|
+
);
|
|
394
|
+
|
|
395
|
+
const tableReact: ReactNodeOutput = (node, output, state) => (
|
|
396
|
+
<MarkdownReactiveScrollView key={state.key}>
|
|
397
|
+
<MarkdownTable node={node} output={output} state={state} styles={styles} />
|
|
398
|
+
</MarkdownReactiveScrollView>
|
|
399
|
+
);
|
|
400
|
+
|
|
266
401
|
const customRules = {
|
|
267
402
|
// do not render images, we will scrape them out of the message and show on attachment card component
|
|
268
403
|
image: { match: () => null },
|
|
@@ -283,6 +418,8 @@ export const renderText = <
|
|
|
283
418
|
},
|
|
284
419
|
}
|
|
285
420
|
: {}),
|
|
421
|
+
codeBlock: { react: codeBlockReact },
|
|
422
|
+
table: { react: tableReact },
|
|
286
423
|
};
|
|
287
424
|
|
|
288
425
|
return (
|
|
@@ -373,3 +510,70 @@ const ListRow = ({ children, style }: PropsWithChildren<ViewProps>) => (
|
|
|
373
510
|
const ListItem = ({ children, style }: PropsWithChildren<TextProps>) => (
|
|
374
511
|
<Text style={style}>{children}</Text>
|
|
375
512
|
);
|
|
513
|
+
|
|
514
|
+
export type MarkdownTableProps = {
|
|
515
|
+
node: SingleASTNode;
|
|
516
|
+
output: ReactOutput;
|
|
517
|
+
state: State;
|
|
518
|
+
styles: Partial<MarkdownStyle>;
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
const transpose = (matrix: SingleASTNode[][]) =>
|
|
522
|
+
matrix[0].map((_, colIndex) => matrix.map((row) => row[colIndex]));
|
|
523
|
+
|
|
524
|
+
const MarkdownTable = ({ node, output, state, styles }: MarkdownTableProps) => {
|
|
525
|
+
const content = useMemo(() => {
|
|
526
|
+
const nodeContent = [node?.header, ...node?.cells];
|
|
527
|
+
return transpose(nodeContent);
|
|
528
|
+
}, [node?.cells, node?.header]);
|
|
529
|
+
const columns = content?.map((column, idx) => (
|
|
530
|
+
<MarkdownTableColumn
|
|
531
|
+
items={column}
|
|
532
|
+
key={`column-${idx}`}
|
|
533
|
+
output={output}
|
|
534
|
+
state={state}
|
|
535
|
+
styles={styles}
|
|
536
|
+
/>
|
|
537
|
+
));
|
|
538
|
+
|
|
539
|
+
return (
|
|
540
|
+
<View key={state.key} style={styles.table}>
|
|
541
|
+
{columns}
|
|
542
|
+
</View>
|
|
543
|
+
);
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
export type MarkdownTableRowProps = {
|
|
547
|
+
items: SingleASTNode[];
|
|
548
|
+
output: ReactOutput;
|
|
549
|
+
state: State;
|
|
550
|
+
styles: Partial<MarkdownStyle>;
|
|
551
|
+
};
|
|
552
|
+
|
|
553
|
+
const MarkdownTableColumn = ({ items, output, state, styles }: MarkdownTableRowProps) => {
|
|
554
|
+
const [headerCellContent, ...columnCellContents] = items;
|
|
555
|
+
|
|
556
|
+
const ColumnCell = useCallback(
|
|
557
|
+
({ content }: { content: SingleASTNode }) =>
|
|
558
|
+
content ? (
|
|
559
|
+
<View style={styles.tableRow}>
|
|
560
|
+
<View style={styles.tableRowCell}>{output(content, state)}</View>
|
|
561
|
+
</View>
|
|
562
|
+
) : null,
|
|
563
|
+
[output, state, styles],
|
|
564
|
+
);
|
|
565
|
+
|
|
566
|
+
return (
|
|
567
|
+
<View style={{ flex: 1, flexDirection: 'column' }}>
|
|
568
|
+
{headerCellContent ? (
|
|
569
|
+
<View key={-1} style={styles.tableHeader}>
|
|
570
|
+
<Text style={styles.tableHeaderCell}>{output(headerCellContent, state)}</Text>
|
|
571
|
+
</View>
|
|
572
|
+
) : null}
|
|
573
|
+
{columnCellContents &&
|
|
574
|
+
columnCellContents.map((content, idx) => (
|
|
575
|
+
<ColumnCell content={content} key={`cell-${idx}`} />
|
|
576
|
+
))}
|
|
577
|
+
</View>
|
|
578
|
+
);
|
|
579
|
+
};
|
|
@@ -20,6 +20,7 @@ export const useCreateMessageContext = <
|
|
|
20
20
|
hasReactions,
|
|
21
21
|
images,
|
|
22
22
|
isEditedMessageOpen,
|
|
23
|
+
isMessageAIGenerated,
|
|
23
24
|
isMyMessage,
|
|
24
25
|
lastGroupMessage,
|
|
25
26
|
lastReceivedId,
|
|
@@ -66,6 +67,7 @@ export const useCreateMessageContext = <
|
|
|
66
67
|
hasReactions,
|
|
67
68
|
images,
|
|
68
69
|
isEditedMessageOpen,
|
|
70
|
+
isMessageAIGenerated,
|
|
69
71
|
isMyMessage,
|
|
70
72
|
lastGroupMessage,
|
|
71
73
|
lastReceivedId,
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { DefaultStreamChatGenerics } from '../../../types/types';
|
|
4
|
+
import { StreamingMessageViewProps } from '../MessageSimple/StreamingMessageView';
|
|
5
|
+
|
|
6
|
+
export type UseStreamingMessageProps<
|
|
7
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
8
|
+
> = Pick<
|
|
9
|
+
StreamingMessageViewProps<StreamChatGenerics>,
|
|
10
|
+
'letterInterval' | 'renderingLetterCount'
|
|
11
|
+
> & { text: string };
|
|
12
|
+
|
|
13
|
+
const DEFAULT_LETTER_INTERVAL = 0;
|
|
14
|
+
const DEFAULT_RENDERING_LETTER_COUNT = 2;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A hook that returns text in a streamed, typewriter fashion. The speed of streaming is
|
|
18
|
+
* configurable.
|
|
19
|
+
* @param {number} [letterInterval=0] - The timeout between each typing animation in milliseconds.
|
|
20
|
+
* @param {number} [renderingLetterCount=2] - The number of letters to be rendered each time we update.
|
|
21
|
+
* @param {string} text - The text that we want to render in a typewriter fashion.
|
|
22
|
+
* @returns {{ streamedMessageText: string }} - A substring of the text property, up until we've finished rendering the typewriter animation.
|
|
23
|
+
*/
|
|
24
|
+
export const useStreamingMessage = <
|
|
25
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
26
|
+
>({
|
|
27
|
+
letterInterval = DEFAULT_LETTER_INTERVAL,
|
|
28
|
+
renderingLetterCount = DEFAULT_RENDERING_LETTER_COUNT,
|
|
29
|
+
text,
|
|
30
|
+
}: UseStreamingMessageProps<StreamChatGenerics>): { streamedMessageText: string } => {
|
|
31
|
+
const [streamedMessageText, setStreamedMessageText] = useState<string>(text);
|
|
32
|
+
const textCursor = useRef<number>(text.length);
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const textLength = text.length;
|
|
36
|
+
const interval = setInterval(() => {
|
|
37
|
+
if (!text || textCursor.current >= textLength) {
|
|
38
|
+
clearInterval(interval);
|
|
39
|
+
}
|
|
40
|
+
const newCursorValue = textCursor.current + renderingLetterCount;
|
|
41
|
+
const newText = text.substring(0, newCursorValue);
|
|
42
|
+
textCursor.current += newText.length - textCursor.current;
|
|
43
|
+
const codeBlockCounts = (newText.match(/```/g) || []).length;
|
|
44
|
+
const shouldOptimisticallyCloseCodeBlock = codeBlockCounts > 0 && codeBlockCounts % 2 > 0;
|
|
45
|
+
setStreamedMessageText(shouldOptimisticallyCloseCodeBlock ? newText + '```' : newText);
|
|
46
|
+
}, letterInterval);
|
|
47
|
+
|
|
48
|
+
return () => {
|
|
49
|
+
clearInterval(interval);
|
|
50
|
+
};
|
|
51
|
+
}, [letterInterval, renderingLetterCount, text]);
|
|
52
|
+
|
|
53
|
+
return { streamedMessageText };
|
|
54
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useMemo, useState } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Modal,
|
|
4
4
|
NativeSyntheticEvent,
|
|
@@ -58,6 +58,7 @@ import {
|
|
|
58
58
|
|
|
59
59
|
import { isImageMediaLibraryAvailable, triggerHaptic } from '../../native';
|
|
60
60
|
import type { Asset, DefaultStreamChatGenerics } from '../../types/types';
|
|
61
|
+
import { AIStates, useAIState } from '../AITypingIndicatorView';
|
|
61
62
|
import { AutoCompleteInput } from '../AutoCompleteInput/AutoCompleteInput';
|
|
62
63
|
import { CreatePoll } from '../Poll/CreatePollContent';
|
|
63
64
|
|
|
@@ -159,6 +160,7 @@ type MessageInputPropsWithContext<
|
|
|
159
160
|
| 'showPollCreationDialog'
|
|
160
161
|
| 'sendMessage'
|
|
161
162
|
| 'CreatePollContent'
|
|
163
|
+
| 'StopMessageStreamingButton'
|
|
162
164
|
> &
|
|
163
165
|
Pick<MessagesContextValue<StreamChatGenerics>, 'Reply'> &
|
|
164
166
|
Pick<
|
|
@@ -228,6 +230,7 @@ const MessageInputWithContext = <
|
|
|
228
230
|
showPollCreationDialog,
|
|
229
231
|
ShowThreadMessageInChannelButton,
|
|
230
232
|
StartAudioRecordingButton,
|
|
233
|
+
StopMessageStreamingButton,
|
|
231
234
|
suggestions,
|
|
232
235
|
text,
|
|
233
236
|
thread,
|
|
@@ -727,6 +730,13 @@ const MessageInputWithContext = <
|
|
|
727
730
|
})),
|
|
728
731
|
};
|
|
729
732
|
|
|
733
|
+
const { channel } = useChannelContext<StreamChatGenerics>();
|
|
734
|
+
const { aiState } = useAIState(channel);
|
|
735
|
+
|
|
736
|
+
const stopGenerating = useCallback(() => channel?.stopAIResponse(), [channel]);
|
|
737
|
+
const shouldDisplayStopAIGeneration =
|
|
738
|
+
[AIStates.Thinking, AIStates.Generating].includes(aiState) && !!StopMessageStreamingButton;
|
|
739
|
+
|
|
730
740
|
return (
|
|
731
741
|
<>
|
|
732
742
|
<View
|
|
@@ -832,7 +842,10 @@ const MessageInputWithContext = <
|
|
|
832
842
|
</>
|
|
833
843
|
)}
|
|
834
844
|
|
|
835
|
-
{
|
|
845
|
+
{shouldDisplayStopAIGeneration ? (
|
|
846
|
+
<StopMessageStreamingButton onPress={stopGenerating} />
|
|
847
|
+
) : (
|
|
848
|
+
isSendingButtonVisible() &&
|
|
836
849
|
(cooldownRemainingSeconds ? (
|
|
837
850
|
<CooldownTimer seconds={cooldownRemainingSeconds} />
|
|
838
851
|
) : (
|
|
@@ -841,7 +854,8 @@ const MessageInputWithContext = <
|
|
|
841
854
|
disabled={sending.current || !isValidMessage() || (giphyActive && !isOnline)}
|
|
842
855
|
/>
|
|
843
856
|
</View>
|
|
844
|
-
))
|
|
857
|
+
))
|
|
858
|
+
)}
|
|
845
859
|
{audioRecordingEnabled && !micLocked && (
|
|
846
860
|
<GestureDetector gesture={panGestureMic}>
|
|
847
861
|
<Animated.View
|
|
@@ -894,21 +908,23 @@ const MessageInputWithContext = <
|
|
|
894
908
|
</View>
|
|
895
909
|
)}
|
|
896
910
|
{showPollCreationDialog ? (
|
|
897
|
-
<
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
<
|
|
904
|
-
<
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
911
|
+
<View style={{ alignItems: 'center', flex: 1, justifyContent: 'center' }}>
|
|
912
|
+
<Modal
|
|
913
|
+
animationType='slide'
|
|
914
|
+
onRequestClose={closePollCreationDialog}
|
|
915
|
+
visible={showPollCreationDialog}
|
|
916
|
+
>
|
|
917
|
+
<GestureHandlerRootView style={{ flex: 1 }}>
|
|
918
|
+
<SafeAreaView style={{ backgroundColor: white, flex: 1 }}>
|
|
919
|
+
<CreatePoll
|
|
920
|
+
closePollCreationDialog={closePollCreationDialog}
|
|
921
|
+
CreatePollContent={CreatePollContent}
|
|
922
|
+
sendMessage={sendMessage}
|
|
923
|
+
/>
|
|
924
|
+
</SafeAreaView>
|
|
925
|
+
</GestureHandlerRootView>
|
|
926
|
+
</Modal>
|
|
927
|
+
</View>
|
|
912
928
|
) : null}
|
|
913
929
|
</>
|
|
914
930
|
);
|
|
@@ -1086,7 +1102,7 @@ export const MessageInput = <
|
|
|
1086
1102
|
const { isOnline } = useChatContext();
|
|
1087
1103
|
const ownCapabilities = useOwnCapabilitiesContext();
|
|
1088
1104
|
|
|
1089
|
-
const {
|
|
1105
|
+
const { members, threadList, watchers } = useChannelContext<StreamChatGenerics>();
|
|
1090
1106
|
|
|
1091
1107
|
const {
|
|
1092
1108
|
additionalTextInputProps,
|
|
@@ -1141,6 +1157,7 @@ export const MessageInput = <
|
|
|
1141
1157
|
showPollCreationDialog,
|
|
1142
1158
|
ShowThreadMessageInChannelButton,
|
|
1143
1159
|
StartAudioRecordingButton,
|
|
1160
|
+
StopMessageStreamingButton,
|
|
1144
1161
|
text,
|
|
1145
1162
|
uploadNewFile,
|
|
1146
1163
|
uploadNewImage,
|
|
@@ -1164,7 +1181,7 @@ export const MessageInput = <
|
|
|
1164
1181
|
* Disable the message input if the channel is frozen, or the user doesn't have the capability to send a message.
|
|
1165
1182
|
* Enable it in frozen mode, if it the input has editing state.
|
|
1166
1183
|
*/
|
|
1167
|
-
if (
|
|
1184
|
+
if (!ownCapabilities.sendMessage && !editing && SendMessageDisallowedIndicator) {
|
|
1168
1185
|
return <SendMessageDisallowedIndicator />;
|
|
1169
1186
|
}
|
|
1170
1187
|
|
|
@@ -1230,6 +1247,7 @@ export const MessageInput = <
|
|
|
1230
1247
|
showPollCreationDialog,
|
|
1231
1248
|
ShowThreadMessageInChannelButton,
|
|
1232
1249
|
StartAudioRecordingButton,
|
|
1250
|
+
StopMessageStreamingButton,
|
|
1233
1251
|
suggestions,
|
|
1234
1252
|
t,
|
|
1235
1253
|
text,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Pressable } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
5
|
+
import { CircleStop } from '../../icons';
|
|
6
|
+
|
|
7
|
+
export type StopMessageStreamingButtonProps = {
|
|
8
|
+
/** Function that opens attachment options bottom sheet */
|
|
9
|
+
onPress?: () => void;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const StopMessageStreamingButton = (props: StopMessageStreamingButtonProps) => {
|
|
13
|
+
const { onPress } = props;
|
|
14
|
+
|
|
15
|
+
const {
|
|
16
|
+
theme: {
|
|
17
|
+
colors: { accent_blue },
|
|
18
|
+
messageInput: { stopMessageStreamingButton, stopMessageStreamingIcon },
|
|
19
|
+
},
|
|
20
|
+
} = useTheme();
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Pressable
|
|
24
|
+
hitSlop={{ bottom: 15, left: 15, right: 15, top: 15 }}
|
|
25
|
+
onPress={onPress}
|
|
26
|
+
style={[stopMessageStreamingButton]}
|
|
27
|
+
testID='more-options-button'
|
|
28
|
+
>
|
|
29
|
+
<CircleStop fill={accent_blue} size={32} {...stopMessageStreamingIcon} />
|
|
30
|
+
</Pressable>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
StopMessageStreamingButton.displayName = 'StopMessageStreamingButton{messageInput}';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
|
|
3
3
|
import { Alert } from 'react-native';
|
|
4
4
|
|
|
5
|
-
import { cleanup, fireEvent, render, userEvent, waitFor } from '@testing-library/react-native';
|
|
5
|
+
import { act, cleanup, fireEvent, render, userEvent, waitFor } from '@testing-library/react-native';
|
|
6
6
|
|
|
7
|
+
import { useMessagesContext } from '../../../contexts';
|
|
7
8
|
import * as AttachmentPickerUtils from '../../../contexts/attachmentPickerContext/AttachmentPickerContext';
|
|
8
9
|
import { OverlayProvider } from '../../../contexts/overlayContext/OverlayProvider';
|
|
9
10
|
import { getOrCreateChannelApi } from '../../../mock-builders/api/getOrCreateChannel';
|
|
@@ -188,4 +189,117 @@ describe('MessageInput', () => {
|
|
|
188
189
|
expect(Alert.alert).toHaveBeenCalledWith('Hold to start recording.');
|
|
189
190
|
});
|
|
190
191
|
});
|
|
192
|
+
|
|
193
|
+
it('should render the SendMessageDisallowedIndicator if the send-message capability is not present', async () => {
|
|
194
|
+
await initializeChannel(generateChannelResponse());
|
|
195
|
+
|
|
196
|
+
const { queryByTestId } = render(
|
|
197
|
+
<Chat client={chatClient}>
|
|
198
|
+
<Channel audioRecordingEnabled channel={channel}>
|
|
199
|
+
<MessageInput />
|
|
200
|
+
</Channel>
|
|
201
|
+
</Chat>,
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
await waitFor(() => {
|
|
205
|
+
expect(queryByTestId('send-message-disallowed-indicator')).toBeNull();
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
act(() => {
|
|
209
|
+
chatClient.dispatchEvent({
|
|
210
|
+
cid: channel.data.cid,
|
|
211
|
+
own_capabilities: channel.data.own_capabilities.filter(
|
|
212
|
+
(capability) => capability !== 'send-message',
|
|
213
|
+
),
|
|
214
|
+
type: 'capabilities.changed',
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
await waitFor(() => {
|
|
219
|
+
expect(queryByTestId('send-message-disallowed-indicator')).toBeTruthy();
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
it('should not render the SendMessageDisallowedIndicator if the channel is frozen and the send-message capability is present', async () => {
|
|
224
|
+
await initializeChannel(generateChannelResponse({ channel: { frozen: true } }));
|
|
225
|
+
|
|
226
|
+
const { queryByTestId } = render(
|
|
227
|
+
<Chat client={chatClient}>
|
|
228
|
+
<Channel audioRecordingEnabled channel={channel}>
|
|
229
|
+
<MessageInput />
|
|
230
|
+
</Channel>
|
|
231
|
+
</Chat>,
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
await waitFor(() => {
|
|
235
|
+
expect(queryByTestId('send-message-disallowed-indicator')).toBeNull();
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
it('should render the SendMessageDisallowedIndicator in a frozen channel only if the send-message capability is not present', async () => {
|
|
240
|
+
await initializeChannel(generateChannelResponse({ channel: { frozen: true } }));
|
|
241
|
+
|
|
242
|
+
const { queryByTestId } = render(
|
|
243
|
+
<Chat client={chatClient}>
|
|
244
|
+
<Channel audioRecordingEnabled channel={channel}>
|
|
245
|
+
<MessageInput />
|
|
246
|
+
</Channel>
|
|
247
|
+
</Chat>,
|
|
248
|
+
);
|
|
249
|
+
|
|
250
|
+
act(() => {
|
|
251
|
+
chatClient.dispatchEvent({
|
|
252
|
+
channel: {
|
|
253
|
+
...channel.data,
|
|
254
|
+
own_capabilities: channel.data.own_capabilities.filter(
|
|
255
|
+
(capability) => capability !== 'send-message',
|
|
256
|
+
),
|
|
257
|
+
},
|
|
258
|
+
cid: channel.data.cid,
|
|
259
|
+
type: 'channel.updated',
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
await waitFor(() => {
|
|
264
|
+
expect(queryByTestId('send-message-disallowed-indicator')).toBeTruthy();
|
|
265
|
+
});
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
const EditingStateMessageInput = () => {
|
|
269
|
+
const { setEditingState } = useMessagesContext();
|
|
270
|
+
useEffect(() => {
|
|
271
|
+
setEditingState({ id: 'some-message-id' });
|
|
272
|
+
}, []);
|
|
273
|
+
return <MessageInput />;
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
it('should not render the SendMessageDisallowedIndicator if we are editing a message, regardless of capabilities', async () => {
|
|
277
|
+
await initializeChannel(generateChannelResponse());
|
|
278
|
+
|
|
279
|
+
const { queryByTestId } = render(
|
|
280
|
+
<Chat client={chatClient}>
|
|
281
|
+
<Channel audioRecordingEnabled channel={channel}>
|
|
282
|
+
<EditingStateMessageInput />
|
|
283
|
+
</Channel>
|
|
284
|
+
</Chat>,
|
|
285
|
+
);
|
|
286
|
+
|
|
287
|
+
await waitFor(() => {
|
|
288
|
+
expect(queryByTestId('send-message-disallowed-indicator')).toBeNull();
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
act(() => {
|
|
292
|
+
chatClient.dispatchEvent({
|
|
293
|
+
cid: channel.data.cid,
|
|
294
|
+
own_capabilities: channel.data.own_capabilities.filter(
|
|
295
|
+
(capability) => capability !== 'send-message',
|
|
296
|
+
),
|
|
297
|
+
type: 'capabilities.changed',
|
|
298
|
+
});
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
await waitFor(() => {
|
|
302
|
+
expect(queryByTestId('send-message-disallowed-indicator')).toBeNull();
|
|
303
|
+
});
|
|
304
|
+
});
|
|
191
305
|
});
|