@cometchat/chat-uikit-react-native 5.5.0 → 5.5.2
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/android/.gradle/7.4/checksums/checksums.lock +0 -0
- package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
- package/android/build.gradle +23 -89
- package/android/gradle.properties +5 -5
- package/android/src/main/java/com/reactnativecometchatuikit/CometChatSoundModule.java +5 -1
- package/android/src/main/java/com/reactnativecometchatuikit/FileManager.java +52 -0
- package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorView.kt +37 -4
- package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorViewManager.kt +9 -1
- package/ios/FileManager.m +77 -3
- package/ios/RichTextEditorView.swift +52 -1
- package/ios/RichTextEditorViewManager.m +1 -0
- package/ios/RichTextEditorViewManager.swift +8 -0
- package/package.json +8 -5
- package/react-native-cometchat-ui-kit.podspec +5 -19
- package/src/CometChatCompactMessageComposer/CometChatCompactMessageComposer.tsx +69 -36
- package/src/CometChatConversations/CometChatConversations.tsx +12 -1
- package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +2 -2
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +50 -31
- package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +10 -1
- package/src/CometChatMessageList/CometChatMessageList.tsx +24 -19
- package/src/CometChatMessageList/components/MessageOptionsSheet.tsx +7 -8
- package/src/CometChatPinnedMessages/CometChatPinnedMessages.tsx +43 -19
- package/src/CometChatRichTextEditor/index.tsx +6 -1
- package/src/CometChatRichTextEditor/types.ts +2 -0
- package/src/CometChatSavedMessages/CometChatSavedMessages.tsx +251 -14
- package/src/CometChatSearch/CometChatSearch.tsx +39 -11
- package/src/calls/CometChatOngoingCall/CometChatOngoingCall.tsx +56 -17
- package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +12 -9
- package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +13 -10
- package/src/extensions/LinkPreview/LinkPreviewExtensionDecorator.tsx +34 -27
- package/src/extensions/Polls/Polls.tsx +7 -7
- package/src/extensions/Polls/PollsBubble.tsx +2 -2
- package/src/globals.d.ts +6 -0
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +2 -1
- package/src/shared/constants/UIKitConstants.ts +3 -17
- package/src/shared/constants/textPatterns.ts +45 -0
- package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +25 -259
- package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +22 -11
- package/src/shared/formatters/CometChatRichTextFormatter/index.tsx +56 -32
- package/src/shared/formatters/CometChatTextFormatter.ts +22 -0
- package/src/shared/formatters/CometChatUrlsFormatter/index.tsx +8 -0
- package/src/shared/formatters/applyRawFormatters.ts +31 -0
- package/src/shared/formatters/codeElements.ts +21 -0
- package/src/shared/framework/MessageDataSource.tsx +14 -8
- package/src/shared/helper/types/index.ts +5 -0
- package/src/shared/libs/ImageZoom/ReactNativeZoomableView.tsx +4 -4
- package/src/shared/libs/ImageZoom/types/index.ts +2 -0
- package/src/shared/resources/CometChatLocalizeNew/CometChatI18nProvider.tsx +15 -30
- package/src/shared/resources/CometChatLocalizeNew/CometChatLocalizationHelper.ts +138 -19
- package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +74 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +0 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +54 -1
- package/src/shared/resources/CometChatSoundManager/sound.js +2 -3
- package/src/shared/services/UploadQueueService.ts +7 -0
- package/src/shared/utils/CometChatMessageHelper/index.ts +3 -0
- package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +11 -0
- package/src/shared/utils/MarkdownUtils.ts +42 -5
- package/src/shared/utils/MessageUtils.tsx +7 -5
- package/src/shared/utils/PinnedMessagesHelper.ts +65 -0
- package/src/shared/utils/SavedMessagesHelper.ts +42 -6
- package/src/shared/utils/__testUtils__/messagesRequestBuilderMock.ts +37 -0
- package/src/shared/utils/cloneRequestBuilder.ts +25 -0
- package/src/shared/utils/groupMemberAddedRows.ts +28 -0
- package/src/shared/utils/linkPreviewSelection.ts +109 -0
- package/src/shared/utils/mentionTokens.ts +77 -0
- package/src/shared/utils/runAfterInteractions.ts +26 -0
- package/src/shared/utils/stripRichText.ts +2 -1
- package/src/shared/utils/tapGesture.ts +23 -0
- package/src/shared/utils/videoThumbnail.ts +74 -0
- package/src/shared/views/ClipboardPasteHandler/ClipboardPasteHandler.ts +15 -4
- package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentTile.tsx +21 -13
- package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +13 -15
- package/src/shared/views/CometChatAudiosBubble/CometChatAudiosBubble.tsx +5 -0
- package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +4 -1
- package/src/shared/views/CometChatCaptionText/CometChatCaptionText.tsx +8 -1
- package/src/shared/views/CometChatEmojiKeyboard/CometChatEmojiKeyboard.tsx +1 -1
- package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +2 -1
- package/src/shared/views/CometChatFilesBubble/CometChatFilesBubble.tsx +7 -1
- package/src/shared/views/CometChatImagesBubble/CometChatImagesBubble.tsx +8 -26
- package/src/shared/views/CometChatInlineAudioRecorder/useAudioRecorder.ts +4 -2
- package/src/shared/views/CometChatList/Header.tsx +9 -3
- package/src/shared/views/CometChatMediaRecorder/CometChatAudioPreview/CometChatAudioPreview.tsx +2 -1
- package/src/shared/views/CometChatMediaViewer/CometChatMediaViewer.tsx +28 -8
- package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +3 -4
- package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +36 -4
- package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +2 -1
- package/src/shared/views/CometChatVideosBubble/CometChatVideosBubble.tsx +62 -30
- package/src/shared/views/CometChatVoiceNoteBubble/CometChatVoiceNoteBubble.tsx +5 -0
- package/src/CometChatMessageList/MANUAL_TEST_CASES.md +0 -154
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useMemo, useState } from 'react';
|
|
1
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import { Image, ImageStyle, StyleProp, StyleSheet, Text, TextStyle, TouchableOpacity, View, ViewStyle } from 'react-native';
|
|
3
3
|
import { CometChat } from '@cometchat/chat-sdk-react-native';
|
|
4
4
|
import { CometChatTheme } from '../../../theme/type';
|
|
@@ -8,10 +8,11 @@ import { deepMerge } from '../../helper/helperFunctions';
|
|
|
8
8
|
import { Icon } from '../../icons/Icon';
|
|
9
9
|
import { getExtensionData } from '../../../extensions/ExtensionModerator';
|
|
10
10
|
import { CometChatUIKit } from '../../CometChatUiKit';
|
|
11
|
-
import { CometChatMessageEvents } from '../../events/CometChatMessageEvents';
|
|
12
11
|
import { CometChatMediaViewer } from '../CometChatMediaViewer';
|
|
13
12
|
import { CometChatCaptionText } from '../CometChatCaptionText';
|
|
14
13
|
import { isVideoMime } from '../CometChatMediaViewer/mediaViewerUtils';
|
|
14
|
+
import { useLocalVideoThumbnail } from '../../utils/videoThumbnail';
|
|
15
|
+
import { AdditionalParams } from "../../base/Types";
|
|
15
16
|
|
|
16
17
|
// ---------------------------------------------------------------------------
|
|
17
18
|
// Design doc §8.1 — VideosBubble: renders a single-kind VIDEO message (all videos after the §7 fan-out)
|
|
@@ -53,6 +54,8 @@ interface VideoCellProps {
|
|
|
53
54
|
testID?: string;
|
|
54
55
|
overflowCount?: number;
|
|
55
56
|
thumbnailUrl?: string;
|
|
57
|
+
/** Retry a failed server thumbnail — only for a just-sent message, whose thumbnail may not exist yet. */
|
|
58
|
+
retryThumbnail?: boolean;
|
|
56
59
|
cellStyle?: StyleProp<ViewStyle>;
|
|
57
60
|
playButtonStyle?: StyleProp<ViewStyle>;
|
|
58
61
|
playIconStyle?: ImageStyle;
|
|
@@ -62,6 +65,14 @@ interface VideoCellProps {
|
|
|
62
65
|
overflowTextStyle?: TextStyle;
|
|
63
66
|
}
|
|
64
67
|
|
|
68
|
+
// The thumbnail-generation extension puts the thumbnail URL on the message at send time but creates the
|
|
69
|
+
// image a few seconds later, so an early load of it fails. The sender's own device shows its local
|
|
70
|
+
// first-frame thumbnail meanwhile — only when that URL exists, so the dashboard setting still decides.
|
|
71
|
+
// Anyone else (another of the sender's devices, a very fast receiver) re-checks the URL with back-off.
|
|
72
|
+
// Older messages never retry — their thumbnail exists or never will.
|
|
73
|
+
const THUMBNAIL_RETRY_DELAYS_MS = [1000, 2000, 4000, 8000, 15000];
|
|
74
|
+
const THUMBNAIL_RETRY_WINDOW_SECS = 120;
|
|
75
|
+
|
|
65
76
|
const VideoCell = ({
|
|
66
77
|
attachment,
|
|
67
78
|
aspectRatio = 1,
|
|
@@ -70,6 +81,7 @@ const VideoCell = ({
|
|
|
70
81
|
testID,
|
|
71
82
|
overflowCount,
|
|
72
83
|
thumbnailUrl,
|
|
84
|
+
retryThumbnail,
|
|
73
85
|
cellStyle,
|
|
74
86
|
playButtonStyle,
|
|
75
87
|
playIconStyle,
|
|
@@ -80,6 +92,29 @@ const VideoCell = ({
|
|
|
80
92
|
}: VideoCellProps) => {
|
|
81
93
|
const theme = useTheme();
|
|
82
94
|
const duration = getDuration(attachment);
|
|
95
|
+
// Only stand in for a server thumbnail that is on its way: no `thumbnailUrl` means the Thumbnail
|
|
96
|
+
// Generation extension is off in the dashboard (or failed for this file), and then no thumbnail shows.
|
|
97
|
+
const localThumbnail = useLocalVideoThumbnail({ remoteUrl: thumbnailUrl ? attachment.getUrl?.() : undefined });
|
|
98
|
+
// Bumped once a retried thumbnail is fetched, to remount the <Image> onto the now-cached file.
|
|
99
|
+
const [thumbnailKey, setThumbnailKey] = useState(0);
|
|
100
|
+
const retry = useRef<{ attempt: number; timer?: ReturnType<typeof setTimeout> }>({ attempt: 0 });
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
retry.current = { attempt: 0 };
|
|
103
|
+
return () => clearTimeout(retry.current.timer);
|
|
104
|
+
}, [thumbnailUrl]);
|
|
105
|
+
const onThumbnailError = () => {
|
|
106
|
+
if (!retryThumbnail || localThumbnail || !thumbnailUrl) return;
|
|
107
|
+
const check = () => {
|
|
108
|
+
Image.prefetch(thumbnailUrl)
|
|
109
|
+
.then((ok) => (ok ? setThumbnailKey((k) => k + 1) : scheduleNext()))
|
|
110
|
+
.catch(scheduleNext);
|
|
111
|
+
};
|
|
112
|
+
const scheduleNext = () => {
|
|
113
|
+
const delay = THUMBNAIL_RETRY_DELAYS_MS[retry.current.attempt++];
|
|
114
|
+
if (delay != null) retry.current.timer = setTimeout(check, delay);
|
|
115
|
+
};
|
|
116
|
+
scheduleNext();
|
|
117
|
+
};
|
|
83
118
|
// A VIDEO bubble previews videos only. Anything else (image / audio / file) is unsupported here →
|
|
84
119
|
// a "no preview" placeholder cell (tapping it opens the "No preview available" fullscreen). Gate on a
|
|
85
120
|
// KNOWN non-video kind (a proper "type/subtype" mime that isn't video/*): an empty / bare-extension
|
|
@@ -107,7 +142,7 @@ const VideoCell = ({
|
|
|
107
142
|
>
|
|
108
143
|
<View
|
|
109
144
|
testID="grid-cell-nopreview"
|
|
110
|
-
style={[StyleSheet.
|
|
145
|
+
style={[StyleSheet.absoluteFill, borderStyle, { backgroundColor: theme.color.neutral200, justifyContent: 'center', alignItems: 'center' }]}
|
|
111
146
|
>
|
|
112
147
|
<Icon name="unknown-file-type" size={theme.spacing.spacing.s12} />
|
|
113
148
|
</View>
|
|
@@ -115,7 +150,7 @@ const VideoCell = ({
|
|
|
115
150
|
<View
|
|
116
151
|
testID="grid-overflow"
|
|
117
152
|
pointerEvents="none"
|
|
118
|
-
style={[StyleSheet.
|
|
153
|
+
style={[StyleSheet.absoluteFill, { backgroundColor: theme.color.mediaOverlay, justifyContent: 'center', alignItems: 'center' }, overflowOverlayStyle]}
|
|
119
154
|
>
|
|
120
155
|
<Text style={[{ ...theme.typography.heading1.bold, color: theme.color.staticWhite, letterSpacing: -0.5 }, overflowTextStyle]}>{`+${overflowCount}`}</Text>
|
|
121
156
|
</View>
|
|
@@ -133,13 +168,24 @@ const VideoCell = ({
|
|
|
133
168
|
accessibilityRole="button"
|
|
134
169
|
accessibilityLabel={attachment.getName()}
|
|
135
170
|
>
|
|
136
|
-
<View style={[StyleSheet.
|
|
171
|
+
<View style={[StyleSheet.absoluteFill, { backgroundColor: theme.color.mediaScrim }, borderStyle]} />
|
|
172
|
+
{localThumbnail ? (
|
|
173
|
+
<Image source={{ uri: localThumbnail }} style={[StyleSheet.absoluteFill, borderStyle]} resizeMode="cover" />
|
|
174
|
+
) : null}
|
|
175
|
+
{/* The server thumbnail draws over the local one once it loads; until then (or if it fails)
|
|
176
|
+
the local thumbnail shows through. */}
|
|
137
177
|
{thumbnailUrl ? (
|
|
138
|
-
<Image
|
|
178
|
+
<Image
|
|
179
|
+
key={thumbnailKey}
|
|
180
|
+
source={{ uri: thumbnailUrl }}
|
|
181
|
+
style={[StyleSheet.absoluteFill, borderStyle]}
|
|
182
|
+
resizeMode="cover"
|
|
183
|
+
onError={onThumbnailError}
|
|
184
|
+
/>
|
|
139
185
|
) : null}
|
|
140
186
|
|
|
141
187
|
{!overflowCount && (
|
|
142
|
-
<View pointerEvents="none" style={StyleSheet.
|
|
188
|
+
<View pointerEvents="none" style={StyleSheet.absoluteFill}>
|
|
143
189
|
<View style={styles.centerFill}>
|
|
144
190
|
<View
|
|
145
191
|
style={[{
|
|
@@ -181,7 +227,7 @@ const VideoCell = ({
|
|
|
181
227
|
<View
|
|
182
228
|
testID="grid-overflow"
|
|
183
229
|
pointerEvents="none"
|
|
184
|
-
style={[StyleSheet.
|
|
230
|
+
style={[StyleSheet.absoluteFill, { backgroundColor: theme.color.mediaOverlay, justifyContent: 'center', alignItems: 'center' }, overflowOverlayStyle]}
|
|
185
231
|
>
|
|
186
232
|
<Text style={[{ ...theme.typography.heading1.bold, color: theme.color.staticWhite, letterSpacing: -0.5 }, overflowTextStyle]}>{`+${overflowCount}`}</Text>
|
|
187
233
|
</View>
|
|
@@ -195,6 +241,7 @@ const VideoCell = ({
|
|
|
195
241
|
const VideoGrid = ({
|
|
196
242
|
attachments,
|
|
197
243
|
thumbnailUrls,
|
|
244
|
+
retryThumbnail,
|
|
198
245
|
onAttachmentPress,
|
|
199
246
|
containerStyle,
|
|
200
247
|
cellStyle,
|
|
@@ -207,6 +254,7 @@ const VideoGrid = ({
|
|
|
207
254
|
}: {
|
|
208
255
|
attachments: CometChat.Attachment[];
|
|
209
256
|
thumbnailUrls?: string[];
|
|
257
|
+
retryThumbnail?: boolean;
|
|
210
258
|
onAttachmentPress: (attachment: CometChat.Attachment, index: number) => void;
|
|
211
259
|
containerStyle?: StyleProp<ViewStyle>;
|
|
212
260
|
cellStyle?: StyleProp<ViewStyle>;
|
|
@@ -231,6 +279,7 @@ const VideoGrid = ({
|
|
|
231
279
|
radii={radii}
|
|
232
280
|
overflowCount={overflowCount}
|
|
233
281
|
thumbnailUrl={thumbnailUrls?.[i]}
|
|
282
|
+
retryThumbnail={retryThumbnail}
|
|
234
283
|
onPress={() => onAttachmentPress(attachments[i], i)}
|
|
235
284
|
cellStyle={cellStyle}
|
|
236
285
|
playButtonStyle={playButtonStyle}
|
|
@@ -309,6 +358,8 @@ export interface CometChatVideosBubbleProps {
|
|
|
309
358
|
theme: CometChatTheme;
|
|
310
359
|
/** Per-instance style overrides — shares the `mediaGridBubbleStyles` theme key with ImagesBubble. */
|
|
311
360
|
style?: CometChatTheme["mediaGridBubbleStyles"];
|
|
361
|
+
/** Render-time params from the message list — carries the consumer's `textFormatters`. */
|
|
362
|
+
additionalParams?: AdditionalParams;
|
|
312
363
|
}
|
|
313
364
|
|
|
314
365
|
/**
|
|
@@ -319,6 +370,7 @@ export function CometChatVideosBubble({
|
|
|
319
370
|
message: initialMessage,
|
|
320
371
|
theme,
|
|
321
372
|
style,
|
|
373
|
+
additionalParams,
|
|
322
374
|
}: CometChatVideosBubbleProps) {
|
|
323
375
|
const compTheme = useCompTheme();
|
|
324
376
|
const s = deepMerge(theme.mediaGridBubbleStyles ?? {}, compTheme.mediaGridBubbleStyles ?? {}, style ?? {});
|
|
@@ -350,28 +402,6 @@ export function CometChatVideosBubble({
|
|
|
350
402
|
});
|
|
351
403
|
}, [message, allAttachments]);
|
|
352
404
|
|
|
353
|
-
// §8.7 — refresh the local copy when the server edits the message in (async thumbnails).
|
|
354
|
-
useEffect(() => {
|
|
355
|
-
const listenerId = `VideosBubble_${message.getId?.() ?? message.getMuid?.() ?? Date.now()}`;
|
|
356
|
-
CometChatMessageEvents.addListener(
|
|
357
|
-
CometChatMessageEvents.messageEdited,
|
|
358
|
-
listenerId,
|
|
359
|
-
(edited: CometChat.BaseMessage) => {
|
|
360
|
-
const editedId = edited.getId?.();
|
|
361
|
-
const editedMuid = edited.getMuid?.();
|
|
362
|
-
const myId = message.getId?.();
|
|
363
|
-
const myMuid = message.getMuid?.();
|
|
364
|
-
if (
|
|
365
|
-
edited instanceof CometChat.MediaMessage &&
|
|
366
|
-
((myId && editedId && myId === editedId) || (myMuid && editedMuid && myMuid === editedMuid))
|
|
367
|
-
) {
|
|
368
|
-
setMessage(edited);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
);
|
|
372
|
-
return () => CometChatMessageEvents.removeListener(CometChatMessageEvents.messageEdited, listenerId);
|
|
373
|
-
}, []);
|
|
374
|
-
|
|
375
405
|
useEffect(() => {
|
|
376
406
|
setMessage(initialMessage);
|
|
377
407
|
}, [initialMessage]);
|
|
@@ -383,6 +413,7 @@ export function CometChatVideosBubble({
|
|
|
383
413
|
<VideoGrid
|
|
384
414
|
attachments={allAttachments}
|
|
385
415
|
thumbnailUrls={thumbnailUrls}
|
|
416
|
+
retryThumbnail={Date.now() / 1000 - (message.getSentAt?.() ?? 0) < THUMBNAIL_RETRY_WINDOW_SECS}
|
|
386
417
|
containerStyle={s.containerStyle}
|
|
387
418
|
cellStyle={s.cellStyle}
|
|
388
419
|
playButtonStyle={s.playButtonStyle}
|
|
@@ -402,6 +433,7 @@ export function CometChatVideosBubble({
|
|
|
402
433
|
{Boolean(caption) && (
|
|
403
434
|
<CometChatCaptionText
|
|
404
435
|
message={message}
|
|
436
|
+
additionalParams={additionalParams}
|
|
405
437
|
caption={caption}
|
|
406
438
|
theme={theme}
|
|
407
439
|
containerStyle={{
|
|
@@ -8,6 +8,7 @@ import { CometChatAudioBubble } from '../CometChatAudioBubble';
|
|
|
8
8
|
import { CometChatCaptionText } from '../CometChatCaptionText';
|
|
9
9
|
import { deepMerge } from '../../helper/helperFunctions';
|
|
10
10
|
import { useCompTheme } from '../../../theme/hook';
|
|
11
|
+
import { AdditionalParams } from "../../base/Types";
|
|
11
12
|
|
|
12
13
|
// ---------------------------------------------------------------------------
|
|
13
14
|
// Design doc §8.1a — the "VoiceNoteBubble": renders a RECORDED voice-note message
|
|
@@ -23,6 +24,8 @@ export interface CometChatVoiceNoteBubbleProps {
|
|
|
23
24
|
theme: CometChatTheme;
|
|
24
25
|
/** Per-instance style overrides (same pattern as the other bubbles). */
|
|
25
26
|
style?: CometChatTheme["voiceNoteBubbleStyles"];
|
|
27
|
+
/** Render-time params from the message list — carries the consumer's `textFormatters`. */
|
|
28
|
+
additionalParams?: AdditionalParams;
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
/**
|
|
@@ -33,6 +36,7 @@ export function CometChatVoiceNoteBubble({
|
|
|
33
36
|
message,
|
|
34
37
|
theme,
|
|
35
38
|
style,
|
|
39
|
+
additionalParams,
|
|
36
40
|
}: CometChatVoiceNoteBubbleProps) {
|
|
37
41
|
const compTheme = useCompTheme();
|
|
38
42
|
const s = deepMerge(theme.voiceNoteBubbleStyles ?? {}, compTheme.voiceNoteBubbleStyles ?? {}, style ?? {});
|
|
@@ -60,6 +64,7 @@ export function CometChatVoiceNoteBubble({
|
|
|
60
64
|
{Boolean(caption) && (
|
|
61
65
|
<CometChatCaptionText
|
|
62
66
|
message={message}
|
|
67
|
+
additionalParams={additionalParams}
|
|
63
68
|
caption={caption}
|
|
64
69
|
theme={theme}
|
|
65
70
|
containerStyle={{
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
# Manual Test Cases — `loadLastAgentConversation`
|
|
2
|
-
|
|
3
|
-
## Prerequisites
|
|
4
|
-
- An `@agentic` user configured in your CometChat dashboard
|
|
5
|
-
- The example app running with `loadLastAgentConversation={true}` on `CometChatMessageList`
|
|
6
|
-
- At least one previous conversation with the agent (send a message, get a response)
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## TC-1: Auto-loads last conversation on open
|
|
11
|
-
|
|
12
|
-
**Steps:**
|
|
13
|
-
1. Have at least one previous conversation with the agent (send "Hello", wait for reply)
|
|
14
|
-
2. Navigate away from the agent chat (go back to conversation list)
|
|
15
|
-
3. Open the agent chat again
|
|
16
|
-
|
|
17
|
-
**Expected:**
|
|
18
|
-
- A loading indicator appears briefly
|
|
19
|
-
- The previous conversation messages load automatically
|
|
20
|
-
- You see your last messages and the agent's responses
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## TC-2: Shows greeting/empty state when no previous conversation exists
|
|
25
|
-
|
|
26
|
-
**Steps:**
|
|
27
|
-
1. Use a fresh `@agentic` user with no message history (or use a new logged-in user who hasn't chatted with the agent)
|
|
28
|
-
2. Open the agent chat
|
|
29
|
-
|
|
30
|
-
**Expected:**
|
|
31
|
-
- The agent greeting view appears (avatar, greeting message, suggested messages)
|
|
32
|
-
- No loading spinner hangs indefinitely
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## TC-3: "New Chat" button from header shows empty state
|
|
37
|
-
|
|
38
|
-
**Steps:**
|
|
39
|
-
1. Open the agent chat (previous conversation auto-loads)
|
|
40
|
-
2. Tap the "New Chat" button (pencil/compose icon) in the header
|
|
41
|
-
|
|
42
|
-
**Expected:**
|
|
43
|
-
- The screen resets to the greeting/empty state
|
|
44
|
-
- The previous conversation is NOT re-loaded
|
|
45
|
-
- You can type a fresh message to start a new conversation
|
|
46
|
-
|
|
47
|
-
---
|
|
48
|
-
|
|
49
|
-
## TC-4: "New Chat" button from Chat History drawer works
|
|
50
|
-
|
|
51
|
-
**Steps:**
|
|
52
|
-
1. Open the agent chat
|
|
53
|
-
2. Tap the "Chat History" button in the header to open the history drawer
|
|
54
|
-
3. Tap the "New Chat" button inside the history drawer
|
|
55
|
-
|
|
56
|
-
**Expected:**
|
|
57
|
-
- The history drawer closes
|
|
58
|
-
- The message list resets to greeting/empty state
|
|
59
|
-
- The previous conversation is NOT re-loaded
|
|
60
|
-
|
|
61
|
-
---
|
|
62
|
-
|
|
63
|
-
## TC-5: Loading a specific conversation from Chat History still works
|
|
64
|
-
|
|
65
|
-
**Steps:**
|
|
66
|
-
1. Open the agent chat (previous conversation auto-loads)
|
|
67
|
-
2. Tap the "Chat History" button in the header
|
|
68
|
-
3. Tap on a specific past conversation from the list
|
|
69
|
-
|
|
70
|
-
**Expected:**
|
|
71
|
-
- The selected conversation loads with all its messages
|
|
72
|
-
- Streaming/responses still work if you send a new message in that thread
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
## TC-6: Sending a new message after "New Chat" starts a new thread
|
|
77
|
-
|
|
78
|
-
**Steps:**
|
|
79
|
-
1. Open the agent chat (previous conversation auto-loads)
|
|
80
|
-
2. Tap "New Chat" (message list resets to empty)
|
|
81
|
-
3. Type and send a message (e.g., "What's the weather?")
|
|
82
|
-
|
|
83
|
-
**Expected:**
|
|
84
|
-
- Your message appears in the list
|
|
85
|
-
- A streaming indicator shows while the agent responds
|
|
86
|
-
- The agent's reply appears correctly
|
|
87
|
-
- This is now a NEW conversation thread (not appended to the old one)
|
|
88
|
-
|
|
89
|
-
---
|
|
90
|
-
|
|
91
|
-
## TC-7: Re-opening after new chat shows the NEW conversation
|
|
92
|
-
|
|
93
|
-
**Steps:**
|
|
94
|
-
1. Complete TC-6 (start a new chat, send message, get reply)
|
|
95
|
-
2. Navigate away from the agent chat
|
|
96
|
-
3. Open the agent chat again
|
|
97
|
-
|
|
98
|
-
**Expected:**
|
|
99
|
-
- The most recent conversation (from step 1-2) auto-loads
|
|
100
|
-
- You see the "What's the weather?" message and the agent's response
|
|
101
|
-
- NOT the older conversation from before
|
|
102
|
-
|
|
103
|
-
---
|
|
104
|
-
|
|
105
|
-
## TC-8: `loadLastAgentConversation={false}` preserves existing behavior
|
|
106
|
-
|
|
107
|
-
**Steps:**
|
|
108
|
-
1. Change the prop to `loadLastAgentConversation={false}` (or remove it) in Messages.tsx
|
|
109
|
-
2. Open the agent chat (even with previous conversations)
|
|
110
|
-
|
|
111
|
-
**Expected:**
|
|
112
|
-
- The greeting/empty state shows immediately
|
|
113
|
-
- No automatic loading of previous conversation
|
|
114
|
-
- Behaves exactly as before this feature was added
|
|
115
|
-
|
|
116
|
-
---
|
|
117
|
-
|
|
118
|
-
## TC-9: Non-agentic users are unaffected
|
|
119
|
-
|
|
120
|
-
**Steps:**
|
|
121
|
-
1. With `loadLastAgentConversation={true}` still set
|
|
122
|
-
2. Open a regular (non-agentic) user chat that has message history
|
|
123
|
-
|
|
124
|
-
**Expected:**
|
|
125
|
-
- Messages load normally (standard behavior)
|
|
126
|
-
- No change in behavior — the prop only applies to `@agentic` users
|
|
127
|
-
|
|
128
|
-
---
|
|
129
|
-
|
|
130
|
-
## TC-10: Scroll up to load older messages in auto-loaded conversation
|
|
131
|
-
|
|
132
|
-
**Steps:**
|
|
133
|
-
1. Have a long conversation history with the agent (30+ messages)
|
|
134
|
-
2. Open the agent chat (auto-loads last conversation)
|
|
135
|
-
3. Scroll up to the top of the loaded messages
|
|
136
|
-
|
|
137
|
-
**Expected:**
|
|
138
|
-
- Older messages load (pagination works)
|
|
139
|
-
- No crash or infinite spinner
|
|
140
|
-
- The loading indicator appears at the top while fetching
|
|
141
|
-
|
|
142
|
-
---
|
|
143
|
-
|
|
144
|
-
## TC-11: Delete all history from Chat History panel
|
|
145
|
-
|
|
146
|
-
**Steps:**
|
|
147
|
-
1. Open the agent chat
|
|
148
|
-
2. Open Chat History drawer
|
|
149
|
-
3. Long-press and delete all conversations one by one until none remain
|
|
150
|
-
|
|
151
|
-
**Expected:**
|
|
152
|
-
- When the last conversation is deleted, the list shows empty state
|
|
153
|
-
- The message list resets to greeting/empty view
|
|
154
|
-
- Re-opening the chat shows greeting (no conversation to auto-load)
|