@cometchat/chat-uikit-react-native 5.5.4 → 5.7.0
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/src/main/java/com/reactnativecometchatuikit/CometChatKeyboardModule.kt +101 -0
- package/android/src/main/java/com/reactnativecometchatuikit/CometchatUiKitPackage.java +1 -0
- package/android/src/main/java/com/reactnativecometchatuikit/FileManager.java +78 -3
- package/android/src/main/java/com/reactnativecometchatuikit/KeyboardDirectionWatcher.kt +64 -0
- package/android/src/main/java/com/reactnativecometchatuikit/KeyboardLanguageDirection.kt +44 -0
- package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorView.kt +287 -49
- package/android/src/main/java/com/reactnativecometchatuikit/SafeFileName.java +78 -0
- package/ios/CCLocalFileGuard.h +19 -0
- package/ios/CCLocalFileGuard.m +34 -0
- package/ios/CometChatKeyboardModule.m +9 -0
- package/ios/CometChatKeyboardModule.swift +71 -0
- package/ios/FileManager.m +70 -6
- package/ios/KeyboardLanguageDirection.swift +24 -0
- package/ios/RichTextEditorView.swift +253 -51
- package/ios/RichTextEditorViewManager.m +1 -0
- package/ios/VideoManager.m +1 -1
- package/package.json +18 -3
- package/src/CometChatAIAssistantChatHistory/CometChatAIAssistantChatHistory.tsx +41 -57
- package/src/CometChatAIAssistantChatHistory/Skeleton.tsx +4 -1
- package/src/CometChatAIAssistantChatHistory/style.ts +5 -2
- package/src/CometChatCompactMessageComposer/CometChatCompactMessageComposer.tsx +145 -63
- package/src/CometChatCompactMessageComposer/styles.ts +7 -7
- package/src/CometChatConversations/CometChatConversations.tsx +276 -147
- package/src/CometChatConversations/Skeleton.tsx +4 -1
- package/src/CometChatConversations/style.ts +1 -1
- package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +39 -18
- package/src/CometChatGroupMembers/Skeleton.tsx +4 -1
- package/src/CometChatGroupMembers/style.ts +6 -4
- package/src/CometChatGroups/CometChatGroups.tsx +74 -58
- package/src/CometChatGroups/GroupsStyle.ts +1 -1
- package/src/CometChatGroups/Skeleton.tsx +4 -1
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +190 -96
- package/src/CometChatMessageComposer/styles.tsx +1 -1
- package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +28 -15
- package/src/CometChatMessageHeader/listners.ts +76 -56
- package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +8 -1
- package/src/CometChatMessageInformation/Skeleton.tsx +4 -1
- package/src/CometChatMessageList/CometChatMessageList.tsx +1465 -313
- package/src/CometChatMessageList/SwipeToReplyView.tsx +61 -0
- package/src/CometChatMessageList/style.ts +32 -32
- package/src/CometChatMessageList/swipeToReply.ts +25 -0
- package/src/CometChatNotificationFeed/CometChatNotificationFeed.tsx +81 -10
- package/src/CometChatNotificationFeed/style.ts +1 -1
- package/src/CometChatNotificationFeed/utils.ts +17 -18
- package/src/CometChatPinnedMessages/CometChatPinnedMessages.tsx +82 -3
- package/src/CometChatPinnedMessages/style.ts +5 -5
- package/src/CometChatRichTextEditor/RichTextEditorViewNativeComponent.ts +2 -0
- package/src/CometChatRichTextEditor/index.tsx +3 -0
- package/src/CometChatSavedMessages/CometChatSavedMessages.tsx +83 -15
- package/src/CometChatSavedMessages/style.ts +3 -3
- package/src/CometChatSearch/CometChatSearch.tsx +391 -136
- package/src/CometChatSearch/Skeleton.tsx +4 -1
- package/src/CometChatSearch/searchLabels.ts +26 -0
- package/src/CometChatSearch/style.ts +7 -7
- package/src/CometChatThreadHeader/CometChatThreadHeader.tsx +34 -8
- package/src/CometChatThreadHeader/Header.tsx +2 -2
- package/src/CometChatUsers/CometChatUsers.tsx +10 -1
- package/src/CometChatUsers/Skeleton.tsx +4 -1
- package/src/CometChatUsers/style.ts +1 -1
- package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +27 -1
- package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +16 -4
- package/src/calls/CometChatCallLogs/Skeleton.tsx +4 -1
- package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +11 -3
- package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +10 -2
- package/src/extensions/CollaborativeBubble/style.ts +4 -4
- package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +1 -1
- package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +1 -1
- package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +11 -6
- package/src/extensions/LinkPreview/style.ts +6 -6
- package/src/extensions/Polls/Header.tsx +1 -1
- package/src/extensions/Polls/Polls.tsx +25 -12
- package/src/extensions/Polls/PollsBubble.tsx +10 -6
- package/src/extensions/Polls/style.ts +4 -4
- package/src/extensions/Stickers/CometChatStickerKeyboard/CometChatStickerKeyboard.tsx +2 -2
- package/src/extensions/Stickers/CometChatStickerKeyboard/Skeleton.tsx +1 -1
- package/src/extensions/Stickers/CometChatStickerKeyboard/style.ts +1 -1
- package/src/extensions/Stickers/StickersExtensionDecorator.tsx +4 -2
- package/src/index.ts +11 -1
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +102 -2
- package/src/shared/CometChatUiKit/UIKitSettings.ts +28 -0
- package/src/shared/events/CometChatUIEventHandler/Listener.ts +10 -0
- package/src/shared/events/index.ts +4 -0
- package/src/shared/events/offline.ts +28 -0
- package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +18 -13
- package/src/shared/formatters/CometChatRichTextFormatter/index.tsx +15 -7
- package/src/shared/formatters/CometChatTextFormatter.ts +11 -0
- package/src/shared/formatters/CometChatUrlsFormatter/index.tsx +7 -4
- package/src/shared/framework/MessageDataSource.tsx +51 -108
- package/src/shared/helper/LocalizedDateHelper.ts +64 -4
- package/src/shared/helper/helperFunctions.ts +71 -4
- package/src/shared/helper/keyboardDirection.ts +54 -0
- package/src/shared/helper/layoutDirection.ts +205 -0
- package/src/shared/helper/pluralRules.ts +67 -0
- package/src/shared/helper/textDirection.ts +118 -0
- package/src/shared/icons/Icon.tsx +37 -2
- package/src/shared/icons/components/format-list-numbered-rtl.tsx +15 -0
- package/src/shared/index.ts +2 -0
- package/src/shared/offline/OfflineHub.ts +651 -0
- package/src/shared/offline/OfflineMediaBubble.tsx +49 -0
- package/src/shared/offline/OfflineViews.tsx +222 -0
- package/src/shared/offline/conversationPins.ts +137 -0
- package/src/shared/offline/conversations.ts +325 -0
- package/src/shared/offline/frameProbe.ts +24 -0
- package/src/shared/offline/gate.ts +94 -0
- package/src/shared/offline/groupActions.ts +81 -0
- package/src/shared/offline/identity.ts +162 -0
- package/src/shared/offline/index.ts +76 -0
- package/src/shared/offline/media.ts +247 -0
- package/src/shared/offline/notices.ts +84 -0
- package/src/shared/offline/reconcile.ts +296 -0
- package/src/shared/offline/searchOutcome.ts +62 -0
- package/src/shared/offline/send.ts +430 -0
- package/src/shared/offline/stateContract.ts +85 -0
- package/src/shared/offline/threadReplies.ts +125 -0
- package/src/shared/offline/twoPhase.ts +372 -0
- package/src/shared/offline/unsentActions.ts +168 -0
- package/src/shared/offline/useOfflineMediaUri.ts +87 -0
- package/src/shared/offline/useOfflineReconnect.ts +25 -0
- package/src/shared/offline/useOfflineSessionEnded.ts +22 -0
- package/src/shared/offline/useOfflineUploadTray.ts +76 -0
- package/src/shared/offline/usePresenceHidden.ts +33 -0
- package/src/shared/resources/CometChatLocalizeNew/CometChatLocalizationHelper.ts +2 -0
- package/src/shared/resources/CometChatLocalizeNew/resources/ar/translation.json +720 -0
- package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +74 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +75 -4
- package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +74 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +75 -4
- package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +74 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +74 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +74 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +74 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +74 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +82 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +74 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +74 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +74 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +90 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +74 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +74 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +74 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +74 -3
- package/src/shared/services/UploadQueueService.ts +106 -1
- package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +13 -12
- package/src/shared/utils/CometChatMessagePreview/style.ts +1 -1
- package/src/shared/utils/MessageReceiptUtils.ts +8 -0
- package/src/shared/utils/MessageUtils.tsx +14 -14
- package/src/shared/utils/PermissionUtil.ts +16 -5
- package/src/shared/utils/SavedMessagesHelper.ts +18 -1
- package/src/shared/utils/attachmentLimits.ts +3 -2
- package/src/shared/utils/catchUpCursor.ts +36 -0
- package/src/shared/utils/conversationUtils.ts +3 -5
- package/src/shared/utils/failedMessageRetry.ts +73 -0
- package/src/shared/utils/fileIconFontSize.ts +10 -0
- package/src/shared/utils/fileSizeLabel.ts +16 -0
- package/src/shared/utils/groupActionText.ts +75 -0
- package/src/shared/utils/messageIdentity.ts +38 -0
- package/src/shared/views/CometChatAIAssistantMessageBubble/CometChatAIAssistantMessageBubble.tsx +12 -8
- package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentPreview.style.ts +1 -1
- package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentPreviewItem.tsx +5 -3
- package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentTile.tsx +22 -17
- package/src/shared/views/CometChatAttachmentViewer/CometChatAttachmentViewer.tsx +45 -12
- package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +16 -10
- package/src/shared/views/CometChatAudiosBubble/CometChatAudiosBubble.tsx +20 -8
- package/src/shared/views/CometChatBadge/CometChatBadge.tsx +8 -4
- package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +6 -2
- package/src/shared/views/CometChatComposerErrorBanner.tsx +3 -1
- package/src/shared/views/CometChatConfirmDialog/CometChatConfirmDialog.tsx +8 -3
- package/src/shared/views/CometChatConversationStarter/CometChatConversationStarter.tsx +2 -2
- package/src/shared/views/CometChatEmojiKeyboard/CometChatEmojiKeyboard.tsx +5 -3
- package/src/shared/views/CometChatEmojiKeyboard/emojis.ts +8 -8
- package/src/shared/views/CometChatEmojiKeyboard/style.ts +2 -2
- package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +13 -27
- package/src/shared/views/CometChatFilesBubble/CometChatFilesBubble.tsx +65 -15
- package/src/shared/views/CometChatImageViewerModal/ImageViewerModal.tsx +7 -3
- package/src/shared/views/CometChatImagesBubble/CometChatImagesBubble.tsx +56 -25
- package/src/shared/views/CometChatInlineAudioRecorder/CometChatInlineAudioRecorder.tsx +41 -21
- package/src/shared/views/CometChatInlineAudioRecorder/useAudioRecorder.ts +7 -3
- package/src/shared/views/CometChatLinkConfirmPopup/CometChatLinkConfirmPopup.tsx +7 -3
- package/src/shared/views/CometChatList/CometChatList.tsx +478 -21
- package/src/shared/views/CometChatList/Header.tsx +5 -2
- package/src/shared/views/CometChatList/sectionLetter.ts +44 -0
- package/src/shared/views/CometChatList/styles.ts +7 -7
- package/src/shared/views/CometChatListItem/CometChatListItem.tsx +6 -4
- package/src/shared/views/CometChatMediaRecorder/CometChatAudioPlayer.tsx +16 -10
- package/src/shared/views/CometChatMediaRecorder/Timer.tsx +5 -1
- package/src/shared/views/CometChatMediaViewer/CometChatMediaViewer.tsx +43 -16
- package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +24 -4
- package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +19 -2
- package/src/shared/views/CometChatNewMessageIndicator/CometChatNewMessageIndicator.tsx +3 -2
- package/src/shared/views/CometChatReactionList/CometChatReactionList.tsx +59 -12
- package/src/shared/views/CometChatReactionList/ReactionListStyle.tsx +2 -2
- package/src/shared/views/CometChatReactionList/Skeleton.tsx +4 -1
- package/src/shared/views/CometChatReactions/CometChatReactions.tsx +6 -2
- package/src/shared/views/CometChatReportDialog/CometChatReportDialog.tsx +7 -3
- package/src/shared/views/CometChatReportDialog/style.ts +1 -1
- package/src/shared/views/CometChatSmartReplies/CometChatSmartReplies.tsx +1 -1
- package/src/shared/views/CometChatStatusIndicator/CometChatStatusIndicator.tsx +4 -0
- package/src/shared/views/CometChatStreamMessageBubble/CometChatStreamMessageBubble.tsx +20 -13
- package/src/shared/views/CometChatSuggestionList/CometChatSuggestionList.tsx +3 -2
- package/src/shared/views/CometChatSuggestionList/Skeleton.tsx +1 -1
- package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +29 -3
- package/src/shared/views/CometChatTooltipMenu/CometChatTooltipMenu.tsx +20 -30
- package/src/shared/views/CometChatTooltipMenu/tooltipPosition.ts +43 -0
- package/src/shared/views/CometChatVideoBubble/style.ts +2 -2
- package/src/shared/views/CometChatVideoPlayer/CometChatVideoPlayer.tsx +4 -1
- package/src/shared/views/CometChatVideosBubble/CometChatVideosBubble.tsx +58 -24
- package/src/shared/views/CometChatVoiceNoteBubble/CometChatVoiceNoteBubble.tsx +24 -12
- package/src/shared/views/SenderLabel.tsx +41 -0
- package/src/theme/default/default.ts +1 -1
- package/src/theme/type.ts +17 -0
- package/android/.gradle/7.4/checksums/checksums.lock +0 -0
- package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.4/gc.properties +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
|
@@ -114,6 +114,10 @@ import {
|
|
|
114
114
|
import { runAfterInteractions } from '../shared/utils/runAfterInteractions';
|
|
115
115
|
import { MessageTypeConstants, ReceiverTypeConstants, ConversationOptionConstants, MentionsVisibility, MentionsTargetElement, ViewAlignment, EnterKeyBehavior, DISABLED_BUTTON_OPACITY } from '../shared/constants/UIKitConstants';
|
|
116
116
|
import { MessageEvents } from '../shared/events';
|
|
117
|
+
import { isQuietRejection, quietAwareOnError, routeSend } from "../shared/offline/send";
|
|
118
|
+
import { isOfflineOn } from "../shared/offline/gate";
|
|
119
|
+
import { useOfflineUploadTray } from "../shared/offline/useOfflineUploadTray";
|
|
120
|
+
import { offlineMutationErrorText } from "../shared/offline/notices";
|
|
117
121
|
import { CometChatUIEventHandler } from '../shared/events/CometChatUIEventHandler/CometChatUIEventHandler';
|
|
118
122
|
import { CometChatMessageEvents } from '../shared/events/CometChatMessageEvents';
|
|
119
123
|
import { ICONS } from './resources';
|
|
@@ -137,6 +141,7 @@ import { CometChatComposerErrorBanner } from '../shared/views/CometChatComposerE
|
|
|
137
141
|
import { CometChatAttachmentTray } from '../shared/views/CometChatAttachmentPreview';
|
|
138
142
|
import { CometChatMediaViewer } from '../shared/views/CometChatMediaViewer';
|
|
139
143
|
import { StagedVideoDurationProbe } from '../shared/views/CometChatAttachmentPreview/StagedVideoDurationProbe';
|
|
144
|
+
import { LayoutDirectionContext, directionStyle, useComponentLayoutDirection, useIosRtlScrollStart } from "../shared/helper/layoutDirection";
|
|
140
145
|
|
|
141
146
|
const { FileManager, CommonUtil } = NativeModules;
|
|
142
147
|
|
|
@@ -347,6 +352,7 @@ interface EmojiButtonProps {
|
|
|
347
352
|
}
|
|
348
353
|
|
|
349
354
|
const EmojiButton = ({ user, group, composerIdMap, replyToMessage, closeReplyPreview, editorRef }: EmojiButtonProps) => {
|
|
355
|
+
const { t } = useCometChatTranslation();
|
|
350
356
|
const [isPanelOpen, setIsPanelOpen] = React.useState(false);
|
|
351
357
|
const [keyboardOpen, setKeyboardOpen] = React.useState(false);
|
|
352
358
|
const theme = useTheme();
|
|
@@ -452,6 +458,7 @@ const EmojiButton = ({ user, group, composerIdMap, replyToMessage, closeReplyPre
|
|
|
452
458
|
}
|
|
453
459
|
})
|
|
454
460
|
.catch((err: any) => {
|
|
461
|
+
if (isQuietRejection(err)) return; // the session ended or the cache was reset: nothing to report
|
|
455
462
|
console.error("Failed to send sticker:", err);
|
|
456
463
|
});
|
|
457
464
|
}, [user, group, composerIdMap]);
|
|
@@ -517,7 +524,7 @@ const EmojiButton = ({ user, group, composerIdMap, replyToMessage, closeReplyPre
|
|
|
517
524
|
<TouchableOpacity
|
|
518
525
|
onPress={togglePanel}
|
|
519
526
|
style={Style.iconButton}
|
|
520
|
-
accessibilityHint='
|
|
527
|
+
accessibilityHint={t('OPEN_STICKER_PANEL')}
|
|
521
528
|
>
|
|
522
529
|
<Icon
|
|
523
530
|
name={isPanelOpen ? "sticker-fill" : "sticker"}
|
|
@@ -603,6 +610,8 @@ export interface ComposerInputHandle {
|
|
|
603
610
|
}
|
|
604
611
|
|
|
605
612
|
export interface CometChatCompactMessageComposerInterface {
|
|
613
|
+
/** Lays this component out `"ltr"` or `"rtl"`, overriding the kit's global `layoutDirection`. Not set = inherit. */
|
|
614
|
+
layoutDirection?: "ltr" | "rtl";
|
|
606
615
|
/**
|
|
607
616
|
* Message composer identifier.
|
|
608
617
|
* @type {string | number}
|
|
@@ -1247,6 +1256,10 @@ export const CometChatCompactMessageComposer = React.forwardRef(
|
|
|
1247
1256
|
// path (no staging tray, no multi-upload/fan-out). Default true = multi-attachment.
|
|
1248
1257
|
enableMultipleAttachments = true,
|
|
1249
1258
|
} = props;
|
|
1259
|
+
// ENG-41333: own setting → enclosing component → global; drives the root and the context.
|
|
1260
|
+
const direction = useComponentLayoutDirection(props.layoutDirection);
|
|
1261
|
+
// The rich-text toolbar opens at its start edge on iOS in RTL, recycled native view or not.
|
|
1262
|
+
const toolbarScrollStart = useIosRtlScrollStart(direction);
|
|
1250
1263
|
|
|
1251
1264
|
// The documented names (…ForOutgoingMessage[s]) were declared but never read, so only the
|
|
1252
1265
|
// aliases had any effect. Honour both, documented name first. Sound is on by default:
|
|
@@ -1481,7 +1494,8 @@ export const CometChatCompactMessageComposer = React.forwardRef(
|
|
|
1481
1494
|
// Cancel all in-flight uploads and discard the tray on unmount / conversation switch
|
|
1482
1495
|
useEffect(() => {
|
|
1483
1496
|
return () => {
|
|
1484
|
-
|
|
1497
|
+
// Offline OFF: destroy the batch as today; ON: detach so it can be restored.
|
|
1498
|
+
uploadQueue.leave();
|
|
1485
1499
|
setSelectedAttachments([]);
|
|
1486
1500
|
};
|
|
1487
1501
|
// uploadQueue is stable (useMemo with [] deps), so this only runs on unmount
|
|
@@ -1530,13 +1544,13 @@ export const CometChatCompactMessageComposer = React.forwardRef(
|
|
|
1530
1544
|
// Pass the target conversation so the SDK can hand receiver/receiverType to the server for
|
|
1531
1545
|
// RBAC/SBAC presign authorization. Refs are read fresh (uploadQueue is memoized, refs are not).
|
|
1532
1546
|
newAttachments.forEach(a =>
|
|
1533
|
-
uploadQueue.enqueue(a, { receiver: chatWithId.current, receiverType: chatWith.current })
|
|
1547
|
+
uploadQueue.enqueue(a, { receiver: chatWithId.current, receiverType: chatWith.current, parentMessageId })
|
|
1534
1548
|
);
|
|
1535
1549
|
} catch {
|
|
1536
1550
|
// upload queue errors are surfaced per-file via onFileFailed
|
|
1537
1551
|
}
|
|
1538
1552
|
},
|
|
1539
|
-
[selectedAttachments.length, uploadQueue]
|
|
1553
|
+
[selectedAttachments.length, uploadQueue, parentMessageId]
|
|
1540
1554
|
);
|
|
1541
1555
|
|
|
1542
1556
|
// §5.0 — clipboard paste: the native editor extracts pasted image(s)/file(s) to temp files
|
|
@@ -1572,13 +1586,13 @@ export const CometChatCompactMessageComposer = React.forwardRef(
|
|
|
1572
1586
|
// Pass the target conversation so the SDK can hand receiver/receiverType to the server for
|
|
1573
1587
|
// RBAC/SBAC presign authorization. Refs are read fresh (uploadQueue is memoized, refs are not).
|
|
1574
1588
|
newAttachments.forEach(a =>
|
|
1575
|
-
uploadQueue.enqueue(a, { receiver: chatWithId.current, receiverType: chatWith.current })
|
|
1589
|
+
uploadQueue.enqueue(a, { receiver: chatWithId.current, receiverType: chatWith.current, parentMessageId })
|
|
1576
1590
|
);
|
|
1577
1591
|
} catch {
|
|
1578
1592
|
// upload queue errors are surfaced per-file via onFileFailed
|
|
1579
1593
|
}
|
|
1580
1594
|
},
|
|
1581
|
-
[enableMultipleAttachments, uploadQueue]
|
|
1595
|
+
[enableMultipleAttachments, uploadQueue, parentMessageId]
|
|
1582
1596
|
);
|
|
1583
1597
|
|
|
1584
1598
|
// §8.2 — staged image/video items (LOCAL URIs) for the full-screen tray preview viewer — the
|
|
@@ -1980,6 +1994,31 @@ export const CometChatCompactMessageComposer = React.forwardRef(
|
|
|
1980
1994
|
replyMessageRef.current = replyMessage;
|
|
1981
1995
|
}, [replyMessage]);
|
|
1982
1996
|
|
|
1997
|
+
// Offline ON: moving to another (receiver, type, thread parent) detaches the batch, which the
|
|
1998
|
+
// SDK keeps for a restore when the user comes back (BEH-UPLOAD-14). Offline OFF: today's tray.
|
|
1999
|
+
const trayOwner = `${user?.getUid?.() ?? ""}|${group?.getGuid?.() ?? ""}|${parentMessageId ?? ""}`;
|
|
2000
|
+
const trayOwnerRef = React.useRef(trayOwner);
|
|
2001
|
+
useEffect(() => {
|
|
2002
|
+
if (trayOwnerRef.current === trayOwner) return;
|
|
2003
|
+
trayOwnerRef.current = trayOwner;
|
|
2004
|
+
if (!isOfflineOn()) return;
|
|
2005
|
+
uploadQueue.detach();
|
|
2006
|
+
selectedAttachmentsRef.current = [];
|
|
2007
|
+
setSelectedAttachments([]);
|
|
2008
|
+
}, [trayOwner, uploadQueue]);
|
|
2009
|
+
|
|
2010
|
+
// Offline ON: restore this chat's tray and clear it with the session. Offline OFF: nothing.
|
|
2011
|
+
useOfflineUploadTray(
|
|
2012
|
+
uploadQueue,
|
|
2013
|
+
{
|
|
2014
|
+
receiver: user?.getUid?.() ?? group?.getGuid?.(),
|
|
2015
|
+
receiverType: user?.getUid?.() ? ReceiverTypeConstants.user : group?.getGuid?.() ? ReceiverTypeConstants.group : undefined,
|
|
2016
|
+
parentMessageId,
|
|
2017
|
+
},
|
|
2018
|
+
selectedAttachmentsRef,
|
|
2019
|
+
setSelectedAttachments
|
|
2020
|
+
);
|
|
2021
|
+
|
|
1983
2022
|
// Configure receiver from user prop
|
|
1984
2023
|
useEffect(() => {
|
|
1985
2024
|
if (user) {
|
|
@@ -2046,6 +2085,8 @@ export const CometChatCompactMessageComposer = React.forwardRef(
|
|
|
2046
2085
|
|
|
2047
2086
|
// Clone and store formatter using tracking character as key (matching MessageComposer pattern)
|
|
2048
2087
|
const newFormatter = CommonUtils.clone(formatter);
|
|
2088
|
+
// Only the composer's copy draws the input box; the app's instance may also draw the list.
|
|
2089
|
+
newFormatter.markAsComposerInput?.();
|
|
2049
2090
|
// A formatter with no tracking character has no suggestion list, but it still takes part in
|
|
2050
2091
|
// the send and edit-preview lifecycle — so key it by id instead of dropping it. The prefix
|
|
2051
2092
|
// keeps it out of reach of the single-character lookup that opens the suggestion list.
|
|
@@ -2558,14 +2599,19 @@ export const CometChatCompactMessageComposer = React.forwardRef(
|
|
|
2558
2599
|
|
|
2559
2600
|
// §7/§12.1 — independent per-message send: one kind can fail while others deliver.
|
|
2560
2601
|
const outgoing = buildMessage(group, index, muid);
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2602
|
+
// Gate read once, at send: OFF runs today's code unchanged; ON goes through the
|
|
2603
|
+
// kit's one send helper (hub reports state and the public events, once).
|
|
2604
|
+
const routed = routeSend(outgoing, "media", () => {
|
|
2605
|
+
CometChat.sendMediaMessage(outgoing)
|
|
2606
|
+
.then((msg: any) => {
|
|
2607
|
+
CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccMessageSent, {
|
|
2608
|
+
message: msg,
|
|
2609
|
+
status: messageStatus.success,
|
|
2610
|
+
});
|
|
2611
|
+
})
|
|
2612
|
+
.catch(() => markSendFailed(outgoing));
|
|
2613
|
+
}, {});
|
|
2614
|
+
void routed;
|
|
2569
2615
|
});
|
|
2570
2616
|
|
|
2571
2617
|
// ENG-36991 — clear the swipe-to-reply preview FIRST, before the teardown below. clearInputBox()
|
|
@@ -2702,21 +2748,28 @@ export const CometChatCompactMessageComposer = React.forwardRef(
|
|
|
2702
2748
|
}
|
|
2703
2749
|
|
|
2704
2750
|
// Send message via SDK
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2751
|
+
// Gate read once, at send: OFF runs today's code unchanged; ON goes through the
|
|
2752
|
+
// kit's one send helper (hub reports state and the public events, once).
|
|
2753
|
+
const routed = routeSend(mediaMessage, "media", () => {
|
|
2754
|
+
CometChat.sendMediaMessage(mediaMessage)
|
|
2755
|
+
.then((message: CometChat.BaseMessage) => {
|
|
2756
|
+
CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccMessageSent, {
|
|
2757
|
+
message: message,
|
|
2758
|
+
status: messageStatus.success,
|
|
2759
|
+
});
|
|
2760
|
+
})
|
|
2761
|
+
.catch((error: CometChat.CometChatException) => {
|
|
2762
|
+
onError?.(error);
|
|
2763
|
+
(localMessage as any).data.metaData = { error: true };
|
|
2764
|
+
CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccMessageSent, {
|
|
2765
|
+
message: localMessage,
|
|
2766
|
+
status: messageStatus.error,
|
|
2767
|
+
});
|
|
2718
2768
|
});
|
|
2719
|
-
|
|
2769
|
+
}, {
|
|
2770
|
+
onFailed: quietAwareOnError(onError),
|
|
2771
|
+
});
|
|
2772
|
+
void routed;
|
|
2720
2773
|
};
|
|
2721
2774
|
|
|
2722
2775
|
/**
|
|
@@ -3430,7 +3483,7 @@ export const CometChatCompactMessageComposer = React.forwardRef(
|
|
|
3430
3483
|
flexDirection: 'row',
|
|
3431
3484
|
alignItems: 'center',
|
|
3432
3485
|
paddingTop: 5,
|
|
3433
|
-
|
|
3486
|
+
paddingStart: 5,
|
|
3434
3487
|
borderTopWidth: 1,
|
|
3435
3488
|
borderTopColor: theme.color.borderDefault,
|
|
3436
3489
|
}}
|
|
@@ -3443,7 +3496,7 @@ export const CometChatCompactMessageComposer = React.forwardRef(
|
|
|
3443
3496
|
/>
|
|
3444
3497
|
<Text
|
|
3445
3498
|
style={{
|
|
3446
|
-
|
|
3499
|
+
marginStart: 5,
|
|
3447
3500
|
color: theme.color.textSecondary,
|
|
3448
3501
|
...theme.typography.caption1.regular,
|
|
3449
3502
|
}}
|
|
@@ -3780,7 +3833,7 @@ export const CometChatCompactMessageComposer = React.forwardRef(
|
|
|
3780
3833
|
<Icon name='info-fill' color={theme.color.error} height={16} width={16} />
|
|
3781
3834
|
<Text
|
|
3782
3835
|
style={{
|
|
3783
|
-
|
|
3836
|
+
marginStart: 5,
|
|
3784
3837
|
color: theme.color.error,
|
|
3785
3838
|
...theme.typography.caption1.regular,
|
|
3786
3839
|
}}
|
|
@@ -4466,42 +4519,60 @@ export const CometChatCompactMessageComposer = React.forwardRef(
|
|
|
4466
4519
|
}
|
|
4467
4520
|
|
|
4468
4521
|
// Send message via SDK
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4522
|
+
// Gate read once, at send: OFF runs today's code unchanged; ON goes through the
|
|
4523
|
+
// kit's one send helper (hub reports state and the public events, once).
|
|
4524
|
+
const routed = routeSend(textMessage, "text", () => {
|
|
4525
|
+
CometChat.sendMessage(textMessage)
|
|
4526
|
+
.then((message: CometChat.BaseMessage) => {
|
|
4527
|
+
/**
|
|
4528
|
+
* For agentic users without parentMessageId prop:
|
|
4529
|
+
* - Store the message ID as parent for subsequent messages
|
|
4530
|
+
* - Start streaming for the message
|
|
4531
|
+
*/
|
|
4532
|
+
if (isAgenticUser() && !parentMessageId && message?.getId) {
|
|
4533
|
+
const messageId = typeof message.getId() === 'string'
|
|
4534
|
+
? Number(message.getId())
|
|
4535
|
+
: message.getId();
|
|
4536
|
+
|
|
4537
|
+
// Store parent message ID for subsequent messages
|
|
4538
|
+
if (!isNaN(messageId) && !parentMessageIdRef.current) {
|
|
4539
|
+
parentMessageIdRef.current = messageId;
|
|
4540
|
+
}
|
|
4480
4541
|
|
|
4481
|
-
|
|
4542
|
+
// Start streaming for agentic user messages
|
|
4543
|
+
if (messageId && !isNaN(messageId)) {
|
|
4544
|
+
startStreamingForRunId(String(messageId));
|
|
4545
|
+
}
|
|
4546
|
+
}
|
|
4547
|
+
|
|
4548
|
+
CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccMessageSent, {
|
|
4549
|
+
message: message,
|
|
4550
|
+
status: messageStatus.success,
|
|
4551
|
+
});
|
|
4552
|
+
})
|
|
4553
|
+
.catch((error: CometChat.CometChatException) => {
|
|
4554
|
+
onError?.(error);
|
|
4555
|
+
(textMessage as any).data.metaData = { error: true };
|
|
4556
|
+
CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccMessageSent, {
|
|
4557
|
+
message: textMessage,
|
|
4558
|
+
status: messageStatus.error,
|
|
4559
|
+
});
|
|
4560
|
+
});
|
|
4561
|
+
}, {
|
|
4562
|
+
onSent: (message: any) => {
|
|
4563
|
+
if (isAgenticUser() && !parentMessageId && message?.getId) {
|
|
4564
|
+
const messageId = typeof message.getId() === 'string' ? Number(message.getId()) : message.getId();
|
|
4482
4565
|
if (!isNaN(messageId) && !parentMessageIdRef.current) {
|
|
4483
4566
|
parentMessageIdRef.current = messageId;
|
|
4484
4567
|
}
|
|
4485
|
-
|
|
4486
|
-
// Start streaming for agentic user messages
|
|
4487
4568
|
if (messageId && !isNaN(messageId)) {
|
|
4488
4569
|
startStreamingForRunId(String(messageId));
|
|
4489
4570
|
}
|
|
4490
4571
|
}
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
});
|
|
4496
|
-
})
|
|
4497
|
-
.catch((error: CometChat.CometChatException) => {
|
|
4498
|
-
onError?.(error);
|
|
4499
|
-
(textMessage as any).data.metaData = { error: true };
|
|
4500
|
-
CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccMessageSent, {
|
|
4501
|
-
message: textMessage,
|
|
4502
|
-
status: messageStatus.error,
|
|
4503
|
-
});
|
|
4504
|
-
});
|
|
4572
|
+
},
|
|
4573
|
+
onFailed: quietAwareOnError(onError),
|
|
4574
|
+
});
|
|
4575
|
+
void routed;
|
|
4505
4576
|
};
|
|
4506
4577
|
|
|
4507
4578
|
/**
|
|
@@ -4570,6 +4641,11 @@ export const CometChatCompactMessageComposer = React.forwardRef(
|
|
|
4570
4641
|
});
|
|
4571
4642
|
}
|
|
4572
4643
|
|
|
4644
|
+
// The composer is cleared and leaves edit mode before the request, offline on or off. A failed
|
|
4645
|
+
// edit goes to onError (plus the offline error notice below); the text is not put back, as on
|
|
4646
|
+
// the Android UI Kit.
|
|
4647
|
+
const offlineOn = isOfflineOn();
|
|
4648
|
+
|
|
4573
4649
|
// Clear input and preview
|
|
4574
4650
|
clearInputBox();
|
|
4575
4651
|
setMessagePreview(null);
|
|
@@ -4595,6 +4671,9 @@ export const CometChatCompactMessageComposer = React.forwardRef(
|
|
|
4595
4671
|
})
|
|
4596
4672
|
.catch((error: CometChat.CometChatException) => {
|
|
4597
4673
|
onError?.(error);
|
|
4674
|
+
// Offline ON: today's error notice too (ENG-41199).
|
|
4675
|
+
const errorText = offlineMutationErrorText(offlineOn, t);
|
|
4676
|
+
if (errorText) showToast(errorText);
|
|
4598
4677
|
});
|
|
4599
4678
|
};
|
|
4600
4679
|
|
|
@@ -4929,7 +5008,7 @@ export const CometChatCompactMessageComposer = React.forwardRef(
|
|
|
4929
5008
|
<Animated.View
|
|
4930
5009
|
style={{
|
|
4931
5010
|
width: micWidthAnim.interpolate({ inputRange: [0, 1], outputRange: [0, 24] }),
|
|
4932
|
-
|
|
5011
|
+
marginStart: micWidthAnim.interpolate({ inputRange: [0, 1], outputRange: [-16, 0] }),
|
|
4933
5012
|
overflow: 'hidden' as const,
|
|
4934
5013
|
}}
|
|
4935
5014
|
>
|
|
@@ -4993,6 +5072,7 @@ export const CometChatCompactMessageComposer = React.forwardRef(
|
|
|
4993
5072
|
];
|
|
4994
5073
|
|
|
4995
5074
|
return (
|
|
5075
|
+
<LayoutDirectionContext.Provider value={direction}>
|
|
4996
5076
|
<>
|
|
4997
5077
|
{/* Modal for custom views */}
|
|
4998
5078
|
<Modal
|
|
@@ -5019,7 +5099,7 @@ export const CometChatCompactMessageComposer = React.forwardRef(
|
|
|
5019
5099
|
{...keyboardAvoidingViewProps}
|
|
5020
5100
|
>
|
|
5021
5101
|
{/* Outer wrapper with padding (matches Figma: Message Composer) */}
|
|
5022
|
-
<View style={wrapperStyle}>
|
|
5102
|
+
<View style={[wrapperStyle, directionStyle(direction)]}>
|
|
5023
5103
|
{/* Error banner floats ABOVE the composer, over the message list. Anchored to the outer
|
|
5024
5104
|
wrapper (bottom:100%), NOT the bordered container which clips via overflow:hidden. */}
|
|
5025
5105
|
<View
|
|
@@ -5116,8 +5196,8 @@ export const CometChatCompactMessageComposer = React.forwardRef(
|
|
|
5116
5196
|
titleStyle={{ color: theme.color.textHighlight as string }}
|
|
5117
5197
|
style={{
|
|
5118
5198
|
borderRadius: 8,
|
|
5119
|
-
|
|
5120
|
-
|
|
5199
|
+
borderStartWidth: 3,
|
|
5200
|
+
borderStartColor: theme.color.borderHighlight as string,
|
|
5121
5201
|
margin: theme.spacing?.padding?.p1 || 4,
|
|
5122
5202
|
}}
|
|
5123
5203
|
/>
|
|
@@ -5308,6 +5388,7 @@ export const CometChatCompactMessageComposer = React.forwardRef(
|
|
|
5308
5388
|
}}>
|
|
5309
5389
|
<ScrollView
|
|
5310
5390
|
testID="toolbar-scrollview"
|
|
5391
|
+
{...toolbarScrollStart}
|
|
5311
5392
|
horizontal
|
|
5312
5393
|
showsHorizontalScrollIndicator={false}
|
|
5313
5394
|
contentContainerStyle={richTextToolbarStyles.toolbarScrollContent}
|
|
@@ -5447,6 +5528,7 @@ export const CometChatCompactMessageComposer = React.forwardRef(
|
|
|
5447
5528
|
}}
|
|
5448
5529
|
/>
|
|
5449
5530
|
</>
|
|
5531
|
+
</LayoutDirectionContext.Provider>
|
|
5450
5532
|
);
|
|
5451
5533
|
}
|
|
5452
5534
|
);
|
|
@@ -51,27 +51,27 @@ export const Style = StyleSheet.create({
|
|
|
51
51
|
leftIconsContainer: {
|
|
52
52
|
flexDirection: 'row',
|
|
53
53
|
alignItems: 'center',
|
|
54
|
-
|
|
54
|
+
marginEnd: 12,
|
|
55
55
|
},
|
|
56
56
|
// Left icons container - top aligned for expanded state
|
|
57
57
|
leftIconsContainerTop: {
|
|
58
58
|
flexDirection: 'row',
|
|
59
59
|
alignItems: 'flex-start',
|
|
60
|
-
|
|
60
|
+
marginEnd: 12,
|
|
61
61
|
paddingTop: 0,
|
|
62
62
|
},
|
|
63
63
|
// Right icons container with spacing (matches Figma: Icons right - gap 16px)
|
|
64
64
|
rightIconsContainer: {
|
|
65
65
|
flexDirection: 'row',
|
|
66
66
|
alignItems: 'center',
|
|
67
|
-
|
|
67
|
+
marginStart: 12,
|
|
68
68
|
gap: 16,
|
|
69
69
|
},
|
|
70
70
|
// Right icons container - top aligned for expanded state
|
|
71
71
|
rightIconsContainerTop: {
|
|
72
72
|
flexDirection: 'row',
|
|
73
73
|
alignItems: 'flex-start',
|
|
74
|
-
|
|
74
|
+
marginStart: 12,
|
|
75
75
|
paddingTop: 0,
|
|
76
76
|
gap: 16,
|
|
77
77
|
},
|
|
@@ -156,7 +156,7 @@ export const Style = StyleSheet.create({
|
|
|
156
156
|
flexDirection: 'row',
|
|
157
157
|
alignItems: 'center',
|
|
158
158
|
paddingTop: 5,
|
|
159
|
-
|
|
159
|
+
paddingStart: 5,
|
|
160
160
|
borderTopWidth: 1,
|
|
161
161
|
},
|
|
162
162
|
// Mention limit icon
|
|
@@ -166,7 +166,7 @@ export const Style = StyleSheet.create({
|
|
|
166
166
|
},
|
|
167
167
|
// Mention limit text
|
|
168
168
|
mentionLimitText: {
|
|
169
|
-
|
|
169
|
+
marginStart: 5,
|
|
170
170
|
},
|
|
171
171
|
});
|
|
172
172
|
|
|
@@ -188,7 +188,7 @@ const getAttachmentOptionsStyle = (
|
|
|
188
188
|
titleStyle: {
|
|
189
189
|
...typography.body.regular,
|
|
190
190
|
color: color.textPrimary,
|
|
191
|
-
|
|
191
|
+
paddingStart: spacing.padding.p1,
|
|
192
192
|
},
|
|
193
193
|
iconStyle: {
|
|
194
194
|
height: 24,
|