stream-chat-react-native-core 5.28.1 → 5.29.0-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/lib/commonjs/components/Attachment/Attachment.js +2 -2
- package/lib/commonjs/components/Attachment/Attachment.js.map +1 -1
- package/lib/commonjs/components/Attachment/AudioAttachment.js +247 -115
- package/lib/commonjs/components/Attachment/AudioAttachment.js.map +1 -1
- package/lib/commonjs/components/Attachment/FileAttachmentGroup.js +30 -50
- package/lib/commonjs/components/Attachment/FileAttachmentGroup.js.map +1 -1
- package/lib/commonjs/components/Attachment/VideoThumbnail.js +3 -3
- package/lib/commonjs/components/Attachment/VideoThumbnail.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js +43 -1
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +24 -0
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js +6 -6
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -1
- package/lib/commonjs/components/Message/Message.js +1 -1
- package/lib/commonjs/components/Message/Message.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js.map +1 -1
- package/lib/commonjs/components/Message/hooks/useMessageActions.js +4 -2
- package/lib/commonjs/components/Message/hooks/useMessageActions.js.map +1 -1
- package/lib/commonjs/components/MessageInput/FileUploadPreview.js +55 -74
- package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
- package/lib/commonjs/components/MessageInput/InputButtons.js +1 -1
- package/lib/commonjs/components/MessageInput/InputButtons.js.map +1 -1
- package/lib/commonjs/components/MessageInput/MessageInput.js +250 -43
- package/lib/commonjs/components/MessageInput/MessageInput.js.map +1 -1
- package/lib/commonjs/components/MessageInput/SendButton.js +9 -7
- package/lib/commonjs/components/MessageInput/SendButton.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecorder.js +221 -0
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecorder.js.map +1 -0
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js +121 -0
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js.map +1 -0
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingInProgress.js +68 -0
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingInProgress.js.map +1 -0
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingLockIndicator.js +75 -0
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingLockIndicator.js.map +1 -0
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.js +87 -0
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.js.map +1 -0
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingWaveform.js +47 -0
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingWaveform.js.map +1 -0
- package/lib/commonjs/components/MessageInput/hooks/useAudioController.js +452 -0
- package/lib/commonjs/components/MessageInput/hooks/useAudioController.js.map +1 -0
- package/lib/commonjs/components/MessageInput/utils/audioSampling.js +91 -0
- package/lib/commonjs/components/MessageInput/utils/audioSampling.js.map +1 -0
- package/lib/commonjs/components/MessageInput/utils/normalizeAudioLevel.js +18 -0
- package/lib/commonjs/components/MessageInput/utils/normalizeAudioLevel.js.map +1 -0
- package/lib/commonjs/components/ProgressControl/ProgressControl.js +57 -40
- package/lib/commonjs/components/ProgressControl/ProgressControl.js.map +1 -1
- package/lib/commonjs/components/ProgressControl/WaveProgressBar.js +162 -0
- package/lib/commonjs/components/ProgressControl/WaveProgressBar.js.map +1 -0
- package/lib/commonjs/components/Reply/Reply.js +45 -20
- package/lib/commonjs/components/Reply/Reply.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/messageInputContext/MessageInputContext.js +23 -12
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +24 -0
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js +76 -28
- package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js +62 -7
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/i18n/en.json +3 -1
- package/lib/commonjs/i18n/es.json +64 -62
- package/lib/commonjs/i18n/fr.json +64 -62
- package/lib/commonjs/i18n/he.json +64 -62
- package/lib/commonjs/i18n/hi.json +64 -62
- package/lib/commonjs/i18n/it.json +64 -62
- package/lib/commonjs/i18n/ja.json +64 -62
- package/lib/commonjs/i18n/ko.json +64 -62
- package/lib/commonjs/i18n/nl.json +64 -62
- package/lib/commonjs/i18n/pt-BR.json +64 -62
- package/lib/commonjs/i18n/ru.json +64 -62
- package/lib/commonjs/i18n/tr.json +64 -62
- package/lib/commonjs/icons/ArrowLeft.js +27 -0
- package/lib/commonjs/icons/ArrowLeft.js.map +1 -0
- package/lib/commonjs/icons/ArrowUp.js +26 -0
- package/lib/commonjs/icons/ArrowUp.js.map +1 -0
- package/lib/commonjs/icons/Audio.js +24 -24
- package/lib/commonjs/icons/Audio.js.map +1 -1
- package/lib/commonjs/icons/CircleStop.js +27 -0
- package/lib/commonjs/icons/CircleStop.js.map +1 -0
- package/lib/commonjs/icons/Delete.js +17 -6
- package/lib/commonjs/icons/Delete.js.map +1 -1
- package/lib/commonjs/icons/Lock.js +30 -0
- package/lib/commonjs/icons/Lock.js.map +1 -0
- package/lib/commonjs/icons/Mic.js +30 -0
- package/lib/commonjs/icons/Mic.js.map +1 -0
- package/lib/commonjs/icons/Pause.js +15 -20
- package/lib/commonjs/icons/Pause.js.map +1 -1
- package/lib/commonjs/icons/Play.js +18 -10
- package/lib/commonjs/icons/Play.js.map +1 -1
- package/lib/commonjs/icons/SendCheck.js +30 -0
- package/lib/commonjs/icons/SendCheck.js.map +1 -0
- package/lib/commonjs/icons/SendRight.js +24 -6
- package/lib/commonjs/icons/SendRight.js.map +1 -1
- package/lib/commonjs/icons/SendUp.js +24 -6
- package/lib/commonjs/icons/SendUp.js.map +1 -1
- package/lib/commonjs/icons/Stop.js +19 -0
- package/lib/commonjs/icons/Stop.js.map +1 -0
- package/lib/commonjs/icons/index.js +77 -0
- package/lib/commonjs/icons/index.js.map +1 -1
- package/lib/commonjs/native.js +10 -1
- package/lib/commonjs/native.js.map +1 -1
- package/lib/commonjs/utils/getTrimmedAttachmentTitle.js +11 -0
- package/lib/commonjs/utils/getTrimmedAttachmentTitle.js.map +1 -0
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/Attachment.js +2 -2
- package/lib/module/components/Attachment/Attachment.js.map +1 -1
- package/lib/module/components/Attachment/AudioAttachment.js +247 -115
- package/lib/module/components/Attachment/AudioAttachment.js.map +1 -1
- package/lib/module/components/Attachment/FileAttachmentGroup.js +30 -50
- package/lib/module/components/Attachment/FileAttachmentGroup.js.map +1 -1
- package/lib/module/components/Attachment/VideoThumbnail.js +3 -3
- package/lib/module/components/Attachment/VideoThumbnail.js.map +1 -1
- package/lib/module/components/Channel/Channel.js +43 -1
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +24 -0
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js +6 -6
- package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -1
- package/lib/module/components/Message/Message.js +1 -1
- package/lib/module/components/Message/Message.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageContent.js +1 -1
- package/lib/module/components/Message/MessageSimple/MessageContent.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageSimple.js +1 -1
- package/lib/module/components/Message/MessageSimple/MessageSimple.js.map +1 -1
- package/lib/module/components/Message/hooks/useMessageActions.js +4 -2
- package/lib/module/components/Message/hooks/useMessageActions.js.map +1 -1
- package/lib/module/components/MessageInput/FileUploadPreview.js +55 -74
- package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
- package/lib/module/components/MessageInput/InputButtons.js +1 -1
- package/lib/module/components/MessageInput/InputButtons.js.map +1 -1
- package/lib/module/components/MessageInput/MessageInput.js +250 -43
- package/lib/module/components/MessageInput/MessageInput.js.map +1 -1
- package/lib/module/components/MessageInput/SendButton.js +9 -7
- package/lib/module/components/MessageInput/SendButton.js.map +1 -1
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecorder.js +221 -0
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecorder.js.map +1 -0
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js +121 -0
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js.map +1 -0
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingInProgress.js +68 -0
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingInProgress.js.map +1 -0
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingLockIndicator.js +75 -0
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingLockIndicator.js.map +1 -0
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.js +87 -0
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.js.map +1 -0
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingWaveform.js +47 -0
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingWaveform.js.map +1 -0
- package/lib/module/components/MessageInput/hooks/useAudioController.js +452 -0
- package/lib/module/components/MessageInput/hooks/useAudioController.js.map +1 -0
- package/lib/module/components/MessageInput/utils/audioSampling.js +91 -0
- package/lib/module/components/MessageInput/utils/audioSampling.js.map +1 -0
- package/lib/module/components/MessageInput/utils/normalizeAudioLevel.js +18 -0
- package/lib/module/components/MessageInput/utils/normalizeAudioLevel.js.map +1 -0
- package/lib/module/components/ProgressControl/ProgressControl.js +57 -40
- package/lib/module/components/ProgressControl/ProgressControl.js.map +1 -1
- package/lib/module/components/ProgressControl/WaveProgressBar.js +162 -0
- package/lib/module/components/ProgressControl/WaveProgressBar.js.map +1 -0
- package/lib/module/components/Reply/Reply.js +45 -20
- package/lib/module/components/Reply/Reply.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/messageInputContext/MessageInputContext.js +23 -12
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +24 -0
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js +76 -28
- package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
- package/lib/module/contexts/themeContext/utils/theme.js +62 -7
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/i18n/en.json +3 -1
- package/lib/module/i18n/es.json +64 -62
- package/lib/module/i18n/fr.json +64 -62
- package/lib/module/i18n/he.json +64 -62
- package/lib/module/i18n/hi.json +64 -62
- package/lib/module/i18n/it.json +64 -62
- package/lib/module/i18n/ja.json +64 -62
- package/lib/module/i18n/ko.json +64 -62
- package/lib/module/i18n/nl.json +64 -62
- package/lib/module/i18n/pt-BR.json +64 -62
- package/lib/module/i18n/ru.json +64 -62
- package/lib/module/i18n/tr.json +64 -62
- package/lib/module/icons/ArrowLeft.js +27 -0
- package/lib/module/icons/ArrowLeft.js.map +1 -0
- package/lib/module/icons/ArrowUp.js +26 -0
- package/lib/module/icons/ArrowUp.js.map +1 -0
- package/lib/module/icons/Audio.js +24 -24
- package/lib/module/icons/Audio.js.map +1 -1
- package/lib/module/icons/CircleStop.js +27 -0
- package/lib/module/icons/CircleStop.js.map +1 -0
- package/lib/module/icons/Delete.js +17 -6
- package/lib/module/icons/Delete.js.map +1 -1
- package/lib/module/icons/Lock.js +30 -0
- package/lib/module/icons/Lock.js.map +1 -0
- package/lib/module/icons/Mic.js +30 -0
- package/lib/module/icons/Mic.js.map +1 -0
- package/lib/module/icons/Pause.js +15 -20
- package/lib/module/icons/Pause.js.map +1 -1
- package/lib/module/icons/Play.js +18 -10
- package/lib/module/icons/Play.js.map +1 -1
- package/lib/module/icons/SendCheck.js +30 -0
- package/lib/module/icons/SendCheck.js.map +1 -0
- package/lib/module/icons/SendRight.js +24 -6
- package/lib/module/icons/SendRight.js.map +1 -1
- package/lib/module/icons/SendUp.js +24 -6
- package/lib/module/icons/SendUp.js.map +1 -1
- package/lib/module/icons/Stop.js +19 -0
- package/lib/module/icons/Stop.js.map +1 -0
- package/lib/module/icons/index.js +77 -0
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/native.js +10 -1
- package/lib/module/native.js.map +1 -1
- package/lib/module/utils/getTrimmedAttachmentTitle.js +11 -0
- package/lib/module/utils/getTrimmedAttachmentTitle.js.map +1 -0
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Attachment/Attachment.d.ts.map +1 -1
- package/lib/typescript/components/Attachment/AudioAttachment.d.ts +3 -8
- package/lib/typescript/components/Attachment/AudioAttachment.d.ts.map +1 -1
- package/lib/typescript/components/Attachment/FileAttachmentGroup.d.ts.map +1 -1
- package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts +15 -3
- package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts.map +1 -1
- package/lib/typescript/components/ImageGallery/components/ImageGalleryVideoControl.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageSimple/MessageContent.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageSimple/MessageSimple.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/FileUploadPreview.d.ts +1 -1
- package/lib/typescript/components/MessageInput/FileUploadPreview.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/InputButtons.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/MessageInput.d.ts +1 -1
- package/lib/typescript/components/MessageInput/MessageInput.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/SendButton.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecorder.d.ts +51 -0
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecorder.d.ts.map +1 -0
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingButton.d.ts +43 -0
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingButton.d.ts.map +1 -0
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingInProgress.d.ts +29 -0
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingInProgress.d.ts.map +1 -0
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingLockIndicator.d.ts +22 -0
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingLockIndicator.d.ts.map +1 -0
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.d.ts +31 -0
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.d.ts.map +1 -0
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingWaveform.d.ts +19 -0
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingWaveform.d.ts.map +1 -0
- package/lib/typescript/components/MessageInput/hooks/useAudioController.d.ts +28 -0
- package/lib/typescript/components/MessageInput/hooks/useAudioController.d.ts.map +1 -0
- package/lib/typescript/components/MessageInput/utils/audioSampling.d.ts +11 -0
- package/lib/typescript/components/MessageInput/utils/audioSampling.d.ts.map +1 -0
- package/lib/typescript/components/MessageInput/utils/normalizeAudioLevel.d.ts +5 -0
- package/lib/typescript/components/MessageInput/utils/normalizeAudioLevel.d.ts.map +1 -0
- package/lib/typescript/components/ProgressControl/ProgressControl.d.ts +2 -2
- package/lib/typescript/components/ProgressControl/ProgressControl.d.ts.map +1 -1
- package/lib/typescript/components/ProgressControl/WaveProgressBar.d.ts +11 -0
- package/lib/typescript/components/ProgressControl/WaveProgressBar.d.ts.map +1 -0
- package/lib/typescript/components/Reply/Reply.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/messageInputContext/MessageInputContext.d.ts +70 -4
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts.map +1 -1
- package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
- package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts.map +1 -1
- package/lib/typescript/contexts/messageInputContext/hooks/useMessageDetailsForState.d.ts.map +1 -1
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +62 -7
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts.map +1 -1
- package/lib/typescript/i18n/en.json +3 -1
- package/lib/typescript/i18n/es.json +64 -62
- package/lib/typescript/i18n/fr.json +64 -62
- package/lib/typescript/i18n/he.json +64 -62
- package/lib/typescript/i18n/hi.json +64 -62
- package/lib/typescript/i18n/it.json +64 -62
- package/lib/typescript/i18n/ja.json +64 -62
- package/lib/typescript/i18n/ko.json +64 -62
- package/lib/typescript/i18n/nl.json +64 -62
- package/lib/typescript/i18n/pt-BR.json +64 -62
- package/lib/typescript/i18n/ru.json +64 -62
- package/lib/typescript/i18n/tr.json +64 -62
- package/lib/typescript/icons/ArrowLeft.d.ts +8 -0
- package/lib/typescript/icons/ArrowLeft.d.ts.map +1 -0
- package/lib/typescript/icons/ArrowUp.d.ts +9 -0
- package/lib/typescript/icons/ArrowUp.d.ts.map +1 -0
- package/lib/typescript/icons/Audio.d.ts.map +1 -1
- package/lib/typescript/icons/CircleStop.d.ts +8 -0
- package/lib/typescript/icons/CircleStop.d.ts.map +1 -0
- package/lib/typescript/icons/Delete.d.ts +5 -1
- package/lib/typescript/icons/Delete.d.ts.map +1 -1
- package/lib/typescript/icons/Lock.d.ts +9 -0
- package/lib/typescript/icons/Lock.d.ts.map +1 -0
- package/lib/typescript/icons/Mic.d.ts +8 -0
- package/lib/typescript/icons/Mic.d.ts.map +1 -0
- package/lib/typescript/icons/Pause.d.ts +3 -1
- package/lib/typescript/icons/Pause.d.ts.map +1 -1
- package/lib/typescript/icons/Play.d.ts +3 -1
- package/lib/typescript/icons/Play.d.ts.map +1 -1
- package/lib/typescript/icons/SendCheck.d.ts +8 -0
- package/lib/typescript/icons/SendCheck.d.ts.map +1 -0
- package/lib/typescript/icons/SendRight.d.ts +5 -1
- package/lib/typescript/icons/SendRight.d.ts.map +1 -1
- package/lib/typescript/icons/SendUp.d.ts +5 -1
- package/lib/typescript/icons/SendUp.d.ts.map +1 -1
- package/lib/typescript/icons/Stop.d.ts +4 -0
- package/lib/typescript/icons/Stop.d.ts.map +1 -0
- package/lib/typescript/icons/index.d.ts +7 -0
- package/lib/typescript/icons/index.d.ts.map +1 -1
- package/lib/typescript/native.d.ts +49 -0
- package/lib/typescript/native.d.ts.map +1 -1
- package/lib/typescript/types/types.d.ts +6 -0
- package/lib/typescript/types/types.d.ts.map +1 -1
- package/lib/typescript/utils/Streami18n.d.ts +2 -0
- package/lib/typescript/utils/Streami18n.d.ts.map +1 -1
- package/lib/typescript/utils/getTrimmedAttachmentTitle.d.ts +2 -0
- package/lib/typescript/utils/getTrimmedAttachmentTitle.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/Attachment/Attachment.tsx +7 -2
- package/src/components/Attachment/AudioAttachment.tsx +223 -119
- package/src/components/Attachment/FileAttachmentGroup.tsx +35 -55
- package/src/components/Attachment/VideoThumbnail.tsx +1 -1
- package/src/components/Channel/Channel.tsx +32 -0
- package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +24 -0
- package/src/components/ImageGallery/__tests__/ImageGallery.test.tsx +1 -1
- package/src/components/ImageGallery/__tests__/ImageGalleryVideoControl.test.tsx +2 -2
- package/src/components/ImageGallery/components/ImageGalleryVideoControl.tsx +2 -7
- package/src/components/Message/Message.tsx +1 -1
- package/src/components/Message/MessageSimple/MessageContent.tsx +2 -1
- package/src/components/Message/MessageSimple/MessageSimple.tsx +2 -1
- package/src/components/Message/hooks/useMessageActions.tsx +2 -2
- package/src/components/MessageInput/FileUploadPreview.tsx +67 -98
- package/src/components/MessageInput/InputButtons.tsx +2 -1
- package/src/components/MessageInput/MessageInput.tsx +320 -49
- package/src/components/MessageInput/SendButton.tsx +7 -3
- package/src/components/MessageInput/__tests__/MessageInput.test.js +0 -1
- package/src/components/MessageInput/__tests__/__snapshots__/SendButton.test.js.snap +132 -48
- package/src/components/MessageInput/components/AudioRecorder/AudioRecorder.tsx +313 -0
- package/src/components/MessageInput/components/AudioRecorder/AudioRecordingButton.tsx +192 -0
- package/src/components/MessageInput/components/AudioRecorder/AudioRecordingInProgress.tsx +114 -0
- package/src/components/MessageInput/components/AudioRecorder/AudioRecordingLockIndicator.tsx +85 -0
- package/src/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.tsx +102 -0
- package/src/components/MessageInput/components/AudioRecorder/AudioRecordingWaveform.tsx +62 -0
- package/src/components/MessageInput/hooks/useAudioController.tsx +288 -0
- package/src/components/MessageInput/utils/audioSampling.ts +108 -0
- package/src/components/MessageInput/utils/normalizeAudioLevel.ts +20 -0
- package/src/components/ProgressControl/ProgressControl.tsx +69 -40
- package/src/components/ProgressControl/WaveProgressBar.tsx +180 -0
- package/src/components/Reply/Reply.tsx +89 -56
- package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +38 -20
- package/src/components/index.ts +6 -0
- package/src/contexts/messageInputContext/MessageInputContext.tsx +95 -10
- package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +25 -0
- package/src/contexts/messageInputContext/hooks/useMessageDetailsForState.ts +80 -27
- package/src/contexts/themeContext/utils/theme.ts +111 -14
- package/src/i18n/en.json +3 -1
- package/src/i18n/es.json +64 -62
- package/src/i18n/fr.json +64 -62
- package/src/i18n/he.json +64 -62
- package/src/i18n/hi.json +64 -62
- package/src/i18n/it.json +64 -62
- package/src/i18n/ja.json +64 -62
- package/src/i18n/ko.json +64 -62
- package/src/i18n/nl.json +64 -62
- package/src/i18n/pt-BR.json +64 -62
- package/src/i18n/ru.json +64 -62
- package/src/i18n/tr.json +64 -62
- package/src/icons/ArrowLeft.tsx +18 -0
- package/src/icons/ArrowUp.tsx +19 -0
- package/src/icons/Audio.tsx +24 -24
- package/src/icons/CircleStop.tsx +18 -0
- package/src/icons/Delete.tsx +14 -8
- package/src/icons/Lock.tsx +22 -0
- package/src/icons/Mic.tsx +20 -0
- package/src/icons/Pause.tsx +12 -11
- package/src/icons/Play.tsx +9 -13
- package/src/icons/SendCheck.tsx +18 -0
- package/src/icons/SendRight.tsx +16 -7
- package/src/icons/SendUp.tsx +16 -7
- package/src/icons/Stop.tsx +12 -0
- package/src/icons/index.ts +7 -0
- package/src/native.ts +69 -0
- package/src/types/types.ts +6 -0
- package/src/utils/getTrimmedAttachmentTitle.ts +5 -0
- package/src/version.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
2
|
-
import { I18nManager, StyleSheet, Text,
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { I18nManager, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import dayjs from 'dayjs';
|
|
5
5
|
import duration from 'dayjs/plugin/duration';
|
|
6
6
|
|
|
7
7
|
import { useTheme } from '../../contexts';
|
|
8
|
-
import { Pause, Play } from '../../icons';
|
|
8
|
+
import { Audio, Pause, Play } from '../../icons';
|
|
9
9
|
import {
|
|
10
10
|
PlaybackStatus,
|
|
11
11
|
Sound,
|
|
@@ -14,85 +14,58 @@ import {
|
|
|
14
14
|
VideoProgressData,
|
|
15
15
|
} from '../../native';
|
|
16
16
|
import type { FileUpload } from '../../types/types';
|
|
17
|
+
import { getTrimmedAttachmentTitle } from '../../utils/getTrimmedAttachmentTitle';
|
|
17
18
|
import { ProgressControl } from '../ProgressControl/ProgressControl';
|
|
19
|
+
import { WaveProgressBar } from '../ProgressControl/WaveProgressBar';
|
|
18
20
|
|
|
19
21
|
dayjs.extend(duration);
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const styles = StyleSheet.create({
|
|
24
|
-
fileContainer: {
|
|
25
|
-
borderRadius: 12,
|
|
26
|
-
borderWidth: 1,
|
|
27
|
-
flexDirection: 'row',
|
|
28
|
-
height: FILE_PREVIEW_HEIGHT,
|
|
29
|
-
paddingLeft: 8,
|
|
30
|
-
paddingRight: 8,
|
|
31
|
-
},
|
|
32
|
-
fileContentContainer: { flexDirection: 'row', paddingRight: 40 },
|
|
33
|
-
filenameText: {
|
|
34
|
-
fontSize: 14,
|
|
35
|
-
fontWeight: 'bold',
|
|
36
|
-
paddingLeft: 10,
|
|
37
|
-
},
|
|
38
|
-
fileTextContainer: {
|
|
39
|
-
justifyContent: 'space-around',
|
|
40
|
-
},
|
|
41
|
-
flatList: { marginBottom: 12, maxHeight: FILE_PREVIEW_HEIGHT * 2.5 + 16 },
|
|
42
|
-
overlay: {
|
|
43
|
-
borderRadius: 12,
|
|
44
|
-
marginLeft: 8,
|
|
45
|
-
marginRight: 8,
|
|
46
|
-
},
|
|
47
|
-
progressControlView: {
|
|
48
|
-
flex: 8,
|
|
49
|
-
},
|
|
50
|
-
progressDurationText: {
|
|
51
|
-
flex: 4,
|
|
52
|
-
fontSize: 12,
|
|
53
|
-
paddingLeft: 10,
|
|
54
|
-
paddingRight: 8,
|
|
55
|
-
},
|
|
56
|
-
roundedView: {
|
|
57
|
-
alignItems: 'center',
|
|
58
|
-
alignSelf: 'center',
|
|
59
|
-
borderRadius: 50,
|
|
60
|
-
display: 'flex',
|
|
61
|
-
elevation: 4,
|
|
62
|
-
height: 36,
|
|
63
|
-
justifyContent: 'center',
|
|
64
|
-
shadowOffset: {
|
|
65
|
-
height: 2,
|
|
66
|
-
width: 0,
|
|
67
|
-
},
|
|
68
|
-
shadowOpacity: 0.23,
|
|
69
|
-
shadowRadius: 2.62,
|
|
70
|
-
width: 36,
|
|
71
|
-
},
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
export type AudioAttachmentPropsWithContext = {
|
|
23
|
+
export type AudioAttachmentProps = {
|
|
75
24
|
item: Omit<FileUpload, 'state'>;
|
|
76
25
|
onLoad: (index: string, duration: number) => void;
|
|
77
26
|
onPlayPause: (index: string, pausedStatus?: boolean) => void;
|
|
78
27
|
onProgress: (index: string, currentTime?: number, hasEnd?: boolean) => void;
|
|
28
|
+
hideProgressBar?: boolean;
|
|
29
|
+
showSpeedSettings?: boolean;
|
|
79
30
|
testID?: string;
|
|
80
31
|
};
|
|
81
32
|
|
|
82
|
-
|
|
33
|
+
/**
|
|
34
|
+
* AudioAttachment
|
|
35
|
+
* UI Component to preview the audio files
|
|
36
|
+
*/
|
|
37
|
+
export const AudioAttachment = (props: AudioAttachmentProps) => {
|
|
38
|
+
const [width, setWidth] = useState(0);
|
|
39
|
+
const [currentSpeed, setCurrentSpeed] = useState<number>(1.0);
|
|
83
40
|
const soundRef = React.useRef<SoundReturnType | null>(null);
|
|
84
|
-
const {
|
|
41
|
+
const {
|
|
42
|
+
hideProgressBar = false,
|
|
43
|
+
item,
|
|
44
|
+
onLoad,
|
|
45
|
+
onPlayPause,
|
|
46
|
+
onProgress,
|
|
47
|
+
showSpeedSettings = false,
|
|
48
|
+
testID,
|
|
49
|
+
} = props;
|
|
85
50
|
|
|
51
|
+
/** This is for Native CLI Apps */
|
|
86
52
|
const handleLoad = (payload: VideoPayloadData) => {
|
|
87
|
-
onLoad(item.id, payload.duration);
|
|
53
|
+
onLoad(item.id, item.duration || payload.duration);
|
|
88
54
|
};
|
|
89
55
|
|
|
56
|
+
/** This is for Native CLI Apps */
|
|
90
57
|
const handleProgress = (data: VideoProgressData) => {
|
|
91
|
-
if (data.currentTime
|
|
58
|
+
if (data.currentTime <= data.seekableDuration) {
|
|
92
59
|
onProgress(item.id, data.currentTime);
|
|
93
60
|
}
|
|
94
61
|
};
|
|
95
62
|
|
|
63
|
+
/** This is for Native CLI Apps */
|
|
64
|
+
const handleEnd = () => {
|
|
65
|
+
onPlayPause(item.id, true);
|
|
66
|
+
onProgress(item.id, item.duration, true);
|
|
67
|
+
};
|
|
68
|
+
|
|
96
69
|
const handlePlayPause = async (isPausedStatusAvailable?: boolean) => {
|
|
97
70
|
if (soundRef.current) {
|
|
98
71
|
if (isPausedStatusAvailable === undefined) {
|
|
@@ -103,9 +76,13 @@ const AudioAttachmentWithContext = (props: AudioAttachmentPropsWithContext) => {
|
|
|
103
76
|
if (soundRef.current.setPositionAsync) soundRef.current.setPositionAsync(0);
|
|
104
77
|
}
|
|
105
78
|
if (item.paused) {
|
|
79
|
+
// For expo CLI
|
|
106
80
|
if (soundRef.current.playAsync) await soundRef.current.playAsync();
|
|
81
|
+
if (soundRef.current.setProgressUpdateIntervalAsync)
|
|
82
|
+
await soundRef.current.setProgressUpdateIntervalAsync(60);
|
|
107
83
|
onPlayPause(item.id, false);
|
|
108
84
|
} else {
|
|
85
|
+
// For expo CLI
|
|
109
86
|
if (soundRef.current.pauseAsync) await soundRef.current.pauseAsync();
|
|
110
87
|
onPlayPause(item.id, true);
|
|
111
88
|
}
|
|
@@ -117,17 +94,15 @@ const AudioAttachmentWithContext = (props: AudioAttachmentPropsWithContext) => {
|
|
|
117
94
|
|
|
118
95
|
const handleProgressDrag = async (position: number) => {
|
|
119
96
|
onProgress(item.id, position);
|
|
97
|
+
// For native CLI
|
|
120
98
|
if (soundRef.current?.seek) soundRef.current.seek(position);
|
|
99
|
+
// For expo CLI
|
|
121
100
|
if (soundRef.current?.setPositionAsync) {
|
|
122
101
|
await soundRef.current.setPositionAsync(position * 1000);
|
|
123
102
|
}
|
|
124
103
|
};
|
|
125
104
|
|
|
126
|
-
|
|
127
|
-
onPlayPause(item.id, true);
|
|
128
|
-
onProgress(item.id, item.duration, true);
|
|
129
|
-
};
|
|
130
|
-
|
|
105
|
+
/** For Expo CLI */
|
|
131
106
|
const onPlaybackStatusUpdate = (playbackStatus: PlaybackStatus) => {
|
|
132
107
|
if (!playbackStatus.isLoaded) {
|
|
133
108
|
// Update your UI for the unloaded state
|
|
@@ -136,7 +111,10 @@ const AudioAttachmentWithContext = (props: AudioAttachmentPropsWithContext) => {
|
|
|
136
111
|
}
|
|
137
112
|
} else {
|
|
138
113
|
const { durationMillis, positionMillis } = playbackStatus;
|
|
139
|
-
|
|
114
|
+
// This is done for Expo CLI where we don't get file duration from file picker
|
|
115
|
+
if (item.duration === 0) {
|
|
116
|
+
onLoad(item.id, durationMillis / 1000);
|
|
117
|
+
}
|
|
140
118
|
// Update your UI for the loaded state
|
|
141
119
|
if (playbackStatus.isPlaying) {
|
|
142
120
|
// Update your UI for the playing state
|
|
@@ -187,24 +165,53 @@ const AudioAttachmentWithContext = (props: AudioAttachmentPropsWithContext) => {
|
|
|
187
165
|
if (soundRef.current.pauseAsync) await soundRef.current.pauseAsync();
|
|
188
166
|
} else {
|
|
189
167
|
if (soundRef.current.playAsync) await soundRef.current.playAsync();
|
|
168
|
+
if (soundRef.current.setProgressUpdateIntervalAsync)
|
|
169
|
+
await soundRef.current.setProgressUpdateIntervalAsync(60);
|
|
190
170
|
}
|
|
191
171
|
}
|
|
192
172
|
};
|
|
173
|
+
// For expo CLI
|
|
193
174
|
if (!Sound.Player) {
|
|
194
175
|
initalPlayPause();
|
|
195
176
|
}
|
|
196
177
|
}, [item.paused]);
|
|
197
178
|
|
|
179
|
+
const onSpeedChangeHandler = async () => {
|
|
180
|
+
if (currentSpeed === 2.0) {
|
|
181
|
+
setCurrentSpeed(1.0);
|
|
182
|
+
if (soundRef.current && soundRef.current.setRateAsync) {
|
|
183
|
+
await soundRef.current.setRateAsync(1.0);
|
|
184
|
+
}
|
|
185
|
+
} else {
|
|
186
|
+
if (currentSpeed === 1.0) {
|
|
187
|
+
setCurrentSpeed(1.5);
|
|
188
|
+
if (soundRef.current && soundRef.current.setRateAsync) {
|
|
189
|
+
await soundRef.current.setRateAsync(1.5);
|
|
190
|
+
}
|
|
191
|
+
} else if (currentSpeed === 1.5) {
|
|
192
|
+
setCurrentSpeed(2.0);
|
|
193
|
+
if (soundRef.current && soundRef.current.setRateAsync) {
|
|
194
|
+
await soundRef.current.setRateAsync(2.0);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
|
|
198
200
|
const {
|
|
199
201
|
theme: {
|
|
200
|
-
|
|
202
|
+
audioAttachment: {
|
|
203
|
+
container,
|
|
204
|
+
leftContainer,
|
|
205
|
+
playPauseButton,
|
|
206
|
+
progressControlContainer,
|
|
207
|
+
progressDurationText,
|
|
208
|
+
rightContainer,
|
|
209
|
+
speedChangeButton,
|
|
210
|
+
speedChangeButtonText,
|
|
211
|
+
},
|
|
212
|
+
colors: { accent_blue, black, grey_dark, grey_whisper, static_black, static_white, white },
|
|
201
213
|
messageInput: {
|
|
202
|
-
fileUploadPreview: {
|
|
203
|
-
audioAttachment: { progressControlView, progressDurationText, roundedView },
|
|
204
|
-
fileContentContainer,
|
|
205
|
-
filenameText,
|
|
206
|
-
fileTextContainer,
|
|
207
|
-
},
|
|
214
|
+
fileUploadPreview: { filenameText },
|
|
208
215
|
},
|
|
209
216
|
},
|
|
210
217
|
} = useTheme();
|
|
@@ -215,28 +222,40 @@ const AudioAttachmentWithContext = (props: AudioAttachmentPropsWithContext) => {
|
|
|
215
222
|
? progressValueInSeconds / 3600 >= 1
|
|
216
223
|
? dayjs.duration(progressValueInSeconds, 'second').format('HH:mm:ss')
|
|
217
224
|
: dayjs.duration(progressValueInSeconds, 'second').format('mm:ss')
|
|
218
|
-
: '
|
|
219
|
-
|
|
220
|
-
const lastIndexOfDot = item.file.name.lastIndexOf('.');
|
|
225
|
+
: dayjs.duration(item.duration ?? 0, 'second').format('mm:ss');
|
|
221
226
|
|
|
222
227
|
return (
|
|
223
|
-
<View
|
|
224
|
-
|
|
228
|
+
<View
|
|
229
|
+
accessibilityLabel='audio-attachment-preview'
|
|
230
|
+
onLayout={({ nativeEvent }) => {
|
|
231
|
+
setWidth(nativeEvent.layout.width);
|
|
232
|
+
}}
|
|
233
|
+
style={[
|
|
234
|
+
styles.container,
|
|
235
|
+
{
|
|
236
|
+
backgroundColor: white,
|
|
237
|
+
borderColor: grey_whisper,
|
|
238
|
+
},
|
|
239
|
+
container,
|
|
240
|
+
]}
|
|
241
|
+
testID={testID}
|
|
242
|
+
>
|
|
243
|
+
<Pressable
|
|
225
244
|
accessibilityLabel='Play Pause Button'
|
|
226
245
|
onPress={() => handlePlayPause()}
|
|
227
246
|
style={[
|
|
228
|
-
styles.
|
|
229
|
-
roundedView,
|
|
247
|
+
styles.playPauseButton,
|
|
230
248
|
{ backgroundColor: static_white, shadowColor: black },
|
|
249
|
+
playPauseButton,
|
|
231
250
|
]}
|
|
232
251
|
>
|
|
233
252
|
{item.paused ? (
|
|
234
|
-
<Play
|
|
253
|
+
<Play fill={static_black} height={32} width={32} />
|
|
235
254
|
) : (
|
|
236
|
-
<Pause
|
|
255
|
+
<Pause fill={static_black} height={32} width={32} />
|
|
237
256
|
)}
|
|
238
|
-
</
|
|
239
|
-
<View style={[styles.
|
|
257
|
+
</Pressable>
|
|
258
|
+
<View style={[styles.leftContainer, leftContainer]}>
|
|
240
259
|
<Text
|
|
241
260
|
accessibilityLabel='File Name'
|
|
242
261
|
numberOfLines={1}
|
|
@@ -254,15 +273,9 @@ const AudioAttachmentWithContext = (props: AudioAttachmentPropsWithContext) => {
|
|
|
254
273
|
filenameText,
|
|
255
274
|
]}
|
|
256
275
|
>
|
|
257
|
-
{
|
|
276
|
+
{getTrimmedAttachmentTitle(item.file.name)}
|
|
258
277
|
</Text>
|
|
259
|
-
<View
|
|
260
|
-
style={{
|
|
261
|
-
alignItems: 'center',
|
|
262
|
-
display: 'flex',
|
|
263
|
-
flexDirection: 'row',
|
|
264
|
-
}}
|
|
265
|
-
>
|
|
278
|
+
<View style={styles.audioInfo}>
|
|
266
279
|
{/* <ExpoSoundPlayer filePaused={!!item.paused} soundRef={soundRef} /> */}
|
|
267
280
|
{Sound.Player && (
|
|
268
281
|
<Sound.Player
|
|
@@ -270,6 +283,7 @@ const AudioAttachmentWithContext = (props: AudioAttachmentPropsWithContext) => {
|
|
|
270
283
|
onLoad={handleLoad}
|
|
271
284
|
onProgress={handleProgress}
|
|
272
285
|
paused={item.paused as boolean}
|
|
286
|
+
rate={currentSpeed}
|
|
273
287
|
soundRef={soundRef}
|
|
274
288
|
testID='sound-player'
|
|
275
289
|
uri={item.file.uri}
|
|
@@ -278,37 +292,127 @@ const AudioAttachmentWithContext = (props: AudioAttachmentPropsWithContext) => {
|
|
|
278
292
|
<Text style={[styles.progressDurationText, { color: grey_dark }, progressDurationText]}>
|
|
279
293
|
{progressDuration}
|
|
280
294
|
</Text>
|
|
281
|
-
|
|
282
|
-
<
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
295
|
+
{!hideProgressBar && (
|
|
296
|
+
<View style={[styles.progressControlContainer, progressControlContainer]}>
|
|
297
|
+
{item.file.waveform_data ? (
|
|
298
|
+
<WaveProgressBar
|
|
299
|
+
amplitudesCount={35}
|
|
300
|
+
onPlayPause={handlePlayPause}
|
|
301
|
+
onProgressDrag={(position) => {
|
|
302
|
+
if (item.file.waveform_data) {
|
|
303
|
+
const progress = (position / 30) * (item.duration as number);
|
|
304
|
+
handleProgressDrag(progress);
|
|
305
|
+
}
|
|
306
|
+
}}
|
|
307
|
+
progress={item.progress as number}
|
|
308
|
+
waveformData={item.file.waveform_data}
|
|
309
|
+
/>
|
|
310
|
+
) : (
|
|
311
|
+
<ProgressControl
|
|
312
|
+
duration={item.duration as number}
|
|
313
|
+
filledColor={accent_blue}
|
|
314
|
+
onPlayPause={handlePlayPause}
|
|
315
|
+
onProgressDrag={handleProgressDrag}
|
|
316
|
+
progress={item.progress as number}
|
|
317
|
+
testID='progress-control'
|
|
318
|
+
width={width / 2}
|
|
319
|
+
/>
|
|
320
|
+
)}
|
|
321
|
+
</View>
|
|
322
|
+
)}
|
|
292
323
|
</View>
|
|
293
324
|
</View>
|
|
325
|
+
{showSpeedSettings && (
|
|
326
|
+
<View style={[styles.rightContainer, rightContainer]}>
|
|
327
|
+
{item.progress === 0 || item.progress === 1 ? (
|
|
328
|
+
<Audio fill={'#ffffff'} />
|
|
329
|
+
) : (
|
|
330
|
+
<Pressable
|
|
331
|
+
onPress={onSpeedChangeHandler}
|
|
332
|
+
style={[
|
|
333
|
+
styles.speedChangeButton,
|
|
334
|
+
{ backgroundColor: static_white, shadowColor: black },
|
|
335
|
+
speedChangeButton,
|
|
336
|
+
]}
|
|
337
|
+
>
|
|
338
|
+
<Text
|
|
339
|
+
style={[styles.speedChangeButtonText, speedChangeButtonText]}
|
|
340
|
+
>{`x${currentSpeed}`}</Text>
|
|
341
|
+
</Pressable>
|
|
342
|
+
)}
|
|
343
|
+
</View>
|
|
344
|
+
)}
|
|
294
345
|
</View>
|
|
295
346
|
);
|
|
296
347
|
};
|
|
297
348
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
349
|
+
const styles = StyleSheet.create({
|
|
350
|
+
audioInfo: {
|
|
351
|
+
alignItems: 'center',
|
|
352
|
+
display: 'flex',
|
|
353
|
+
flexDirection: 'row',
|
|
354
|
+
},
|
|
355
|
+
container: {
|
|
356
|
+
alignItems: 'center',
|
|
357
|
+
borderRadius: 12,
|
|
358
|
+
borderWidth: 1,
|
|
359
|
+
flexDirection: 'row',
|
|
360
|
+
paddingHorizontal: 8,
|
|
361
|
+
paddingVertical: 12,
|
|
362
|
+
},
|
|
363
|
+
filenameText: {
|
|
364
|
+
fontSize: 14,
|
|
365
|
+
fontWeight: 'bold',
|
|
366
|
+
paddingBottom: 12,
|
|
367
|
+
paddingLeft: 8,
|
|
368
|
+
},
|
|
369
|
+
leftContainer: {
|
|
370
|
+
justifyContent: 'space-around',
|
|
371
|
+
},
|
|
372
|
+
playPauseButton: {
|
|
373
|
+
alignItems: 'center',
|
|
374
|
+
alignSelf: 'center',
|
|
375
|
+
borderRadius: 50,
|
|
376
|
+
display: 'flex',
|
|
377
|
+
elevation: 4,
|
|
378
|
+
justifyContent: 'center',
|
|
379
|
+
paddingVertical: 2,
|
|
380
|
+
shadowOffset: {
|
|
381
|
+
height: 2,
|
|
382
|
+
width: 0,
|
|
383
|
+
},
|
|
384
|
+
shadowOpacity: 0.23,
|
|
385
|
+
shadowRadius: 2.62,
|
|
386
|
+
width: 36,
|
|
387
|
+
},
|
|
388
|
+
progressControlContainer: {},
|
|
389
|
+
progressDurationText: {
|
|
390
|
+
fontSize: 12,
|
|
391
|
+
paddingLeft: 10,
|
|
392
|
+
paddingRight: 8,
|
|
393
|
+
},
|
|
394
|
+
rightContainer: {
|
|
395
|
+
marginLeft: 10,
|
|
396
|
+
},
|
|
397
|
+
speedChangeButton: {
|
|
398
|
+
alignItems: 'center',
|
|
399
|
+
alignSelf: 'center',
|
|
400
|
+
borderRadius: 50,
|
|
401
|
+
elevation: 4,
|
|
402
|
+
justifyContent: 'center',
|
|
403
|
+
paddingVertical: 5,
|
|
404
|
+
shadowOffset: {
|
|
405
|
+
height: 2,
|
|
406
|
+
width: 0,
|
|
407
|
+
},
|
|
408
|
+
shadowOpacity: 0.23,
|
|
409
|
+
shadowRadius: 2.62,
|
|
410
|
+
width: 36,
|
|
411
|
+
},
|
|
412
|
+
speedChangeButtonText: {
|
|
413
|
+
fontSize: 12,
|
|
414
|
+
fontWeight: '500',
|
|
415
|
+
},
|
|
416
|
+
});
|
|
313
417
|
|
|
314
418
|
AudioAttachment.displayName = 'AudioAttachment{messageInput{audioAttachment}}';
|
|
@@ -19,23 +19,6 @@ import { isAudioPackageAvailable } from '../../native';
|
|
|
19
19
|
|
|
20
20
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
21
21
|
|
|
22
|
-
const FILE_PREVIEW_HEIGHT = 60;
|
|
23
|
-
|
|
24
|
-
const styles = StyleSheet.create({
|
|
25
|
-
container: {
|
|
26
|
-
padding: 4,
|
|
27
|
-
},
|
|
28
|
-
fileContainer: {
|
|
29
|
-
borderRadius: 12,
|
|
30
|
-
borderWidth: 1,
|
|
31
|
-
flexDirection: 'row',
|
|
32
|
-
height: FILE_PREVIEW_HEIGHT,
|
|
33
|
-
justifyContent: 'space-between',
|
|
34
|
-
paddingLeft: 8,
|
|
35
|
-
paddingRight: 8,
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
|
|
39
22
|
export type FileAttachmentGroupPropsWithContext<
|
|
40
23
|
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
41
24
|
> = Pick<MessageContextValue<StreamChatGenerics>, 'files'> &
|
|
@@ -67,7 +50,9 @@ const FileAttachmentGroupWithContext = <
|
|
|
67
50
|
const [filesToDisplay, setFilesToDisplay] = useState<FilesToDisplayType[]>([]);
|
|
68
51
|
|
|
69
52
|
useEffect(() => {
|
|
70
|
-
setFilesToDisplay(
|
|
53
|
+
setFilesToDisplay(
|
|
54
|
+
files.map((file) => ({ ...file, duration: file.duration || 0, paused: true, progress: 0 })),
|
|
55
|
+
);
|
|
71
56
|
}, [files]);
|
|
72
57
|
|
|
73
58
|
// Handler triggered when an audio is loaded in the message input. The initial state is defined for the audio here and the duration is set.
|
|
@@ -82,17 +67,17 @@ const FileAttachmentGroupWithContext = <
|
|
|
82
67
|
|
|
83
68
|
// The handler which is triggered when the audio progresses/ the thumb is dragged in the progress control. The progressed duration is set here.
|
|
84
69
|
const onProgress = (index: string, currentTime?: number, hasEnd?: boolean) => {
|
|
85
|
-
setFilesToDisplay((
|
|
86
|
-
|
|
87
|
-
...
|
|
70
|
+
setFilesToDisplay((prevFilesToDisplay) =>
|
|
71
|
+
prevFilesToDisplay.map((filesToDisplay, id) => ({
|
|
72
|
+
...filesToDisplay,
|
|
88
73
|
progress:
|
|
89
74
|
id.toString() === index
|
|
90
75
|
? hasEnd
|
|
91
76
|
? 1
|
|
92
77
|
: currentTime
|
|
93
|
-
? currentTime / (
|
|
78
|
+
? currentTime / (filesToDisplay.duration as number)
|
|
94
79
|
: 0
|
|
95
|
-
:
|
|
80
|
+
: filesToDisplay.progress,
|
|
96
81
|
})),
|
|
97
82
|
);
|
|
98
83
|
};
|
|
@@ -120,9 +105,8 @@ const FileAttachmentGroupWithContext = <
|
|
|
120
105
|
|
|
121
106
|
const {
|
|
122
107
|
theme: {
|
|
123
|
-
colors: { grey_whisper, white },
|
|
124
108
|
messageSimple: {
|
|
125
|
-
fileAttachmentGroup: { container },
|
|
109
|
+
fileAttachmentGroup: { attachmentContainer, container },
|
|
126
110
|
},
|
|
127
111
|
},
|
|
128
112
|
} = useTheme();
|
|
@@ -135,39 +119,29 @@ const FileAttachmentGroupWithContext = <
|
|
|
135
119
|
style={[
|
|
136
120
|
{ paddingBottom: index !== files.length - 1 ? 4 : 0 },
|
|
137
121
|
stylesProp.attachmentContainer,
|
|
122
|
+
attachmentContainer,
|
|
138
123
|
]}
|
|
139
124
|
>
|
|
140
|
-
{file.type === 'audio'
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
: {},
|
|
150
|
-
{
|
|
151
|
-
backgroundColor: white,
|
|
152
|
-
borderColor: grey_whisper,
|
|
153
|
-
width: -16,
|
|
125
|
+
{(file.type === 'audio' || file.type === 'voiceRecording') &&
|
|
126
|
+
isAudioPackageAvailable() ? (
|
|
127
|
+
<AudioAttachment
|
|
128
|
+
item={{
|
|
129
|
+
duration: file.duration,
|
|
130
|
+
file: {
|
|
131
|
+
name: file.title as string,
|
|
132
|
+
uri: file.asset_url,
|
|
133
|
+
waveform_data: file.waveform_data,
|
|
154
134
|
},
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
onLoad={onLoad}
|
|
166
|
-
onPlayPause={onPlayPause}
|
|
167
|
-
onProgress={onProgress}
|
|
168
|
-
testID='audio-attachment-preview'
|
|
169
|
-
/>
|
|
170
|
-
</View>
|
|
135
|
+
id: index.toString(),
|
|
136
|
+
paused: file.paused,
|
|
137
|
+
progress: file.progress,
|
|
138
|
+
}}
|
|
139
|
+
onLoad={onLoad}
|
|
140
|
+
onPlayPause={onPlayPause}
|
|
141
|
+
onProgress={onProgress}
|
|
142
|
+
showSpeedSettings={true}
|
|
143
|
+
testID='audio-attachment-preview'
|
|
144
|
+
/>
|
|
171
145
|
) : (
|
|
172
146
|
<Attachment attachment={file} />
|
|
173
147
|
)}
|
|
@@ -225,4 +199,10 @@ export const FileAttachmentGroup = <
|
|
|
225
199
|
);
|
|
226
200
|
};
|
|
227
201
|
|
|
202
|
+
const styles = StyleSheet.create({
|
|
203
|
+
container: {
|
|
204
|
+
padding: 4,
|
|
205
|
+
},
|
|
206
|
+
});
|
|
207
|
+
|
|
228
208
|
FileAttachmentGroup.displayName = 'FileAttachmentGroup{messageSimple{fileAttachmentGroup}}';
|
|
@@ -55,7 +55,7 @@ export const VideoThumbnail = (props: VideoThumbnailProps) => {
|
|
|
55
55
|
style={[styles.container, container, style]}
|
|
56
56
|
>
|
|
57
57
|
<View style={[styles.roundedView, roundedView, { backgroundColor: static_white }]}>
|
|
58
|
-
<Play
|
|
58
|
+
<Play fill={static_black} height={32} width={32} />
|
|
59
59
|
</View>
|
|
60
60
|
</ImageBackground>
|
|
61
61
|
);
|