stream-chat-react-native-core 4.4.0 → 4.5.1-beta.1
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 +2 -2
- package/lib/commonjs/components/Attachment/Attachment.js +1 -1
- package/lib/commonjs/components/Attachment/AttachmentActions.js +1 -1
- package/lib/commonjs/components/Attachment/Card.js +26 -29
- package/lib/commonjs/components/Attachment/Card.js.map +1 -1
- package/lib/commonjs/components/Attachment/FileAttachment.js +20 -25
- package/lib/commonjs/components/Attachment/FileAttachment.js.map +1 -1
- package/lib/commonjs/components/Attachment/FileAttachmentGroup.js +1 -1
- package/lib/commonjs/components/Attachment/FileIcon.js +1 -1
- package/lib/commonjs/components/Attachment/Gallery.js +1 -1
- package/lib/commonjs/components/Attachment/Giphy.js +1 -1
- package/lib/commonjs/components/Attachment/hooks/useGoToURL.js +42 -0
- package/lib/commonjs/components/Attachment/hooks/useGoToURL.js.map +1 -0
- package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js +25 -18
- package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerBottomSheetHandle.js +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerError.js +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerErrorImage.js +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentSelectionBar.js +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/CameraSelectorIcon.js +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/FileSelectorIcon.js +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/ImageOverlaySelectedComponent.js +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/ImageSelectorIcon.js +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteInput.js +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionCommandIcon.js +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionHeader.js +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionItem.js +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionList.js +1 -1
- package/lib/commonjs/components/Avatar/Avatar.js +1 -1
- package/lib/commonjs/components/Avatar/GroupAvatar.js +1 -1
- package/lib/commonjs/components/Channel/Channel.js +1 -1
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreatePaginatedMessageListContext.js +4 -12
- package/lib/commonjs/components/Channel/hooks/useCreatePaginatedMessageListContext.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateThreadContext.js +4 -12
- package/lib/commonjs/components/Channel/hooks/useCreateThreadContext.js.map +1 -1
- package/lib/commonjs/components/ChannelList/ChannelList.js +1 -1
- package/lib/commonjs/components/ChannelList/ChannelListFooterLoadingIndicator.js +1 -1
- package/lib/commonjs/components/ChannelList/ChannelListHeaderErrorIndicator.js +1 -1
- package/lib/commonjs/components/ChannelList/ChannelListHeaderNetworkDownIndicator.js +1 -1
- package/lib/commonjs/components/ChannelList/ChannelListLoadingIndicator.js +1 -1
- package/lib/commonjs/components/ChannelList/ChannelListMessenger.js +1 -1
- package/lib/commonjs/components/ChannelList/Skeleton.js +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelAvatar.js +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreview.js +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessage.js +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessenger.js +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewMutedStatus.js +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewStatus.js +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewTitle.js +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewUnreadCount.js +1 -1
- package/lib/commonjs/components/Chat/Chat.js +9 -5
- package/lib/commonjs/components/Chat/Chat.js.map +1 -1
- package/lib/commonjs/components/Chat/hooks/useAppSettings.js +80 -0
- package/lib/commonjs/components/Chat/hooks/useAppSettings.js.map +1 -0
- package/lib/commonjs/components/Chat/hooks/useCreateChatContext.js +3 -1
- package/lib/commonjs/components/Chat/hooks/useCreateChatContext.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +1 -1
- package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryImage.js +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryOverlay.js +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGrid.js +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGridHandle.js +1 -1
- package/lib/commonjs/components/Indicators/EmptyStateIndicator.js +1 -1
- package/lib/commonjs/components/Indicators/LoadingDot.js +1 -1
- package/lib/commonjs/components/Indicators/LoadingDots.js +1 -1
- package/lib/commonjs/components/Indicators/LoadingErrorIndicator.js +1 -1
- package/lib/commonjs/components/Indicators/LoadingIndicator.js +1 -1
- package/lib/commonjs/components/KeyboardCompatibleView/KeyboardCompatibleView.js +1 -1
- package/lib/commonjs/components/KeyboardCompatibleView/KeyboardCompatibleViewFC.js +1 -1
- package/lib/commonjs/components/Message/Message.js +28 -23
- package/lib/commonjs/components/Message/Message.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageAvatar.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageDeleted.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageFooter.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessagePinnedHeader.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageReplies.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageRepliesAvatars.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageStatus.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageTextContainer.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/ReactionList.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js +29 -15
- package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/utils/renderText.test.js +1 -1
- package/lib/commonjs/components/Message/hooks/useMessageActions.js +1 -1
- package/lib/commonjs/components/MessageInput/AttachButton.js +1 -1
- package/lib/commonjs/components/MessageInput/CommandsButton.js +1 -1
- package/lib/commonjs/components/MessageInput/CooldownTimer.js +1 -1
- package/lib/commonjs/components/MessageInput/FileUploadPreview.js +109 -41
- package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
- package/lib/commonjs/components/MessageInput/ImageUploadPreview.js +118 -25
- package/lib/commonjs/components/MessageInput/ImageUploadPreview.js.map +1 -1
- package/lib/commonjs/components/MessageInput/InputButtons.js +1 -1
- package/lib/commonjs/components/MessageInput/MessageInput.js +1 -1
- package/lib/commonjs/components/MessageInput/MoreOptionsButton.js +1 -1
- package/lib/commonjs/components/MessageInput/SendButton.js +1 -1
- package/lib/commonjs/components/MessageInput/SendMessageDisallowedIndicator.js +1 -1
- package/lib/commonjs/components/MessageInput/ShowThreadMessageInChannelButton.js +1 -1
- package/lib/commonjs/components/MessageInput/UploadProgressIndicator.js +53 -21
- package/lib/commonjs/components/MessageInput/UploadProgressIndicator.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/InputEditingStateHeader.js +1 -1
- package/lib/commonjs/components/MessageInput/components/InputGiphySearch.js +1 -1
- package/lib/commonjs/components/MessageInput/components/InputReplyStateHeader.js +1 -1
- package/lib/commonjs/components/MessageList/DateHeader.js +1 -1
- package/lib/commonjs/components/MessageList/InlineDateSeparator.js +1 -1
- package/lib/commonjs/components/MessageList/InlineLoadingMoreIndicator.js +1 -1
- package/lib/commonjs/components/MessageList/InlineLoadingMoreRecentIndicator.js +1 -1
- package/lib/commonjs/components/MessageList/InlineLoadingMoreThreadIndicator.js +1 -1
- package/lib/commonjs/components/MessageList/InlineUnreadIndicator.js +1 -1
- package/lib/commonjs/components/MessageList/MessageList.js +1 -1
- package/lib/commonjs/components/MessageList/MessageSystem.js +1 -1
- package/lib/commonjs/components/MessageList/NetworkDownIndicator.js +1 -1
- package/lib/commonjs/components/MessageList/ScrollToBottomButton.js +1 -1
- package/lib/commonjs/components/MessageList/TypingIndicator.js +1 -1
- package/lib/commonjs/components/MessageList/TypingIndicatorContainer.js +1 -1
- package/lib/commonjs/components/MessageOverlay/MessageActionList.js +1 -1
- package/lib/commonjs/components/MessageOverlay/MessageActionListItem.js +1 -1
- package/lib/commonjs/components/MessageOverlay/MessageOverlay.js +1 -1
- package/lib/commonjs/components/MessageOverlay/OverlayBackdrop.js +1 -1
- package/lib/commonjs/components/MessageOverlay/OverlayReactionList.js +1 -1
- package/lib/commonjs/components/MessageOverlay/OverlayReactions.js +1 -1
- package/lib/commonjs/components/MessageOverlay/OverlayReactionsAvatar.js +1 -1
- package/lib/commonjs/components/Reply/Reply.js +1 -1
- package/lib/commonjs/components/Spinner/Spinner.js +1 -1
- package/lib/commonjs/components/Thread/Thread.js +1 -1
- package/lib/commonjs/components/Thread/components/ThreadFooterComponent.js +1 -1
- package/lib/commonjs/contexts/activeChannelsRefContext/ActiveChannelsRefContext.js +1 -1
- package/lib/commonjs/contexts/attachmentPickerContext/AttachmentPickerContext.js +1 -1
- package/lib/commonjs/contexts/channelContext/ChannelContext.js +1 -1
- package/lib/commonjs/contexts/channelsContext/ChannelsContext.js +1 -1
- package/lib/commonjs/contexts/channelsStateContext/ChannelsStateContext.js +1 -1
- package/lib/commonjs/contexts/chatContext/ChatContext.js +3 -3
- package/lib/commonjs/contexts/chatContext/ChatContext.js.map +1 -1
- package/lib/commonjs/contexts/imageGalleryContext/ImageGalleryContext.js +1 -1
- package/lib/commonjs/contexts/keyboardContext/KeyboardContext.js +1 -1
- package/lib/commonjs/contexts/messageContext/MessageContext.js +3 -3
- package/lib/commonjs/contexts/messageContext/MessageContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +146 -120
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
- package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js +1 -1
- package/lib/commonjs/contexts/messageOverlayContext/hooks/useResettableState.test.js +1 -1
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js +1 -1
- package/lib/commonjs/contexts/overlayContext/OverlayContext.js +1 -1
- package/lib/commonjs/contexts/overlayContext/OverlayProvider.js +1 -1
- package/lib/commonjs/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.js +1 -1
- package/lib/commonjs/contexts/paginatedMessageListContext/PaginatedMessageListContext.js +1 -1
- package/lib/commonjs/contexts/suggestionsContext/SuggestionsContext.js +1 -1
- package/lib/commonjs/contexts/themeContext/ThemeContext.js +1 -1
- package/lib/commonjs/contexts/threadContext/ThreadContext.js +1 -1
- package/lib/commonjs/contexts/translationContext/TranslationContext.js +1 -1
- package/lib/commonjs/contexts/typingContext/TypingContext.js +1 -1
- package/lib/commonjs/i18n/en.json +2 -0
- package/lib/commonjs/i18n/fr.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 +3 -1
- package/lib/commonjs/i18n/ko.json +3 -1
- package/lib/commonjs/i18n/nl.json +2 -0
- package/lib/commonjs/i18n/ru.json +2 -0
- package/lib/commonjs/i18n/tr.json +2 -0
- package/lib/commonjs/icons/ArrowRight.js +1 -1
- package/lib/commonjs/icons/AtMentions.js +1 -1
- package/lib/commonjs/icons/Attach.js +1 -1
- package/lib/commonjs/icons/Audio.js +1 -1
- package/lib/commonjs/icons/CSV.js +1 -1
- package/lib/commonjs/icons/Camera.js +1 -1
- package/lib/commonjs/icons/Check.js +1 -1
- package/lib/commonjs/icons/CheckAll.js +1 -1
- package/lib/commonjs/icons/CheckSend.js +1 -1
- package/lib/commonjs/icons/CircleClose.js +1 -1
- package/lib/commonjs/icons/CirclePlus.js +1 -1
- package/lib/commonjs/icons/CircleRight.js +1 -1
- package/lib/commonjs/icons/Close.js +1 -1
- package/lib/commonjs/icons/Copy.js +1 -1
- package/lib/commonjs/icons/CurveLineLeftUp.js +1 -1
- package/lib/commonjs/icons/DOC.js +1 -1
- package/lib/commonjs/icons/DOCX.js +1 -1
- package/lib/commonjs/icons/Delete.js +1 -1
- package/lib/commonjs/icons/Down.js +1 -1
- package/lib/commonjs/icons/DownloadArrow.js +1 -1
- package/lib/commonjs/icons/DownloadCloud.js +1 -1
- package/lib/commonjs/icons/Edit.js +1 -1
- package/lib/commonjs/icons/Error.js +1 -1
- package/lib/commonjs/icons/Eye.js +1 -1
- package/lib/commonjs/icons/Flag.js +1 -1
- package/lib/commonjs/icons/Folder.js +1 -1
- package/lib/commonjs/icons/GenericFile.js +1 -1
- package/lib/commonjs/icons/GiphyIcon.js +1 -1
- package/lib/commonjs/icons/Grid.js +1 -1
- package/lib/commonjs/icons/Group.js +1 -1
- package/lib/commonjs/icons/HTML.js +1 -1
- package/lib/commonjs/icons/Imgur.js +1 -1
- package/lib/commonjs/icons/LOLReaction.js +1 -1
- package/lib/commonjs/icons/Lightning.js +1 -1
- package/lib/commonjs/icons/Link.js +1 -1
- package/lib/commonjs/icons/Loading.js +1 -1
- package/lib/commonjs/icons/Logo.js +1 -1
- package/lib/commonjs/icons/LoveReaction.js +1 -1
- package/lib/commonjs/icons/MD.js +1 -1
- package/lib/commonjs/icons/MailOpen.js +1 -1
- package/lib/commonjs/icons/MenuPointHorizontal.js +1 -1
- package/lib/commonjs/icons/MenuPointVertical.js +1 -1
- package/lib/commonjs/icons/MessageFlag.js +1 -1
- package/lib/commonjs/icons/MessageIcon.js +1 -1
- package/lib/commonjs/icons/Mute.js +1 -1
- package/lib/commonjs/icons/Notification.js +1 -1
- package/lib/commonjs/icons/ODT.js +1 -1
- package/lib/commonjs/icons/PDF.js +1 -1
- package/lib/commonjs/icons/PPT.js +1 -1
- package/lib/commonjs/icons/PPTX.js +1 -1
- package/lib/commonjs/icons/Picture.js +1 -1
- package/lib/commonjs/icons/Pin.js +1 -1
- package/lib/commonjs/icons/PinHeader.js +1 -1
- package/lib/commonjs/icons/RAR.js +1 -1
- package/lib/commonjs/icons/RTF.js +1 -1
- package/lib/commonjs/icons/Refresh.js +1 -1
- package/lib/commonjs/icons/SEVEN_Z.js +1 -1
- package/lib/commonjs/icons/Search.js +1 -1
- package/lib/commonjs/icons/SendRight.js +1 -1
- package/lib/commonjs/icons/SendUp.js +1 -1
- package/lib/commonjs/icons/Share.js +1 -1
- package/lib/commonjs/icons/ShareRightArrow.js +1 -1
- package/lib/commonjs/icons/Smile.js +1 -1
- package/lib/commonjs/icons/Sound.js +1 -1
- package/lib/commonjs/icons/TAR.js +1 -1
- package/lib/commonjs/icons/TXT.js +1 -1
- package/lib/commonjs/icons/ThreadReply.js +1 -1
- package/lib/commonjs/icons/ThumbsDownReaction.js +1 -1
- package/lib/commonjs/icons/ThumbsUpReaction.js +1 -1
- package/lib/commonjs/icons/Time.js +1 -1
- package/lib/commonjs/icons/Unknown.js +1 -1
- package/lib/commonjs/icons/Unpin.js +1 -1
- package/lib/commonjs/icons/User.js +1 -1
- package/lib/commonjs/icons/UserAdd.js +1 -1
- package/lib/commonjs/icons/UserAdmin.js +1 -1
- package/lib/commonjs/icons/UserDelete.js +1 -1
- package/lib/commonjs/icons/UserMinus.js +1 -1
- package/lib/commonjs/icons/Warning.js +38 -0
- package/lib/commonjs/icons/Warning.js.map +1 -0
- package/lib/commonjs/icons/WutReaction.js +1 -1
- package/lib/commonjs/icons/XLS.js +1 -1
- package/lib/commonjs/icons/XLSX.js +1 -1
- package/lib/commonjs/icons/ZIP.js +1 -1
- package/lib/commonjs/icons/index.js +13 -0
- package/lib/commonjs/icons/index.js.map +1 -1
- package/lib/commonjs/icons/utils/base.js +1 -1
- package/lib/commonjs/utils/utils.js +33 -2
- package/lib/commonjs/utils/utils.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/Attachment.js +1 -1
- package/lib/module/components/Attachment/AttachmentActions.js +1 -1
- package/lib/module/components/Attachment/Card.js +26 -29
- package/lib/module/components/Attachment/Card.js.map +1 -1
- package/lib/module/components/Attachment/FileAttachment.js +20 -25
- package/lib/module/components/Attachment/FileAttachment.js.map +1 -1
- package/lib/module/components/Attachment/FileAttachmentGroup.js +1 -1
- package/lib/module/components/Attachment/FileIcon.js +1 -1
- package/lib/module/components/Attachment/Gallery.js +1 -1
- package/lib/module/components/Attachment/Giphy.js +1 -1
- package/lib/module/components/Attachment/hooks/useGoToURL.js +42 -0
- package/lib/module/components/Attachment/hooks/useGoToURL.js.map +1 -0
- package/lib/module/components/AttachmentPicker/AttachmentPicker.js +25 -18
- package/lib/module/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerBottomSheetHandle.js +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerError.js +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerErrorImage.js +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentSelectionBar.js +1 -1
- package/lib/module/components/AttachmentPicker/components/CameraSelectorIcon.js +1 -1
- package/lib/module/components/AttachmentPicker/components/FileSelectorIcon.js +1 -1
- package/lib/module/components/AttachmentPicker/components/ImageOverlaySelectedComponent.js +1 -1
- package/lib/module/components/AttachmentPicker/components/ImageSelectorIcon.js +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteInput.js +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionCommandIcon.js +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionHeader.js +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionItem.js +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionList.js +1 -1
- package/lib/module/components/Avatar/Avatar.js +1 -1
- package/lib/module/components/Avatar/GroupAvatar.js +1 -1
- package/lib/module/components/Channel/Channel.js +1 -1
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreatePaginatedMessageListContext.js +4 -12
- package/lib/module/components/Channel/hooks/useCreatePaginatedMessageListContext.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateThreadContext.js +4 -12
- package/lib/module/components/Channel/hooks/useCreateThreadContext.js.map +1 -1
- package/lib/module/components/ChannelList/ChannelList.js +1 -1
- package/lib/module/components/ChannelList/ChannelListFooterLoadingIndicator.js +1 -1
- package/lib/module/components/ChannelList/ChannelListHeaderErrorIndicator.js +1 -1
- package/lib/module/components/ChannelList/ChannelListHeaderNetworkDownIndicator.js +1 -1
- package/lib/module/components/ChannelList/ChannelListLoadingIndicator.js +1 -1
- package/lib/module/components/ChannelList/ChannelListMessenger.js +1 -1
- package/lib/module/components/ChannelList/Skeleton.js +1 -1
- package/lib/module/components/ChannelPreview/ChannelAvatar.js +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreview.js +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewMessage.js +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewMessenger.js +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewMutedStatus.js +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewStatus.js +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewTitle.js +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewUnreadCount.js +1 -1
- package/lib/module/components/Chat/Chat.js +9 -5
- package/lib/module/components/Chat/Chat.js.map +1 -1
- package/lib/module/components/Chat/hooks/useAppSettings.js +80 -0
- package/lib/module/components/Chat/hooks/useAppSettings.js.map +1 -0
- package/lib/module/components/Chat/hooks/useCreateChatContext.js +3 -1
- package/lib/module/components/Chat/hooks/useCreateChatContext.js.map +1 -1
- package/lib/module/components/ImageGallery/ImageGallery.js +1 -1
- package/lib/module/components/ImageGallery/components/AnimatedGalleryImage.js +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryOverlay.js +1 -1
- package/lib/module/components/ImageGallery/components/ImageGrid.js +1 -1
- package/lib/module/components/ImageGallery/components/ImageGridHandle.js +1 -1
- package/lib/module/components/Indicators/EmptyStateIndicator.js +1 -1
- package/lib/module/components/Indicators/LoadingDot.js +1 -1
- package/lib/module/components/Indicators/LoadingDots.js +1 -1
- package/lib/module/components/Indicators/LoadingErrorIndicator.js +1 -1
- package/lib/module/components/Indicators/LoadingIndicator.js +1 -1
- package/lib/module/components/KeyboardCompatibleView/KeyboardCompatibleView.js +1 -1
- package/lib/module/components/KeyboardCompatibleView/KeyboardCompatibleViewFC.js +1 -1
- package/lib/module/components/Message/Message.js +28 -23
- package/lib/module/components/Message/Message.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageAvatar.js +1 -1
- package/lib/module/components/Message/MessageSimple/MessageContent.js +1 -1
- package/lib/module/components/Message/MessageSimple/MessageDeleted.js +1 -1
- package/lib/module/components/Message/MessageSimple/MessageFooter.js +1 -1
- package/lib/module/components/Message/MessageSimple/MessagePinnedHeader.js +1 -1
- package/lib/module/components/Message/MessageSimple/MessageReplies.js +1 -1
- package/lib/module/components/Message/MessageSimple/MessageRepliesAvatars.js +1 -1
- package/lib/module/components/Message/MessageSimple/MessageSimple.js +1 -1
- package/lib/module/components/Message/MessageSimple/MessageStatus.js +1 -1
- package/lib/module/components/Message/MessageSimple/MessageTextContainer.js +1 -1
- package/lib/module/components/Message/MessageSimple/ReactionList.js +1 -1
- package/lib/module/components/Message/MessageSimple/utils/renderText.js +29 -15
- package/lib/module/components/Message/MessageSimple/utils/renderText.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/utils/renderText.test.js +1 -1
- package/lib/module/components/Message/hooks/useMessageActions.js +1 -1
- package/lib/module/components/MessageInput/AttachButton.js +1 -1
- package/lib/module/components/MessageInput/CommandsButton.js +1 -1
- package/lib/module/components/MessageInput/CooldownTimer.js +1 -1
- package/lib/module/components/MessageInput/FileUploadPreview.js +109 -41
- package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
- package/lib/module/components/MessageInput/ImageUploadPreview.js +118 -25
- package/lib/module/components/MessageInput/ImageUploadPreview.js.map +1 -1
- package/lib/module/components/MessageInput/InputButtons.js +1 -1
- package/lib/module/components/MessageInput/MessageInput.js +1 -1
- package/lib/module/components/MessageInput/MoreOptionsButton.js +1 -1
- package/lib/module/components/MessageInput/SendButton.js +1 -1
- package/lib/module/components/MessageInput/SendMessageDisallowedIndicator.js +1 -1
- package/lib/module/components/MessageInput/ShowThreadMessageInChannelButton.js +1 -1
- package/lib/module/components/MessageInput/UploadProgressIndicator.js +53 -21
- package/lib/module/components/MessageInput/UploadProgressIndicator.js.map +1 -1
- package/lib/module/components/MessageInput/components/InputEditingStateHeader.js +1 -1
- package/lib/module/components/MessageInput/components/InputGiphySearch.js +1 -1
- package/lib/module/components/MessageInput/components/InputReplyStateHeader.js +1 -1
- package/lib/module/components/MessageList/DateHeader.js +1 -1
- package/lib/module/components/MessageList/InlineDateSeparator.js +1 -1
- package/lib/module/components/MessageList/InlineLoadingMoreIndicator.js +1 -1
- package/lib/module/components/MessageList/InlineLoadingMoreRecentIndicator.js +1 -1
- package/lib/module/components/MessageList/InlineLoadingMoreThreadIndicator.js +1 -1
- package/lib/module/components/MessageList/InlineUnreadIndicator.js +1 -1
- package/lib/module/components/MessageList/MessageList.js +1 -1
- package/lib/module/components/MessageList/MessageSystem.js +1 -1
- package/lib/module/components/MessageList/NetworkDownIndicator.js +1 -1
- package/lib/module/components/MessageList/ScrollToBottomButton.js +1 -1
- package/lib/module/components/MessageList/TypingIndicator.js +1 -1
- package/lib/module/components/MessageList/TypingIndicatorContainer.js +1 -1
- package/lib/module/components/MessageOverlay/MessageActionList.js +1 -1
- package/lib/module/components/MessageOverlay/MessageActionListItem.js +1 -1
- package/lib/module/components/MessageOverlay/MessageOverlay.js +1 -1
- package/lib/module/components/MessageOverlay/OverlayBackdrop.js +1 -1
- package/lib/module/components/MessageOverlay/OverlayReactionList.js +1 -1
- package/lib/module/components/MessageOverlay/OverlayReactions.js +1 -1
- package/lib/module/components/MessageOverlay/OverlayReactionsAvatar.js +1 -1
- package/lib/module/components/Reply/Reply.js +1 -1
- package/lib/module/components/Spinner/Spinner.js +1 -1
- package/lib/module/components/Thread/Thread.js +1 -1
- package/lib/module/components/Thread/components/ThreadFooterComponent.js +1 -1
- package/lib/module/contexts/activeChannelsRefContext/ActiveChannelsRefContext.js +1 -1
- package/lib/module/contexts/attachmentPickerContext/AttachmentPickerContext.js +1 -1
- package/lib/module/contexts/channelContext/ChannelContext.js +1 -1
- package/lib/module/contexts/channelsContext/ChannelsContext.js +1 -1
- package/lib/module/contexts/channelsStateContext/ChannelsStateContext.js +1 -1
- package/lib/module/contexts/chatContext/ChatContext.js +3 -3
- package/lib/module/contexts/chatContext/ChatContext.js.map +1 -1
- package/lib/module/contexts/imageGalleryContext/ImageGalleryContext.js +1 -1
- package/lib/module/contexts/keyboardContext/KeyboardContext.js +1 -1
- package/lib/module/contexts/messageContext/MessageContext.js +3 -3
- package/lib/module/contexts/messageContext/MessageContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js +146 -120
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
- package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js +1 -1
- package/lib/module/contexts/messageOverlayContext/hooks/useResettableState.test.js +1 -1
- package/lib/module/contexts/messagesContext/MessagesContext.js +1 -1
- package/lib/module/contexts/overlayContext/OverlayContext.js +1 -1
- package/lib/module/contexts/overlayContext/OverlayProvider.js +1 -1
- package/lib/module/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.js +1 -1
- package/lib/module/contexts/paginatedMessageListContext/PaginatedMessageListContext.js +1 -1
- package/lib/module/contexts/suggestionsContext/SuggestionsContext.js +1 -1
- package/lib/module/contexts/themeContext/ThemeContext.js +1 -1
- package/lib/module/contexts/threadContext/ThreadContext.js +1 -1
- package/lib/module/contexts/translationContext/TranslationContext.js +1 -1
- package/lib/module/contexts/typingContext/TypingContext.js +1 -1
- package/lib/module/i18n/en.json +2 -0
- package/lib/module/i18n/fr.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 +3 -1
- package/lib/module/i18n/ko.json +3 -1
- package/lib/module/i18n/nl.json +2 -0
- package/lib/module/i18n/ru.json +2 -0
- package/lib/module/i18n/tr.json +2 -0
- package/lib/module/icons/ArrowRight.js +1 -1
- package/lib/module/icons/AtMentions.js +1 -1
- package/lib/module/icons/Attach.js +1 -1
- package/lib/module/icons/Audio.js +1 -1
- package/lib/module/icons/CSV.js +1 -1
- package/lib/module/icons/Camera.js +1 -1
- package/lib/module/icons/Check.js +1 -1
- package/lib/module/icons/CheckAll.js +1 -1
- package/lib/module/icons/CheckSend.js +1 -1
- package/lib/module/icons/CircleClose.js +1 -1
- package/lib/module/icons/CirclePlus.js +1 -1
- package/lib/module/icons/CircleRight.js +1 -1
- package/lib/module/icons/Close.js +1 -1
- package/lib/module/icons/Copy.js +1 -1
- package/lib/module/icons/CurveLineLeftUp.js +1 -1
- package/lib/module/icons/DOC.js +1 -1
- package/lib/module/icons/DOCX.js +1 -1
- package/lib/module/icons/Delete.js +1 -1
- package/lib/module/icons/Down.js +1 -1
- package/lib/module/icons/DownloadArrow.js +1 -1
- package/lib/module/icons/DownloadCloud.js +1 -1
- package/lib/module/icons/Edit.js +1 -1
- package/lib/module/icons/Error.js +1 -1
- package/lib/module/icons/Eye.js +1 -1
- package/lib/module/icons/Flag.js +1 -1
- package/lib/module/icons/Folder.js +1 -1
- package/lib/module/icons/GenericFile.js +1 -1
- package/lib/module/icons/GiphyIcon.js +1 -1
- package/lib/module/icons/Grid.js +1 -1
- package/lib/module/icons/Group.js +1 -1
- package/lib/module/icons/HTML.js +1 -1
- package/lib/module/icons/Imgur.js +1 -1
- package/lib/module/icons/LOLReaction.js +1 -1
- package/lib/module/icons/Lightning.js +1 -1
- package/lib/module/icons/Link.js +1 -1
- package/lib/module/icons/Loading.js +1 -1
- package/lib/module/icons/Logo.js +1 -1
- package/lib/module/icons/LoveReaction.js +1 -1
- package/lib/module/icons/MD.js +1 -1
- package/lib/module/icons/MailOpen.js +1 -1
- package/lib/module/icons/MenuPointHorizontal.js +1 -1
- package/lib/module/icons/MenuPointVertical.js +1 -1
- package/lib/module/icons/MessageFlag.js +1 -1
- package/lib/module/icons/MessageIcon.js +1 -1
- package/lib/module/icons/Mute.js +1 -1
- package/lib/module/icons/Notification.js +1 -1
- package/lib/module/icons/ODT.js +1 -1
- package/lib/module/icons/PDF.js +1 -1
- package/lib/module/icons/PPT.js +1 -1
- package/lib/module/icons/PPTX.js +1 -1
- package/lib/module/icons/Picture.js +1 -1
- package/lib/module/icons/Pin.js +1 -1
- package/lib/module/icons/PinHeader.js +1 -1
- package/lib/module/icons/RAR.js +1 -1
- package/lib/module/icons/RTF.js +1 -1
- package/lib/module/icons/Refresh.js +1 -1
- package/lib/module/icons/SEVEN_Z.js +1 -1
- package/lib/module/icons/Search.js +1 -1
- package/lib/module/icons/SendRight.js +1 -1
- package/lib/module/icons/SendUp.js +1 -1
- package/lib/module/icons/Share.js +1 -1
- package/lib/module/icons/ShareRightArrow.js +1 -1
- package/lib/module/icons/Smile.js +1 -1
- package/lib/module/icons/Sound.js +1 -1
- package/lib/module/icons/TAR.js +1 -1
- package/lib/module/icons/TXT.js +1 -1
- package/lib/module/icons/ThreadReply.js +1 -1
- package/lib/module/icons/ThumbsDownReaction.js +1 -1
- package/lib/module/icons/ThumbsUpReaction.js +1 -1
- package/lib/module/icons/Time.js +1 -1
- package/lib/module/icons/Unknown.js +1 -1
- package/lib/module/icons/Unpin.js +1 -1
- package/lib/module/icons/User.js +1 -1
- package/lib/module/icons/UserAdd.js +1 -1
- package/lib/module/icons/UserAdmin.js +1 -1
- package/lib/module/icons/UserDelete.js +1 -1
- package/lib/module/icons/UserMinus.js +1 -1
- package/lib/module/icons/Warning.js +38 -0
- package/lib/module/icons/Warning.js.map +1 -0
- package/lib/module/icons/WutReaction.js +1 -1
- package/lib/module/icons/XLS.js +1 -1
- package/lib/module/icons/XLSX.js +1 -1
- package/lib/module/icons/ZIP.js +1 -1
- package/lib/module/icons/index.js +13 -0
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/icons/utils/base.js +1 -1
- package/lib/module/utils/utils.js +33 -2
- package/lib/module/utils/utils.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Attachment/FileAttachment.d.ts +0 -1
- package/lib/typescript/components/Attachment/hooks/useGoToURL.d.ts +2 -0
- package/lib/typescript/components/Chat/hooks/__tests__/useAppSettings.test.d.ts +1 -0
- package/lib/typescript/components/Chat/hooks/useAppSettings.d.ts +3 -0
- package/lib/typescript/components/Chat/hooks/useCreateChatContext.d.ts +1 -1
- package/lib/typescript/components/Message/Message.d.ts +12 -2
- package/lib/typescript/components/MessageInput/UploadProgressIndicator.d.ts +1 -3
- package/lib/typescript/contexts/chatContext/ChatContext.d.ts +5 -1
- package/lib/typescript/contexts/messageContext/MessageContext.d.ts +4 -4
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +3 -3
- package/lib/typescript/i18n/en.json +2 -0
- package/lib/typescript/i18n/fr.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 +3 -1
- package/lib/typescript/i18n/ko.json +3 -1
- package/lib/typescript/i18n/nl.json +2 -0
- package/lib/typescript/i18n/ru.json +2 -0
- package/lib/typescript/i18n/tr.json +2 -0
- package/lib/typescript/icons/Warning.d.ts +3 -0
- package/lib/typescript/icons/index.d.ts +1 -0
- package/lib/typescript/utils/Streami18n.d.ts +6 -0
- package/lib/typescript/utils/utils.d.ts +15 -2
- package/package.json +1 -1
- package/src/components/Attachment/Card.tsx +5 -13
- package/src/components/Attachment/FileAttachment.tsx +5 -13
- package/src/components/Attachment/__tests__/Attachment.test.js +39 -0
- package/src/components/Attachment/hooks/useGoToURL.ts +27 -0
- package/src/components/AttachmentPicker/AttachmentPicker.tsx +32 -32
- package/src/components/Channel/Channel.tsx +1 -1
- package/src/components/Channel/hooks/useCreatePaginatedMessageListContext.ts +3 -9
- package/src/components/Channel/hooks/useCreateThreadContext.ts +3 -9
- package/src/components/ChannelList/hooks/listeners/__tests__/useChannelUpdated.test.tsx +1 -0
- package/src/components/Chat/Chat.tsx +4 -0
- package/src/components/Chat/hooks/__tests__/useAppSettings.test.tsx +34 -0
- package/src/components/Chat/hooks/useAppSettings.ts +39 -0
- package/src/components/Chat/hooks/useCreateChatContext.ts +2 -0
- package/src/components/Message/Message.tsx +56 -48
- package/src/components/Message/MessageSimple/utils/renderText.tsx +17 -2
- package/src/components/MessageInput/FileUploadPreview.tsx +60 -14
- package/src/components/MessageInput/ImageUploadPreview.tsx +95 -42
- package/src/components/MessageInput/UploadProgressIndicator.tsx +49 -22
- package/src/components/MessageInput/__tests__/FileUploadPreview.test.js +50 -80
- package/src/components/MessageInput/__tests__/ImageUploadPreview.test.js +49 -74
- package/src/components/MessageInput/__tests__/UploadProgressIndicator.test.js +36 -13
- package/src/components/MessageInput/__tests__/__snapshots__/UploadProgressIndicator.test.js.snap +122 -17
- package/src/contexts/chatContext/ChatContext.tsx +5 -1
- package/src/contexts/messageContext/MessageContext.tsx +7 -4
- package/src/contexts/messageInputContext/MessageInputContext.tsx +127 -96
- package/src/contexts/messageInputContext/hooks/useMessageDetailsForState.ts +2 -2
- package/src/i18n/en.json +2 -0
- package/src/i18n/fr.json +2 -0
- package/src/i18n/hi.json +2 -0
- package/src/i18n/it.json +2 -0
- package/src/i18n/ja.json +3 -1
- package/src/i18n/ko.json +3 -1
- package/src/i18n/nl.json +2 -0
- package/src/i18n/ru.json +2 -0
- package/src/i18n/tr.json +2 -0
- package/src/icons/Warning.tsx +12 -0
- package/src/icons/index.ts +1 -0
- package/src/utils/utils.ts +53 -1
- package/src/version.json +1 -1
- package/CHANGELOG.md +0 -1519
- package/src/components/MessageInput/__tests__/__snapshots__/FileUploadPreview.test.js.snap +0 -4413
- package/src/components/MessageInput/__tests__/__snapshots__/ImageUploadPreview.test.js.snap +0 -2373
|
@@ -13,13 +13,15 @@ import {
|
|
|
13
13
|
useMessagesContext,
|
|
14
14
|
} from '../../contexts/messagesContext/MessagesContext';
|
|
15
15
|
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
16
|
+
import { useTranslationContext } from '../../contexts/translationContext/TranslationContext';
|
|
16
17
|
import { Close } from '../../icons/Close';
|
|
18
|
+
import { Warning } from '../../icons/Warning';
|
|
17
19
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
+
import { getIndicatorTypeForFileState, ProgressIndicatorTypes } from '../../utils/utils';
|
|
20
21
|
import { getFileSizeDisplayText } from '../Attachment/FileAttachment';
|
|
21
22
|
|
|
22
23
|
const FILE_PREVIEW_HEIGHT = 60;
|
|
24
|
+
const WARNING_ICON_SIZE = 16;
|
|
23
25
|
|
|
24
26
|
const styles = StyleSheet.create({
|
|
25
27
|
dismiss: {
|
|
@@ -59,8 +61,55 @@ const styles = StyleSheet.create({
|
|
|
59
61
|
marginLeft: 8,
|
|
60
62
|
marginRight: 8,
|
|
61
63
|
},
|
|
64
|
+
unsupportedFile: {
|
|
65
|
+
flexDirection: 'row',
|
|
66
|
+
paddingLeft: 10,
|
|
67
|
+
},
|
|
68
|
+
unsupportedFileText: {
|
|
69
|
+
fontSize: 16,
|
|
70
|
+
},
|
|
71
|
+
warningIconStyle: {
|
|
72
|
+
borderRadius: 24,
|
|
73
|
+
marginTop: 4,
|
|
74
|
+
},
|
|
62
75
|
});
|
|
63
76
|
|
|
77
|
+
const UnsupportedFileTypeOrFileSizeIndicator = ({
|
|
78
|
+
indicatorType,
|
|
79
|
+
item,
|
|
80
|
+
}: {
|
|
81
|
+
indicatorType: typeof ProgressIndicatorTypes[keyof typeof ProgressIndicatorTypes];
|
|
82
|
+
item: FileUpload;
|
|
83
|
+
}) => {
|
|
84
|
+
const {
|
|
85
|
+
theme: {
|
|
86
|
+
colors: { accent_red, grey },
|
|
87
|
+
messageInput: {
|
|
88
|
+
fileUploadPreview: { fileSizeText },
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
} = useTheme();
|
|
92
|
+
|
|
93
|
+
const { t } = useTranslationContext();
|
|
94
|
+
return indicatorType === ProgressIndicatorTypes.NOT_SUPPORTED ? (
|
|
95
|
+
<View style={styles.unsupportedFile}>
|
|
96
|
+
<Warning
|
|
97
|
+
height={WARNING_ICON_SIZE}
|
|
98
|
+
pathFill={accent_red}
|
|
99
|
+
style={styles.warningIconStyle}
|
|
100
|
+
width={WARNING_ICON_SIZE}
|
|
101
|
+
/>
|
|
102
|
+
<Text style={[styles.unsupportedFileText, { color: grey }]}>
|
|
103
|
+
{t('File type not supported')}
|
|
104
|
+
</Text>
|
|
105
|
+
</View>
|
|
106
|
+
) : (
|
|
107
|
+
<Text style={[styles.fileSizeText, { color: grey }, fileSizeText]}>
|
|
108
|
+
{getFileSizeDisplayText(item.file.size)}
|
|
109
|
+
</Text>
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
|
|
64
113
|
type FileUploadPreviewPropsWithContext<
|
|
65
114
|
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
66
115
|
> = Pick<
|
|
@@ -81,14 +130,13 @@ const FileUploadPreviewWithContext = <
|
|
|
81
130
|
|
|
82
131
|
const {
|
|
83
132
|
theme: {
|
|
84
|
-
colors: { black,
|
|
133
|
+
colors: { black, grey_whisper, overlay },
|
|
85
134
|
messageInput: {
|
|
86
135
|
fileUploadPreview: {
|
|
87
136
|
dismiss,
|
|
88
137
|
fileContainer,
|
|
89
138
|
fileContentContainer,
|
|
90
139
|
filenameText,
|
|
91
|
-
fileSizeText,
|
|
92
140
|
fileTextContainer,
|
|
93
141
|
flatList,
|
|
94
142
|
},
|
|
@@ -97,12 +145,7 @@ const FileUploadPreviewWithContext = <
|
|
|
97
145
|
} = useTheme();
|
|
98
146
|
|
|
99
147
|
const renderItem = ({ index, item }: { index: number; item: FileUpload }) => {
|
|
100
|
-
const indicatorType =
|
|
101
|
-
item.state === FileState.UPLOADING
|
|
102
|
-
? ProgressIndicatorTypes.IN_PROGRESS
|
|
103
|
-
: item.state === FileState.UPLOAD_FAILED
|
|
104
|
-
? ProgressIndicatorTypes.RETRY
|
|
105
|
-
: undefined;
|
|
148
|
+
const indicatorType = getIndicatorTypeForFileState(item.state);
|
|
106
149
|
|
|
107
150
|
return (
|
|
108
151
|
<>
|
|
@@ -110,7 +153,6 @@ const FileUploadPreviewWithContext = <
|
|
|
110
153
|
action={() => {
|
|
111
154
|
uploadFile({ newFile: item });
|
|
112
155
|
}}
|
|
113
|
-
active={item.state !== FileState.UPLOADED && item.state !== FileState.FINISHED}
|
|
114
156
|
style={styles.overlay}
|
|
115
157
|
type={indicatorType}
|
|
116
158
|
>
|
|
@@ -150,9 +192,12 @@ const FileUploadPreviewWithContext = <
|
|
|
150
192
|
>
|
|
151
193
|
{item.file.name || ''}
|
|
152
194
|
</Text>
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
195
|
+
{indicatorType !== null && (
|
|
196
|
+
<UnsupportedFileTypeOrFileSizeIndicator
|
|
197
|
+
indicatorType={indicatorType}
|
|
198
|
+
item={item}
|
|
199
|
+
/>
|
|
200
|
+
)}
|
|
156
201
|
</View>
|
|
157
202
|
</View>
|
|
158
203
|
</View>
|
|
@@ -235,6 +280,7 @@ export const FileUploadPreview = <
|
|
|
235
280
|
props: FileUploadPreviewProps<StreamChatGenerics>,
|
|
236
281
|
) => {
|
|
237
282
|
const { fileUploads, removeFile, uploadFile } = useMessageInputContext<StreamChatGenerics>();
|
|
283
|
+
|
|
238
284
|
const { FileAttachmentIcon } = useMessagesContext<StreamChatGenerics>();
|
|
239
285
|
|
|
240
286
|
return (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { FlatList, Image, StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
2
|
+
import { FlatList, Image, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { UploadProgressIndicator } from './UploadProgressIndicator';
|
|
5
5
|
|
|
@@ -9,11 +9,14 @@ import {
|
|
|
9
9
|
useMessageInputContext,
|
|
10
10
|
} from '../../contexts/messageInputContext/MessageInputContext';
|
|
11
11
|
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
12
|
+
import { useTranslationContext } from '../../contexts/translationContext/TranslationContext';
|
|
12
13
|
import { Close } from '../../icons/Close';
|
|
14
|
+
import { Warning } from '../../icons/Warning';
|
|
13
15
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
14
|
-
import {
|
|
16
|
+
import { getIndicatorTypeForFileState, ProgressIndicatorTypes } from '../../utils/utils';
|
|
15
17
|
|
|
16
18
|
const IMAGE_PREVIEW_SIZE = 100;
|
|
19
|
+
const WARNING_ICON_SIZE = 16;
|
|
17
20
|
|
|
18
21
|
const styles = StyleSheet.create({
|
|
19
22
|
dismiss: {
|
|
@@ -22,17 +25,45 @@ const styles = StyleSheet.create({
|
|
|
22
25
|
right: 8,
|
|
23
26
|
top: 8,
|
|
24
27
|
},
|
|
28
|
+
fileSizeText: {
|
|
29
|
+
fontSize: 12,
|
|
30
|
+
paddingLeft: 10,
|
|
31
|
+
},
|
|
25
32
|
flatList: { paddingBottom: 12 },
|
|
33
|
+
iconContainer: {
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
flexDirection: 'row',
|
|
36
|
+
justifyContent: 'center',
|
|
37
|
+
},
|
|
26
38
|
itemContainer: {
|
|
27
39
|
flexDirection: 'row',
|
|
28
40
|
height: IMAGE_PREVIEW_SIZE,
|
|
29
41
|
marginLeft: 8,
|
|
30
42
|
},
|
|
43
|
+
unsupportedImage: {
|
|
44
|
+
borderRadius: 20,
|
|
45
|
+
bottom: 8,
|
|
46
|
+
flexDirection: 'row',
|
|
47
|
+
marginLeft: 3,
|
|
48
|
+
position: 'absolute',
|
|
49
|
+
},
|
|
31
50
|
upload: {
|
|
32
51
|
borderRadius: 10,
|
|
33
52
|
height: IMAGE_PREVIEW_SIZE,
|
|
34
53
|
width: IMAGE_PREVIEW_SIZE,
|
|
35
54
|
},
|
|
55
|
+
warningIconStyle: {
|
|
56
|
+
borderRadius: 24,
|
|
57
|
+
marginLeft: 4,
|
|
58
|
+
marginTop: 4,
|
|
59
|
+
},
|
|
60
|
+
warningText: {
|
|
61
|
+
alignItems: 'center',
|
|
62
|
+
color: 'black',
|
|
63
|
+
fontSize: 10,
|
|
64
|
+
justifyContent: 'center',
|
|
65
|
+
paddingRight: 8,
|
|
66
|
+
},
|
|
36
67
|
});
|
|
37
68
|
|
|
38
69
|
type ImageUploadPreviewPropsWithContext<
|
|
@@ -46,6 +77,8 @@ export type ImageUploadPreviewProps<
|
|
|
46
77
|
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
47
78
|
> = Partial<ImageUploadPreviewPropsWithContext<StreamChatGenerics>>;
|
|
48
79
|
|
|
80
|
+
type ImageUploadPreviewItem = { index: number; item: ImageUpload };
|
|
81
|
+
|
|
49
82
|
const ImageUploadPreviewWithContext = <
|
|
50
83
|
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
51
84
|
>(
|
|
@@ -55,52 +88,72 @@ const ImageUploadPreviewWithContext = <
|
|
|
55
88
|
|
|
56
89
|
const {
|
|
57
90
|
theme: {
|
|
58
|
-
colors: { overlay
|
|
91
|
+
colors: { overlay },
|
|
59
92
|
messageInput: {
|
|
60
93
|
imageUploadPreview: { dismiss, flatList, itemContainer, upload },
|
|
61
94
|
},
|
|
62
95
|
},
|
|
63
96
|
} = useTheme();
|
|
64
97
|
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
98
|
+
const UnsupportedImageTypeIndicator = ({
|
|
99
|
+
indicatorType,
|
|
100
|
+
}: {
|
|
101
|
+
indicatorType: typeof ProgressIndicatorTypes[keyof typeof ProgressIndicatorTypes] | null;
|
|
102
|
+
}) => {
|
|
103
|
+
const {
|
|
104
|
+
theme: {
|
|
105
|
+
colors: { accent_red, overlay, white },
|
|
106
|
+
},
|
|
107
|
+
} = useTheme();
|
|
108
|
+
|
|
109
|
+
const { t } = useTranslationContext();
|
|
110
|
+
return indicatorType === ProgressIndicatorTypes.NOT_SUPPORTED ? (
|
|
111
|
+
<View style={[styles.unsupportedImage, { backgroundColor: overlay }]}>
|
|
112
|
+
<View style={[styles.iconContainer]}>
|
|
113
|
+
<Warning
|
|
114
|
+
height={WARNING_ICON_SIZE}
|
|
115
|
+
pathFill={accent_red}
|
|
116
|
+
style={styles.warningIconStyle}
|
|
117
|
+
width={WARNING_ICON_SIZE}
|
|
118
|
+
/>
|
|
119
|
+
<Text style={[styles.warningText, { color: white }]}>{t('Not supported')}</Text>
|
|
120
|
+
</View>
|
|
121
|
+
</View>
|
|
122
|
+
) : null;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const renderItem = ({ index, item }: ImageUploadPreviewItem) => {
|
|
126
|
+
const indicatorType = getIndicatorTypeForFileState(item.state);
|
|
127
|
+
const itemMarginForIndex = index === imageUploads.length - 1 ? { marginRight: 8 } : {};
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<View style={[styles.itemContainer, itemMarginForIndex, itemContainer]}>
|
|
131
|
+
<UploadProgressIndicator
|
|
132
|
+
action={() => {
|
|
133
|
+
uploadImage({ newImage: item });
|
|
134
|
+
}}
|
|
135
|
+
style={styles.upload}
|
|
136
|
+
type={indicatorType}
|
|
137
|
+
>
|
|
138
|
+
<Image
|
|
139
|
+
resizeMode='cover'
|
|
140
|
+
source={{ uri: item.file.uri || item.url }}
|
|
141
|
+
style={[styles.upload, upload]}
|
|
142
|
+
/>
|
|
143
|
+
</UploadProgressIndicator>
|
|
144
|
+
<TouchableOpacity
|
|
145
|
+
onPress={() => {
|
|
146
|
+
removeImage(item.id);
|
|
147
|
+
}}
|
|
148
|
+
style={[styles.dismiss, { backgroundColor: overlay }, dismiss]}
|
|
149
|
+
testID='remove-image-upload-preview'
|
|
150
|
+
>
|
|
151
|
+
<Close />
|
|
152
|
+
</TouchableOpacity>
|
|
153
|
+
<UnsupportedImageTypeIndicator indicatorType={indicatorType} />
|
|
154
|
+
</View>
|
|
155
|
+
);
|
|
156
|
+
};
|
|
104
157
|
|
|
105
158
|
return imageUploads.length > 0 ? (
|
|
106
159
|
<FlatList
|
|
@@ -13,6 +13,8 @@ import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
|
13
13
|
import { Refresh } from '../../icons';
|
|
14
14
|
import { ProgressIndicatorTypes } from '../../utils/utils';
|
|
15
15
|
|
|
16
|
+
const REFRESH_ICON_SIZE = 18;
|
|
17
|
+
|
|
16
18
|
const styles = StyleSheet.create({
|
|
17
19
|
activityIndicatorContainer: {
|
|
18
20
|
alignItems: 'center',
|
|
@@ -55,27 +57,25 @@ const styles = StyleSheet.create({
|
|
|
55
57
|
export type UploadProgressIndicatorProps = {
|
|
56
58
|
/** Action triggered when clicked indicator */
|
|
57
59
|
action?: (event: GestureResponderEvent) => void;
|
|
58
|
-
/** Boolean status of upload progress */
|
|
59
|
-
active?: boolean;
|
|
60
60
|
/** style */
|
|
61
61
|
style?: StyleProp<ViewStyle>;
|
|
62
62
|
/** Type of active indicator */
|
|
63
|
-
type?: 'in_progress' | 'retry';
|
|
63
|
+
type?: 'in_progress' | 'retry' | 'not_supported' | 'inactive' | null;
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
export const UploadProgressIndicator: React.FC<UploadProgressIndicatorProps> = (props) => {
|
|
67
|
-
const { action,
|
|
67
|
+
const { action, children, style, type } = props;
|
|
68
68
|
|
|
69
69
|
const {
|
|
70
70
|
theme: {
|
|
71
|
-
colors: { overlay: overlayColor
|
|
71
|
+
colors: { overlay: overlayColor },
|
|
72
72
|
messageInput: {
|
|
73
73
|
uploadProgressIndicator: { container, overlay },
|
|
74
74
|
},
|
|
75
75
|
},
|
|
76
76
|
} = useTheme();
|
|
77
77
|
|
|
78
|
-
return
|
|
78
|
+
return type === ProgressIndicatorTypes.INACTIVE ? (
|
|
79
79
|
<View style={[styles.overflowHidden, style]} testID='inactive-upload-progress-indicator'>
|
|
80
80
|
{children}
|
|
81
81
|
</View>
|
|
@@ -83,26 +83,53 @@ export const UploadProgressIndicator: React.FC<UploadProgressIndicatorProps> = (
|
|
|
83
83
|
<View style={[styles.overflowHidden, style]} testID='active-upload-progress-indicator'>
|
|
84
84
|
{children}
|
|
85
85
|
<View style={[styles.overlay, { backgroundColor: overlayColor }, overlay]} />
|
|
86
|
-
<View
|
|
87
|
-
{
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
pathFill={white_smoke}
|
|
97
|
-
testID='retry-upload-progress-indicator'
|
|
98
|
-
width={18}
|
|
99
|
-
/>
|
|
100
|
-
</TouchableOpacity>
|
|
101
|
-
)}
|
|
86
|
+
<View
|
|
87
|
+
style={[
|
|
88
|
+
type === ProgressIndicatorTypes.NOT_SUPPORTED ? styles.overflowHidden : styles.container,
|
|
89
|
+
{ backgroundColor: overlayColor },
|
|
90
|
+
container,
|
|
91
|
+
]}
|
|
92
|
+
testID='not-supported-upload-progress-indicator'
|
|
93
|
+
>
|
|
94
|
+
{type === ProgressIndicatorTypes.IN_PROGRESS && <InProgressIndicator />}
|
|
95
|
+
{type === ProgressIndicatorTypes.RETRY && <RetryIndicator action={action} />}
|
|
102
96
|
</View>
|
|
103
97
|
</View>
|
|
104
98
|
);
|
|
105
99
|
};
|
|
106
100
|
|
|
101
|
+
const InProgressIndicator = () => {
|
|
102
|
+
const {
|
|
103
|
+
theme: {
|
|
104
|
+
colors: { white_smoke },
|
|
105
|
+
},
|
|
106
|
+
} = useTheme();
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<View style={styles.activityIndicatorContainer}>
|
|
110
|
+
<ActivityIndicator color={white_smoke} testID='upload-progress-indicator' />
|
|
111
|
+
</View>
|
|
112
|
+
);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const RetryIndicator = ({ action }: Pick<UploadProgressIndicatorProps, 'action'>) => {
|
|
116
|
+
const {
|
|
117
|
+
theme: {
|
|
118
|
+
colors: { white_smoke },
|
|
119
|
+
},
|
|
120
|
+
} = useTheme();
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<TouchableOpacity onPress={action} style={styles.retryButtonContainer}>
|
|
124
|
+
<Refresh
|
|
125
|
+
height={REFRESH_ICON_SIZE}
|
|
126
|
+
pathFill={white_smoke}
|
|
127
|
+
testID='retry-upload-progress-indicator'
|
|
128
|
+
width={REFRESH_ICON_SIZE}
|
|
129
|
+
/>
|
|
130
|
+
</TouchableOpacity>
|
|
131
|
+
);
|
|
132
|
+
};
|
|
133
|
+
|
|
107
134
|
UploadProgressIndicator.displayName =
|
|
108
135
|
'UploadProgressIndicator{messageInput{uploadProgressIndicator}}';
|
|
@@ -31,6 +31,7 @@ describe('FileUploadPreview', () => {
|
|
|
31
31
|
generateFileUploadPreview({ id: 'file-upload-id-1', state: FileState.UPLOADING }),
|
|
32
32
|
generateFileUploadPreview({ id: 'file-upload-id-2', state: FileState.UPLOADING }),
|
|
33
33
|
generateFileUploadPreview({ id: 'file-upload-id-3', state: FileState.UPLOADING }),
|
|
34
|
+
generateFileUploadPreview({ id: 'file-upload-id-4', state: FileState.UPLOADING }),
|
|
34
35
|
];
|
|
35
36
|
const removeFile = jest.fn();
|
|
36
37
|
const uploadFile = jest.fn();
|
|
@@ -47,7 +48,7 @@ describe('FileUploadPreview', () => {
|
|
|
47
48
|
const channel = chatClient.channel('messaging', mockedChannel.id);
|
|
48
49
|
await channel.query();
|
|
49
50
|
|
|
50
|
-
const { getAllByTestId, queryAllByTestId,
|
|
51
|
+
const { getAllByTestId, queryAllByTestId, queryAllByText } = render(
|
|
51
52
|
<OverlayProvider>
|
|
52
53
|
<Chat client={chatClient}>
|
|
53
54
|
<Channel channel={channel} FlatList={MockedFlatList}>
|
|
@@ -66,6 +67,7 @@ describe('FileUploadPreview', () => {
|
|
|
66
67
|
expect(queryAllByTestId('inactive-upload-progress-indicator')).toHaveLength(0);
|
|
67
68
|
expect(queryAllByTestId('upload-progress-indicator')).toHaveLength(fileUploads.length);
|
|
68
69
|
expect(queryAllByTestId('retry-upload-progress-indicator')).toHaveLength(0);
|
|
70
|
+
expect(queryAllByText('File type not supported')).toHaveLength(0);
|
|
69
71
|
expect(removeFile).toHaveBeenCalledTimes(0);
|
|
70
72
|
expect(uploadFile).toHaveBeenCalledTimes(0);
|
|
71
73
|
});
|
|
@@ -76,29 +78,6 @@ describe('FileUploadPreview', () => {
|
|
|
76
78
|
expect(removeFile).toHaveBeenCalledTimes(1);
|
|
77
79
|
expect(uploadFile).toHaveBeenCalledTimes(0);
|
|
78
80
|
});
|
|
79
|
-
|
|
80
|
-
rerender(
|
|
81
|
-
<OverlayProvider>
|
|
82
|
-
<Chat client={chatClient}>
|
|
83
|
-
<Channel channel={channel} FlatList={MockedFlatList}>
|
|
84
|
-
<FileUploadPreview
|
|
85
|
-
fileUploads={fileUploads.map((file, index) => ({
|
|
86
|
-
...file,
|
|
87
|
-
id: `${index}`,
|
|
88
|
-
}))}
|
|
89
|
-
removeFile={removeFile}
|
|
90
|
-
uploadFile={uploadFile}
|
|
91
|
-
/>
|
|
92
|
-
</Channel>
|
|
93
|
-
</Chat>
|
|
94
|
-
</OverlayProvider>,
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
const snapshot = toJSON();
|
|
98
|
-
|
|
99
|
-
await waitFor(() => {
|
|
100
|
-
expect(snapshot).toMatchSnapshot();
|
|
101
|
-
});
|
|
102
81
|
});
|
|
103
82
|
|
|
104
83
|
it('should render FileUploadPreview with all uploaded files', async () => {
|
|
@@ -106,6 +85,7 @@ describe('FileUploadPreview', () => {
|
|
|
106
85
|
generateFileUploadPreview({ id: 'file-upload-id-1', state: FileState.UPLOADED }),
|
|
107
86
|
generateFileUploadPreview({ id: 'file-upload-id-2', state: FileState.UPLOADED }),
|
|
108
87
|
generateFileUploadPreview({ id: 'file-upload-id-3', state: FileState.UPLOADED }),
|
|
88
|
+
generateFileUploadPreview({ id: 'file-upload-id-4', state: FileState.UPLOADED }),
|
|
109
89
|
];
|
|
110
90
|
const removeFile = jest.fn();
|
|
111
91
|
const uploadFile = jest.fn();
|
|
@@ -122,7 +102,7 @@ describe('FileUploadPreview', () => {
|
|
|
122
102
|
const channel = chatClient.channel('messaging', mockedChannel.id);
|
|
123
103
|
await channel.query();
|
|
124
104
|
|
|
125
|
-
const { getAllByTestId, queryAllByTestId,
|
|
105
|
+
const { getAllByTestId, queryAllByTestId, queryAllByText } = render(
|
|
126
106
|
<OverlayProvider>
|
|
127
107
|
<Chat client={chatClient}>
|
|
128
108
|
<Channel channel={channel} FlatList={MockedFlatList}>
|
|
@@ -143,6 +123,7 @@ describe('FileUploadPreview', () => {
|
|
|
143
123
|
);
|
|
144
124
|
expect(queryAllByTestId('upload-progress-indicator')).toHaveLength(0);
|
|
145
125
|
expect(queryAllByTestId('retry-upload-progress-indicator')).toHaveLength(0);
|
|
126
|
+
expect(queryAllByText('File type not supported')).toHaveLength(0);
|
|
146
127
|
expect(removeFile).toHaveBeenCalledTimes(0);
|
|
147
128
|
expect(uploadFile).toHaveBeenCalledTimes(0);
|
|
148
129
|
});
|
|
@@ -153,29 +134,6 @@ describe('FileUploadPreview', () => {
|
|
|
153
134
|
expect(removeFile).toHaveBeenCalledTimes(1);
|
|
154
135
|
expect(uploadFile).toHaveBeenCalledTimes(0);
|
|
155
136
|
});
|
|
156
|
-
|
|
157
|
-
rerender(
|
|
158
|
-
<OverlayProvider>
|
|
159
|
-
<Chat client={chatClient}>
|
|
160
|
-
<Channel channel={channel} FlatList={MockedFlatList}>
|
|
161
|
-
<FileUploadPreview
|
|
162
|
-
fileUploads={fileUploads.map((file, index) => ({
|
|
163
|
-
...file,
|
|
164
|
-
id: `${index}`,
|
|
165
|
-
}))}
|
|
166
|
-
removeFile={removeFile}
|
|
167
|
-
uploadFile={uploadFile}
|
|
168
|
-
/>
|
|
169
|
-
</Channel>
|
|
170
|
-
</Chat>
|
|
171
|
-
</OverlayProvider>,
|
|
172
|
-
);
|
|
173
|
-
|
|
174
|
-
const snapshot = toJSON();
|
|
175
|
-
|
|
176
|
-
await waitFor(() => {
|
|
177
|
-
expect(snapshot).toMatchSnapshot();
|
|
178
|
-
});
|
|
179
137
|
});
|
|
180
138
|
|
|
181
139
|
it('should render FileUploadPreview with all failed files', async () => {
|
|
@@ -183,6 +141,7 @@ describe('FileUploadPreview', () => {
|
|
|
183
141
|
generateFileUploadPreview({ id: 'file-upload-id-1', state: FileState.UPLOAD_FAILED }),
|
|
184
142
|
generateFileUploadPreview({ id: 'file-upload-id-2', state: FileState.UPLOAD_FAILED }),
|
|
185
143
|
generateFileUploadPreview({ id: 'file-upload-id-3', state: FileState.UPLOAD_FAILED }),
|
|
144
|
+
generateFileUploadPreview({ id: 'file-upload-id-4', state: FileState.UPLOAD_FAILED }),
|
|
186
145
|
];
|
|
187
146
|
const removeFile = jest.fn();
|
|
188
147
|
const uploadFile = jest.fn();
|
|
@@ -199,7 +158,7 @@ describe('FileUploadPreview', () => {
|
|
|
199
158
|
const channel = chatClient.channel('messaging', mockedChannel.id);
|
|
200
159
|
await channel.query();
|
|
201
160
|
|
|
202
|
-
const { getAllByTestId, queryAllByTestId,
|
|
161
|
+
const { getAllByTestId, queryAllByTestId, queryAllByText } = render(
|
|
203
162
|
<OverlayProvider>
|
|
204
163
|
<Chat client={chatClient}>
|
|
205
164
|
<Channel channel={channel} FlatList={MockedFlatList}>
|
|
@@ -218,6 +177,7 @@ describe('FileUploadPreview', () => {
|
|
|
218
177
|
expect(queryAllByTestId('inactive-upload-progress-indicator')).toHaveLength(0);
|
|
219
178
|
expect(queryAllByTestId('upload-progress-indicator')).toHaveLength(0);
|
|
220
179
|
expect(queryAllByTestId('retry-upload-progress-indicator')).toHaveLength(fileUploads.length);
|
|
180
|
+
expect(queryAllByText('File type not supported')).toHaveLength(0);
|
|
221
181
|
expect(removeFile).toHaveBeenCalledTimes(0);
|
|
222
182
|
expect(uploadFile).toHaveBeenCalledTimes(0);
|
|
223
183
|
});
|
|
@@ -235,16 +195,36 @@ describe('FileUploadPreview', () => {
|
|
|
235
195
|
expect(removeFile).toHaveBeenCalledTimes(1);
|
|
236
196
|
expect(uploadFile).toHaveBeenCalledTimes(1);
|
|
237
197
|
});
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
it('should render FileUploadPreview with all unsupported files', async () => {
|
|
201
|
+
const fileUploads = [
|
|
202
|
+
generateFileUploadPreview({ id: 'file-upload-id-1', state: FileState.NOT_SUPPORTED }),
|
|
203
|
+
generateFileUploadPreview({ id: 'file-upload-id-2', state: FileState.NOT_SUPPORTED }),
|
|
204
|
+
generateFileUploadPreview({ id: 'file-upload-id-3', state: FileState.NOT_SUPPORTED }),
|
|
205
|
+
generateFileUploadPreview({ id: 'file-upload-id-4', state: FileState.NOT_SUPPORTED }),
|
|
206
|
+
];
|
|
207
|
+
const removeFile = jest.fn();
|
|
208
|
+
const uploadFile = jest.fn();
|
|
209
|
+
|
|
210
|
+
const user1 = generateUser();
|
|
238
211
|
|
|
239
|
-
|
|
212
|
+
const mockedChannel = generateChannelResponse({
|
|
213
|
+
members: [generateMember({ user: user1 })],
|
|
214
|
+
messages: [generateMessage({ user: user1 }), generateMessage({ user: user1 })],
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
const chatClient = await getTestClientWithUser({ id: 'testID' });
|
|
218
|
+
useMockedApis(chatClient, [getOrCreateChannelApi(mockedChannel)]);
|
|
219
|
+
const channel = chatClient.channel('messaging', mockedChannel.id);
|
|
220
|
+
await channel.query();
|
|
221
|
+
|
|
222
|
+
const { getAllByTestId, queryAllByTestId, queryAllByText } = render(
|
|
240
223
|
<OverlayProvider>
|
|
241
224
|
<Chat client={chatClient}>
|
|
242
225
|
<Channel channel={channel} FlatList={MockedFlatList}>
|
|
243
226
|
<FileUploadPreview
|
|
244
|
-
fileUploads={fileUploads
|
|
245
|
-
...file,
|
|
246
|
-
id: `${index}`,
|
|
247
|
-
}))}
|
|
227
|
+
fileUploads={fileUploads}
|
|
248
228
|
removeFile={removeFile}
|
|
249
229
|
uploadFile={uploadFile}
|
|
250
230
|
/>
|
|
@@ -253,10 +233,21 @@ describe('FileUploadPreview', () => {
|
|
|
253
233
|
</OverlayProvider>,
|
|
254
234
|
);
|
|
255
235
|
|
|
256
|
-
|
|
236
|
+
await waitFor(() => {
|
|
237
|
+
expect(queryAllByTestId('active-upload-progress-indicator')).toHaveLength(fileUploads.length);
|
|
238
|
+
expect(queryAllByTestId('inactive-upload-progress-indicator')).toHaveLength(0);
|
|
239
|
+
expect(queryAllByTestId('upload-progress-indicator')).toHaveLength(0);
|
|
240
|
+
expect(queryAllByTestId('retry-upload-progress-indicator')).toHaveLength(0);
|
|
241
|
+
expect(queryAllByText('File type not supported')).toHaveLength(fileUploads.length);
|
|
242
|
+
expect(removeFile).toHaveBeenCalledTimes(0);
|
|
243
|
+
expect(uploadFile).toHaveBeenCalledTimes(0);
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
fireEvent.press(getAllByTestId('remove-file-upload-preview')[0]);
|
|
257
247
|
|
|
258
248
|
await waitFor(() => {
|
|
259
|
-
expect(
|
|
249
|
+
expect(removeFile).toHaveBeenCalledTimes(1);
|
|
250
|
+
expect(uploadFile).toHaveBeenCalledTimes(0);
|
|
260
251
|
});
|
|
261
252
|
});
|
|
262
253
|
|
|
@@ -265,6 +256,7 @@ describe('FileUploadPreview', () => {
|
|
|
265
256
|
generateFileUploadPreview({ id: 'file-upload-id-1', state: FileState.UPLOADING }),
|
|
266
257
|
generateFileUploadPreview({ id: 'file-upload-id-2', state: FileState.UPLOADED }),
|
|
267
258
|
generateFileUploadPreview({ id: 'file-upload-id-3', state: FileState.UPLOAD_FAILED }),
|
|
259
|
+
generateFileUploadPreview({ id: 'file-upload-id-3', state: FileState.NOT_SUPPORTED }),
|
|
268
260
|
];
|
|
269
261
|
const removeFile = jest.fn();
|
|
270
262
|
const uploadFile = jest.fn();
|
|
@@ -281,7 +273,7 @@ describe('FileUploadPreview', () => {
|
|
|
281
273
|
const channel = chatClient.channel('messaging', mockedChannel.id);
|
|
282
274
|
await channel.query();
|
|
283
275
|
|
|
284
|
-
const { queryAllByTestId,
|
|
276
|
+
const { queryAllByTestId, queryAllByText } = render(
|
|
285
277
|
<OverlayProvider>
|
|
286
278
|
<Chat client={chatClient}>
|
|
287
279
|
<Channel channel={channel} FlatList={MockedFlatList}>
|
|
@@ -301,31 +293,9 @@ describe('FileUploadPreview', () => {
|
|
|
301
293
|
expect(queryAllByTestId('inactive-upload-progress-indicator')).toHaveLength(1);
|
|
302
294
|
expect(queryAllByTestId('upload-progress-indicator')).toHaveLength(1);
|
|
303
295
|
expect(queryAllByTestId('retry-upload-progress-indicator')).toHaveLength(1);
|
|
296
|
+
expect(queryAllByText('File type not supported')).toHaveLength(1);
|
|
304
297
|
expect(removeFile).toHaveBeenCalledTimes(0);
|
|
305
298
|
expect(uploadFile).toHaveBeenCalledTimes(0);
|
|
306
299
|
});
|
|
307
|
-
|
|
308
|
-
rerender(
|
|
309
|
-
<OverlayProvider>
|
|
310
|
-
<Chat client={chatClient}>
|
|
311
|
-
<Channel channel={channel} FlatList={MockedFlatList}>
|
|
312
|
-
<FileUploadPreview
|
|
313
|
-
fileUploads={fileUploads.map((file, index) => ({
|
|
314
|
-
...file,
|
|
315
|
-
id: `${index}`,
|
|
316
|
-
}))}
|
|
317
|
-
removeFile={removeFile}
|
|
318
|
-
uploadFile={uploadFile}
|
|
319
|
-
/>
|
|
320
|
-
</Channel>
|
|
321
|
-
</Chat>
|
|
322
|
-
</OverlayProvider>,
|
|
323
|
-
);
|
|
324
|
-
|
|
325
|
-
const snapshot = toJSON();
|
|
326
|
-
|
|
327
|
-
await waitFor(() => {
|
|
328
|
-
expect(snapshot).toMatchSnapshot();
|
|
329
|
-
});
|
|
330
300
|
});
|
|
331
301
|
});
|