@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
|
@@ -8,9 +8,11 @@ import { GroupTypeConstants, UserStatusConstants } from "../shared/constants/UIK
|
|
|
8
8
|
import { CometChatUIEventHandler } from "../shared/events/CometChatUIEventHandler/CometChatUIEventHandler";
|
|
9
9
|
import { CometChatUIEvents } from "../shared/events/CometChatUIEvents";
|
|
10
10
|
import { deepMerge } from "../shared/helper/helperFunctions";
|
|
11
|
+
import { sentenceWithNames, stripBidiControls } from "../shared/helper/textDirection";
|
|
11
12
|
import { Icon } from "../shared/icons/Icon";
|
|
12
13
|
import { CometChatAvatar } from "../shared/views/CometChatAvatar";
|
|
13
14
|
import { CometChatStatusIndicator } from "../shared/views/CometChatStatusIndicator";
|
|
15
|
+
import { usePresenceHidden } from "../shared/offline/usePresenceHidden";
|
|
14
16
|
import { useTheme } from "../theme";
|
|
15
17
|
import { MessageHeaderStyle } from "./styles";
|
|
16
18
|
import { CommonUtils } from "../shared/utils/CommonUtils";
|
|
@@ -26,8 +28,12 @@ import {
|
|
|
26
28
|
} from "../shared/utils/ThreadSubscriptionHelper";
|
|
27
29
|
import { useToast } from "../shared/helper/useToast";
|
|
28
30
|
import { skipNextAgentAutoLoad } from "../CometChatMessageList/CometChatMessageList";
|
|
31
|
+
import { pluralCountLabel } from "../shared/helper/pluralRules";
|
|
32
|
+
import { LayoutDirectionContext, directionStyle, useComponentLayoutDirection, TEXT_START } from "../shared/helper/layoutDirection";
|
|
29
33
|
|
|
30
34
|
export type CometChatMessageHeaderInterface = {
|
|
35
|
+
/** Lays this component out `"ltr"` or `"rtl"`, overriding the kit's global `layoutDirection`. Not set = inherit. */
|
|
36
|
+
layoutDirection?: "ltr" | "rtl";
|
|
31
37
|
/**
|
|
32
38
|
* Custom item view. Receives { user, group }.
|
|
33
39
|
*/
|
|
@@ -194,7 +200,7 @@ export const CometChatMessageHeader = (props: CometChatMessageHeaderInterface) =
|
|
|
194
200
|
const msgTypingListenerId = "message_typing_" + Date.now() + "_" + (++__listenerIdCounter);
|
|
195
201
|
const groupListenerId = "head_group_" + Date.now() + "_" + (++__listenerIdCounter);
|
|
196
202
|
const theme = useTheme();
|
|
197
|
-
const { t } = useCometChatTranslation();
|
|
203
|
+
const { t, language } = useCometChatTranslation();
|
|
198
204
|
|
|
199
205
|
const {
|
|
200
206
|
TitleView,
|
|
@@ -225,11 +231,15 @@ export const CometChatMessageHeader = (props: CometChatMessageHeaderInterface) =
|
|
|
225
231
|
showPinnedMessagesButton = false,
|
|
226
232
|
onPinnedMessagesPress,
|
|
227
233
|
} = props;
|
|
234
|
+
// ENG-41333: own setting → enclosing component → global; drives the root and the context.
|
|
235
|
+
const direction = useComponentLayoutDirection(props.layoutDirection);
|
|
228
236
|
|
|
229
237
|
const [groupObj, setGroupObj] = useState(group);
|
|
230
238
|
const [userObj, setUserObj] = useState<CometChat.User | undefined>(user);
|
|
231
239
|
const [userStatus, setUserStatus] = useState(user && user.getStatus ? user.getStatus() : "");
|
|
232
240
|
const [typingText, setTypingText] = useState("");
|
|
241
|
+
// Offline ON, SDK not connected: no presence subtitle and no typing text (nothing can arrive).
|
|
242
|
+
const presenceHidden = usePresenceHidden();
|
|
233
243
|
const [showOptionsMenu, setShowOptionsMenu] = useState(false);
|
|
234
244
|
const [tooltipPosition, setTooltipPosition] = useState({ pageX: 0, pageY: 0 });
|
|
235
245
|
const receiverTypeRef = useRef(
|
|
@@ -450,12 +460,12 @@ export const CometChatMessageHeader = (props: CometChatMessageHeaderInterface) =
|
|
|
450
460
|
*/
|
|
451
461
|
const SubtitleViewFnc = useCallback(() => {
|
|
452
462
|
try {
|
|
453
|
-
if (typingText !== "")
|
|
463
|
+
if (typingText !== "" && !presenceHidden)
|
|
454
464
|
return (
|
|
455
465
|
<Text
|
|
456
466
|
numberOfLines={1}
|
|
457
467
|
ellipsizeMode='tail'
|
|
458
|
-
style={[messageHeaderStyles.typingIndicatorTextStyle]}
|
|
468
|
+
style={[TEXT_START, messageHeaderStyles.typingIndicatorTextStyle]}
|
|
459
469
|
>
|
|
460
470
|
{typingText}
|
|
461
471
|
</Text>
|
|
@@ -465,7 +475,7 @@ export const CometChatMessageHeader = (props: CometChatMessageHeaderInterface) =
|
|
|
465
475
|
if (groupObj) {
|
|
466
476
|
const count = groupObj.getMembersCount?.() ?? groupObj?.["membersCount"];
|
|
467
477
|
if (count != null) {
|
|
468
|
-
subtitle =
|
|
478
|
+
subtitle = pluralCountLabel(t, "MEMBER_COUNT", count, language);
|
|
469
479
|
}
|
|
470
480
|
}
|
|
471
481
|
|
|
@@ -473,7 +483,8 @@ export const CometChatMessageHeader = (props: CometChatMessageHeaderInterface) =
|
|
|
473
483
|
userObj &&
|
|
474
484
|
!(userObj.getBlockedByMe() || userObj.getHasBlockedMe()) &&
|
|
475
485
|
usersStatusVisibility &&
|
|
476
|
-
userStatus
|
|
486
|
+
userStatus &&
|
|
487
|
+
!presenceHidden
|
|
477
488
|
) {
|
|
478
489
|
subtitle =
|
|
479
490
|
userStatus === UserStatusConstants.online
|
|
@@ -482,7 +493,7 @@ export const CometChatMessageHeader = (props: CometChatMessageHeaderInterface) =
|
|
|
482
493
|
}
|
|
483
494
|
|
|
484
495
|
if (subtitle) {
|
|
485
|
-
return <Text style={[messageHeaderStyles.subtitleTextStyle]}>{subtitle}</Text>;
|
|
496
|
+
return <Text style={[TEXT_START, messageHeaderStyles.subtitleTextStyle]}>{subtitle}</Text>;
|
|
486
497
|
}
|
|
487
498
|
|
|
488
499
|
return <></>;
|
|
@@ -490,7 +501,7 @@ export const CometChatMessageHeader = (props: CometChatMessageHeaderInterface) =
|
|
|
490
501
|
errorHandler(error);
|
|
491
502
|
return <></>;
|
|
492
503
|
}
|
|
493
|
-
}, [userObj, groupObj, messageHeaderStyles, usersStatusVisibility, userStatus]);
|
|
504
|
+
}, [userObj, groupObj, messageHeaderStyles, usersStatusVisibility, userStatus, presenceHidden, t, language]);
|
|
494
505
|
|
|
495
506
|
/**
|
|
496
507
|
* Error handler to call onError with a proper CometChatException.
|
|
@@ -524,7 +535,7 @@ export const CometChatMessageHeader = (props: CometChatMessageHeaderInterface) =
|
|
|
524
535
|
groupObj?.getGuid() === typist.getReceiverId()
|
|
525
536
|
) {
|
|
526
537
|
setTypingText(
|
|
527
|
-
status === "typing" ?
|
|
538
|
+
status === "typing" ? sentenceWithNames(`\${name}: ${t("IS_TYPING")}`, { name: typist.getSender()?.getName() ?? "" }) : ""
|
|
528
539
|
);
|
|
529
540
|
} else if (
|
|
530
541
|
receiverTypeRef.current === CometChat.RECEIVER_TYPE.USER &&
|
|
@@ -679,11 +690,12 @@ export const CometChatMessageHeader = (props: CometChatMessageHeaderInterface) =
|
|
|
679
690
|
const menuItems = buildMenuItems();
|
|
680
691
|
|
|
681
692
|
return (
|
|
693
|
+
<LayoutDirectionContext.Provider value={direction}>
|
|
682
694
|
<>
|
|
683
695
|
{ItemView ? (
|
|
684
696
|
ItemView({ user: userObj, group })
|
|
685
697
|
) : (
|
|
686
|
-
<View style={[messageHeaderStyles.containerStyle]}>
|
|
698
|
+
<View style={[messageHeaderStyles.containerStyle, directionStyle(direction)]}>
|
|
687
699
|
{showBackButton === true && <BackButton />}
|
|
688
700
|
{LeadingView ? LeadingView({ user: userObj, group }) : <AvatarWithStatusView />}
|
|
689
701
|
<View style={{ flex: 1, justifyContent: "center" }}>
|
|
@@ -693,9 +705,9 @@ export const CometChatMessageHeader = (props: CometChatMessageHeaderInterface) =
|
|
|
693
705
|
<Text
|
|
694
706
|
numberOfLines={1}
|
|
695
707
|
ellipsizeMode='tail'
|
|
696
|
-
style={[messageHeaderStyles.titleTextStyle]}
|
|
708
|
+
style={[TEXT_START, messageHeaderStyles.titleTextStyle]}
|
|
697
709
|
>
|
|
698
|
-
{userObj ? userObj.getName() : groupObj ? groupObj.getName() : ""}
|
|
710
|
+
{stripBidiControls(userObj ? userObj.getName() : groupObj ? groupObj.getName() : "")}
|
|
699
711
|
</Text>
|
|
700
712
|
)}
|
|
701
713
|
{SubtitleView ? SubtitleView({ user: userObj, group }) : <SubtitleViewFnc />}
|
|
@@ -705,7 +717,7 @@ export const CometChatMessageHeader = (props: CometChatMessageHeaderInterface) =
|
|
|
705
717
|
flexDirection: "row",
|
|
706
718
|
alignItems: "center"
|
|
707
719
|
}}>
|
|
708
|
-
<View style={{
|
|
720
|
+
<View style={{ marginStart: "auto", flexDirection: "row" }}>
|
|
709
721
|
{(() => {
|
|
710
722
|
const isAgenticUser = userObj?.getRole?.() === '@agentic';
|
|
711
723
|
|
|
@@ -722,19 +734,19 @@ export const CometChatMessageHeader = (props: CometChatMessageHeaderInterface) =
|
|
|
722
734
|
});
|
|
723
735
|
})()}
|
|
724
736
|
{showThreadSubscription && (
|
|
725
|
-
<View style={{
|
|
737
|
+
<View style={{ marginStart: theme.spacing.padding.p4 }}>
|
|
726
738
|
<ThreadSubscriptionButton />
|
|
727
739
|
</View>
|
|
728
740
|
)}
|
|
729
741
|
{TrailingView && !isAgenticUser() && (
|
|
730
|
-
<View style={{
|
|
742
|
+
<View style={{ marginStart: theme.spacing.padding.p4 }}>
|
|
731
743
|
{TrailingView({ user: userObj, group })}
|
|
732
744
|
</View>
|
|
733
745
|
)}
|
|
734
746
|
{menuItems.length > 0 && (
|
|
735
747
|
<TouchableOpacity
|
|
736
748
|
testID='MessageHeader.optionsMenu'
|
|
737
|
-
style={{
|
|
749
|
+
style={{ marginStart: theme.spacing.padding.p2 }}
|
|
738
750
|
onPress={(e) => {
|
|
739
751
|
if (e.nativeEvent) {
|
|
740
752
|
setTooltipPosition({
|
|
@@ -783,5 +795,6 @@ export const CometChatMessageHeader = (props: CometChatMessageHeaderInterface) =
|
|
|
783
795
|
"the toast never appeared" bug. */}
|
|
784
796
|
{ToastElement}
|
|
785
797
|
</>
|
|
798
|
+
</LayoutDirectionContext.Provider>
|
|
786
799
|
);
|
|
787
800
|
};
|
|
@@ -1,5 +1,64 @@
|
|
|
1
1
|
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
2
2
|
import { CometChatUIEventHandler, CometChatUIKit } from "../shared";
|
|
3
|
+
import { OfflineHub } from "../shared/offline/OfflineHub";
|
|
4
|
+
import { dispatchSweptGroupAction } from "../shared/offline/groupActions";
|
|
5
|
+
|
|
6
|
+
/** Hub subscriptions for swept group actions, per header group listener id. */
|
|
7
|
+
const sweptGroupActionSubscriptions = new Map<string, { unsubscribe(): void }>();
|
|
8
|
+
|
|
9
|
+
/** The header's GroupListener handlers, shared by the live listener and swept actions. */
|
|
10
|
+
export const groupListenerHandlers = (handleGroupListener: (group: CometChat.Group) => void) => ({
|
|
11
|
+
onGroupMemberKicked: (
|
|
12
|
+
message: any,
|
|
13
|
+
kickedUser: CometChat.User,
|
|
14
|
+
kickedBy: CometChat.User,
|
|
15
|
+
kickedFrom: CometChat.Group
|
|
16
|
+
) => {
|
|
17
|
+
handleGroupListener(kickedFrom);
|
|
18
|
+
},
|
|
19
|
+
onGroupMemberBanned: (
|
|
20
|
+
message: any,
|
|
21
|
+
bannedUser: CometChat.User,
|
|
22
|
+
bannedBy: CometChat.User,
|
|
23
|
+
bannedFrom: CometChat.Group
|
|
24
|
+
) => {
|
|
25
|
+
handleGroupListener(bannedFrom);
|
|
26
|
+
},
|
|
27
|
+
onMemberAddedToGroup: (
|
|
28
|
+
message: any,
|
|
29
|
+
userAdded: CometChat.User,
|
|
30
|
+
userAddedBy: CometChat.User,
|
|
31
|
+
userAddedIn: CometChat.Group
|
|
32
|
+
) => {
|
|
33
|
+
console.log("onMemberAddedToGroup", userAddedIn);
|
|
34
|
+
handleGroupListener(userAddedIn);
|
|
35
|
+
},
|
|
36
|
+
onGroupMemberLeft: (
|
|
37
|
+
message: any,
|
|
38
|
+
leavingUser: CometChat.User,
|
|
39
|
+
group: CometChat.Group
|
|
40
|
+
) => {
|
|
41
|
+
handleGroupListener(group);
|
|
42
|
+
},
|
|
43
|
+
onGroupMemberJoined: (
|
|
44
|
+
message: any,
|
|
45
|
+
joinedUser: CometChat.User,
|
|
46
|
+
joinedGroup: CometChat.Group
|
|
47
|
+
) => {
|
|
48
|
+
handleGroupListener(joinedGroup);
|
|
49
|
+
},
|
|
50
|
+
onGroupMemberScopeChanged: (
|
|
51
|
+
message: CometChat.Action,
|
|
52
|
+
changedUser: CometChat.GroupMember,
|
|
53
|
+
newScope: CometChat.GroupMemberScope,
|
|
54
|
+
oldScope: CometChat.GroupMemberScope,
|
|
55
|
+
changedGroup: CometChat.Group
|
|
56
|
+
) => {
|
|
57
|
+
if (changedUser.getUid() !== CometChatUIKit.loggedInUser?.getUid()) return;
|
|
58
|
+
changedGroup.setScope(newScope);
|
|
59
|
+
handleGroupListener(changedGroup);
|
|
60
|
+
},
|
|
61
|
+
});
|
|
3
62
|
|
|
4
63
|
export const listners = {
|
|
5
64
|
addListener: {
|
|
@@ -26,62 +85,20 @@ export const listners = {
|
|
|
26
85
|
msgTypingIndicator(typistDetails, "");
|
|
27
86
|
},
|
|
28
87
|
}),
|
|
29
|
-
groupListener: ({ groupListenerId, handleGroupListener }: any) =>
|
|
30
|
-
|
|
88
|
+
groupListener: ({ groupListenerId, handleGroupListener }: any) => {
|
|
89
|
+
const handlers = groupListenerHandlers(handleGroupListener);
|
|
90
|
+
CometChat.addGroupListener(groupListenerId, new CometChat.GroupListener(handlers));
|
|
91
|
+
// Offline (ON path): a group action the catch-up sweep delivered fires no GroupListener
|
|
92
|
+
// callback; run the same handlers for it (UIT-SYNC-13). Inert with offline off.
|
|
93
|
+
sweptGroupActionSubscriptions.get(groupListenerId)?.unsubscribe();
|
|
94
|
+
sweptGroupActionSubscriptions.set(
|
|
31
95
|
groupListenerId,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
kickedUser: CometChat.User,
|
|
36
|
-
kickedBy: CometChat.User,
|
|
37
|
-
kickedFrom: CometChat.Group
|
|
38
|
-
) => {
|
|
39
|
-
handleGroupListener(kickedFrom);
|
|
40
|
-
},
|
|
41
|
-
onGroupMemberBanned: (
|
|
42
|
-
message: any,
|
|
43
|
-
bannedUser: CometChat.User,
|
|
44
|
-
bannedBy: CometChat.User,
|
|
45
|
-
bannedFrom: CometChat.Group
|
|
46
|
-
) => {
|
|
47
|
-
handleGroupListener(bannedFrom);
|
|
48
|
-
},
|
|
49
|
-
onMemberAddedToGroup: (
|
|
50
|
-
message: any,
|
|
51
|
-
userAdded: CometChat.User,
|
|
52
|
-
userAddedBy: CometChat.User,
|
|
53
|
-
userAddedIn: CometChat.Group
|
|
54
|
-
) => {
|
|
55
|
-
console.log("onMemberAddedToGroup", userAddedIn);
|
|
56
|
-
handleGroupListener(userAddedIn);
|
|
57
|
-
},
|
|
58
|
-
onGroupMemberLeft: (
|
|
59
|
-
message: any,
|
|
60
|
-
leavingUser: CometChat.User,
|
|
61
|
-
group: CometChat.Group
|
|
62
|
-
) => {
|
|
63
|
-
handleGroupListener(group);
|
|
64
|
-
},
|
|
65
|
-
onGroupMemberJoined: (
|
|
66
|
-
message: any,
|
|
67
|
-
joinedUser: CometChat.User,
|
|
68
|
-
joinedGroup: CometChat.Group
|
|
69
|
-
) => {
|
|
70
|
-
handleGroupListener(joinedGroup);
|
|
71
|
-
},
|
|
72
|
-
onGroupMemberScopeChanged: (
|
|
73
|
-
message: CometChat.Action,
|
|
74
|
-
changedUser: CometChat.GroupMember,
|
|
75
|
-
newScope: CometChat.GroupMemberScope,
|
|
76
|
-
oldScope: CometChat.GroupMemberScope,
|
|
77
|
-
changedGroup: CometChat.Group
|
|
78
|
-
) => {
|
|
79
|
-
if (changedUser.getUid() !== CometChatUIKit.loggedInUser?.getUid()) return;
|
|
80
|
-
changedGroup.setScope(newScope);
|
|
81
|
-
handleGroupListener(changedGroup);
|
|
82
|
-
},
|
|
96
|
+
OfflineHub.getInstance().groupActionSwept$.subscribe((event) => {
|
|
97
|
+
if (event.gen !== OfflineHub.getInstance().gen) return;
|
|
98
|
+
dispatchSweptGroupAction(event.message, handlers);
|
|
83
99
|
})
|
|
84
|
-
)
|
|
100
|
+
);
|
|
101
|
+
},
|
|
85
102
|
},
|
|
86
103
|
removeListner: {
|
|
87
104
|
removeUserListener: ({ userStatusListenerId }: any) =>
|
|
@@ -90,7 +107,10 @@ export const listners = {
|
|
|
90
107
|
removeMessageListener: ({ msgTypingListenerId }: any) =>
|
|
91
108
|
CometChatUIEventHandler.removeMessageListener(msgTypingListenerId),
|
|
92
109
|
|
|
93
|
-
removeGroupListener: ({ groupListenerId }: any) =>
|
|
94
|
-
|
|
110
|
+
removeGroupListener: ({ groupListenerId }: any) => {
|
|
111
|
+
sweptGroupActionSubscriptions.get(groupListenerId)?.unsubscribe();
|
|
112
|
+
sweptGroupActionSubscriptions.delete(groupListenerId);
|
|
113
|
+
return CometChat.removeGroupListener(groupListenerId);
|
|
114
|
+
},
|
|
95
115
|
},
|
|
96
116
|
};
|
|
@@ -22,6 +22,7 @@ import { CometChatTheme } from "../theme/type";
|
|
|
22
22
|
import { deepMerge } from "../shared/helper/helperFunctions";
|
|
23
23
|
import { DeepPartial } from "../shared/helper/types";
|
|
24
24
|
import { useCometChatTranslation } from "../shared/resources/CometChatLocalizeNew";
|
|
25
|
+
import { LayoutDirectionContext, directionStyle, useComponentLayoutDirection } from "../shared/helper/layoutDirection";
|
|
25
26
|
|
|
26
27
|
const listenerId = "uiEvents_" + Date.now() + "_" + (++__listenerIdCounter);
|
|
27
28
|
|
|
@@ -33,6 +34,8 @@ type Recipient = {
|
|
|
33
34
|
};
|
|
34
35
|
|
|
35
36
|
export interface CometChatMessageInformationInterface {
|
|
37
|
+
/** Lays this component out `"ltr"` or `"rtl"`, overriding the kit's global `layoutDirection`. Not set = inherit. */
|
|
38
|
+
layoutDirection?: "ltr" | "rtl";
|
|
36
39
|
title?: string;
|
|
37
40
|
/**
|
|
38
41
|
* Text formatters, only needed when this screen is used on its own — opened from the message
|
|
@@ -79,6 +82,8 @@ export const CometChatMessageInformation = (props: CometChatMessageInformationIn
|
|
|
79
82
|
LoadingStateView,
|
|
80
83
|
style,
|
|
81
84
|
} = props;
|
|
85
|
+
// ENG-41333: own setting → enclosing component → global; drives the root and the context.
|
|
86
|
+
const direction = useComponentLayoutDirection(props.layoutDirection);
|
|
82
87
|
|
|
83
88
|
const defaultReceiptTimestampForUser = "----";
|
|
84
89
|
const theme = useTheme();
|
|
@@ -346,7 +351,8 @@ export const CometChatMessageInformation = (props: CometChatMessageInformationIn
|
|
|
346
351
|
}, [message, receipts]);
|
|
347
352
|
|
|
348
353
|
return (
|
|
349
|
-
<
|
|
354
|
+
<LayoutDirectionContext.Provider value={direction}>
|
|
355
|
+
<View style={[mergedStyle.containerStyle, directionStyle(direction)]}>
|
|
350
356
|
<View style={mergedStyle.titleContainerStyle}>
|
|
351
357
|
<View style={{ flex: 1, alignItems: "center" }}>
|
|
352
358
|
<Text style={mergedStyle.titleStyle}>{title}</Text>
|
|
@@ -384,5 +390,6 @@ export const CometChatMessageInformation = (props: CometChatMessageInformationIn
|
|
|
384
390
|
/>
|
|
385
391
|
)}
|
|
386
392
|
</View>
|
|
393
|
+
</LayoutDirectionContext.Provider>
|
|
387
394
|
);
|
|
388
395
|
};
|
|
@@ -2,6 +2,7 @@ import React, { useEffect, useRef } from "react";
|
|
|
2
2
|
import { Animated, Dimensions, Easing, ScrollView, StyleSheet, View } from "react-native";
|
|
3
3
|
import Svg, { Defs, G, LinearGradient, Path, Stop } from "react-native-svg";
|
|
4
4
|
import { useTheme } from "../theme";
|
|
5
|
+
import { useRtlMirror } from "../shared/helper/layoutDirection";
|
|
5
6
|
|
|
6
7
|
const { width: screenWidth } = Dimensions.get("window");
|
|
7
8
|
|
|
@@ -56,6 +57,8 @@ const SkeletonItemTop = () => {
|
|
|
56
57
|
|
|
57
58
|
export const Skeleton = () => {
|
|
58
59
|
const theme = useTheme();
|
|
60
|
+
// ENG-41390: SVG shapes and the shimmer use fixed x positions; flip the whole skeleton in RTL.
|
|
61
|
+
const rtlMirror = useRtlMirror();
|
|
59
62
|
const animatedValue = useRef(new Animated.Value(0)).current;
|
|
60
63
|
|
|
61
64
|
useEffect(() => {
|
|
@@ -80,7 +83,7 @@ export const Skeleton = () => {
|
|
|
80
83
|
});
|
|
81
84
|
|
|
82
85
|
return (
|
|
83
|
-
<ScrollView>
|
|
86
|
+
<ScrollView style={rtlMirror}>
|
|
84
87
|
{new Array(20).fill(0).map((_, i) => {
|
|
85
88
|
return <SkeletonItemBottom key={i} />;
|
|
86
89
|
})}
|