stream-chat-react-native-core 5.36.1-beta.3 → 5.36.1-beta.5
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/Channel/Channel.js +2 -0
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js +2 -0
- package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
- package/lib/commonjs/components/Message/Message.js +4 -0
- package/lib/commonjs/components/Message/Message.js.map +1 -1
- package/lib/commonjs/components/Message/hooks/useMessageActions.js +64 -28
- package/lib/commonjs/components/Message/hooks/useMessageActions.js.map +1 -1
- package/lib/commonjs/components/Message/utils/messageActions.js +3 -2
- package/lib/commonjs/components/Message/utils/messageActions.js.map +1 -1
- package/lib/commonjs/components/MessageInput/MessageInput.js +40 -37
- package/lib/commonjs/components/MessageInput/MessageInput.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecorder.js +1 -0
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecorder.js.map +1 -1
- package/lib/commonjs/components/MessageInput/hooks/useAudioController.js +51 -50
- package/lib/commonjs/components/MessageInput/hooks/useAudioController.js.map +1 -1
- package/lib/commonjs/components/MessageOverlay/MessageActionListItem.js.map +1 -1
- package/lib/commonjs/contexts/messageContext/MessageContext.js.map +1 -1
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/commonjs/i18n/en.json +2 -0
- package/lib/commonjs/i18n/es.json +4 -2
- package/lib/commonjs/i18n/fr.json +2 -0
- package/lib/commonjs/i18n/he.json +2 -0
- package/lib/commonjs/i18n/hi.json +2 -0
- package/lib/commonjs/i18n/it.json +2 -0
- package/lib/commonjs/i18n/ja.json +2 -0
- package/lib/commonjs/i18n/ko.json +2 -0
- package/lib/commonjs/i18n/nl.json +2 -0
- package/lib/commonjs/i18n/pt-br.json +2 -0
- package/lib/commonjs/i18n/ru.json +2 -0
- package/lib/commonjs/i18n/tr.json +2 -0
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Channel/Channel.js +2 -0
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateMessagesContext.js +2 -0
- package/lib/module/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
- package/lib/module/components/Message/Message.js +4 -0
- package/lib/module/components/Message/Message.js.map +1 -1
- package/lib/module/components/Message/hooks/useMessageActions.js +64 -28
- package/lib/module/components/Message/hooks/useMessageActions.js.map +1 -1
- package/lib/module/components/Message/utils/messageActions.js +3 -2
- package/lib/module/components/Message/utils/messageActions.js.map +1 -1
- package/lib/module/components/MessageInput/MessageInput.js +40 -37
- package/lib/module/components/MessageInput/MessageInput.js.map +1 -1
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecorder.js +1 -0
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecorder.js.map +1 -1
- package/lib/module/components/MessageInput/hooks/useAudioController.js +51 -50
- package/lib/module/components/MessageInput/hooks/useAudioController.js.map +1 -1
- package/lib/module/components/MessageOverlay/MessageActionListItem.js.map +1 -1
- package/lib/module/contexts/messageContext/MessageContext.js.map +1 -1
- package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/module/i18n/en.json +2 -0
- package/lib/module/i18n/es.json +4 -2
- package/lib/module/i18n/fr.json +2 -0
- package/lib/module/i18n/he.json +2 -0
- package/lib/module/i18n/hi.json +2 -0
- package/lib/module/i18n/it.json +2 -0
- package/lib/module/i18n/ja.json +2 -0
- package/lib/module/i18n/ko.json +2 -0
- package/lib/module/i18n/nl.json +2 -0
- package/lib/module/i18n/pt-br.json +2 -0
- package/lib/module/i18n/ru.json +2 -0
- package/lib/module/i18n/tr.json +2 -0
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Channel/Channel.d.ts +1 -1
- package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts.map +1 -1
- package/lib/typescript/components/Message/Message.d.ts +1 -1
- package/lib/typescript/components/Message/Message.d.ts.map +1 -1
- package/lib/typescript/components/Message/hooks/useMessageActions.d.ts +2 -1
- package/lib/typescript/components/Message/hooks/useMessageActions.d.ts.map +1 -1
- package/lib/typescript/components/Message/utils/messageActions.d.ts +6 -2
- package/lib/typescript/components/Message/utils/messageActions.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/hooks/useAudioController.d.ts.map +1 -1
- package/lib/typescript/components/MessageOverlay/MessageActionListItem.d.ts +3 -3
- package/lib/typescript/components/MessageOverlay/MessageActionListItem.d.ts.map +1 -1
- package/lib/typescript/contexts/messageContext/MessageContext.d.ts +32 -0
- package/lib/typescript/contexts/messageContext/MessageContext.d.ts.map +1 -1
- package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +11 -0
- package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts.map +1 -1
- package/lib/typescript/i18n/en.json +2 -0
- package/lib/typescript/i18n/es.json +4 -2
- package/lib/typescript/i18n/fr.json +2 -0
- package/lib/typescript/i18n/he.json +2 -0
- package/lib/typescript/i18n/hi.json +2 -0
- package/lib/typescript/i18n/it.json +2 -0
- package/lib/typescript/i18n/ja.json +2 -0
- package/lib/typescript/i18n/ko.json +2 -0
- package/lib/typescript/i18n/nl.json +2 -0
- package/lib/typescript/i18n/pt-br.json +2 -0
- package/lib/typescript/i18n/ru.json +2 -0
- package/lib/typescript/i18n/tr.json +2 -0
- package/lib/typescript/utils/i18n/Streami18n.d.ts +2 -0
- package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/Channel/Channel.tsx +6 -1
- package/src/components/Channel/__tests__/ownCapabilities.test.js +5 -5
- package/src/components/Channel/hooks/useCreateMessagesContext.ts +2 -0
- package/src/components/Message/Message.tsx +5 -0
- package/src/components/Message/hooks/useMessageActions.tsx +22 -0
- package/src/components/Message/utils/messageActions.ts +7 -2
- package/src/components/MessageInput/MessageInput.tsx +47 -40
- package/src/components/MessageInput/__tests__/MessageInput.test.js +60 -1
- package/src/components/MessageInput/components/AudioRecorder/AudioRecorder.tsx +1 -1
- package/src/components/MessageInput/hooks/useAudioController.tsx +15 -14
- package/src/components/MessageOverlay/MessageActionListItem.tsx +3 -2
- package/src/contexts/messageContext/MessageContext.tsx +32 -0
- package/src/contexts/messagesContext/MessagesContext.tsx +11 -0
- package/src/i18n/en.json +2 -0
- package/src/i18n/es.json +4 -2
- package/src/i18n/fr.json +2 -0
- package/src/i18n/he.json +2 -0
- package/src/i18n/hi.json +2 -0
- package/src/i18n/it.json +2 -0
- package/src/i18n/ja.json +2 -0
- package/src/i18n/ko.json +2 -0
- package/src/i18n/nl.json +2 -0
- package/src/i18n/pt-br.json +2 -0
- package/src/i18n/ru.json +2 -0
- package/src/i18n/tr.json +2 -0
- package/src/version.json +1 -1
|
@@ -2,15 +2,14 @@ import React, { useEffect, useMemo, useState } from 'react';
|
|
|
2
2
|
import { NativeSyntheticEvent, StyleSheet, TextInputFocusEventData, View } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
Gesture,
|
|
6
|
+
GestureDetector,
|
|
7
7
|
PanGestureHandlerEventPayload,
|
|
8
8
|
} from 'react-native-gesture-handler';
|
|
9
9
|
import Animated, {
|
|
10
10
|
Extrapolation,
|
|
11
11
|
interpolate,
|
|
12
12
|
runOnJS,
|
|
13
|
-
useAnimatedGestureHandler,
|
|
14
13
|
useAnimatedStyle,
|
|
15
14
|
useSharedValue,
|
|
16
15
|
withSpring,
|
|
@@ -104,6 +103,7 @@ type MessageInputPropsWithContext<
|
|
|
104
103
|
| 'asyncMessagesLockDistance'
|
|
105
104
|
| 'asyncMessagesMinimumPressDuration'
|
|
106
105
|
| 'asyncMessagesSlideToCancelDistance'
|
|
106
|
+
| 'asyncMessagesMultiSendEnabled'
|
|
107
107
|
| 'asyncUploads'
|
|
108
108
|
| 'AudioRecorder'
|
|
109
109
|
| 'AudioRecordingInProgress'
|
|
@@ -168,6 +168,7 @@ const MessageInputWithContext = <
|
|
|
168
168
|
asyncIds,
|
|
169
169
|
asyncMessagesLockDistance,
|
|
170
170
|
asyncMessagesMinimumPressDuration,
|
|
171
|
+
asyncMessagesMultiSendEnabled,
|
|
171
172
|
asyncMessagesSlideToCancelDistance,
|
|
172
173
|
asyncUploads,
|
|
173
174
|
AttachmentPickerSelectionBar,
|
|
@@ -624,19 +625,16 @@ const MessageInputWithContext = <
|
|
|
624
625
|
|
|
625
626
|
const resetAudioRecording = async () => {
|
|
626
627
|
await deleteVoiceRecording();
|
|
627
|
-
micPositionX.value = 0;
|
|
628
628
|
};
|
|
629
629
|
|
|
630
630
|
const micLockHandler = () => {
|
|
631
631
|
setMicLocked(true);
|
|
632
|
-
micPositionY.value = 0;
|
|
633
632
|
triggerHaptic('impactMedium');
|
|
634
633
|
};
|
|
635
634
|
|
|
636
|
-
const
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
onActive: (event) => {
|
|
635
|
+
const panGestureMic = Gesture.Pan()
|
|
636
|
+
.activateAfterLongPress(asyncMessagesMinimumPressDuration + 100)
|
|
637
|
+
.onChange((event: PanGestureHandlerEventPayload) => {
|
|
640
638
|
const newPositionX = event.translationX;
|
|
641
639
|
const newPositionY = event.translationY;
|
|
642
640
|
|
|
@@ -646,27 +644,38 @@ const MessageInputWithContext = <
|
|
|
646
644
|
if (newPositionY <= 0 && newPositionY >= Y_AXIS_POSITION) {
|
|
647
645
|
micPositionY.value = newPositionY;
|
|
648
646
|
}
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
|
|
647
|
+
})
|
|
648
|
+
.onEnd(() => {
|
|
649
|
+
const belowThresholdY = micPositionY.value > Y_AXIS_POSITION / 2;
|
|
650
|
+
const belowThresholdX = micPositionX.value > X_AXIS_POSITION / 2;
|
|
651
|
+
|
|
652
|
+
if (belowThresholdY && belowThresholdX) {
|
|
652
653
|
micPositionY.value = withSpring(0);
|
|
653
|
-
|
|
654
|
+
micPositionX.value = withSpring(0);
|
|
655
|
+
if (recordingStatus === 'recording') {
|
|
656
|
+
runOnJS(uploadVoiceRecording)(asyncMessagesMultiSendEnabled);
|
|
657
|
+
}
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
if (!belowThresholdY) {
|
|
654
662
|
micPositionY.value = withSpring(Y_AXIS_POSITION);
|
|
655
663
|
runOnJS(micLockHandler)();
|
|
656
664
|
}
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
} else {
|
|
665
|
+
|
|
666
|
+
if (!belowThresholdX) {
|
|
660
667
|
micPositionX.value = withSpring(X_AXIS_POSITION);
|
|
661
668
|
runOnJS(resetAudioRecording)();
|
|
662
669
|
}
|
|
663
|
-
|
|
664
|
-
|
|
670
|
+
|
|
671
|
+
micPositionX.value = 0;
|
|
672
|
+
micPositionY.value = 0;
|
|
673
|
+
})
|
|
674
|
+
.onStart(() => {
|
|
665
675
|
micPositionX.value = 0;
|
|
666
676
|
micPositionY.value = 0;
|
|
667
677
|
runOnJS(setMicLocked)(false);
|
|
668
|
-
}
|
|
669
|
-
});
|
|
678
|
+
});
|
|
670
679
|
|
|
671
680
|
const animatedStyles = {
|
|
672
681
|
lockIndicator: useAnimatedStyle(() => ({
|
|
@@ -720,21 +729,20 @@ const MessageInputWithContext = <
|
|
|
720
729
|
micLocked={micLocked}
|
|
721
730
|
style={animatedStyles.lockIndicator}
|
|
722
731
|
/>
|
|
723
|
-
{
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
))}
|
|
732
|
+
{recordingStatus === 'stopped' ? (
|
|
733
|
+
<AudioRecordingPreview
|
|
734
|
+
onVoicePlayerPlayPause={onVoicePlayerPlayPause}
|
|
735
|
+
paused={paused}
|
|
736
|
+
position={position}
|
|
737
|
+
progress={progress}
|
|
738
|
+
waveformData={waveformData}
|
|
739
|
+
/>
|
|
740
|
+
) : micLocked ? (
|
|
741
|
+
<AudioRecordingInProgress
|
|
742
|
+
recordingDuration={recordingDuration}
|
|
743
|
+
waveformData={waveformData}
|
|
744
|
+
/>
|
|
745
|
+
) : null}
|
|
738
746
|
</>
|
|
739
747
|
)}
|
|
740
748
|
|
|
@@ -818,10 +826,7 @@ const MessageInputWithContext = <
|
|
|
818
826
|
</View>
|
|
819
827
|
))}
|
|
820
828
|
{audioRecordingEnabled && !micLocked && (
|
|
821
|
-
<
|
|
822
|
-
activateAfterLongPress={asyncMessagesMinimumPressDuration + 100}
|
|
823
|
-
onGestureEvent={handleMicGestureEvent}
|
|
824
|
-
>
|
|
829
|
+
<GestureDetector gesture={panGestureMic}>
|
|
825
830
|
<Animated.View
|
|
826
831
|
style={[
|
|
827
832
|
styles.micButtonContainer,
|
|
@@ -835,7 +840,7 @@ const MessageInputWithContext = <
|
|
|
835
840
|
startVoiceRecording={startVoiceRecording}
|
|
836
841
|
/>
|
|
837
842
|
</Animated.View>
|
|
838
|
-
</
|
|
843
|
+
</GestureDetector>
|
|
839
844
|
)}
|
|
840
845
|
</>
|
|
841
846
|
)}
|
|
@@ -1042,6 +1047,7 @@ export const MessageInput = <
|
|
|
1042
1047
|
asyncIds,
|
|
1043
1048
|
asyncMessagesLockDistance,
|
|
1044
1049
|
asyncMessagesMinimumPressDuration,
|
|
1050
|
+
asyncMessagesMultiSendEnabled,
|
|
1045
1051
|
asyncMessagesSlideToCancelDistance,
|
|
1046
1052
|
asyncUploads,
|
|
1047
1053
|
AudioRecorder,
|
|
@@ -1118,6 +1124,7 @@ export const MessageInput = <
|
|
|
1118
1124
|
asyncIds,
|
|
1119
1125
|
asyncMessagesLockDistance,
|
|
1120
1126
|
asyncMessagesMinimumPressDuration,
|
|
1127
|
+
asyncMessagesMultiSendEnabled,
|
|
1121
1128
|
asyncMessagesSlideToCancelDistance,
|
|
1122
1129
|
asyncUploads,
|
|
1123
1130
|
AttachmentPickerSelectionBar,
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { Alert } from 'react-native';
|
|
4
4
|
|
|
5
|
-
import { cleanup, fireEvent, render, waitFor } from '@testing-library/react-native';
|
|
5
|
+
import { cleanup, fireEvent, render, userEvent, waitFor } from '@testing-library/react-native';
|
|
6
6
|
|
|
7
7
|
import * as AttachmentPickerUtils from '../../../contexts/attachmentPickerContext/AttachmentPickerContext';
|
|
8
8
|
import { OverlayProvider } from '../../../contexts/overlayContext/OverlayProvider';
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
import { generateChannelResponse } from '../../../mock-builders/generator/channel';
|
|
17
17
|
import { generateUser } from '../../../mock-builders/generator/user';
|
|
18
18
|
import { getTestClientWithUser } from '../../../mock-builders/mock';
|
|
19
|
+
import { Audio } from '../../../native';
|
|
19
20
|
import { AttachmentPickerSelectionBar } from '../../AttachmentPicker/components/AttachmentPickerSelectionBar';
|
|
20
21
|
import { CameraSelectorIcon } from '../../AttachmentPicker/components/CameraSelectorIcon';
|
|
21
22
|
import { FileSelectorIcon } from '../../AttachmentPicker/components/FileSelectorIcon';
|
|
@@ -127,4 +128,62 @@ describe('MessageInput', () => {
|
|
|
127
128
|
// Both for files and for images triggered in one test itself.
|
|
128
129
|
expect(Alert.alert).toHaveBeenCalledTimes(4);
|
|
129
130
|
});
|
|
131
|
+
|
|
132
|
+
it('should start the audio recorder on long press and cleanup on unmount', async () => {
|
|
133
|
+
jest.clearAllMocks();
|
|
134
|
+
|
|
135
|
+
await initializeChannel(generateChannelResponse());
|
|
136
|
+
const userBot = userEvent.setup();
|
|
137
|
+
|
|
138
|
+
const { queryByTestId, unmount } = render(
|
|
139
|
+
<Chat client={chatClient}>
|
|
140
|
+
<Channel audioRecordingEnabled channel={channel}>
|
|
141
|
+
<MessageInput />
|
|
142
|
+
</Channel>
|
|
143
|
+
</Chat>,
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
await userBot.longPress(queryByTestId('audio-button'), { duration: 1000 });
|
|
147
|
+
|
|
148
|
+
await waitFor(() => {
|
|
149
|
+
expect(Audio.startRecording).toHaveBeenCalledTimes(1);
|
|
150
|
+
expect(Audio.stopRecording).not.toHaveBeenCalled();
|
|
151
|
+
expect(queryByTestId('recording-active-container')).toBeTruthy();
|
|
152
|
+
expect(Alert.alert).not.toHaveBeenCalledWith('Hold to start recording.');
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
unmount();
|
|
156
|
+
|
|
157
|
+
await waitFor(() => {
|
|
158
|
+
expect(Audio.stopRecording).toHaveBeenCalledTimes(1);
|
|
159
|
+
// once when starting the recording, once on unmount
|
|
160
|
+
expect(Audio.stopPlayer).toHaveBeenCalledTimes(2);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
it('should trigger an alert if a normal press happened on audio recording', async () => {
|
|
165
|
+
jest.clearAllMocks();
|
|
166
|
+
|
|
167
|
+
await initializeChannel(generateChannelResponse());
|
|
168
|
+
const userBot = userEvent.setup();
|
|
169
|
+
|
|
170
|
+
const { queryByTestId } = render(
|
|
171
|
+
<Chat client={chatClient}>
|
|
172
|
+
<Channel audioRecordingEnabled channel={channel}>
|
|
173
|
+
<MessageInput />
|
|
174
|
+
</Channel>
|
|
175
|
+
</Chat>,
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
await userBot.press(queryByTestId('audio-button'));
|
|
179
|
+
|
|
180
|
+
await waitFor(() => {
|
|
181
|
+
expect(Audio.startRecording).not.toHaveBeenCalled();
|
|
182
|
+
expect(Audio.stopRecording).not.toHaveBeenCalled();
|
|
183
|
+
expect(queryByTestId('recording-active-container')).not.toBeTruthy();
|
|
184
|
+
// This is sort of a brittle test, but there doesn't seem to be another way
|
|
185
|
+
// to target alerts. The reason why it's here is because we had a bug with it.
|
|
186
|
+
expect(Alert.alert).toHaveBeenCalledWith('Hold to start recording.');
|
|
187
|
+
});
|
|
188
|
+
});
|
|
130
189
|
});
|
|
@@ -180,7 +180,7 @@ const AudioRecorderWithContext = <
|
|
|
180
180
|
} else {
|
|
181
181
|
return (
|
|
182
182
|
<>
|
|
183
|
-
<View style={[styles.micContainer, micContainer]}>
|
|
183
|
+
<View style={[styles.micContainer, micContainer]} testID='recording-active-container'>
|
|
184
184
|
<Mic fill={recordingDuration !== 0 ? accent_red : grey_dark} size={32} {...micIcon} />
|
|
185
185
|
<Text style={[styles.durationLabel, { color: grey_dark }]}>
|
|
186
186
|
{recordingDuration ? dayjs.duration(recordingDuration).format('mm:ss') : null}
|
|
@@ -38,10 +38,12 @@ export const useAudioController = () => {
|
|
|
38
38
|
// For playback support in Expo CLI apps
|
|
39
39
|
const soundRef = useRef<SoundReturnType | null>(null);
|
|
40
40
|
|
|
41
|
-
//
|
|
41
|
+
// This effect stop the player from playing and stops audio recording on
|
|
42
|
+
// the audio SDK side on unmount.
|
|
42
43
|
useEffect(
|
|
43
44
|
() => () => {
|
|
44
45
|
stopVoicePlayer();
|
|
46
|
+
stopSDKVoiceRecording();
|
|
45
47
|
},
|
|
46
48
|
[],
|
|
47
49
|
);
|
|
@@ -163,7 +165,6 @@ export const useAudioController = () => {
|
|
|
163
165
|
*/
|
|
164
166
|
const startVoiceRecording = async () => {
|
|
165
167
|
if (!Audio) return;
|
|
166
|
-
setRecordingStatus('recording');
|
|
167
168
|
const recordingInfo = await Audio.startRecording(
|
|
168
169
|
{
|
|
169
170
|
isMeteringEnabled: true,
|
|
@@ -178,6 +179,7 @@ export const useAudioController = () => {
|
|
|
178
179
|
recording.setProgressUpdateInterval(Platform.OS === 'android' ? 100 : 60);
|
|
179
180
|
}
|
|
180
181
|
setRecording(recording);
|
|
182
|
+
setRecordingStatus('recording');
|
|
181
183
|
await stopVoicePlayer();
|
|
182
184
|
} else {
|
|
183
185
|
setPermissionsGranted(false);
|
|
@@ -186,22 +188,21 @@ export const useAudioController = () => {
|
|
|
186
188
|
}
|
|
187
189
|
};
|
|
188
190
|
|
|
191
|
+
/**
|
|
192
|
+
* A function that takes care of stopping the voice recording from the library's
|
|
193
|
+
* side only. Meant to be used as a pure function (during unmounting for instance)
|
|
194
|
+
* hence this approach.
|
|
195
|
+
*/
|
|
196
|
+
const stopSDKVoiceRecording = async () => {
|
|
197
|
+
if (!Audio) return;
|
|
198
|
+
await Audio.stopRecording();
|
|
199
|
+
};
|
|
200
|
+
|
|
189
201
|
/**
|
|
190
202
|
* Function to stop voice recording.
|
|
191
203
|
*/
|
|
192
204
|
const stopVoiceRecording = async () => {
|
|
193
|
-
|
|
194
|
-
if (recording) {
|
|
195
|
-
// For Expo CLI
|
|
196
|
-
if (typeof recording !== 'string') {
|
|
197
|
-
await recording.stopAndUnloadAsync();
|
|
198
|
-
await Audio.stopRecording();
|
|
199
|
-
}
|
|
200
|
-
// For RN CLI
|
|
201
|
-
else {
|
|
202
|
-
await Audio.stopRecording();
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
+
await stopSDKVoiceRecording();
|
|
205
206
|
setRecordingStatus('stopped');
|
|
206
207
|
};
|
|
207
208
|
|
|
@@ -11,6 +11,7 @@ import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
|
11
11
|
import type { MessageOverlayPropsWithContext } from '../MessageOverlay/MessageOverlay';
|
|
12
12
|
|
|
13
13
|
export type ActionType =
|
|
14
|
+
| 'banUser'
|
|
14
15
|
| 'blockUser'
|
|
15
16
|
| 'copyMessage'
|
|
16
17
|
| 'deleteMessage'
|
|
@@ -32,9 +33,9 @@ export type MessageActionType = {
|
|
|
32
33
|
action: () => void;
|
|
33
34
|
/**
|
|
34
35
|
* Type of the action performed.
|
|
35
|
-
* Eg: 'blockUser', 'copyMessage', 'deleteMessage', 'editMessage', 'flagMessage', 'muteUser', 'pinMessage', 'selectReaction', 'reply', 'retry', 'quotedReply', 'threadReply', 'unpinMessage'
|
|
36
|
+
* Eg: 'banUser', 'blockUser', 'copyMessage', 'deleteMessage', 'editMessage', 'flagMessage', 'muteUser', 'pinMessage', 'selectReaction', 'reply', 'retry', 'quotedReply', 'threadReply', 'unpinMessage'
|
|
36
37
|
*/
|
|
37
|
-
actionType: ActionType;
|
|
38
|
+
actionType: ActionType | string;
|
|
38
39
|
/**
|
|
39
40
|
* Title for action button.
|
|
40
41
|
*/
|
|
@@ -38,13 +38,45 @@ export type MessageContextValue<
|
|
|
38
38
|
groupStyles: GroupType[];
|
|
39
39
|
/** Handler for actions. Actions in combination with attachments can be used to build [commands](https://getstream.io/chat/docs/#channel_commands). */
|
|
40
40
|
handleAction: ActionHandler;
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated
|
|
43
|
+
* @returns Promise<void>
|
|
44
|
+
*/
|
|
41
45
|
handleCopyMessage: () => void;
|
|
46
|
+
/**
|
|
47
|
+
* @deprecated
|
|
48
|
+
* @returns Promise<void>
|
|
49
|
+
*/
|
|
42
50
|
handleDeleteMessage: () => void;
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated
|
|
53
|
+
* @returns Promise<void>
|
|
54
|
+
*/
|
|
43
55
|
handleEditMessage: () => void;
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated
|
|
58
|
+
* @returns Promise<void>
|
|
59
|
+
*/
|
|
44
60
|
handleFlagMessage: () => void;
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated
|
|
63
|
+
* @returns Promise<void>
|
|
64
|
+
*/
|
|
45
65
|
handleQuotedReplyMessage: () => void;
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated
|
|
68
|
+
* @returns Promise<void>
|
|
69
|
+
*/
|
|
46
70
|
handleResendMessage: () => Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* @deprecated
|
|
73
|
+
* @returns Promise<void>
|
|
74
|
+
*/
|
|
47
75
|
handleToggleBanUser: () => Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* @deprecated
|
|
78
|
+
* @returns Promise<void>
|
|
79
|
+
*/
|
|
48
80
|
handleToggleMuteUser: () => Promise<void>;
|
|
49
81
|
handleToggleReaction: (reactionType: string) => Promise<void>;
|
|
50
82
|
/** Whether or not message has reactions */
|
|
@@ -316,6 +316,16 @@ export type MessagesContextValue<
|
|
|
316
316
|
*/
|
|
317
317
|
forceAlignMessages?: Alignment | boolean;
|
|
318
318
|
getMessagesGroupStyles?: typeof getGroupStyles;
|
|
319
|
+
/**
|
|
320
|
+
* Handler to access when a ban user action is invoked.
|
|
321
|
+
* @param message
|
|
322
|
+
*/
|
|
323
|
+
handleBan?: (message: MessageType<StreamChatGenerics>) => Promise<void>;
|
|
324
|
+
/**
|
|
325
|
+
* @deprecated
|
|
326
|
+
* Handler to access when a block user action is invoked.
|
|
327
|
+
* @param message
|
|
328
|
+
*/
|
|
319
329
|
handleBlock?: (message: MessageType<StreamChatGenerics>) => Promise<void>;
|
|
320
330
|
/** Handler to access when a copy message action is invoked */
|
|
321
331
|
handleCopy?: (message: MessageType<StreamChatGenerics>) => Promise<void>;
|
|
@@ -380,6 +390,7 @@ export type MessagesContextValue<
|
|
|
380
390
|
* ```
|
|
381
391
|
* <Channel
|
|
382
392
|
* messageActions={({
|
|
393
|
+
* banUser,
|
|
383
394
|
* blockUser,
|
|
384
395
|
* copyMessage,
|
|
385
396
|
* deleteMessage,
|
package/src/i18n/en.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"Also send to channel": "Also send to channel",
|
|
7
7
|
"Are you sure you want to permanently delete this message?": "Are you sure you want to permanently delete this message?",
|
|
8
8
|
"Are you sure?": "Are you sure?",
|
|
9
|
+
"Ban User": "Ban User",
|
|
9
10
|
"Block User": "Block User",
|
|
10
11
|
"Cancel": "Cancel",
|
|
11
12
|
"Cannot Flag Message": "Cannot Flag Message",
|
|
@@ -67,6 +68,7 @@
|
|
|
67
68
|
"Slow mode ON": "Slow mode ON",
|
|
68
69
|
"The message has been reported to a moderator.": "The message has been reported to a moderator.",
|
|
69
70
|
"Thread Reply": "Thread Reply",
|
|
71
|
+
"Unban User": "Unban User",
|
|
70
72
|
"Unblock User": "Unblock User",
|
|
71
73
|
"Unknown User": "Unknown User",
|
|
72
74
|
"Unmute User": "Unmute User",
|
package/src/i18n/es.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"Also send to channel": "También enviar al canal",
|
|
7
7
|
"Are you sure you want to permanently delete this message?": "¿Estás seguro de que deseas eliminar permanentemente este mensaje?",
|
|
8
8
|
"Are you sure?": "¿Estás seguro?",
|
|
9
|
+
"Ban User": "Bloquear Usuario",
|
|
9
10
|
"Block User": "Bloquear usuario",
|
|
10
11
|
"Cancel": "Cancelar",
|
|
11
12
|
"Cannot Flag Message": "No se puede reportar el mensaje",
|
|
@@ -67,8 +68,9 @@
|
|
|
67
68
|
"Slow mode ON": "Modo lento ACTIVADO",
|
|
68
69
|
"The message has been reported to a moderator.": "El mensaje ha sido reportado a un moderador.",
|
|
69
70
|
"Thread Reply": "Respuesta de hilo",
|
|
70
|
-
"
|
|
71
|
-
"
|
|
71
|
+
"Unban User": "Desbloquear usuario",
|
|
72
|
+
"Unblock User": "Usuario desconocido",
|
|
73
|
+
"Unknown User": "Desbloquear Usuario",
|
|
72
74
|
"Unmute User": "Activar sonido del usuario",
|
|
73
75
|
"Unpin from Conversation": "Desmarcar de la conversación",
|
|
74
76
|
"Unread Messages": "Mensajes no leídos",
|
package/src/i18n/fr.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"Also send to channel": "Envoyer également à la chaîne",
|
|
7
7
|
"Are you sure you want to permanently delete this message?": "Êtes-vous sûr de vouloir supprimer définitivement ce message?",
|
|
8
8
|
"Are you sure?": "Es-tu sûr ?",
|
|
9
|
+
"Ban User": "Bannir Utilisateur",
|
|
9
10
|
"Block User": "Bloquer un utilisateur",
|
|
10
11
|
"Cancel": "Annuler",
|
|
11
12
|
"Cannot Flag Message": "Impossible de signaler le message",
|
|
@@ -67,6 +68,7 @@
|
|
|
67
68
|
"Slow mode ON": "Mode lent activé",
|
|
68
69
|
"The message has been reported to a moderator.": "Le message a été signalé à un modérateur.",
|
|
69
70
|
"Thread Reply": "Réponse à la discussion",
|
|
71
|
+
"Unban User": "Débannir Utilisateur",
|
|
70
72
|
"Unblock User": "Débloquer Utilisateur",
|
|
71
73
|
"Unknown User": "Utilisateur inconnu",
|
|
72
74
|
"Unmute User": "Activer le son de Utilisateur",
|
package/src/i18n/he.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"Also send to channel": "שלח/י הודעה לשיחה",
|
|
7
7
|
"Are you sure you want to permanently delete this message?": "האם את/ה בטוח/ה שאת/ה רוצה למחוק את ההודעה הזו לצמיתות?",
|
|
8
8
|
"Are you sure?": "האם אתה בטוח?",
|
|
9
|
+
"Ban User": "לחסום משתמש",
|
|
9
10
|
"Block User": "חסום משתמש",
|
|
10
11
|
"Cancel": "ביטול",
|
|
11
12
|
"Cannot Flag Message": "סימון הודעה לא אפשרי",
|
|
@@ -67,6 +68,7 @@
|
|
|
67
68
|
"Slow mode ON": "מצב איטי מופעל",
|
|
68
69
|
"The message has been reported to a moderator.": "ההודעה דווחה למנהל",
|
|
69
70
|
"Thread Reply": "הגב/י בשרשור",
|
|
71
|
+
"Unban User": "לבטל חסימת משתמש",
|
|
70
72
|
"Unblock User": "בטל/י חסימת משתמש",
|
|
71
73
|
"Unknown User": "משתמש לא ידוע",
|
|
72
74
|
"Unmute User": "בטל/י השתקת משתמש",
|
package/src/i18n/hi.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"Also send to channel": "चैनल को भी भेजें",
|
|
7
7
|
"Are you sure you want to permanently delete this message?": "क्या आप वाकई इस संदेश को स्थायी रूप से हटाना चाहते हैं?",
|
|
8
8
|
"Are you sure?": "क्या आप सुनिश्चित हैं?",
|
|
9
|
+
"Ban User": "उपयोगकर्ता को प्रतिबंधित करें",
|
|
9
10
|
"Block User": "उपयोगकर्ता को रोक देना, ब्लॉक यूजर",
|
|
10
11
|
"Cancel": "रद्द करें",
|
|
11
12
|
"Cannot Flag Message": "मैसेज फ्लैग नहीं किया जा सकता है",
|
|
@@ -67,6 +68,7 @@
|
|
|
67
68
|
"Slow mode ON": "स्लो मोड चालू",
|
|
68
69
|
"The message has been reported to a moderator.": "संदेश एक मॉडरेटर को सूचित किया गया है।",
|
|
69
70
|
"Thread Reply": "धागा जवाब",
|
|
71
|
+
"Unban User": "उपयोगकर्ता को अनब्लॉक करें",
|
|
70
72
|
"Unblock User": "उपयोगकर्ता को अनब्लॉक करें",
|
|
71
73
|
"Unknown User": "अज्ञात उपयोगकर्ता",
|
|
72
74
|
"Unmute User": "उपयोगकर्ता को अनम्यूट करें",
|
package/src/i18n/it.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"Also send to channel": "Invia anche al canale",
|
|
7
7
|
"Are you sure you want to permanently delete this message?": "Sei sicuro di voler eliminare definitivamente questo messaggio?",
|
|
8
8
|
"Are you sure?": "Sei sicuro?",
|
|
9
|
+
"Ban User": "Blocca Utente",
|
|
9
10
|
"Block User": "Blocca Utente",
|
|
10
11
|
"Cancel": "Annulla",
|
|
11
12
|
"Cannot Flag Message": "Impossibile Segnalare Messaggio",
|
|
@@ -67,6 +68,7 @@
|
|
|
67
68
|
"Slow mode ON": "Slowmode attiva",
|
|
68
69
|
"The message has been reported to a moderator.": "Il messaggio è stato segnalato a un moderatore.",
|
|
69
70
|
"Thread Reply": "Rispondi alla Discussione",
|
|
71
|
+
"Unban User": "Sblocca Utente",
|
|
70
72
|
"Unblock User": "Sblocca utente",
|
|
71
73
|
"Unknown User": "Utente sconosciuto",
|
|
72
74
|
"Unmute User": "Riattiva utente",
|
package/src/i18n/ja.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"Also send to channel": "チャンネルにも送信",
|
|
7
7
|
"Are you sure you want to permanently delete this message?": "このメッセージを完全に削除してもよろしいですか?",
|
|
8
8
|
"Are you sure?": "本当によろしいですか?",
|
|
9
|
+
"Ban User": "ユーザーを禁止する",
|
|
9
10
|
"Block User": "ユーザをブロックする",
|
|
10
11
|
"Cancel": "キャンセル",
|
|
11
12
|
"Cannot Flag Message": "メッセージをフラグできません",
|
|
@@ -67,6 +68,7 @@
|
|
|
67
68
|
"Slow mode ON": "スローモードオン",
|
|
68
69
|
"The message has been reported to a moderator.": "メッセージはモデレーターに報告されました。",
|
|
69
70
|
"Thread Reply": "スレッドの返信",
|
|
71
|
+
"Unban User": "ユーザーの禁止を解除する",
|
|
70
72
|
"Unblock User": "ユーザーのブロックを解除する",
|
|
71
73
|
"Unknown User": "不明なユーザー",
|
|
72
74
|
"Unmute User": "ユーザーのミュートを解除する",
|
package/src/i18n/ko.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"Also send to channel": "채널에도 전송",
|
|
7
7
|
"Are you sure you want to permanently delete this message?": "이 메시지를 영구적으로 삭제하시겠습니까?",
|
|
8
8
|
"Are you sure?": "확실합니까?",
|
|
9
|
+
"Ban User": "사용자 차단",
|
|
9
10
|
"Block User": "사용자 차단",
|
|
10
11
|
"Cancel": "취소",
|
|
11
12
|
"Cannot Flag Message": "메세지를 플래그 할 수 없습니다",
|
|
@@ -67,6 +68,7 @@
|
|
|
67
68
|
"Slow mode ON": "슬로모드 켜짐",
|
|
68
69
|
"The message has been reported to a moderator.": "메시지는 운영자에보고되었습니다.",
|
|
69
70
|
"Thread Reply": "스레드\u3000답장",
|
|
71
|
+
"Unban User": "사용자 차단 해제",
|
|
70
72
|
"Unblock User": "사용자 차단 해제",
|
|
71
73
|
"Unknown User": "알 수없는 사용자",
|
|
72
74
|
"Unmute User": "사용자 음소거 해제",
|
package/src/i18n/nl.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"Also send to channel": "Stuur ook naar kanaal",
|
|
7
7
|
"Are you sure you want to permanently delete this message?": "Weet u zeker dat u dit bericht definitief wilt verwijderen?",
|
|
8
8
|
"Are you sure?": "Weet je het zeker?",
|
|
9
|
+
"Ban User": "Gebruiker Verbannen",
|
|
9
10
|
"Block User": "Blokkeer Gebruiker",
|
|
10
11
|
"Cancel": "Annuleer",
|
|
11
12
|
"Cannot Flag Message": "Kan bericht niet rapporteren",
|
|
@@ -67,6 +68,7 @@
|
|
|
67
68
|
"Slow mode ON": "Langzame modus aan",
|
|
68
69
|
"The message has been reported to a moderator.": "Het bericht is gerapporteerd aan een moderator.",
|
|
69
70
|
"Thread Reply": "Discussie beantwoorden",
|
|
71
|
+
"Unban User": "Gebruiker Deblokeren",
|
|
70
72
|
"Unblock User": "Deblokkeer gebruiker",
|
|
71
73
|
"Unknown User": "Onbekende gebruiker",
|
|
72
74
|
"Unmute User": "Dempen van gebruiker opheffen",
|
package/src/i18n/pt-br.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"Also send to channel": "Também enviar para o canal",
|
|
7
7
|
"Are you sure you want to permanently delete this message?": "Tem certeza de que deseja excluir esta mensagem permanentemente?",
|
|
8
8
|
"Are you sure?": "Tem certeza?",
|
|
9
|
+
"Ban User": "Banir Usuário",
|
|
9
10
|
"Block User": "Bloquear Usuário",
|
|
10
11
|
"Cancel": "Cancelar",
|
|
11
12
|
"Cannot Flag Message": "Não é possível reportar a mensagem",
|
|
@@ -67,6 +68,7 @@
|
|
|
67
68
|
"Slow mode ON": "Modo Lento ATIVADO",
|
|
68
69
|
"The message has been reported to a moderator.": "A mensagem foi relatada a um moderador.",
|
|
69
70
|
"Thread Reply": "Respostas de Tópico",
|
|
71
|
+
"Unban User": "Desbanir Usuário",
|
|
70
72
|
"Unblock User": "Desbloquear Usuário",
|
|
71
73
|
"Unknown User": "Usuário Desconhecido",
|
|
72
74
|
"Unmute User": "Remover usuário do modo silencioso",
|
package/src/i18n/ru.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"Also send to channel": "Также отправить на канал",
|
|
7
7
|
"Are you sure you want to permanently delete this message?": "Вы действительно хотите удалить это сообщение без возможности восстановления?",
|
|
8
8
|
"Are you sure?": "Вы уверены?",
|
|
9
|
+
"Ban User": "Заблокировать Пользователя",
|
|
9
10
|
"Block User": "Заблокировать пользователя",
|
|
10
11
|
"Cancel": "Отмена",
|
|
11
12
|
"Cannot Flag Message": "Невозможно пожаловаться на сообщение",
|
|
@@ -67,6 +68,7 @@
|
|
|
67
68
|
"Slow mode ON": "Медленный режим включен",
|
|
68
69
|
"The message has been reported to a moderator.": "Сообщение отправлено модератору.",
|
|
69
70
|
"Thread Reply": "Тема Ответить",
|
|
71
|
+
"Unban User": "Разблокировать Пользователя",
|
|
70
72
|
"Unblock User": "Разблокировать пользователя",
|
|
71
73
|
"Unknown User": "Неизвестный пользователь",
|
|
72
74
|
"Unmute User": "Включить микрофон",
|
package/src/i18n/tr.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"Also send to channel": "Kanala da gönder",
|
|
7
7
|
"Are you sure you want to permanently delete this message?": "Bu mesajı kalıcı olarak silmek istediğinizden emin misiniz?",
|
|
8
8
|
"Are you sure?": "Emin misiniz?",
|
|
9
|
+
"Ban User": "Kullanıcıyı Yasakla",
|
|
9
10
|
"Block User": "Kullanıcıyı engelle",
|
|
10
11
|
"Cancel": "İptal",
|
|
11
12
|
"Cannot Flag Message": "Raporlama Başarısız",
|
|
@@ -67,6 +68,7 @@
|
|
|
67
68
|
"Slow mode ON": "Yavaş Mod Açık",
|
|
68
69
|
"The message has been reported to a moderator.": "Mesaj moderatöre bildirildi.",
|
|
69
70
|
"Thread Reply": "Konu Yanıtı",
|
|
71
|
+
"Unban User": "Kullanıcının Yasağını Kaldır",
|
|
70
72
|
"Unblock User": "Kullanıcının engelini kaldır",
|
|
71
73
|
"Unknown User": "Bilinmeyen kullanıcı",
|
|
72
74
|
"Unmute User": "Kullanıcının sesini aç",
|
package/src/version.json
CHANGED