Skip to content

Commit

Permalink
fix: change default value of audioRecordingEnabled and not rely on pa…
Browse files Browse the repository at this point in the history
…ckage availability for default value
  • Loading branch information
khushal87 committed Jan 8, 2025
1 parent f7eeec8 commit 9ef7d69
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
3 changes: 1 addition & 2 deletions package/src/components/Channel/Channel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ import {
} from '../../icons';
import {
FlatList as FlatListDefault,
isAudioRecorderAvailable,
isDocumentPickerAvailable,
isImageMediaLibraryAvailable,
isImagePickerAvailable,
Expand Down Expand Up @@ -494,7 +493,7 @@ const ChannelWithContext = <
AudioAttachment = AudioAttachmentDefault,
AudioAttachmentUploadPreview = AudioAttachmentDefault,
AudioRecorder = AudioRecorderDefault,
audioRecordingEnabled = isAudioRecorderAvailable(),
audioRecordingEnabled = false,
AudioRecordingInProgress = AudioRecordingInProgressDefault,
AudioRecordingLockIndicator = AudioRecordingLockIndicatorDefault,
AudioRecordingPreview = AudioRecordingPreviewDefault,
Expand Down
10 changes: 7 additions & 3 deletions package/src/components/MessageInput/MessageInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -624,7 +628,7 @@ const MessageInputWithContext = <
} = useAudioController();

const isSendingButtonVisible = () => {
if (audioRecordingEnabled) {
if (audioRecordingEnabled && isAudioRecorderAvailable()) {
if (recording) {
return false;
}
Expand Down Expand Up @@ -856,7 +860,7 @@ const MessageInputWithContext = <
</View>
))
)}
{audioRecordingEnabled && !micLocked && (
{audioRecordingEnabled && isAudioRecorderAvailable() && !micLocked && (
<GestureDetector gesture={panGestureMic}>
<Animated.View
style={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ import {
import { useTheme } from '../../../../contexts/themeContext/ThemeContext';
import { useTranslationContext } from '../../../../contexts/translationContext/TranslationContext';
import { Mic } from '../../../../icons/Mic';
import {
AudioRecordingReturnType,
isAudioRecorderAvailable,
triggerHaptic,
} from '../../../../native';
import { AudioRecordingReturnType, triggerHaptic } from '../../../../native';

import type { DefaultStreamChatGenerics } from '../../../../types/types';

Expand Down Expand Up @@ -102,8 +98,6 @@ const AudioRecordingButtonWithContext = <
}
};

if (!isAudioRecorderAvailable()) return null;

return (
<Pressable
delayLongPress={asyncMessagesMinimumPressDuration}
Expand Down

0 comments on commit 9ef7d69

Please sign in to comment.