From 9ef7d69d6ed87bd84fe2f43fce6e7744fa0b37b4 Mon Sep 17 00:00:00 2001 From: Khushal Agarwal Date: Wed, 8 Jan 2025 18:24:30 +0530 Subject: [PATCH 1/2] fix: change default value of audioRecordingEnabled and not rely on package availability for default value --- package/src/components/Channel/Channel.tsx | 3 +-- package/src/components/MessageInput/MessageInput.tsx | 10 +++++++--- .../components/AudioRecorder/AudioRecordingButton.tsx | 8 +------- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/package/src/components/Channel/Channel.tsx b/package/src/components/Channel/Channel.tsx index 87da8bbc47..d9f1c6d4b8 100644 --- a/package/src/components/Channel/Channel.tsx +++ b/package/src/components/Channel/Channel.tsx @@ -85,7 +85,6 @@ import { } from '../../icons'; import { FlatList as FlatListDefault, - isAudioRecorderAvailable, isDocumentPickerAvailable, isImageMediaLibraryAvailable, isImagePickerAvailable, @@ -494,7 +493,7 @@ const ChannelWithContext = < AudioAttachment = AudioAttachmentDefault, AudioAttachmentUploadPreview = AudioAttachmentDefault, AudioRecorder = AudioRecorderDefault, - audioRecordingEnabled = isAudioRecorderAvailable(), + audioRecordingEnabled = false, AudioRecordingInProgress = AudioRecordingInProgressDefault, AudioRecordingLockIndicator = AudioRecordingLockIndicatorDefault, AudioRecordingPreview = AudioRecordingPreviewDefault, diff --git a/package/src/components/MessageInput/MessageInput.tsx b/package/src/components/MessageInput/MessageInput.tsx index 63a6ff159e..371a4168a8 100644 --- a/package/src/components/MessageInput/MessageInput.tsx +++ b/package/src/components/MessageInput/MessageInput.tsx @@ -56,7 +56,11 @@ import { useTranslationContext, } from '../../contexts/translationContext/TranslationContext'; -import { isImageMediaLibraryAvailable, triggerHaptic } from '../../native'; +import { + isAudioRecorderAvailable, + isImageMediaLibraryAvailable, + triggerHaptic, +} from '../../native'; import type { Asset, DefaultStreamChatGenerics } from '../../types/types'; import { AIStates, useAIState } from '../AITypingIndicatorView'; import { AutoCompleteInput } from '../AutoCompleteInput/AutoCompleteInput'; @@ -624,7 +628,7 @@ const MessageInputWithContext = < } = useAudioController(); const isSendingButtonVisible = () => { - if (audioRecordingEnabled) { + if (audioRecordingEnabled && isAudioRecorderAvailable()) { if (recording) { return false; } @@ -856,7 +860,7 @@ const MessageInputWithContext = < )) )} - {audioRecordingEnabled && !micLocked && ( + {audioRecordingEnabled && isAudioRecorderAvailable() && !micLocked && ( Date: Wed, 8 Jan 2025 18:34:15 +0530 Subject: [PATCH 2/2] fix: tests snapshots --- .../__snapshots__/Thread.test.js.snap | 75 ++++++++----------- 1 file changed, 31 insertions(+), 44 deletions(-) diff --git a/package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap b/package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap index 213ed3c79f..af64d42236 100644 --- a/package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +++ b/package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap @@ -2136,21 +2136,9 @@ exports[`Thread should match thread snapshot 1`] = ` - - + - + } + fillRule={0} + propList={ + [ + "fill", + "fillRule", + ] + } + />