@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
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { CallingExtension } from "../../calls";
|
|
2
2
|
import { ExtensionsDataSource } from "../framework";
|
|
3
|
+
import type { CometChatLayoutDirection } from "../helper/layoutDirection";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Offline settings handed through to the Chat SDK's `OfflineConfig` (README §4). The kit's own
|
|
7
|
+
* structural type, so it never names an SDK type an older SDK lacks; an SDK `OfflineConfig`
|
|
8
|
+
* instance is accepted as is. The kit never reads it back: it asks the SDK
|
|
9
|
+
* (`CometChat.isOfflineEnabled()`) at each decision instead.
|
|
10
|
+
*/
|
|
11
|
+
export interface UIKitOfflineSettings {
|
|
12
|
+
/** Turn offline messaging on. Default `false`. */
|
|
13
|
+
enabled?: boolean;
|
|
14
|
+
[option: string]: unknown;
|
|
15
|
+
}
|
|
3
16
|
|
|
4
17
|
export type UIKitSettings = {
|
|
5
18
|
appId: string;
|
|
@@ -15,6 +28,17 @@ export type UIKitSettings = {
|
|
|
15
28
|
extensions?: ExtensionsDataSource[];
|
|
16
29
|
roles?: string[];
|
|
17
30
|
callingExtension?: CallingExtension;
|
|
31
|
+
/**
|
|
32
|
+
* The kit's layout direction: `'auto'` (default, follow the app), `'ltr'` or `'rtl'`. Needs no
|
|
33
|
+
* `I18nManager.forceRTL` and no reload; the app's own screens are not affected.
|
|
34
|
+
*/
|
|
35
|
+
layoutDirection?: CometChatLayoutDirection;
|
|
36
|
+
/**
|
|
37
|
+
* Offline messaging (Chat SDK 4.2.1 or later). `true`, an options object, or an SDK
|
|
38
|
+
* `OfflineConfig`. Absent ⇒ offline off and the kit behaves exactly as before. Ignored by an
|
|
39
|
+
* SDK below 4.2.1, which the kit runs online only.
|
|
40
|
+
*/
|
|
41
|
+
offline?: boolean | UIKitOfflineSettings | object;
|
|
18
42
|
};
|
|
19
43
|
|
|
20
44
|
export function UIKitSettings({
|
|
@@ -31,6 +55,8 @@ export function UIKitSettings({
|
|
|
31
55
|
extensions,
|
|
32
56
|
roles,
|
|
33
57
|
callingExtension,
|
|
58
|
+
layoutDirection,
|
|
59
|
+
offline,
|
|
34
60
|
}: UIKitSettings): UIKitSettings {
|
|
35
61
|
return {
|
|
36
62
|
appId,
|
|
@@ -46,5 +72,7 @@ export function UIKitSettings({
|
|
|
46
72
|
extensions,
|
|
47
73
|
roles,
|
|
48
74
|
callingExtension,
|
|
75
|
+
layoutDirection,
|
|
76
|
+
offline,
|
|
49
77
|
};
|
|
50
78
|
}
|
|
@@ -51,6 +51,16 @@ type MessageUIEvents = {
|
|
|
51
51
|
};
|
|
52
52
|
export class MessageUIEventListener {
|
|
53
53
|
ccMessageSent?: Function = undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Offline (additive): an own message's send state changed — `{ message, state, reason? }` with
|
|
56
|
+
* `state` one of "sending" | "sent" | "failed" | "discarded". Never emitted with offline off.
|
|
57
|
+
*/
|
|
58
|
+
ccMessageSendStateChanged?: Function = undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Offline (additive): the SDK rebuilt its offline cache — `{ reason, pendingMessagesLost }`
|
|
61
|
+
* (`null` when the count is unknown). Never emitted with offline off.
|
|
62
|
+
*/
|
|
63
|
+
ccOfflineCacheReset?: Function = undefined;
|
|
54
64
|
ccMessageEdited?: Function = undefined;
|
|
55
65
|
ccMessageDeleted?: Function = undefined;
|
|
56
66
|
ccMessageRead?: Function = undefined;
|
|
@@ -3,6 +3,8 @@ import { CometChatUIEvents } from "./CometChatUIEvents";
|
|
|
3
3
|
import { CometChatConversationEvents } from "./conversations";
|
|
4
4
|
import { CometChatGroupsEvents } from "./groups";
|
|
5
5
|
import { MessageEvents } from "./messages";
|
|
6
|
+
import { OfflineMessageEvents } from "./offline";
|
|
7
|
+
import type { MessageSendState, MessageSendStateChangedEvent, OfflineCacheResetEvent } from "./offline";
|
|
6
8
|
|
|
7
9
|
export {
|
|
8
10
|
CometChatConversationEvents,
|
|
@@ -10,4 +12,6 @@ export {
|
|
|
10
12
|
CometChatUIEventHandler,
|
|
11
13
|
CometChatUIEvents,
|
|
12
14
|
MessageEvents,
|
|
15
|
+
OfflineMessageEvents,
|
|
13
16
|
};
|
|
17
|
+
export type { MessageSendState, MessageSendStateChangedEvent, OfflineCacheResetEvent };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public offline events (README §4, additive). Emitted on the existing message event bus
|
|
3
|
+
* (`CometChatUIEventHandler.addMessageListener`) next to `ccMessageSent`, which keeps its meaning
|
|
4
|
+
* and fires once per transition. Never emitted with offline off. `MessageEvents` is not extended,
|
|
5
|
+
* so an exhaustive switch over it keeps compiling.
|
|
6
|
+
*/
|
|
7
|
+
export const OfflineMessageEvents = Object.freeze({
|
|
8
|
+
ccMessageSendStateChanged: "ccMessageSendStateChanged",
|
|
9
|
+
ccOfflineCacheReset: "ccOfflineCacheReset",
|
|
10
|
+
} as const);
|
|
11
|
+
|
|
12
|
+
/** An own message's send state on the offline path. */
|
|
13
|
+
export type MessageSendState = "sending" | "sent" | "failed" | "discarded";
|
|
14
|
+
|
|
15
|
+
export interface MessageSendStateChangedEvent {
|
|
16
|
+
/** The SDK message (read `getMessageStatus()` / `getLocalMessageId()` on it for details). */
|
|
17
|
+
message: object;
|
|
18
|
+
state: MessageSendState;
|
|
19
|
+
/** The SDK's `MessageFailureReason` for "failed" / "discarded". */
|
|
20
|
+
reason?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface OfflineCacheResetEvent {
|
|
24
|
+
/** The SDK's `OfflineCacheResetReason`. */
|
|
25
|
+
reason: string;
|
|
26
|
+
/** Unsent messages lost, or `null` when the SDK could not count them. */
|
|
27
|
+
pendingMessagesLost: number | null;
|
|
28
|
+
}
|
|
@@ -14,6 +14,8 @@ import { CometChatTheme } from "../../../theme/type";
|
|
|
14
14
|
import { deepMerge } from "../../helper/helperFunctions";
|
|
15
15
|
import { unescapeTypedMentionTokensInTree } from "../../utils/mentionTokens";
|
|
16
16
|
import { getCometChatTranslation } from "../../resources/CometChatLocalizeNew/LocalizationManager";
|
|
17
|
+
import { isolateText, stripBidiControls } from "../../helper/textDirection";
|
|
18
|
+
import { readListPage } from "../../offline/twoPhase";
|
|
17
19
|
|
|
18
20
|
const t = getCometChatTranslation();
|
|
19
21
|
|
|
@@ -337,8 +339,9 @@ export class CometChatMentionsFormatter extends CometChatTextFormatter {
|
|
|
337
339
|
return users.map((item: CometChat.User) => {
|
|
338
340
|
return new SuggestionItem({
|
|
339
341
|
id: item?.getUid(),
|
|
340
|
-
|
|
341
|
-
|
|
342
|
+
// ENG-41456: the name is shown in the list AND inserted into the composer when picked.
|
|
343
|
+
name: stripBidiControls(item?.getName()),
|
|
344
|
+
promptText: "@" + stripBidiControls(item?.getName()),
|
|
342
345
|
trackingCharacter: "@",
|
|
343
346
|
underlyingText: `<@uid:${item?.getUid()}>`,
|
|
344
347
|
leadingIconUrl: item?.getAvatar(),
|
|
@@ -395,10 +398,11 @@ export class CometChatMentionsFormatter extends CometChatTextFormatter {
|
|
|
395
398
|
|
|
396
399
|
fetchNext(freshCall?: boolean): void | null {
|
|
397
400
|
if (this.getUniqueUsersList().size >= this.limit) return;
|
|
401
|
+
// Offline ON: two-phase (cached people without a keyword; a keyword has no cache, so offline
|
|
402
|
+
// it answers empty, never an error). Offline OFF: today's Promise fetch.
|
|
398
403
|
this.searchRequest?.fetchNext &&
|
|
399
|
-
this.searchRequest
|
|
400
|
-
|
|
401
|
-
.then((users: CometChat.User[]) => {
|
|
404
|
+
readListPage<CometChat.User>(this.searchRequest, "next")
|
|
405
|
+
.then(({ rows: users }) => {
|
|
402
406
|
let structuredData = this.convertCCUsersToSuggestionsItem(users);
|
|
403
407
|
// Deduplicate: only add items whose id is not already present
|
|
404
408
|
const existingIds = new Set(this.searchData.map((item) => item.id));
|
|
@@ -656,17 +660,18 @@ export class CometChatMentionsFormatter extends CometChatTextFormatter {
|
|
|
656
660
|
paddingHorizontal: 2,
|
|
657
661
|
} : {};
|
|
658
662
|
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
663
|
+
// ENG-41314: an isolated "@name" keeps its own direction and can't reorder the words
|
|
664
|
+
// around it. Not in the composer input, where the marks would become typed text.
|
|
665
|
+
// A label that is empty once bidi controls are stripped falls back to the uid, so the
|
|
666
|
+
// chip is never an invisible, still-pressable span.
|
|
667
|
+
const label =
|
|
668
|
+
this.target === MentionsTargetElement.textinput
|
|
669
|
+
? userRegistry[id]
|
|
670
|
+
: isolateText(userRegistry[id]) || isolateText("@" + id);
|
|
666
671
|
|
|
667
672
|
return (
|
|
668
673
|
<Text suppressHighlighting={true} key={index} {...onPressProp} style={[textStyle, mentionContainerStyle]}>
|
|
669
|
-
{
|
|
674
|
+
{label}
|
|
670
675
|
</Text>
|
|
671
676
|
);
|
|
672
677
|
} else {
|
|
@@ -4,6 +4,8 @@ import { Text, TextStyle, ViewStyle, Platform, Linking, View } from "react-nativ
|
|
|
4
4
|
import { CometChatTextFormatter } from "../CometChatTextFormatter";
|
|
5
5
|
import { COLOR_OPEN_TAG, HEX_COLOR_REGEX, findColorTag, stripColorTags } from "../richTextWireFormat";
|
|
6
6
|
import { markCode } from "../codeElements";
|
|
7
|
+
import { LRM, pinLtr } from "../../helper/textDirection";
|
|
8
|
+
import { CODE_DIRECTION } from "../../helper/layoutDirection";
|
|
7
9
|
import { isTextElement, isViewElement } from "../../utils/elementType";
|
|
8
10
|
import { urlPattern, emailPattern, markdownLinkPattern } from "../../constants/textPatterns";
|
|
9
11
|
|
|
@@ -113,7 +115,7 @@ const BQ_BAR_STYLE = {
|
|
|
113
115
|
backgroundColor: 'rgba(255,255,255,0.6)',
|
|
114
116
|
borderRadius: 2,
|
|
115
117
|
marginVertical: 4,
|
|
116
|
-
|
|
118
|
+
marginStart: 4,
|
|
117
119
|
};
|
|
118
120
|
const BQ_CONTENT_STYLE = {
|
|
119
121
|
flexShrink: 1 as const,
|
|
@@ -284,6 +286,7 @@ export class CometChatRichTextFormatter extends CometChatTextFormatter {
|
|
|
284
286
|
backgroundColor: "transparent",
|
|
285
287
|
borderRadius: 4,
|
|
286
288
|
padding: 12,
|
|
289
|
+
direction: "ltr",
|
|
287
290
|
},
|
|
288
291
|
this.style.codeBlockContainerStyle,
|
|
289
292
|
]}
|
|
@@ -292,7 +295,7 @@ export class CometChatRichTextFormatter extends CometChatTextFormatter {
|
|
|
292
295
|
style here — but it must never reach the reader as literal markup either.
|
|
293
296
|
Messages sent before the serializer fix still carry the token inside the
|
|
294
297
|
fence, so strip rather than render (ENG-38253). */}
|
|
295
|
-
{markCode(<Text style={[this.style.codeBlockStyle]}>{stripColorTags(content)}</Text>)}
|
|
298
|
+
{markCode(<Text style={[CODE_DIRECTION, this.style.codeBlockStyle]}>{stripColorTags(content)}</Text>)}
|
|
296
299
|
</View>
|
|
297
300
|
);
|
|
298
301
|
lineIndex++;
|
|
@@ -332,6 +335,8 @@ export class CometChatRichTextFormatter extends CometChatTextFormatter {
|
|
|
332
335
|
backgroundColor: "transparent",
|
|
333
336
|
borderRadius: 4,
|
|
334
337
|
padding: 12,
|
|
338
|
+
// Code reads left to right in an RTL layout too (CODE_DIRECTION).
|
|
339
|
+
direction: "ltr",
|
|
335
340
|
},
|
|
336
341
|
this.style.codeBlockContainerStyle,
|
|
337
342
|
]}
|
|
@@ -339,6 +344,7 @@ export class CometChatRichTextFormatter extends CometChatTextFormatter {
|
|
|
339
344
|
{markCode(
|
|
340
345
|
<Text
|
|
341
346
|
style={[
|
|
347
|
+
CODE_DIRECTION,
|
|
342
348
|
this.style.codeBlockStyle,
|
|
343
349
|
]}
|
|
344
350
|
>
|
|
@@ -392,7 +398,7 @@ export class CometChatRichTextFormatter extends CometChatTextFormatter {
|
|
|
392
398
|
quoteLevelCounters.set(level, currentCount);
|
|
393
399
|
const indent = level * NESTED_LIST_INDENT;
|
|
394
400
|
quoteContent.push(
|
|
395
|
-
<View key={`ql-${i}`} style={[LIST_ROW_STYLE, indent > 0 ? {
|
|
401
|
+
<View key={`ql-${i}`} style={[LIST_ROW_STYLE, indent > 0 ? { marginStart: indent } : undefined]}>
|
|
396
402
|
<Text style={ORDERED_MARKER_STYLE}>{formatListMarker(currentCount, level)}</Text>
|
|
397
403
|
<Text style={LIST_CONTENT_STYLE}>
|
|
398
404
|
{orderedMatch[3].trim() === '' ? ' ' : this.parseInlineFormats(orderedMatch[3])}
|
|
@@ -452,7 +458,7 @@ export class CometChatRichTextFormatter extends CometChatTextFormatter {
|
|
|
452
458
|
const { text: itemText, level } = listItems[i];
|
|
453
459
|
const indent = level * NESTED_LIST_INDENT;
|
|
454
460
|
elements.push(
|
|
455
|
-
<View key={`bullet-${elements.length}`} style={[LIST_ROW_STYLE, indent > 0 ? {
|
|
461
|
+
<View key={`bullet-${elements.length}`} style={[LIST_ROW_STYLE, indent > 0 ? { marginStart: indent } : undefined]}>
|
|
456
462
|
<Text style={BULLET_MARKER_STYLE}>{"‧ "}</Text>
|
|
457
463
|
<Text style={LIST_CONTENT_STYLE}>
|
|
458
464
|
{itemText.trim() === '' ? ' ' : this.parseInlineFormats(itemText)}
|
|
@@ -494,7 +500,7 @@ export class CometChatRichTextFormatter extends CometChatTextFormatter {
|
|
|
494
500
|
levelCounters.set(level, currentCount);
|
|
495
501
|
const indent = level * NESTED_LIST_INDENT;
|
|
496
502
|
elements.push(
|
|
497
|
-
<View key={`ordered-${elements.length}`} style={[LIST_ROW_STYLE, indent > 0 ? {
|
|
503
|
+
<View key={`ordered-${elements.length}`} style={[LIST_ROW_STYLE, indent > 0 ? { marginStart: indent } : undefined]}>
|
|
498
504
|
<Text style={ORDERED_MARKER_STYLE}>{formatListMarker(currentCount, level)}</Text>
|
|
499
505
|
<Text style={LIST_CONTENT_STYLE}>
|
|
500
506
|
{itemText.trim() === '' ? ' ' : this.parseInlineFormats(itemText)}
|
|
@@ -656,8 +662,10 @@ export class CometChatRichTextFormatter extends CometChatTextFormatter {
|
|
|
656
662
|
// Use a single Text element (not View) so inline code stays on the
|
|
657
663
|
// same text baseline as surrounding content (mentions, plain text).
|
|
658
664
|
// Text supports backgroundColor, borderRadius, and padding in RN.
|
|
665
|
+
// ENG-41314: an LRM on each side keeps code LTR in an RTL message — pinLtr() takes a
|
|
666
|
+
// string, this content can be elements.
|
|
659
667
|
elements.push(markCode(
|
|
660
|
-
<Text key={`fmt-${keyCounter++}`} style={[this.style.inlineCodeContainerStyle, this.style.inlineCodeStyle]}>{innerContent}</Text>
|
|
668
|
+
<Text key={`fmt-${keyCounter++}`} style={[this.style.inlineCodeContainerStyle, this.style.inlineCodeStyle]}>{LRM}{innerContent}{LRM}</Text>
|
|
661
669
|
));
|
|
662
670
|
} else if (match.type === "codeBlock") {
|
|
663
671
|
// Inline ```text``` — render identically to single-backtick inline code
|
|
@@ -667,7 +675,7 @@ export class CometChatRichTextFormatter extends CometChatTextFormatter {
|
|
|
667
675
|
<Text
|
|
668
676
|
key={`fmt-${keyCounter++}`}
|
|
669
677
|
style={[this.style.inlineCodeContainerStyle, this.style.inlineCodeStyle]}
|
|
670
|
-
>{restoredContent}</Text>
|
|
678
|
+
>{pinLtr(restoredContent)}</Text>
|
|
671
679
|
));
|
|
672
680
|
} else if (match.type === "textColor" && match.color) {
|
|
673
681
|
// Re-validate at render time: the hex reaching here came off the wire, and an
|
|
@@ -82,6 +82,17 @@ export abstract class CometChatTextFormatter {
|
|
|
82
82
|
return this.composerId;
|
|
83
83
|
};
|
|
84
84
|
|
|
85
|
+
// ENG-41314: true only on the composer's own copy of a formatter — the instance that draws the
|
|
86
|
+
// input box. Not the composer id: the app's instance carries that too and may also draw the
|
|
87
|
+
// message list. Read it from a prototype method (this = the copy), never from an arrow property,
|
|
88
|
+
// which CommonUtils.clone carries over still bound to the original instance.
|
|
89
|
+
protected composerInput = false;
|
|
90
|
+
|
|
91
|
+
/** Marks this formatter as the composer's own copy (called by the composers after cloning). */
|
|
92
|
+
markAsComposerInput() {
|
|
93
|
+
this.composerInput = true;
|
|
94
|
+
}
|
|
95
|
+
|
|
85
96
|
/**
|
|
86
97
|
* Gets the formatter ID.
|
|
87
98
|
* @returns The formatter ID.
|
|
@@ -4,6 +4,7 @@ import { ColorValue, Linking, Text, TextStyle } from "react-native";
|
|
|
4
4
|
import { emailPattern, phoneNumPattern, urlPattern } from "../../constants/UIKitConstants";
|
|
5
5
|
import { CometChatTextFormatter } from "../CometChatTextFormatter";
|
|
6
6
|
import { isCode } from "../codeElements";
|
|
7
|
+
import { pinLtr } from "../../helper/textDirection";
|
|
7
8
|
|
|
8
9
|
export class CometChatUrlsFormatter extends CometChatTextFormatter {
|
|
9
10
|
protected style: {
|
|
@@ -77,7 +78,8 @@ export class CometChatUrlsFormatter extends CometChatTextFormatter {
|
|
|
77
78
|
return null;
|
|
78
79
|
}
|
|
79
80
|
try {
|
|
80
|
-
|
|
81
|
+
// Decided here, a method running on the composer's copy: no invisible marks in the input box.
|
|
82
|
+
let formattedText = this.getFormatTextForLinks({ str: inputText, style: this.style, pin: !this.composerInput });
|
|
81
83
|
return formattedText;
|
|
82
84
|
} catch {
|
|
83
85
|
// Gracefully handle regex stack overflow on Android Hermes for very long messages.
|
|
@@ -86,7 +88,7 @@ export class CometChatUrlsFormatter extends CometChatTextFormatter {
|
|
|
86
88
|
}
|
|
87
89
|
}
|
|
88
90
|
|
|
89
|
-
getFormatTextForLinks = ({ str, style }: any): any => {
|
|
91
|
+
getFormatTextForLinks = ({ str, style, pin = true }: any): any => {
|
|
90
92
|
if (typeof str === "string") {
|
|
91
93
|
let res = str.matchAll(
|
|
92
94
|
(phoneNumPattern + "|" + emailPattern + "|" + urlPattern) as unknown as RegExp
|
|
@@ -103,13 +105,14 @@ export class CometChatUrlsFormatter extends CometChatTextFormatter {
|
|
|
103
105
|
<Text>
|
|
104
106
|
<Text>{pre}</Text>
|
|
105
107
|
{this.Link({
|
|
106
|
-
text: resPart[0].trim(),
|
|
108
|
+
text: pin ? pinLtr(resPart[0].trim()) : resPart[0].trim(),
|
|
107
109
|
url: urlLink.trim() + resPart[0].trim(),
|
|
108
110
|
style: { ...this.style },
|
|
109
111
|
})}
|
|
110
112
|
{this.getFormatTextForLinks({
|
|
111
113
|
str: post,
|
|
112
114
|
style: style,
|
|
115
|
+
pin,
|
|
113
116
|
})}
|
|
114
117
|
</Text>
|
|
115
118
|
);
|
|
@@ -130,7 +133,7 @@ export class CometChatUrlsFormatter extends CometChatTextFormatter {
|
|
|
130
133
|
// and call addMentionsSpan recursively for each child.
|
|
131
134
|
return React.cloneElement(str as React.ReactElement<any>, {
|
|
132
135
|
children: React.Children.map((str as React.ReactElement<any>).props.children, (child) => {
|
|
133
|
-
return this.getFormatTextForLinks({ str: child, style: style });
|
|
136
|
+
return this.getFormatTextForLinks({ str: child, style: style, pin });
|
|
134
137
|
}),
|
|
135
138
|
});
|
|
136
139
|
} else {
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
} from "../constants/UIKitConstants";
|
|
28
28
|
import { CometChatUiKitConstants } from "../index";
|
|
29
29
|
import { CometChatMessageComposerAction } from "../helper/types";
|
|
30
|
+
import { groupActionText } from "../utils/groupActionText";
|
|
30
31
|
import { Icon, IconName } from "../icons/Icon";
|
|
31
32
|
import { getMessagePreviewInternal } from "../utils/MessageUtils";
|
|
32
33
|
import { canPin, isPinned, isPinSaveEligible, isSaved, PinSaveConfig } from "../utils/PinSaveHelper";
|
|
@@ -37,6 +38,8 @@ import {
|
|
|
37
38
|
import { CometChatMessageOption } from "../modals/CometChatMessageOption";
|
|
38
39
|
import { CometChatMessageTemplate } from "../modals/CometChatMessageTemplate";
|
|
39
40
|
import { CometChatConversationUtils, attachmentCountLabel } from "../utils/conversationUtils";
|
|
41
|
+
import { downloadAttachments, shouldUseCachedMedia } from "../offline/media";
|
|
42
|
+
import { OfflineMediaBubble } from "../offline/OfflineMediaBubble";
|
|
40
43
|
import { CometChatAudioBubble } from "../views/CometChatAudioBubble";
|
|
41
44
|
import { CometChatDeletedBubble } from "../views/CometChatDeletedBubble";
|
|
42
45
|
import { CometChatFileBubble } from "../views/CometChatFileBubble";
|
|
@@ -828,9 +831,7 @@ export class MessageDataSource implements DataSource {
|
|
|
828
831
|
onPress: (message: CometChat.BaseMessage) => {
|
|
829
832
|
const mediaMsg = message as CometChat.MediaMessage;
|
|
830
833
|
const attachments = mediaMsg.getAttachments?.() ?? [];
|
|
831
|
-
attachments
|
|
832
|
-
FileManager?.checkAndDownload(att.getUrl(), att.getName(), () => {});
|
|
833
|
-
});
|
|
834
|
+
downloadAttachments(attachments, (uri, name) => FileManager?.checkAndDownload(uri, name, () => {}));
|
|
834
835
|
},
|
|
835
836
|
};
|
|
836
837
|
}
|
|
@@ -1342,9 +1343,6 @@ export class MessageDataSource implements DataSource {
|
|
|
1342
1343
|
* Returns a localized group action message string for group events (added, kicked, banned, etc.)
|
|
1343
1344
|
*/
|
|
1344
1345
|
getActionMessage(message: any): string {
|
|
1345
|
-
|
|
1346
|
-
let actionMessage = "";
|
|
1347
|
-
|
|
1348
1346
|
if (!message || typeof message !== "object") {
|
|
1349
1347
|
return "";
|
|
1350
1348
|
}
|
|
@@ -1364,94 +1362,19 @@ export class MessageDataSource implements DataSource {
|
|
|
1364
1362
|
return message.message || "";
|
|
1365
1363
|
}
|
|
1366
1364
|
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
switch (action) {
|
|
1382
|
-
case GroupMemberAction.ADDED:
|
|
1383
|
-
// Use template string with placeholders for names
|
|
1384
|
-
actionMessage = t("MESSAGE_LIST_ACTION_ADDED").replace("${byName}", byName).replace("${onName}", onName);
|
|
1385
|
-
// Fallback to simpler format if template is missing
|
|
1386
|
-
if (actionMessage === "MESSAGE_LIST_ACTION_ADDED") {
|
|
1387
|
-
actionMessage = `${byName} ${t("ADDED")} ${onName}`;
|
|
1388
|
-
}
|
|
1389
|
-
break;
|
|
1390
|
-
|
|
1391
|
-
case GroupMemberAction.JOINED:
|
|
1392
|
-
// No onName needed
|
|
1393
|
-
actionMessage = t("MESSAGE_LIST_ACTION_JOINED").replace("${byName}", byName);
|
|
1394
|
-
if (actionMessage === "MESSAGE_LIST_ACTION_JOINED") {
|
|
1395
|
-
actionMessage = `${byName} ${t("JOINED")}`;
|
|
1396
|
-
}
|
|
1397
|
-
break;
|
|
1398
|
-
|
|
1399
|
-
case GroupMemberAction.LEFT:
|
|
1400
|
-
// No onName needed
|
|
1401
|
-
actionMessage = t("MESSAGE_LIST_ACTION_LEFT").replace("${byName}", byName);
|
|
1402
|
-
if (actionMessage === "MESSAGE_LIST_ACTION_LEFT") {
|
|
1403
|
-
actionMessage = `${byName} ${t("LEFT")}`;
|
|
1404
|
-
}
|
|
1405
|
-
break;
|
|
1406
|
-
|
|
1407
|
-
case GroupMemberAction.KICKED:
|
|
1408
|
-
actionMessage = t("MESSAGE_LIST_ACTION_KICKED").replace("${byName}", byName).replace("${onName}", onName);
|
|
1409
|
-
if (actionMessage === "MESSAGE_LIST_ACTION_KICKED") {
|
|
1410
|
-
actionMessage = `${byName} ${t("KICKED")} ${onName}`;
|
|
1411
|
-
}
|
|
1412
|
-
break;
|
|
1413
|
-
|
|
1414
|
-
case GroupMemberAction.BANNED:
|
|
1415
|
-
actionMessage = t("MESSAGE_LIST_ACTION_BANNED").replace("${byName}", byName).replace("${onName}", onName);
|
|
1416
|
-
if (actionMessage === "MESSAGE_LIST_ACTION_BANNED") {
|
|
1417
|
-
actionMessage = `${byName} ${t("BANNED")} ${onName}`;
|
|
1418
|
-
}
|
|
1419
|
-
break;
|
|
1420
|
-
|
|
1421
|
-
case GroupMemberAction.UNBANNED:
|
|
1422
|
-
actionMessage = t("MESSAGE_LIST_ACTION_UNBANNED").replace("${byName}", byName).replace("${onName}", onName);
|
|
1423
|
-
if (actionMessage === "MESSAGE_LIST_ACTION_UNBANNED") {
|
|
1424
|
-
actionMessage = `${byName} ${t("UNBANNED")} ${onName}`;
|
|
1425
|
-
}
|
|
1426
|
-
break;
|
|
1427
|
-
|
|
1428
|
-
case GroupMemberAction.SCOPE_CHANGE: {
|
|
1429
|
-
const newScope =
|
|
1430
|
-
message.newScope ||
|
|
1431
|
-
message.data?.extras?.scope?.new ||
|
|
1432
|
-
message.rawMessage?.data?.extras?.scope?.new ||
|
|
1433
|
-
"";
|
|
1434
|
-
|
|
1435
|
-
const translatedRole = newScope ? t(newScope.toUpperCase()) : "";
|
|
1436
|
-
|
|
1437
|
-
// Template with three placeholders
|
|
1438
|
-
actionMessage = t("MESSAGE_LIST_ACTION_SCOPE_CHANGED")
|
|
1439
|
-
.replace("${byName}", byName)
|
|
1440
|
-
.replace("${onName}", onName)
|
|
1441
|
-
.replace("${role}", translatedRole);
|
|
1442
|
-
|
|
1443
|
-
if (actionMessage === "MESSAGE_LIST_ACTION_SCOPE_CHANGED") {
|
|
1444
|
-
actionMessage = `${byName} ${t("MADE")} ${onName} ${translatedRole}`.trim();
|
|
1445
|
-
}
|
|
1446
|
-
break;
|
|
1447
|
-
}
|
|
1448
|
-
|
|
1449
|
-
default:
|
|
1450
|
-
actionMessage = message.message || "";
|
|
1451
|
-
break;
|
|
1452
|
-
}
|
|
1453
|
-
|
|
1454
|
-
return actionMessage;
|
|
1365
|
+
const newScope =
|
|
1366
|
+
message.newScope ||
|
|
1367
|
+
message.data?.extras?.scope?.new ||
|
|
1368
|
+
message.rawMessage?.data?.extras?.scope?.new ||
|
|
1369
|
+
"";
|
|
1370
|
+
// RTL parity (Android GroupActionText.kt): "You …" / "… you" for the logged-in user. The
|
|
1371
|
+
// action's users can be SDK objects or raw JSON (conversation list preview), so read both.
|
|
1372
|
+
const myUid = CometChatUIKit.loggedInUser?.getUid?.();
|
|
1373
|
+
const uidOf = (user: any) => user?.getUid?.() ?? user?.uid;
|
|
1374
|
+
const self = myUid
|
|
1375
|
+
? { actor: uidOf(actionBy) === myUid, target: !!actionOn && uidOf(actionOn) === myUid }
|
|
1376
|
+
: {};
|
|
1377
|
+
return groupActionText(action, actionBy?.name, actionOn?.name, t, newScope, message.message || "", self);
|
|
1455
1378
|
}
|
|
1456
1379
|
|
|
1457
1380
|
getGroupActionBubble(message: CometChat.BaseMessage, theme: CometChatTheme): JSX.Element | null {
|
|
@@ -1537,8 +1460,8 @@ export class MessageDataSource implements DataSource {
|
|
|
1537
1460
|
backgroundColor: isOutgoingMessage ? theme.color.extendedPrimary800 : theme.color.neutral400,
|
|
1538
1461
|
borderRadius: 8,
|
|
1539
1462
|
borderWidth: 0,
|
|
1540
|
-
|
|
1541
|
-
|
|
1463
|
+
borderStartWidth: 3,
|
|
1464
|
+
borderStartColor: isOutgoingMessage ? theme.color.staticWhite : theme.color.borderHighlight,
|
|
1542
1465
|
margin:2,
|
|
1543
1466
|
width:"98%"
|
|
1544
1467
|
}}
|
|
@@ -1923,9 +1846,12 @@ export class MessageDataSource implements DataSource {
|
|
|
1923
1846
|
// DD §9 — enableMultipleAttachments=false on the message list → deprecated single-attachment bubble.
|
|
1924
1847
|
if (additionalParams?.enableMultipleAttachments === false) {
|
|
1925
1848
|
const attachment = message.getAttachment();
|
|
1926
|
-
|
|
1927
|
-
|
|
1849
|
+
const bubble = (url: string) => ChatConfigurator.dataSource.getAudioMessageBubble(
|
|
1850
|
+
url, attachment?.getName() ?? "", {}, message, theme
|
|
1928
1851
|
);
|
|
1852
|
+
return shouldUseCachedMedia() && attachment
|
|
1853
|
+
? <OfflineMediaBubble attachment={attachment} playable>{bubble}</OfflineMediaBubble>
|
|
1854
|
+
: bubble(attachment?.getUrl());
|
|
1929
1855
|
}
|
|
1930
1856
|
// §8.1a — audio rendering matches WhatsApp:
|
|
1931
1857
|
// • SHARED / picked audio file (no audioType) → the headphone-chip + filename player
|
|
@@ -1946,13 +1872,20 @@ export class MessageDataSource implements DataSource {
|
|
|
1946
1872
|
return <CometChatVoiceNoteBubble message={message} theme={theme} additionalParams={additionalParams} />;
|
|
1947
1873
|
}
|
|
1948
1874
|
const attachment = message.getAttachment();
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
attachment
|
|
1875
|
+
const bubble = (url: string) => ChatConfigurator.dataSource.getAudioMessageBubble(
|
|
1876
|
+
url,
|
|
1877
|
+
attachment?.getName() ?? "",
|
|
1952
1878
|
{},
|
|
1953
1879
|
message,
|
|
1954
1880
|
theme
|
|
1955
1881
|
);
|
|
1882
|
+
// A message just sent with offline support on is the SDK's pending copy of the composed message,
|
|
1883
|
+
// which has no attachment until the upload is acknowledged (getAttachment() is null). Draw it as
|
|
1884
|
+
// the optimistic bubble is drawn with offline off (no source yet), not through the offline media
|
|
1885
|
+
// wrapper; the acknowledged message replaces it. Same guard on every single-attachment bubble.
|
|
1886
|
+
return shouldUseCachedMedia() && attachment
|
|
1887
|
+
? <OfflineMediaBubble attachment={attachment} playable>{bubble}</OfflineMediaBubble>
|
|
1888
|
+
: bubble(attachment?.getUrl());
|
|
1956
1889
|
}
|
|
1957
1890
|
getVideoMessageContentView(
|
|
1958
1891
|
message: CometChat.MediaMessage,
|
|
@@ -1963,9 +1896,12 @@ export class MessageDataSource implements DataSource {
|
|
|
1963
1896
|
// DD §9 — enableMultipleAttachments=false → deprecated single-attachment video bubble.
|
|
1964
1897
|
if (additionalParams?.enableMultipleAttachments === false) {
|
|
1965
1898
|
const attachment = message.getAttachment();
|
|
1966
|
-
|
|
1967
|
-
|
|
1899
|
+
const bubble = (url: string) => ChatConfigurator.dataSource.getVideoMessageBubble(
|
|
1900
|
+
url, attachment?.getUrl(), message, theme
|
|
1968
1901
|
);
|
|
1902
|
+
return shouldUseCachedMedia() && attachment
|
|
1903
|
+
? <OfflineMediaBubble attachment={attachment} playable>{bubble}</OfflineMediaBubble>
|
|
1904
|
+
: bubble(attachment?.getUrl());
|
|
1969
1905
|
}
|
|
1970
1906
|
// A VIDEO message ALWAYS renders the video grid — no fallback to a file list. Any attachment that
|
|
1971
1907
|
// isn't a video (image / audio / file) shows a "no preview" placeholder cell inside the grid, and
|
|
@@ -1982,9 +1918,12 @@ export class MessageDataSource implements DataSource {
|
|
|
1982
1918
|
// DD §9 — enableMultipleAttachments=false → deprecated single-attachment image bubble.
|
|
1983
1919
|
if (additionalParams?.enableMultipleAttachments === false) {
|
|
1984
1920
|
const attachment = message.getAttachment();
|
|
1985
|
-
|
|
1986
|
-
|
|
1921
|
+
const bubble = (url: string) => ChatConfigurator.dataSource.getImageMessageBubble(
|
|
1922
|
+
url, caption, message, theme
|
|
1987
1923
|
);
|
|
1924
|
+
return shouldUseCachedMedia() && attachment
|
|
1925
|
+
? <OfflineMediaBubble attachment={attachment}>{bubble}</OfflineMediaBubble>
|
|
1926
|
+
: bubble(attachment?.getUrl());
|
|
1988
1927
|
}
|
|
1989
1928
|
// An IMAGE message ALWAYS renders the image grid — no fallback to a file list. Any attachment that
|
|
1990
1929
|
// can't be previewed (unsupported format / load error) shows a "no preview" placeholder cell inside
|
|
@@ -2000,9 +1939,13 @@ export class MessageDataSource implements DataSource {
|
|
|
2000
1939
|
// DD §9 — enableMultipleAttachments=false → deprecated single-attachment file bubble.
|
|
2001
1940
|
if (additionalParams?.enableMultipleAttachments === false) {
|
|
2002
1941
|
const attachment = message.getAttachment();
|
|
2003
|
-
|
|
2004
|
-
|
|
1942
|
+
const bubble = (url: string) => ChatConfigurator.dataSource.getFileMessageBubble(
|
|
1943
|
+
url, attachment?.getName() ?? "", {}, message, theme
|
|
2005
1944
|
);
|
|
1945
|
+
// The file bubble names its download after the URL, so it keeps the URL (no cached source).
|
|
1946
|
+
return shouldUseCachedMedia() && attachment
|
|
1947
|
+
? <OfflineMediaBubble attachment={attachment}>{() => bubble(attachment.getUrl())}</OfflineMediaBubble>
|
|
1948
|
+
: bubble(attachment?.getUrl());
|
|
2006
1949
|
}
|
|
2007
1950
|
// DD §9 (flag=true, default): the new FilesBubble renders 1..N — including a single file.
|
|
2008
1951
|
return <CometChatFilesBubble message={message} theme={theme} additionalParams={additionalParams} />;
|
|
@@ -2799,7 +2742,7 @@ export const internalMessageDataSource = new MessageDataSource();
|
|
|
2799
2742
|
|
|
2800
2743
|
const styles = StyleSheet.create({
|
|
2801
2744
|
aiCopyIcon: {
|
|
2802
|
-
|
|
2745
|
+
marginStart: 10,
|
|
2803
2746
|
marginBottom: -20,
|
|
2804
2747
|
},
|
|
2805
2748
|
});
|