@cometchat/chat-uikit-react-native 4.3.2 → 4.3.4

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.
Files changed (118) hide show
  1. package/android/src/main/AndroidManifest.xml +3 -4
  2. package/android/src/main/java/com/reactnativecometchatuikit/CometchatUiKitPackage.java +0 -1
  3. package/android/src/main/java/com/reactnativecometchatuikit/FileManager.java +125 -7
  4. package/android/src/main/java/com/reactnativecometchatuikit/ImageManager.java +1 -1
  5. package/ios/CommonUtil.h +4 -0
  6. package/ios/CommonUtil.m +27 -0
  7. package/package.json +1 -1
  8. package/src/AI/AIAssistBot/AIAssistBotDecorator.tsx +0 -3
  9. package/src/CometChatConversations/CometChatConversations.tsx +151 -66
  10. package/src/CometChatConversations/ConversationsConfiguration.ts +25 -4
  11. package/src/CometChatConversations/style.ts +5 -1
  12. package/src/CometChatConversationsWithMessages/CometChatConversationsWithMessages.tsx +29 -29
  13. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +598 -63
  14. package/src/CometChatMessageComposer/MessageComposerConfiguration.tsx +12 -1
  15. package/src/CometChatMessageComposer/resources/Info.png +0 -0
  16. package/src/CometChatMessageComposer/resources/index.ts +3 -1
  17. package/src/CometChatMessageHeader/listners.ts +0 -2
  18. package/src/CometChatMessageList/CometChatMessageList.tsx +139 -30
  19. package/src/CometChatMessageList/MessageListConfiguration.ts +19 -6
  20. package/src/CometChatMessages/CometChatMessages.tsx +16 -16
  21. package/src/CometChatThreadedMessages/CometChatThreadedMessages.tsx +41 -3
  22. package/src/calls/CallingExtentionDecorator.tsx +5 -5
  23. package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +3 -3
  24. package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +2 -0
  25. package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +2 -0
  26. package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +3 -3
  27. package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +3 -3
  28. package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +51 -15
  29. package/src/extensions/LinkPreview/LinkPreviewExtentionDecorator.tsx +4 -4
  30. package/src/extensions/MessageTranslation/MessageTranslationBubble.tsx +31 -9
  31. package/src/extensions/MessageTranslation/MessageTranslationDecorator.tsx +83 -6
  32. package/src/extensions/Polls/Polls.tsx +106 -70
  33. package/src/extensions/Polls/PollsDecorator.tsx +3 -2
  34. package/src/extensions/Stickers/CometChatStickerKeyboard/style.ts +3 -3
  35. package/src/extensions/Stickers/StickersExtensionDecorator.tsx +14 -6
  36. package/src/extensions/TextModeration/TextModerationExtensionDecorator.tsx +3 -3
  37. package/src/index.ts +29 -8
  38. package/src/shared/CometChatUiKit/CometChatUIKit.ts +146 -24
  39. package/src/shared/CometChatUiKit/index.ts +1 -1
  40. package/src/shared/base/vars.ts +13 -0
  41. package/src/shared/constants/UIKitConstants.ts +6 -0
  42. package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +7 -0
  43. package/src/shared/events/CometChatUIEventHandler/Listener.ts +11 -1
  44. package/src/shared/events/CometChatUIEvents.ts +3 -1
  45. package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +380 -0
  46. package/src/shared/formatters/CometChatMentionsFormatter/MentionTextStyle.ts +14 -0
  47. package/src/shared/formatters/CometChatMentionsFormatter/index.ts +7 -0
  48. package/src/shared/formatters/CometChatTextFormatter.ts +253 -0
  49. package/src/shared/formatters/CometChatUrlsFormatter/index.tsx +146 -0
  50. package/src/shared/formatters/index.ts +11 -0
  51. package/src/shared/framework/DataSource.ts +21 -16
  52. package/src/shared/framework/DataSourceDecorator.tsx +29 -13
  53. package/src/shared/framework/MessageDataSource.tsx +215 -49
  54. package/src/shared/helper/useKeyboard.tsx +20 -2
  55. package/src/shared/index.ts +31 -11
  56. package/src/shared/libs/ImageZoom/ReactNativeZoomableView.tsx +1040 -0
  57. package/src/shared/libs/ImageZoom/ReactNativeZoomableViewWithGestures.tsx +223 -0
  58. package/src/shared/libs/ImageZoom/helper.ts +144 -0
  59. package/src/shared/libs/ImageZoom/index.tsx +13 -0
  60. package/src/shared/libs/ImageZoom/types/index.ts +186 -0
  61. package/src/shared/libs/VideoPlayer/Video.js +0 -24
  62. package/src/shared/libs/VideoPlayerControls/assets/img/back.png +0 -0
  63. package/src/shared/libs/VideoPlayerControls/components/Back/Back.tsx +1 -1
  64. package/src/shared/resources/CometChatLocalize/CometChatLocalize.ts +2 -0
  65. package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +11 -1
  66. package/src/shared/resources/CometChatLocalize/resources/de/translation.json +11 -1
  67. package/src/shared/resources/CometChatLocalize/resources/en/translation.json +10 -1
  68. package/src/shared/resources/CometChatLocalize/resources/es/translation.json +11 -1
  69. package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +11 -1
  70. package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +10 -1
  71. package/src/shared/resources/CometChatLocalize/resources/hu/translation.json +315 -0
  72. package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +11 -1
  73. package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +11 -1
  74. package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +12 -1
  75. package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +11 -1
  76. package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +11 -1
  77. package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +11 -1
  78. package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +11 -1
  79. package/src/shared/resources/CometChatTheme/Palette.ts +16 -0
  80. package/src/shared/utils/InteractiveMessageUtils.ts +39 -1
  81. package/src/shared/utils/NetworkUtils.tsx +5 -0
  82. package/src/shared/utils/PermissionUtil.ts +142 -0
  83. package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +1 -0
  84. package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +8 -6
  85. package/src/shared/views/CometChatAvatar/CometChatAvatar.tsx +5 -1
  86. package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +12 -11
  87. package/src/shared/views/CometChatImageBubble/CometChatImageBubble.tsx +70 -22
  88. package/src/shared/views/CometChatImageBubble/assets/index.ts +5 -0
  89. package/src/shared/views/CometChatImageBubble/assets/spineer.png +0 -0
  90. package/src/shared/views/CometChatImageViewerModal/ImageViewerModal.tsx +106 -0
  91. package/src/shared/views/CometChatImageViewerModal/index.tsx +1 -0
  92. package/src/shared/views/CometChatImageViewerModal/resources/Back.png +0 -0
  93. package/src/shared/views/CometChatImageViewerModal/resources/index.ts +5 -0
  94. package/src/shared/views/CometChatList/CometChatList.tsx +10 -1
  95. package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +3 -2
  96. package/src/shared/views/{CometChatReactionsList/CometChatReactionsList.tsx → CometChatReactionList/CometChatReactionList.tsx} +17 -17
  97. package/src/shared/views/CometChatReactionList/ReactionListConfiguration.tsx +14 -0
  98. package/src/shared/views/CometChatReactionList/index.ts +12 -0
  99. package/src/shared/views/CometChatReactions/CometChatReactions.tsx +3 -3
  100. package/src/shared/views/CometChatSchedulerBubble/CometChatSchedulerBubble.tsx +12 -0
  101. package/src/shared/views/CometChatSuggestionList/CometChatSuggestionList.tsx +64 -0
  102. package/src/shared/views/CometChatSuggestionList/SuggestionItem.ts +48 -0
  103. package/src/shared/views/CometChatSuggestionList/SuggestionListConfiguration.ts +23 -0
  104. package/src/shared/views/CometChatSuggestionList/index.ts +11 -0
  105. package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +33 -46
  106. package/src/shared/views/CometChatTextBubble/TextBubbleStyle.ts +0 -14
  107. package/src/shared/views/CometChatTextBubble/index.ts +2 -3
  108. package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +6 -4
  109. package/src/shared/views/index.ts +14 -8
  110. package/android/src/main/java/com/reactnativecometchatuikit/VideoManager.java +0 -40
  111. package/src/shared/libs/VideoPlayerControls/assets/img/back@2x.png +0 -0
  112. package/src/shared/libs/VideoPlayerControls/assets/img/back@3x.png +0 -0
  113. package/src/shared/utils/PermissionUtilIOS.ts +0 -104
  114. package/src/shared/views/CometChatReactionsList/ReactionsListConfiguration.tsx +0 -14
  115. package/src/shared/views/CometChatReactionsList/index.ts +0 -12
  116. /package/src/shared/views/{CometChatReactionsList/ReactionsListStyle.tsx → CometChatReactionList/ReactionListStyle.tsx} +0 -0
  117. /package/src/shared/views/{CometChatReactionsList → CometChatReactionList}/resources/Spineer.png +0 -0
  118. /package/src/shared/views/{CometChatReactionsList → CometChatReactionList}/resources/index.ts +0 -0
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ImageType } from '../shared';
2
+ import { CometChatMentionsFormatter, CometChatTextFormatter, CometChatUrlsFormatter, ImageType } from '../shared';
3
3
  import {
4
4
  CometChatMessageComposerInterface,
5
5
  MessageComposerStyleInterface,
@@ -8,6 +8,7 @@ import {
8
8
  import { CometChat } from '@cometchat/chat-sdk-react-native';
9
9
  import { MediaRecorderStyle } from '../shared/views/CometChatMediaRecorder';
10
10
  import { AIOptionsStyle } from '../AI/AIOptionsStyle';
11
+ import { KeyboardAvoidingViewProps } from 'react-native';
11
12
  export interface MessageComposerConfigurationInterface
12
13
  extends Omit<
13
14
  CometChatMessageComposerInterface,
@@ -75,6 +76,16 @@ export class MessageComposerConfiguration {
75
76
  text?: string;
76
77
  AIIconURL?: string;
77
78
  AIOptionsStyle?: AIOptionsStyle;
79
+ /**
80
+ * To override keyboardAvoidingViewProps.
81
+ */
82
+ keyboardAvoidingViewProps?: KeyboardAvoidingViewProps
83
+ /**
84
+ * Collection of text formatter class
85
+ * @type {Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>}
86
+ */
87
+ textFormatters?: Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>;
88
+ disableMentions?: boolean;
78
89
  constructor(props: MessageComposerConfigurationInterface) {
79
90
  if (props)
80
91
  for (const [key, value] of Object.entries(props)) {
@@ -7,6 +7,7 @@ import CLOSE from './close.png';
7
7
  import STICKER from "./stickers.png";
8
8
  import MICROPHONE from "./microphone.png";
9
9
  import AI from './ai.png'
10
+ import INFO from './Info.png';
10
11
 
11
12
  export const ICONS ={
12
13
  HEART,
@@ -17,5 +18,6 @@ export const ICONS ={
17
18
  CLOSE,
18
19
  STICKER,
19
20
  MICROPHONE,
20
- AI
21
+ AI,
22
+ INFO
21
23
  }
@@ -23,12 +23,10 @@ export const listners = {
23
23
  msgTypingListenerId,
24
24
  {
25
25
  onTypingStarted: (typistDetails) => {
26
- console.log('onTypingStarted', typistDetails);
27
26
 
28
27
  msgTypingIndicator(typistDetails, 'typing');
29
28
  },
30
29
  onTypingEnded: (typistDetails) => {
31
- console.log('onTypingEnded', typistDetails);
32
30
  msgTypingIndicator(typistDetails, '');
33
31
  },
34
32
  }
@@ -3,7 +3,7 @@ import { View, FlatList, Text, Image, TouchableOpacity, ActivityIndicator, Modal
3
3
  //@ts-ignore
4
4
  import { CometChat } from "@cometchat/chat-sdk-react-native";
5
5
  import { LeftArrowCurve, RightArrowCurve } from "./resources";
6
- import { BaseStyle, BaseStyleInterface, CometChatContext, CometChatLiveReactions, CometChatUIKit, ImageType } from "../shared";
6
+ import { BaseStyle, BaseStyleInterface, CometChatContext, CometChatLiveReactions, CometChatMentionsFormatter, CometChatTextFormatter, CometChatUIKit, CometChatUrlsFormatter, ImageType, SuggestionItem } from "../shared";
7
7
  import { MessageBubbleStyle, MessageBubbleStyleInterface } from "../shared/views/CometChatMessageBubble/MessageBubbleStyle";
8
8
  import { AvatarStyle, AvatarStyleInterface } from "../shared";
9
9
  import { CometChatAvatar, CometChatDate, CometChatReceipt, DateStyle } from "../shared";
@@ -23,16 +23,16 @@ import { DateStyleInterface } from "../shared/views/CometChatDate/DateStyle";
23
23
  import { CometChatContextType } from "../shared/base/Types";
24
24
  import { CometChatUIEventHandler } from "../shared/events/CometChatUIEventHandler/CometChatUIEventHandler";
25
25
  import { ActionSheetStylesInterface } from "../shared/views/CometChatActionSheet/ActionSheetStyle";
26
- import Clipboard from "@react-native-clipboard/clipboard";
27
26
  import { CometChatMessageInformation } from "../CometChatMessageInformation/CometChatMessageInformation";
28
27
  // import { CometChatContacts, ForwardMessageConfigurationInterface } from "../CometChatContacts";
29
28
  import { MessageInformationConfigurationInterface } from "../CometChatMessageInformation";
30
29
  import { InteractiveMessageUtils } from "../shared/utils/InteractiveMessageUtils";
31
30
  import { CometChatEmojiKeyboard, EmojiKeyboardStyle } from "../shared/views/CometChatEmojiKeyboard";
32
- import { CometChatReactionsList, ReactionsListConfigurationInterface } from "../shared/views/CometChatReactionsList";
31
+ import { CometChatReactionList, ReactionListConfigurationInterface } from "../shared/views/CometChatReactionList";
33
32
  import { CometChatQuickReactions, QuickReactionsConfigurationInterface } from "../shared/views/CometChatQuickReactions";
34
33
  import { CometChatReactions, ReactionsConfigurationInterface } from "../shared/views/CometChatReactions";
35
34
  import { CommonUtils } from "../shared/utils/CommonUtils";
35
+ import Clipboard from "@react-native-clipboard/clipboard";
36
36
 
37
37
  let templatesMap = new Map<string, CometChatMessageTemplate>();
38
38
 
@@ -87,9 +87,9 @@ export interface CometChatMessageListProps {
87
87
  */
88
88
  reactionsConfiguration?: ReactionsConfigurationInterface,
89
89
  /**
90
- * Message Reaction List Configuration @ReactionsListConfigurationInterface
90
+ * Message Reaction List Configuration @ReactionListConfigurationInterface
91
91
  */
92
- reactionsListConfiguration?: ReactionsListConfigurationInterface,
92
+ reactionListConfiguration?: ReactionListConfigurationInterface,
93
93
  /**
94
94
  * Quick Reaction Configuration @QuickReactionsConfigurationInterface
95
95
  */
@@ -102,6 +102,12 @@ export interface CometChatMessageListProps {
102
102
  * Disables the reactions functionality
103
103
  */
104
104
  disableReactions?: boolean,
105
+ disableMentions?: boolean,
106
+ /**
107
+ * Collection of text formatter class
108
+ * @type {Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>}
109
+ */
110
+ textFormatters?: Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>;
105
111
  }
106
112
 
107
113
  export interface CometChatMessageListActionsInterface {
@@ -160,9 +166,11 @@ export const CometChatMessageList = memo(forwardRef<
160
166
  hideActionSheetHeader,
161
167
  reactionsConfiguration,
162
168
  disableReactions,
163
- reactionsListConfiguration,
169
+ reactionListConfiguration,
164
170
  quickReactionConfiguration,
165
171
  emojiKeyboardStyle,
172
+ disableMentions,
173
+ textFormatters
166
174
  } = props;
167
175
 
168
176
  const callListenerId = "call_" + new Date().getTime();
@@ -287,7 +295,7 @@ export const CometChatMessageList = memo(forwardRef<
287
295
  const [ongoingCallView, setOngoingCallView] = useState(null);
288
296
  const [selectedMessage, setSelectedMessage] = useState(null);
289
297
  const [showEmojiKeyboard, setShowEmojiKeyboard] = useState(false);
290
- const [showReactionsList, setShowReactionsList] = useState(false);
298
+ const [showReactionList, setShowReactionList] = useState(false);
291
299
  const [selectedEmoji, setSelectedEmoji] = useState(null);
292
300
  // const [forwarding, setForwarding] = useState(false);
293
301
 
@@ -477,7 +485,14 @@ export const CometChatMessageList = memo(forwardRef<
477
485
  }
478
486
 
479
487
  const loadTemplates = useCallback(() => {
480
- let templates: CometChatMessageTemplate[] = ChatConfigurator.dataSource.getAllMessageTemplates(theme);
488
+
489
+ let _formatters = textFormatters || [];
490
+
491
+ let templates: CometChatMessageTemplate[] = ChatConfigurator.dataSource.getAllMessageTemplates(theme, {
492
+ textFormatters: _formatters,
493
+ disableMentions: disableMentions
494
+ });
495
+
481
496
  templates.forEach(template => {
482
497
 
483
498
  if (templatesMap.get(`${template.category}_${template.type}`)) return
@@ -485,6 +500,79 @@ export const CometChatMessageList = memo(forwardRef<
485
500
  });
486
501
  }, [])
487
502
 
503
+
504
+ const getPlainString = (underlyingText: string, messageObject: CometChat.BaseMessage) => {
505
+
506
+ let _plainString = underlyingText;
507
+
508
+ let regexes: Array<RegExp> = []
509
+ let users: { key: string, value: SuggestionItem } = {};
510
+
511
+
512
+ let edits: Array<{
513
+ "endIndex": number,
514
+ "replacement": string,
515
+ "startIndex": number,
516
+ "user": SuggestionItem
517
+ }> = [];
518
+
519
+ let allFormatters = [...(textFormatters || [])];
520
+ let mentionsTextFormatter = ChatConfigurator.getDataSource().getMentionsFormatter(loggedInUser.current);
521
+ allFormatters.push(mentionsTextFormatter);
522
+
523
+ allFormatters.forEach((formatter: CometChatMentionsFormatter, key) => {
524
+ regexes.push(formatter.getRegexPattern());
525
+ let suggestionUsers = formatter.getSuggestionItems();
526
+ if (formatter instanceof CometChatMentionsFormatter) {
527
+ let mentionUsers = (messageObject?.getMentionedUsers && messageObject?.getMentionedUsers()).map(item => new SuggestionItem({
528
+ id: item.getUid(),
529
+ name: item.getName(),
530
+ promptText: "@" + item.getName(),
531
+ trackingCharacter: "@",
532
+ underlyingText: `<@uid:${item.getUid()}>`,
533
+ hideLeadingIcon: false
534
+
535
+ })) || [];
536
+ suggestionUsers = [...suggestionUsers, ...mentionUsers];
537
+ }
538
+ suggestionUsers?.length > 0 && suggestionUsers.forEach(item => users[item.underlyingText] = item);
539
+ })
540
+
541
+ regexes.forEach(regex => {
542
+ let match;
543
+ while ((match = regex.exec(_plainString)) !== null) {
544
+ const user = users[match[0]];
545
+ if (user) {
546
+ edits.push({
547
+ startIndex: match.index,
548
+ endIndex: regex.lastIndex,
549
+ replacement: user.promptText,
550
+ user
551
+ });
552
+ }
553
+ }
554
+ });
555
+
556
+ // Sort edits by startIndex to apply them in order
557
+ edits.sort((a, b) => a.startIndex - b.startIndex);
558
+
559
+ // Get an array of the entries in the map using the spread operator
560
+ const entries = [...edits].reverse();
561
+
562
+ // Iterate over the array in reverse order
563
+ entries.forEach(({ endIndex, replacement, startIndex, user }) => {
564
+
565
+ let pre = _plainString.substring(0, startIndex);
566
+ let post = _plainString.substring(endIndex);
567
+
568
+ _plainString = pre + replacement + post;
569
+
570
+ });
571
+
572
+ return _plainString;
573
+
574
+ }
575
+
488
576
  const playNotificationSound = useCallback((message) => {
489
577
 
490
578
  if (disableSoundForMessages) return;
@@ -554,6 +642,19 @@ export const CometChatMessageList = memo(forwardRef<
554
642
  return conversationId.current != null && (message.getConversationId() == conversationId.current);
555
643
  }
556
644
 
645
+ function isNearBottom() {
646
+ const { layoutHeight, scrollViewHeight, y } = currentScrollPosition.current;
647
+
648
+ let scrollPos = scrollViewHeight - (layoutHeight + y);
649
+ let scrollPosFromBottomInPercentage = (scrollPos / layoutHeight) * 100;
650
+
651
+ if (scrollPosFromBottomInPercentage <= 30) { // 30% from bottom
652
+ return true;
653
+ }
654
+ return false;
655
+
656
+ }
657
+
557
658
  const newMessage = (newMessage, isReceived = true) => {
558
659
  let baseMessage = newMessage as CometChat.BaseMessage;
559
660
  if (baseMessage.getCategory() === MessageCategoryConstants.interactive) {
@@ -596,7 +697,9 @@ export const CometChatMessageList = memo(forwardRef<
596
697
  if (baseMessage?.getReceiverType() == ReceiverTypeConstants.user) {
597
698
  CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccMessageDelivered, { message: newMessage });
598
699
  }
599
- if ((!parentMessageId && !(newMessage.parentMessageId)) || (parentMessageId && newMessage.parentMessageId == parseInt(parentMessageId))) {
700
+ if (isNearBottom()) {
701
+ scrollToBottom();
702
+ } else if ((!parentMessageId && !(newMessage.parentMessageId)) || (parentMessageId && newMessage.parentMessageId == parseInt(parentMessageId))) {
600
703
  setUnreadCount(unreadCount + 1);
601
704
  }
602
705
  } else {
@@ -719,12 +822,12 @@ export const CometChatMessageList = memo(forwardRef<
719
822
  }
720
823
 
721
824
  const handlePannel = (item) => {
722
- if(item.alignment === ViewAlignment.messageListBottom && CommonUtils.checkIdBelongsToThisComponent(item.id, user, group,parentMessageId) ){
825
+ if (item.alignment === ViewAlignment.messageListBottom && CommonUtils.checkIdBelongsToThisComponent(item.id, user, group, parentMessageId)) {
723
826
  if (item.child)
724
827
  setCustomListHeader(() => item.child)
725
828
  else
726
829
  setCustomListHeader(null)
727
- }
830
+ }
728
831
 
729
832
  }
730
833
 
@@ -732,7 +835,10 @@ export const CometChatMessageList = memo(forwardRef<
732
835
  CometChatUIEventHandler.addUIListener(
733
836
  uiEventListenerShow,
734
837
  {
735
- showPanel: (item) => handlePannel(item)
838
+ showPanel: (item) => handlePannel(item),
839
+ // ccMentionClick: (item) => {
840
+ // // console.log("item", item)
841
+ // }
736
842
  }
737
843
  )
738
844
  CometChatUIEventHandler.addUIListener(
@@ -823,7 +929,7 @@ export const CometChatMessageList = memo(forwardRef<
823
929
  if (status == MessageStatusConstants.success) {
824
930
  messageEdited(message, true);
825
931
  }
826
- if( status == MessageStatusConstants.error) {
932
+ if (status == MessageStatusConstants.error) {
827
933
  messageEdited(message, true);
828
934
  }
829
935
  },
@@ -1017,7 +1123,7 @@ export const CometChatMessageList = memo(forwardRef<
1017
1123
 
1018
1124
  useEffect(() => {
1019
1125
  if (selectedEmoji) {
1020
- setShowReactionsList(true);
1126
+ setShowReactionList(true);
1021
1127
  }
1022
1128
  }, [selectedEmoji])
1023
1129
 
@@ -1116,10 +1222,10 @@ export const CometChatMessageList = memo(forwardRef<
1116
1222
 
1117
1223
  return (
1118
1224
  <View style={{ flexDirection: "row" }}>
1119
- <Text style={[Style.nameStyle, {
1225
+ {Boolean(senderName) && <Text style={[Style.nameStyle, {
1120
1226
  color: _messageListStyle.nameTextColor,
1121
1227
  ..._messageListStyle.nameTextFont,
1122
- }]}>{senderName}</Text>
1228
+ }]}>{senderName}</Text>}
1123
1229
  {
1124
1230
  timeStampAlignment == "bottom" || item['category'] == "action" ?
1125
1231
  null :
@@ -1147,7 +1253,7 @@ export const CometChatMessageList = memo(forwardRef<
1147
1253
  messageState = "DELIVERED";
1148
1254
  else if (item.getSentAt())
1149
1255
  messageState = "SENT";
1150
- else if(item?.data?.metaData?.error)
1256
+ else if (item?.data?.metaData?.error)
1151
1257
  messageState = "ERROR"
1152
1258
  else if (isSender)
1153
1259
  messageState = "WAIT";
@@ -1246,7 +1352,8 @@ export const CometChatMessageList = memo(forwardRef<
1246
1352
  }
1247
1353
 
1248
1354
  const copyMessage = (item) => {
1249
- Clipboard.setString(item['text']);
1355
+ let copyMessage = getPlainString(item['text'], item);
1356
+ Clipboard.setString(copyMessage);
1250
1357
  setShowMessageOptions([]);
1251
1358
  }
1252
1359
 
@@ -1324,7 +1431,9 @@ export const CometChatMessageList = memo(forwardRef<
1324
1431
  }
1325
1432
 
1326
1433
  const shareMedia = async (messageObject: CometChat.MediaMessage) => {
1327
- let textMessage = messageObject.data.text;
1434
+ let _plainString = getPlainString(messageObject?.data?.text || "", messageObject);
1435
+
1436
+ let textMessage = _plainString;
1328
1437
  let fileUrl = messageObject.data.url;
1329
1438
 
1330
1439
  const getFileName = () => {
@@ -1360,7 +1469,7 @@ export const CometChatMessageList = memo(forwardRef<
1360
1469
  if ((item.getSender()?.getUid() || item?.['sender']?.['uid']) == loggedInUser.current?.['uid'])
1361
1470
  _style.backgroundColor = (alignment !== "leftAligned" && (item.getType() === MessageTypeConstants.text || item.getType() === MessageTypeConstants.meeting)) ? theme?.palette.getPrimary() : theme?.palette.getAccent50();
1362
1471
 
1363
- if(item?.getDeletedBy()) {
1472
+ if (item?.getDeletedBy()) {
1364
1473
  _style.backgroundColor = 'transparent';
1365
1474
  }
1366
1475
 
@@ -1516,11 +1625,11 @@ export const CometChatMessageList = memo(forwardRef<
1516
1625
  <CometChatMessageBubble
1517
1626
  id={`${message.getId()}`}
1518
1627
  LeadingView={() => !isThreaded && getLeadingView(message)}
1519
- HeaderView={() => !isThreaded && getHeaderView(message)}
1520
- FooterView={() => (disableReactions || isThreaded) ? null : getFooterView(message, bubbleAlignment)}
1628
+ HeaderView={hasTemplate.HeaderView ? hasTemplate.HeaderView?.bind(this, message, bubbleAlignment) : () => !isThreaded && getHeaderView(message)}
1629
+ FooterView={hasTemplate.FooterView ? hasTemplate.FooterView?.bind(this, message, bubbleAlignment) : () => (disableReactions || isThreaded) ? null : getFooterView(message, bubbleAlignment)}
1521
1630
  alignment={isThreaded ? "left" : bubbleAlignment}
1522
1631
  ContentView={hasTemplate.ContentView?.bind(this, message, bubbleAlignment)}
1523
- ThreadView={() => !isThreaded && getThreadView(message, bubbleAlignment)}
1632
+ ThreadView={() => !isThreaded && !message.getDeletedBy() && getThreadView(message, bubbleAlignment)}
1524
1633
  BottomView={() => ChatConfigurator.dataSource.getBottomView(message, bubbleAlignment)} // Note please rewrite this
1525
1634
  StatusInfoView={() => getStatusInfoView(message, bubbleAlignment)}
1526
1635
  style={getStyle(message)}
@@ -1929,26 +2038,26 @@ export const CometChatMessageList = memo(forwardRef<
1929
2038
  </CometChatBottomSheet>
1930
2039
 
1931
2040
  <CometChatBottomSheet
1932
- isOpen={showReactionsList}
2041
+ isOpen={showReactionList}
1933
2042
  onClose={() => {
1934
- setShowReactionsList(false);
2043
+ setShowReactionList(false);
1935
2044
  setSelectedEmoji(null);
1936
2045
  }}
1937
2046
  sliderMaxHeight={Dimensions.get('window').height * 0.5}
1938
2047
  sliderMinHeight={Dimensions.get('window').height * 0.5}
1939
2048
  >
1940
- <CometChatReactionsList
2049
+ <CometChatReactionList
1941
2050
  messageObject={selectedMessage}
1942
2051
  selectedReaction={selectedEmoji}
1943
- {...reactionsListConfiguration}
2052
+ {...reactionListConfiguration}
1944
2053
  onPress={(messageReaction: CometChat.Reaction, messageObject: CometChat.BaseMessage) => {
1945
- if (reactionsListConfiguration?.onPress) {
1946
- reactionsListConfiguration.onPress(messageReaction, messageObject);
2054
+ if (reactionListConfiguration?.onPress) {
2055
+ reactionListConfiguration.onPress(messageReaction, messageObject);
1947
2056
  return;
1948
2057
  }
1949
2058
  reactToMessage(messageReaction?.getReaction(), messageObject);
1950
2059
  if (messageObject?.getReactions()?.length === 1 && messageObject?.getReactions()?.[0]?.['count'] == 1) {
1951
- setShowReactionsList(false);
2060
+ setShowReactionList(false);
1952
2061
  setSelectedEmoji(null);
1953
2062
  }
1954
2063
  }}
@@ -1,6 +1,6 @@
1
1
  //@ts-ignore
2
2
  import { CometChat } from '@cometchat/chat-sdk-react-native';
3
- import { AvatarStyleInterface, ImageType } from '../shared';
3
+ import { AvatarStyleInterface, CometChatMentionsFormatter, CometChatTextFormatter, CometChatUrlsFormatter, ImageType } from '../shared';
4
4
  import { DateStyle } from '../shared';
5
5
  import { AvatarStyle } from '../shared';
6
6
  import {
@@ -22,7 +22,7 @@ import {
22
22
  import { DateStyleInterface } from '../shared/views/CometChatDate/DateStyle';
23
23
  import { ActionSheetStylesInterface } from '../shared/views/CometChatActionSheet/ActionSheetStyle';
24
24
  import { ReactionsConfigurationInterface } from '../shared/views/CometChatReactions';
25
- import { ReactionsListConfigurationInterface } from '../shared/views/CometChatReactionsList';
25
+ import { ReactionListConfigurationInterface } from '../shared/views/CometChatReactionList';
26
26
  import { QuickReactionsConfigurationInterface } from '../shared/views/CometChatQuickReactions';
27
27
  import { EmojiKeyboardStyle } from '../shared/views/CometChatEmojiKeyboard';
28
28
 
@@ -82,9 +82,9 @@ export interface MessageListConfigurationInterface {
82
82
  */
83
83
  reactionsConfiguration?: ReactionsConfigurationInterface;
84
84
  /**
85
- * Message Reaction List Configuration @ReactionsListConfigurationInterface
85
+ * Message Reaction List Configuration @ReactionListConfigurationInterface
86
86
  */
87
- reactionsListConfiguration?: ReactionsListConfigurationInterface;
87
+ reactionListConfiguration?: ReactionListConfigurationInterface;
88
88
  /**
89
89
  * Quick Reaction Configuration @QuickReactionsConfigurationInterface
90
90
  */
@@ -97,6 +97,12 @@ export interface MessageListConfigurationInterface {
97
97
  * Disables the reactions functionality
98
98
  */
99
99
  disableReactions?: boolean;
100
+ disableMentions?: boolean;
101
+ /**
102
+ * Collection of text formatter class
103
+ * @type {Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>}
104
+ */
105
+ textFormatters?: Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>;
100
106
  }
101
107
  export class MessageListConfiguration
102
108
  implements MessageListConfigurationInterface {
@@ -155,9 +161,9 @@ export class MessageListConfiguration
155
161
  */
156
162
  reactionsConfiguration?: ReactionsConfigurationInterface;
157
163
  /**
158
- * Message Reaction List Configuration @ReactionsListConfigurationInterface
164
+ * Message Reaction List Configuration @ReactionListConfigurationInterface
159
165
  */
160
- reactionsListConfiguration?: ReactionsListConfigurationInterface;
166
+ reactionListConfiguration?: ReactionListConfigurationInterface;
161
167
  /**
162
168
  * Quick Reaction Configuration @QuickReactionsConfigurationInterface
163
169
  */
@@ -171,6 +177,13 @@ export class MessageListConfiguration
171
177
  */
172
178
  disableReactions?: boolean;
173
179
 
180
+ disableMentions: boolean;
181
+ /**
182
+ * Collection of text formatter class
183
+ * @type {Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>}
184
+ */
185
+ textFormatters?: Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>;
186
+
174
187
  constructor(props: MessageListConfigurationInterface) {
175
188
  if (props) {
176
189
  for (const [key, value] of Object.entries(props)) {
@@ -170,24 +170,24 @@ export const CometChatMessages = (props: CometChatMessagesInterface) => {
170
170
  new CometChat.ConnectionListener({
171
171
  onConnected: () => {
172
172
  console.log("ConnectionListener => On Connected", user, group);
173
- if(user?.uid){
174
- CometChat.getUser(user?.uid)
175
- .then(user => {
176
- setUserObject(user);
177
- console.log("onConnected getUser", { user });
178
- })
179
- .catch(e => {
180
- console.log("ERROR")
181
- })
173
+ if (user?.uid) {
174
+ CometChat.getUser(user?.uid)
175
+ .then(user => {
176
+ setUserObject(user);
177
+ console.log("onConnected getUser", { user });
178
+ })
179
+ .catch(e => {
180
+ console.log("ERROR")
181
+ })
182
182
  } else {
183
183
  CometChat.getGroup(group?.guid)
184
- .then(group => {
185
- setGroupObject(group);
186
- console.log("onConnected getGroup", { group });
187
- })
188
- .catch(e => {
189
- console.log("ERROR")
190
- })
184
+ .then(group => {
185
+ setGroupObject(group);
186
+ console.log("onConnected getGroup", { group });
187
+ })
188
+ .catch(e => {
189
+ console.log("ERROR")
190
+ })
191
191
  }
192
192
  },
193
193
  inConnecting: () => {
@@ -22,6 +22,7 @@ import { messageStatus } from '../shared/utils/CometChatMessageHelper';
22
22
  import { CometChatContextType } from '../shared/base/Types';
23
23
  import { useKeyboard } from '../shared/helper/useKeyboard';
24
24
  import { CometChatUIEventHandler } from '../shared/events/CometChatUIEventHandler/CometChatUIEventHandler';
25
+ import { commonVars } from '../shared/base/vars';
25
26
 
26
27
  const uiEventId = 'ccUiEvent' + new Date().getTime();
27
28
  export interface CometChatThreadedMessagesInterface {
@@ -132,10 +133,20 @@ export const CometChatThreadedMessages = (
132
133
 
133
134
  let limit: number = 30;
134
135
 
136
+ const checkMessageBelongsToSameThread = (updatedMessage : CometChat.BaseMessage)=>{
137
+
138
+ return (updatedMessage.getParentMessageId() == message.getId() );
139
+ }
140
+
141
+ const checkAndUpdateRepliesCount = ( updatedMessage : CometChat.BaseMessage)=>{
142
+ if(checkMessageBelongsToSameThread(updatedMessage)){
143
+ setReplyCount((prev) => prev + 1);
144
+ }
145
+ }
146
+
135
147
  const ccMessageSentFunc = ({ message: msg, status }) => {
136
148
  if (status === messageStatus.success) {
137
- if (message.getId() == msg.parentMessageId)
138
- setReplyCount((prev) => prev + 1);
149
+ checkAndUpdateRepliesCount(msg)
139
150
  if (message.getId() == msg.id) setMessage(message);
140
151
  }
141
152
  };
@@ -150,12 +161,35 @@ export const CometChatThreadedMessages = (
150
161
  if (message.getId() == msg.id) setMessage(message);
151
162
  };
152
163
 
164
+
165
+
153
166
  useEffect(() => {
154
167
  CometChatUIEventHandler.addMessageListener(uiEventId, {
155
168
  ccMessageSent: (item) => ccMessageSentFunc(item),
156
169
  ccMessageEdited: (item) => ccMessageEditedFunc(item),
157
170
  ccMessageDeleted: (item) => ccMessageDeletedFunc(item),
158
171
  ccMessageRead: (item) => ccMessageReadFunc(item),
172
+ onTextMessageReceived: (textMessage) => {
173
+ checkAndUpdateRepliesCount(textMessage)
174
+ },
175
+ onMediaMessageReceived: (mediaMessage) => {
176
+ checkAndUpdateRepliesCount(mediaMessage)
177
+ },
178
+ onCustomMessageReceived: (customMessage) => {
179
+ checkAndUpdateRepliesCount(customMessage)
180
+ },
181
+ onFormMessageReceived: (formMessage) => {
182
+ checkAndUpdateRepliesCount(formMessage)
183
+ },
184
+ onCardMessageReceived: (cardMessage) => {
185
+ checkAndUpdateRepliesCount(cardMessage)
186
+ },
187
+ onSchedulerMessageReceived: (schedulerMessage) => {
188
+ checkAndUpdateRepliesCount(schedulerMessage)
189
+ },
190
+ onCustomInteractiveMessageReceived: (customInteractiveMessage) => {
191
+ checkAndUpdateRepliesCount(customInteractiveMessage)
192
+ }
159
193
  });
160
194
 
161
195
  return () => {
@@ -272,7 +306,11 @@ export const CometChatThreadedMessages = (
272
306
  <View
273
307
  style={{
274
308
  width: '100%',
275
- height: keyboardHeight - 35,
309
+ height:
310
+ keyboardHeight -
311
+ (Number.isInteger(commonVars.safeAreaInsets.bottom)
312
+ ? commonVars.safeAreaInsets.bottom
313
+ : 35),
276
314
  }}
277
315
  />
278
316
  )}
@@ -6,7 +6,7 @@ import { localize } from "../shared/resources/CometChatLocalize";
6
6
  import { DataSource, DataSourceDecorator } from "../shared/framework";
7
7
  import { CometChatTheme } from "../shared/resources/CometChatTheme";
8
8
  import { CallingConfiguration } from "./CallingConfiguration";
9
- import { CallContstatnts, MessageCategoryConstants, MessageOptionConstants, MessageTypeConstants } from "../shared/constants/UIKitConstants";
9
+ import { AdditionalBubbleStylingParams, CallContstatnts, MessageCategoryConstants, MessageOptionConstants, MessageTypeConstants } from "../shared/constants/UIKitConstants";
10
10
  import { CometChatCallBubble } from "./CometChatCallBubble";
11
11
  import { AudioIcon } from "./resources";
12
12
  import { VideoIcon } from "./resources";
@@ -16,7 +16,7 @@ import { CallingPackage } from "./CallingPackage";
16
16
  import { CallUtils } from "./CallUtils";
17
17
  import { CometChatUIEventHandler } from "../shared";
18
18
  import { CallUIEvents } from "./CallEvents";
19
- import { permissionUtilIOS } from "../shared/utils/PermissionUtilIOS";
19
+ import { permissionUtil } from "../shared/utils/PermissionUtil";
20
20
 
21
21
  const CometChatCalls = CallingPackage.CometChatCalls;
22
22
 
@@ -129,7 +129,7 @@ export class CallingExtensionDecorator extends DataSourceDecorator {
129
129
  }
130
130
 
131
131
  async startDirectCall(sessionId: string, theme?: CometChatTheme) {
132
- if (!(await permissionUtilIOS.startResourceBasedTask(["mic", "camera"]))) {
132
+ if (!(await permissionUtil.startResourceBasedTask(["mic", "camera"]))) {
133
133
  return;
134
134
  }
135
135
  const callSettingsBuilder = new CometChatCalls.CallSettingsBuilder()
@@ -195,8 +195,8 @@ export class CallingExtensionDecorator extends DataSourceDecorator {
195
195
  })
196
196
  }
197
197
 
198
- getAllMessageTemplates(theme: CometChatTheme): CometChatMessageTemplate[] {
199
- let templates = super.getAllMessageTemplates(theme);
198
+ getAllMessageTemplates(theme: CometChatTheme, additionalParams?: AdditionalBubbleStylingParams): CometChatMessageTemplate[] {
199
+ let templates = super.getAllMessageTemplates(theme, additionalParams);
200
200
  templates.push(
201
201
  this.getUserAudioCallTemplate(theme),
202
202
  this.getUserVideoCallTemplates(theme),
@@ -12,7 +12,7 @@ import { Style } from './style'
12
12
  import { CallUIEvents } from '../CallEvents'
13
13
  import { CometChatOutgoingCall } from '../CometChatOutgoingCall'
14
14
  import { CometChatUIKit } from '../../shared/CometChatUiKit/CometChatUIKit'
15
- import { permissionUtilIOS } from '../../shared/utils/PermissionUtilIOS'
15
+ import { permissionUtil } from '../../shared/utils/PermissionUtil'
16
16
 
17
17
  const listenerId = "callEventListener_" + new Date().getTime();
18
18
 
@@ -206,7 +206,7 @@ export const CometChatCallButtons = (props: CometChatCallButtonsInterface) => {
206
206
  if (disableButton)
207
207
  return;
208
208
 
209
- if (!(await permissionUtilIOS.startResourceBasedTask(["mic"]))) {
209
+ if (!(await permissionUtil.startResourceBasedTask(["mic"]))) {
210
210
  return;
211
211
  }
212
212
 
@@ -222,7 +222,7 @@ export const CometChatCallButtons = (props: CometChatCallButtonsInterface) => {
222
222
  if (disableButton)
223
223
  return;
224
224
 
225
- if (!(await permissionUtilIOS.startResourceBasedTask(["mic", "camera"]))) {
225
+ if (!(await permissionUtil.startResourceBasedTask(["mic", "camera"]))) {
226
226
  return;
227
227
  }
228
228