@cometchat/chat-uikit-react-native 4.3.12 → 4.3.14

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 (164) hide show
  1. package/lib/AI/AIConversationStarter/style.d.ts +8 -8
  2. package/lib/AI/style.d.ts +15 -15
  3. package/lib/CometChatAddMembers/CometChatAddMembers.js +1 -0
  4. package/lib/CometChatAddMembers/CometChatAddMembers.js.map +1 -1
  5. package/lib/CometChatDetails/CometChatDetails.js +4 -2
  6. package/lib/CometChatDetails/CometChatDetails.js.map +1 -1
  7. package/lib/CometChatGroupMembers/CometChatGroupMembers.js +15 -4
  8. package/lib/CometChatGroupMembers/CometChatGroupMembers.js.map +1 -1
  9. package/lib/CometChatMessageComposer/CometChatMessageComposer.js +11 -3
  10. package/lib/CometChatMessageComposer/CometChatMessageComposer.js.map +1 -1
  11. package/lib/CometChatMessageHeader/CometChatMessageHeader.js +1 -1
  12. package/lib/CometChatMessageHeader/CometChatMessageHeader.js.map +1 -1
  13. package/lib/CometChatMessageInformation/CometChatMessageInformation.js +3 -1
  14. package/lib/CometChatMessageInformation/CometChatMessageInformation.js.map +1 -1
  15. package/lib/CometChatMessageList/CometChatMessageList.js +3 -1
  16. package/lib/CometChatMessageList/CometChatMessageList.js.map +1 -1
  17. package/lib/CometChatMessageList/MessageListConfiguration.js +1 -0
  18. package/lib/CometChatMessageList/MessageListConfiguration.js.map +1 -1
  19. package/lib/calls/CallingPackage.d.ts +1 -1
  20. package/lib/extensions/CollaborativeBubble/CometChatCollaborativeBubble.d.ts +2 -2
  21. package/lib/extensions/ExtensionModerator.d.ts +1 -1
  22. package/lib/extensions/SmartReplies/SmartRepliesView.d.ts +2 -2
  23. package/lib/extensions/Stickers/CometChatStickerKeyboard/StickerKeyboardConfiguration.d.ts +2 -2
  24. package/lib/extensions/ThumbnailGeneration/ThumbnailGenerationDecorator.js +5 -5
  25. package/lib/extensions/ThumbnailGeneration/ThumbnailGenerationDecorator.js.map +1 -1
  26. package/lib/extensions/ThumbnailGeneration/resources/index.d.ts +2 -2
  27. package/lib/extensions/ThumbnailGeneration/resources/index.js +2 -2
  28. package/lib/extensions/ThumbnailGeneration/resources/index.js.map +1 -1
  29. package/lib/shared/constants/UIKitConstants.d.ts +9 -0
  30. package/lib/shared/constants/UIKitConstants.js +12 -1
  31. package/lib/shared/constants/UIKitConstants.js.map +1 -1
  32. package/lib/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.js +40 -1
  33. package/lib/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.js.map +1 -1
  34. package/lib/shared/helper/SwipeRow.d.ts +5 -5
  35. package/lib/shared/helper/functions.d.ts +1 -1
  36. package/lib/shared/libs/ImageZoom/ReactNativeZoomableView.d.ts +8 -5
  37. package/lib/shared/libs/ImageZoom/ReactNativeZoomableViewWithGestures.d.ts +2 -2
  38. package/lib/shared/libs/VideoPlayerControls/OSSupport/TVOSSupport.d.ts +1 -1
  39. package/lib/shared/libs/datePickerModal/DateTimePickerModal.d.ts +1 -1
  40. package/lib/shared/libs/datePickerModal/DateTimePickerModal.ios.d.ts +2 -2
  41. package/lib/shared/libs/datePickerModal/Modal.d.ts +3 -3
  42. package/lib/shared/libs/luxon/src/datetime.d.ts +81 -81
  43. package/lib/shared/libs/luxon/src/duration.d.ts +24 -24
  44. package/lib/shared/libs/luxon/src/impl/english.d.ts +3 -3
  45. package/lib/shared/libs/luxon/src/impl/locale.d.ts +1 -1
  46. package/lib/shared/libs/luxon/src/impl/util.d.ts +7 -7
  47. package/lib/shared/libs/luxon/src/info.d.ts +28 -28
  48. package/lib/shared/libs/luxon/src/interval.d.ts +14 -14
  49. package/lib/shared/libs/luxon/src/settings.d.ts +2 -2
  50. package/lib/shared/libs/luxon/src/zones/IANAZone.d.ts +1 -1
  51. package/lib/shared/libs/luxon/src/zones/invalidZone.d.ts +1 -1
  52. package/lib/shared/libs/luxon/src/zones/systemZone.d.ts +1 -1
  53. package/lib/shared/modals/InteractiveData/InteractiveMessage/SchedulerMessage.d.ts +8 -8
  54. package/lib/shared/resources/CometChatSoundManager/CometChatSoundManager.d.ts +2 -2
  55. package/lib/shared/resources/CometChatTheme/CometChatTheme.d.ts +2 -2
  56. package/lib/shared/resources/CometChatTheme/Palette.d.ts +24 -24
  57. package/lib/shared/resources/CometChatTheme/Typography.d.ts +23 -23
  58. package/lib/shared/utils/CometChatMessagePreview/CometChatMessagePreview.d.ts +1 -1
  59. package/lib/shared/utils/CometChatMessagePreview/MessagePreviewConfiguration.d.ts +3 -3
  60. package/lib/shared/utils/CometChatMessagePreview/MessagePreviewStyle.d.ts +10 -10
  61. package/lib/shared/utils/DetailsUtils/DetailsUtils.d.ts +1 -1
  62. package/lib/shared/utils/SchedulerUtils.d.ts +4 -4
  63. package/lib/shared/views/CometChatActionSheet/ActionItem.d.ts +9 -9
  64. package/lib/shared/views/CometChatActionSheet/CometChatActionSheet.d.ts +3 -3
  65. package/lib/shared/views/CometChatDate/CometChatDate.d.ts +1 -1
  66. package/lib/shared/views/CometChatEmojiKeyboard/Emoji.d.ts +1 -1
  67. package/lib/shared/views/CometChatEmojiKeyboard/EmojiKeyboardConfiguration.d.ts +3 -3
  68. package/lib/shared/views/CometChatEmojiKeyboard/EmojiKeyboardStyle.d.ts +3 -3
  69. package/lib/shared/views/CometChatImageBubble/CometChatImageBubble.js +8 -2
  70. package/lib/shared/views/CometChatImageBubble/CometChatImageBubble.js.map +1 -1
  71. package/lib/shared/views/CometChatList/CometChatList.js +0 -1
  72. package/lib/shared/views/CometChatList/CometChatList.js.map +1 -1
  73. package/lib/shared/views/CometChatMessageBubble/style.js +1 -0
  74. package/lib/shared/views/CometChatReactions/CometChatReactions.d.ts +1 -1
  75. package/lib/shared/views/CometChatReceipt/CometChatReceipt.d.ts +1 -1
  76. package/lib/shared/views/CometChatVideoBubble/CometChatVideoBubble.js +7 -1
  77. package/lib/shared/views/CometChatVideoBubble/CometChatVideoBubble.js.map +1 -1
  78. package/lib/shared/views/CometChatVideoBubble/VideoBubbleStyle.js +1 -1
  79. package/lib/shared/views/CometChatVideoBubble/VideoBubbleStyle.js.map +1 -1
  80. package/package.json +1 -1
  81. package/src/AI/AIConversationSummary/resources/close.png +0 -0
  82. package/src/CometChatConversations/CometChatConversations.tsx +85 -72
  83. package/src/CometChatConversations/resources/close.png +0 -0
  84. package/src/CometChatConversations/resources/rightTick.png +0 -0
  85. package/src/CometChatCreateGroup/resources/close.png +0 -0
  86. package/src/CometChatCreateGroup/resources/rightTick.png +0 -0
  87. package/src/CometChatDetails/CometChatDetails.tsx +4 -2
  88. package/src/CometChatDetails/resources/close.png +0 -0
  89. package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +26 -11
  90. package/src/CometChatGroupMembers/resources/rightTick.png +0 -0
  91. package/src/CometChatGroups/resources/close.png +0 -0
  92. package/src/CometChatGroups/resources/rightTick.png +0 -0
  93. package/src/CometChatJoinProtectedGroup/resources/close.png +0 -0
  94. package/src/CometChatJoinProtectedGroup/resources/rightTick.png +0 -0
  95. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +43 -48
  96. package/src/CometChatMessageComposer/resources/Info.png +0 -0
  97. package/src/CometChatMessageComposer/resources/circle_add.png +0 -0
  98. package/src/CometChatMessageComposer/resources/close.png +0 -0
  99. package/src/CometChatMessageComposer/resources/image.png +0 -0
  100. package/src/CometChatMessageComposer/resources/send_message.png +0 -0
  101. package/src/CometChatMessageComposer/resources/stickers.png +0 -0
  102. package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +1 -1
  103. package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +9 -6
  104. package/src/CometChatMessageList/CometChatMessageList.tsx +53 -64
  105. package/src/CometChatMessageList/MessageListConfiguration.ts +2 -0
  106. package/src/CometChatMessageList/resources/close.png +0 -0
  107. package/src/CometChatMessageList/resources/leftarrowcurve.png +0 -0
  108. package/src/CometChatMessages/CometChatMessages.tsx +1 -2
  109. package/src/CometChatMessages/resources/info.png +0 -0
  110. package/src/CometChatMessages/style.ts +0 -1
  111. package/src/CometChatThreadedMessages/resources/close.png +0 -0
  112. package/src/calls/CometChatCallButtons/resources/Call.png +0 -0
  113. package/src/calls/CometChatCallButtons/resources/Video.png +0 -0
  114. package/src/calls/CometChatCallLogHistory/resources/Info.png +0 -0
  115. package/src/calls/CometChatCallLogRecordings/resources/download.png +0 -0
  116. package/src/calls/CometChatCallLogs/CallLogsConfiguration.ts +4 -4
  117. package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +2 -2
  118. package/src/calls/CometChatCallLogs/resources/Info.png +0 -0
  119. package/src/calls/CometChatOutgoingCall/resources/Close.png +0 -0
  120. package/src/calls/resources/Call.png +0 -0
  121. package/src/calls/resources/Video.png +0 -0
  122. package/src/extensions/CollaborativeDocument/resources/collaborative_document.png +0 -0
  123. package/src/extensions/CollaborativeWhiteboard/resources/collaborative_whiteboard.png +0 -0
  124. package/src/extensions/MessageTranslation/resources/translate.png +0 -0
  125. package/src/extensions/Polls/resources/close.png +0 -0
  126. package/src/extensions/Polls/resources/document.png +0 -0
  127. package/src/extensions/Polls/resources/kickIcon.png +0 -0
  128. package/src/extensions/Polls/resources/rightTick.png +0 -0
  129. package/src/extensions/SmartReplies/resources/close.png +0 -0
  130. package/src/extensions/Stickers/resources/Stickers.png +0 -0
  131. package/src/shared/assets/images/checkmark.png +0 -0
  132. package/src/shared/assets/images/grey-double-tick-icon.png +0 -0
  133. package/src/shared/assets/images/grey-tick-icon.png +0 -0
  134. package/src/shared/constants/UIKitConstants.ts +12 -1
  135. package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +46 -1
  136. package/src/shared/framework/resources/audio-file.png +0 -0
  137. package/src/shared/framework/resources/circle_add.png +0 -0
  138. package/src/shared/framework/resources/copy.png +0 -0
  139. package/src/shared/framework/resources/delete.png +0 -0
  140. package/src/shared/framework/resources/edit.png +0 -0
  141. package/src/shared/framework/resources/file_upload.png +0 -0
  142. package/src/shared/framework/resources/image.png +0 -0
  143. package/src/shared/framework/resources/info.png +0 -0
  144. package/src/shared/framework/resources/messageInPrivate.png +0 -0
  145. package/src/shared/framework/resources/pause.png +0 -0
  146. package/src/shared/framework/resources/play.png +0 -0
  147. package/src/shared/framework/resources/send_message.png +0 -0
  148. package/src/shared/framework/resources/share.png +0 -0
  149. package/src/shared/framework/resources/thread.png +0 -0
  150. package/src/shared/framework/resources/video_upload.png +0 -0
  151. package/src/shared/utils/CometChatMessagePreview/resources/close.png +0 -0
  152. package/src/shared/utils/CommonUtils.ts +43 -9
  153. package/src/shared/utils/DetailsUtils/resources/close.png +0 -0
  154. package/src/shared/views/CometChatActionSheet/resources/grid.png +0 -0
  155. package/src/shared/views/CometChatActionSheet/resources/list.png +0 -0
  156. package/src/shared/views/CometChatAudioBubble/resources/pause.png +0 -0
  157. package/src/shared/views/CometChatAudioBubble/resources/play.png +0 -0
  158. package/src/shared/views/CometChatFileBubble/resources/download.png +0 -0
  159. package/src/shared/views/CometChatFileBubble/resources/file_upload.png +0 -0
  160. package/src/shared/views/CometChatFileBubble/style.ts +2 -0
  161. package/src/shared/views/CometChatList/CometChatList.tsx +13 -5
  162. package/src/shared/views/CometChatList/resources/checkmark.png +0 -0
  163. package/src/shared/views/CometChatSchedulerBubble/CometChatSchedulerBubble.tsx +7 -4
  164. package/src/shared/views/CometChatVideoBubble/resources/play.png +0 -0
@@ -48,6 +48,7 @@ export interface CometChatMessageListProps {
48
48
  emptyStateText?: String,
49
49
  ErrorStateView?: (e: CometChat.CometChatException) => JSX.Element,
50
50
  errorStateText?: String,
51
+ hideError?: boolean,
51
52
  LoadingStateView?: () => JSX.Element,
52
53
  disableReceipt?: boolean,
53
54
  disableSoundForMessages?: boolean,
@@ -140,6 +141,7 @@ export const CometChatMessageList = memo(forwardRef<
140
141
  emptyStateText = localize("NO_MESSAGES_FOUND"),
141
142
  ErrorStateView,
142
143
  errorStateText = localize("SOMETHING_WRONG"),
144
+ hideError,
143
145
  LoadingStateView,
144
146
  disableReceipt = false,
145
147
  disableSoundForMessages,
@@ -187,6 +189,8 @@ export const CometChatMessageList = memo(forwardRef<
187
189
  const uiEventListenerShow = "uiEvent_show_" + new Date().getTime();
188
190
  const uiEventListenerHide = "uiEvent_hide_" + new Date().getTime();
189
191
  const connectionListenerId = 'connectionListener_' + new Date().getTime();
192
+ const messageEventListener = "messageEvent_" + new Date().getTime();
193
+ const groupEventListener = "groupEvent_" + new Date().getTime();
190
194
 
191
195
  useLayoutEffect(() => {
192
196
  if (user) {
@@ -435,10 +439,10 @@ export const CometChatMessageList = memo(forwardRef<
435
439
  messagesRequest.build()
436
440
  .fetchNext()
437
441
  .then(updatedMessages => {
438
- let tmpList = [...messagesList];
442
+ let tmpList = [...messagesContentListRef.current];
439
443
  for (let i = 0; i < updatedMessages.length; i++) {
440
444
  let condition = (msg) => msg.getId() == updatedMessages[i]?.actionOn.getId()
441
- let msgIndex = messagesList.findIndex(condition);
445
+ let msgIndex = messagesContentListRef.current.findIndex(condition);
442
446
  if (msgIndex > -1) {
443
447
  tmpList[msgIndex] = updatedMessages[i]?.actionOn;
444
448
  }
@@ -459,19 +463,10 @@ export const CometChatMessageList = memo(forwardRef<
459
463
  .fetchNext()
460
464
  .then(newMessages => {
461
465
  let cleanUpdatedList = [...updatedList];
462
- for (let i = (cleanUpdatedList.length - 1); i >= 0; i--) {
463
- if (cleanUpdatedList[i].id == lastID.current) break;
464
- if (cleanUpdatedList[i].id == undefined || Number.isNaN(parseInt(cleanUpdatedList[i].id)))
465
- cleanUpdatedList.splice(i, 1);
466
- }
467
- // console.log("newMessages", newMessages.length, JSON.stringify(newMessages))
468
- if (cleanUpdatedList?.length > 0 && cleanUpdatedList?.[cleanUpdatedList.length - 1]?.["muid"]) {
469
- let localFileExists = newMessages.findIndex(msg => msg?.["muid"] == cleanUpdatedList?.[cleanUpdatedList.length - 1]?.["muid"]);
470
- if (localFileExists > -1) {
471
- cleanUpdatedList.shift();
472
- }
473
- }
474
- let tmpList = [...cleanUpdatedList, ...newMessages];
466
+
467
+ let finalOutput = CommonUtils.mergeArrays(cleanUpdatedList, newMessages, "muid");
468
+
469
+ let tmpList = [...finalOutput];
475
470
  tmpList = tmpList.map((item: CometChat.BaseMessage, index) => {
476
471
  if (item.getCategory() === MessageCategoryConstants.interactive) {
477
472
  return InteractiveMessageUtils.convertInteractiveMessage(item);
@@ -483,7 +478,7 @@ export const CometChatMessageList = memo(forwardRef<
483
478
  const filteredInProgressMessages = inProgressMessages.current.filter(secondItem =>
484
479
  !tmpList.some(firstItem => firstItem.muid === secondItem.muid)
485
480
  );
486
- const combinedArray = tmpList.concat(filteredInProgressMessages);
481
+ const combinedArray = CommonUtils.mergeArrays(tmpList, filteredInProgressMessages, "muid");
487
482
  tmpList = combinedArray
488
483
  }
489
484
  messagesContentListRef.current = tmpList;
@@ -759,9 +754,9 @@ export const CometChatMessageList = memo(forwardRef<
759
754
  }
760
755
  else
761
756
  condition = (msg) => msg.getId() == editedMessage.getId()
762
- let msgIndex = messagesList.findIndex(condition);
757
+ let msgIndex = messagesContentListRef.current.findIndex(condition);
763
758
  if (msgIndex > -1) {
764
- let tmpList = [...messagesList];
759
+ let tmpList = [...messagesContentListRef.current];
765
760
  if (editedMessage.getCategory() === MessageCategoryConstants.interactive) {
766
761
  editedMessage = InteractiveMessageUtils.convertInteractiveMessage(editedMessage);
767
762
  }
@@ -796,29 +791,31 @@ export const CometChatMessageList = memo(forwardRef<
796
791
  const createActionMessage = () => { }
797
792
 
798
793
  const updateMessageReceipt = (receipt) => {
799
- let index = messagesList.findIndex((msg, index) => msg['id'] == receipt['messageId'] || msg['messageId'] == receipt['messageId']);
800
-
794
+ let index = messagesContentListRef.current.findIndex((msg, index) => msg['id'] == receipt['messageId'] || msg['messageId'] == receipt['messageId']);
801
795
  if (index == -1) return;
802
796
 
803
- let tmpList: Array<CometChat.BaseMessage> = [...messagesList];
797
+ let tmpList: Array<CometChat.BaseMessage> = [...messagesContentListRef.current];
804
798
 
805
799
  for (let i = index; i > 0; i--) {
806
800
 
807
801
  if (tmpList[i]?.getReadAt && tmpList[i]?.getReadAt()) break;
808
802
 
809
803
  let tmpMsg = tmpList[i];
810
- if ((tmpMsg as CometChat.BaseMessage)?.getReceiverType() == ReceiverTypeConstants.group)
811
- return;
812
- if (tmpMsg.getCategory() === MessageCategoryConstants.interactive) {
813
- tmpMsg = InteractiveMessageUtils.convertInteractiveMessage(tmpMsg);
814
- }
815
- if (receipt.getDeliveredAt) {
816
- tmpMsg.setDeliveredAt(receipt.getDeliveredAt());
817
- }
818
- if (receipt.getReadAt) {
819
- tmpMsg.setReadAt(receipt.getReadAt());
820
- }
804
+ if (!Number.isNaN(Number(tmpMsg.getId()))) {
821
805
 
806
+ if ((tmpMsg as CometChat.BaseMessage)?.getReceiverType() == ReceiverTypeConstants.group)
807
+ return;
808
+ if (tmpMsg.getCategory() === MessageCategoryConstants.interactive) {
809
+ tmpMsg = InteractiveMessageUtils.convertInteractiveMessage(tmpMsg);
810
+ }
811
+ if (receipt.getDeliveredAt) {
812
+ tmpMsg.setDeliveredAt(receipt.getDeliveredAt());
813
+ }
814
+ if (receipt.getReadAt) {
815
+ tmpMsg.setReadAt(receipt.getReadAt());
816
+ }
817
+
818
+ }
822
819
  tmpList[i] = CommonUtils.clone(tmpMsg);
823
820
  }
824
821
 
@@ -861,12 +858,6 @@ export const CometChatMessageList = memo(forwardRef<
861
858
  bottomSheetRef.current?.togglePanel()
862
859
  },
863
860
  });
864
- CometChatUIEventHandler.addCallListener(callEventListener, {
865
- ccShowOngoingCall: (CometChatOngoingComponent) => {
866
- //show ongoing call
867
- setOngoingCallView(CometChatOngoingComponent?.child);
868
- },
869
- });
870
861
  CometChat.getLoggedinUser()
871
862
  .then(u => {
872
863
  loggedInUser.current = u;
@@ -886,7 +877,6 @@ export const CometChatMessageList = memo(forwardRef<
886
877
  CometChatUIEventHandler.removeUIListener(uiEventListenerShow)
887
878
  CometChatUIEventHandler.removeUIListener(uiEventListenerHide)
888
879
  CometChatUIEventHandler.removeUIListener(uiEventListener);
889
- CometChatUIEventHandler.removeCallListener(callEventListener);
890
880
  onBack && onBack();
891
881
  }
892
882
  }, [])
@@ -930,7 +920,7 @@ export const CometChatMessageList = memo(forwardRef<
930
920
  );
931
921
 
932
922
  CometChatUIEventHandler.addMessageListener(
933
- uiEventListener,
923
+ messageEventListener,
934
924
  {
935
925
  ccMessageSent: ({ message, status }) => {
936
926
  if (status == MessageStatusConstants.inprogress) {
@@ -1009,7 +999,7 @@ export const CometChatMessageList = memo(forwardRef<
1009
999
  }
1010
1000
  )
1011
1001
  CometChatUIEventHandler.addGroupListener(
1012
- uiEventListener,
1002
+ groupEventListener,
1013
1003
  {
1014
1004
  ccGroupMemberUnBanned: ({ message }) => {
1015
1005
  newMessage(message, false)
@@ -1056,7 +1046,7 @@ export const CometChatMessageList = memo(forwardRef<
1056
1046
  );
1057
1047
 
1058
1048
  CometChatUIEventHandler.addCallListener(
1059
- uiEventListener,
1049
+ callEventListener,
1060
1050
  {
1061
1051
  ccCallInitiated: ({ call }) => {
1062
1052
  if (call['type'] == CallTypeConstants.audio || call['type'] == CallTypeConstants.video) {
@@ -1082,21 +1072,22 @@ export const CometChatMessageList = memo(forwardRef<
1082
1072
  if (call['type'] == CallTypeConstants.audio || call['type'] == CallTypeConstants.video) {
1083
1073
  newMessage(call);
1084
1074
  }
1085
- }
1075
+ },
1076
+ ccShowOngoingCall: (CometChatOngoingComponent) => {
1077
+ //show ongoing call
1078
+ setOngoingCallView(CometChatOngoingComponent?.child);
1079
+ },
1086
1080
  }
1087
1081
  )
1088
1082
  CometChat.addConnectionListener(
1089
1083
  connectionListenerId,
1090
1084
  new CometChat.ConnectionListener({
1091
1085
  onConnected: () => {
1092
- console.log("ConnectionListener => On Connected - Message List", messagesList.length);
1093
1086
  getUpdatedPreviousMessages();
1094
1087
  },
1095
1088
  inConnecting: () => {
1096
- console.log("ConnectionListener => In connecting");
1097
1089
  },
1098
1090
  onDisconnected: () => {
1099
- console.log("ConnectionListener => On Disconnected");
1100
1091
  if (!messagesList[messagesList.length - 1].id) {
1101
1092
  for (let i = (messagesList.length - 1); i >= 0; i--) {
1102
1093
  if (messagesList[i].id) {
@@ -1113,9 +1104,9 @@ export const CometChatMessageList = memo(forwardRef<
1113
1104
 
1114
1105
  return () => {
1115
1106
  // clean up code like removing listeners
1116
- CometChatUIEventHandler.removeMessageListener(uiEventListener);
1117
- CometChatUIEventHandler.removeGroupListener(uiEventListener);
1118
- CometChatUIEventHandler.removeCallListener(uiEventListener);
1107
+ CometChatUIEventHandler.removeMessageListener(messageEventListener);
1108
+ CometChatUIEventHandler.removeGroupListener(groupEventListener);
1109
+ CometChatUIEventHandler.removeCallListener(callEventListener);
1119
1110
 
1120
1111
  CometChat.removeGroupListener(groupListenerId);
1121
1112
  CometChat.removeCallListener(callListenerId);
@@ -1261,15 +1252,17 @@ export const CometChatMessageList = memo(forwardRef<
1261
1252
  )
1262
1253
  }, [])
1263
1254
 
1264
- const getStatusInfoView = useCallback((item: CometChat.TextMessage | CometChat.MediaMessage | CometChat.CustomMessage | CometChat.InteractiveMessage | CometChat.BaseMessage, bubbleAlignment: MessageBubbleAlignmentType): JSX.Element => {
1255
+ const getStatusInfoView = useCallback((item: CometChat.TextMessage | CometChat.MediaMessage | CometChat.CustomMessage | CometChat.InteractiveMessage | CometChat.BaseMessage, bubbleAlignment: MessageBubbleAlignmentType, currentIndex?: number): JSX.Element => {
1265
1256
  // return null if time alignment is top
1266
1257
  if (timeStampAlignment == "top" || item['category'] == "action" || item['deletedAt']) return null
1267
1258
 
1268
1259
  let isSender = (item.getSender()?.getUid() || item?.['sender']?.['uid']) == loggedInUser.current['uid'];
1269
1260
  let messageState;
1270
- if (item.getReadAt())
1261
+ const nextItemIsRead = messagesContentListRef.current[currentIndex + 1] && messagesContentListRef.current[currentIndex + 1].getReadAt();
1262
+ const nextItemIsDelivered = messagesContentListRef.current[currentIndex + 1] && messagesContentListRef.current[currentIndex + 1].getDeliveredAt();
1263
+ if (item.getReadAt() || nextItemIsRead)
1271
1264
  messageState = "READ";
1272
- else if (item.getDeliveredAt())
1265
+ else if (item.getDeliveredAt() || nextItemIsDelivered)
1273
1266
  messageState = "DELIVERED";
1274
1267
  else if (item.getSentAt())
1275
1268
  messageState = "SENT";
@@ -1382,8 +1375,6 @@ export const CometChatMessageList = memo(forwardRef<
1382
1375
 
1383
1376
  let style = [{
1384
1377
  color: theme?.palette.getAccent900(),
1385
- marginRight: alignment === "right" ? 3 : 0,
1386
- marginLeft: alignment === "left" ? 3 : 0
1387
1378
  }, theme?.typography?.subtitle1];
1388
1379
 
1389
1380
  // let unreadReplyCount = item?.getUnreadReplyCount && item?.getUnreadReplyCount();
@@ -1399,7 +1390,7 @@ export const CometChatMessageList = memo(forwardRef<
1399
1390
  alignSelf: alignment === "right" ? "flex-end" : "flex-start",
1400
1391
  }}
1401
1392
  >
1402
- {alignment === "left" && <Image style={{ resizeMode: "contain", tintColor: theme?.palette.getAccent600() }} source={LeftArrowCurve} />}
1393
+ {alignment === "left" && <Image style={{ resizeMode: "contain", tintColor: theme?.palette.getAccent600(), width: 30, height: 18 }} source={LeftArrowCurve} />}
1403
1394
  <Text style={style}>{`${item.getReplyCount()} ${item.getReplyCount() > 1 ? localize("REPLIES") : localize("REPLY")}`}</Text>
1404
1395
 
1405
1396
  {/** NOTE: uncomment below code when want unread count in thread view **/}
@@ -1430,7 +1421,7 @@ export const CometChatMessageList = memo(forwardRef<
1430
1421
  } */}
1431
1422
  {/** NOTE: uncomment above code when want unread count in thread view **/}
1432
1423
 
1433
- {alignment === "right" && <Image style={[{ resizeMode: "contain", tintColor: theme?.palette.getAccent600() },
1424
+ {alignment === "right" && <Image style={[{ resizeMode: "contain", tintColor: theme?.palette.getAccent600(), width: 30, height: 18 },
1434
1425
  {
1435
1426
  transform: [{ scaleX: -1 }]
1436
1427
  }
@@ -1621,8 +1612,8 @@ export const CometChatMessageList = memo(forwardRef<
1621
1612
  setShowMessageOptions(optionsWithPressHandling);
1622
1613
  }, [])
1623
1614
 
1624
- const MessageView = useCallback((params: { message: CometChat.BaseMessage, showOptions?: boolean, isThreaded?: boolean }) => {
1625
- const { message, showOptions = true, isThreaded = false } = params;
1615
+ const MessageView = useCallback((params: { message: CometChat.BaseMessage, showOptions?: boolean, isThreaded?: boolean, currentIndex?: number }) => {
1616
+ const { message, showOptions = true, isThreaded = false, currentIndex } = params;
1626
1617
  let hasTemplate = templatesMap.get(`${message.getCategory()}_${message.getType()}`)
1627
1618
  if (templates?.length > 0) {
1628
1619
  let customTemplate = templates.find(template => template.type == message.getType() && template.category == message.getCategory())
@@ -1651,7 +1642,7 @@ export const CometChatMessageList = memo(forwardRef<
1651
1642
  ContentView={hasTemplate.ContentView?.bind(this, message, bubbleAlignment)}
1652
1643
  ThreadView={() => !isThreaded && !message.getDeletedBy() && getThreadView(message, bubbleAlignment)}
1653
1644
  BottomView={hasTemplate.BottomView && hasTemplate.BottomView?.bind(this, message, bubbleAlignment)}
1654
- StatusInfoView={hasTemplate.StatusInfoView ? hasTemplate.StatusInfoView?.bind(this, message, bubbleAlignment) : () => getStatusInfoView(message, bubbleAlignment)}
1645
+ StatusInfoView={hasTemplate.StatusInfoView ? hasTemplate.StatusInfoView?.bind(this, message, bubbleAlignment) : () => getStatusInfoView(message, bubbleAlignment, currentIndex)}
1655
1646
  style={getStyle(message)}
1656
1647
  />
1657
1648
  </TouchableOpacity>
@@ -1661,10 +1652,7 @@ export const CometChatMessageList = memo(forwardRef<
1661
1652
  }, []);
1662
1653
 
1663
1654
  const getSentAtTimestamp = useCallback((item) => {
1664
- if (!item['sentAt']) {
1665
- return item['_composedAt'];
1666
- }
1667
- return item['sentAt'] * 1000;
1655
+ return Date.now();
1668
1656
  }, [])
1669
1657
 
1670
1658
 
@@ -1770,7 +1758,7 @@ export const CometChatMessageList = memo(forwardRef<
1770
1758
 
1771
1759
  return <React.Fragment key={index}>
1772
1760
  {seperatorView}
1773
- <MessageView message={item} />
1761
+ <MessageView message={item} currentIndex={index} />
1774
1762
  </React.Fragment>
1775
1763
  }), []);
1776
1764
 
@@ -1800,6 +1788,7 @@ export const CometChatMessageList = memo(forwardRef<
1800
1788
  }, [])
1801
1789
 
1802
1790
  const getErrorStateView = useCallback(() => {
1791
+ if (hideError) return null;
1803
1792
  if (ErrorStateView)
1804
1793
  return ErrorStateView(new CometChat.CometChatException({ message: "Something went wrong" }));
1805
1794
  return (
@@ -25,6 +25,7 @@ import { EmojiKeyboardStyle } from '../shared/views/CometChatEmojiKeyboard';
25
25
  export interface MessageListConfigurationInterface {
26
26
  ErrorStateView?: (e: CometChat.CometChatException) => JSX.Element;
27
27
  errorStateText?: String;
28
+ hideError?: boolean,
28
29
  EmptyStateView?: () => JSX.Element;
29
30
  emptyStateText?: String;
30
31
  LoadingStateView?: () => JSX.Element;
@@ -110,6 +111,7 @@ export class MessageListConfiguration
110
111
  implements MessageListConfigurationInterface {
111
112
  ErrorStateView: (e: CometChat.CometChatException) => JSX.Element;
112
113
  errorStateText?: String;
114
+ hideError?: boolean;
113
115
  EmptyStateView: () => JSX.Element;
114
116
  emptyStateText?: String;
115
117
  LoadingStateView: () => JSX.Element;
@@ -178,7 +178,6 @@ export const CometChatMessages = (props: CometChatMessagesInterface) => {
178
178
  CometChat.getUser(user?.uid)
179
179
  .then(user => {
180
180
  setUserObject(user);
181
- console.log("onConnected getUser", { user });
182
181
  })
183
182
  .catch(e => {
184
183
  console.log("ERROR")
@@ -235,7 +234,7 @@ export const CometChatMessages = (props: CometChatMessagesInterface) => {
235
234
  detailsData.current = { user: params.user, group: params.group }
236
235
  setShowComponent(ComponentNames.Details);
237
236
  }}>
238
- <Image source={infoIcon} style={Style.infoIconStyle} />
237
+ <Image source={infoIcon} style={[Style.infoIconStyle, {tintColor: theme.palette.getPrimary()}]} />
239
238
  </TouchableOpacity>
240
239
  )
241
240
  }
@@ -8,7 +8,6 @@ export const Style = StyleSheet.create({
8
8
  infoIconStyle: {
9
9
  height: 24,
10
10
  width: 24,
11
- tintColor: 'rgb(51,155,255)'
12
11
  },
13
12
  appBarStyle: {
14
13
  flexDirection: "row",
@@ -12,8 +12,8 @@ export interface CallLogsConfigurationInterface {
12
12
  AppBarOptions?: () => JSX.Element,
13
13
  options?: (param: { message: CometChat.BaseMessage }) => CometChatOptions[],
14
14
  callRequestBuilder?: any,
15
- datePattern: DatePattern,
16
- dateSeparatorPattern: DatePattern,
15
+ datePattern?: DatePattern,
16
+ dateSeparatorPattern?: DatePattern,
17
17
  hideSeperator?: boolean,
18
18
  BackButton?: JSX.Element,
19
19
  showBackButton?: boolean,
@@ -48,8 +48,8 @@ export class CallLogsConfiguration implements CallLogsConfigurationInterface {
48
48
  AppBarOptions?: () => JSX.Element
49
49
  options?: (param: { message: CometChat.BaseMessage }) => CometChatOptions[]
50
50
  callRequestBuilder?: any
51
- datePattern: DatePattern
52
- dateSeparatorPattern: DatePattern
51
+ datePattern?: DatePattern
52
+ dateSeparatorPattern?: DatePattern
53
53
  hideSeperator?: boolean
54
54
  BackButton?: JSX.Element
55
55
  showBackButton?: boolean
@@ -24,8 +24,8 @@ export interface CometChatCallLogsConfigurationInterface {
24
24
  AppBarOptions?: () => JSX.Element,
25
25
  options?: (param: { message: any }) => CometChatOptions[],
26
26
  callRequestBuilder?: any,
27
- datePattern: DatePattern,
28
- dateSeparatorPattern: DatePattern,
27
+ datePattern?: DatePattern,
28
+ dateSeparatorPattern?: DatePattern,
29
29
  hideSeperator?: boolean,
30
30
  BackButton?: JSX.Element,
31
31
  showBackButton?: boolean,
Binary file
Binary file
@@ -228,7 +228,7 @@ export const ReceiverTypeConstants = {
228
228
 
229
229
  export const UserStatusConstants = {
230
230
  online: CometChat.USER_STATUS.ONLINE,
231
- offline: CometChat.USER_STATUS.ONLINE,
231
+ offline: CometChat.USER_STATUS.OFFLINE,
232
232
  blocked: 'blocked',
233
233
  unblocked: 'unblocked',
234
234
  };
@@ -379,3 +379,14 @@ export enum goalType {
379
379
  anyAction = CometChat.GoalType.ANY_ACTION,
380
380
  none = CometChat.GoalType.NONE
381
381
  }
382
+
383
+ export enum MentionsType {
384
+ users,
385
+ usersAndGroupMembers,
386
+ }
387
+
388
+ export enum MentionsVisibility {
389
+ both,
390
+ usersConversationOnly,
391
+ groupsConversationOnly,
392
+ }
@@ -7,6 +7,7 @@ import { CometChatUIEventHandler, CometChatUIEvents } from '../../events';
7
7
  import { localize } from '../../resources';
8
8
  import { SuggestionItem } from '../../views/CometChatSuggestionList';
9
9
  import { CometChatUIKit } from '../../CometChatUiKit';
10
+ import { MentionsType, MentionsVisibility } from '../../constants/UIKitConstants';
10
11
 
11
12
  /**
12
13
  * Represents the CometChatMentionsFormatter class.
@@ -50,6 +51,20 @@ export class CometChatMentionsFormatter extends CometChatTextFormatter {
50
51
  */
51
52
  protected limit: number = 10;
52
53
 
54
+ /**
55
+ * visibleIn property to determine where the mentions should be visible.
56
+ * @type {MentionsVisibility}
57
+ * @default MentionsVisibility.both
58
+ */
59
+ protected visibleIn: MentionsVisibility = MentionsVisibility.both;
60
+
61
+ /**
62
+ * type property to determine the type of mention list.
63
+ * @type {MentionsType}
64
+ * @default MentionsType.usersAndGroupMembers
65
+ */
66
+ protected type: MentionsType = MentionsType.usersAndGroupMembers;
67
+
53
68
  /**
54
69
  * Initializes a new CometChatMentionsFormatter.
55
70
  * @param {CometChat.User} loggedInUser - The user who is currently logged in.
@@ -127,7 +142,7 @@ export class CometChatMentionsFormatter extends CometChatTextFormatter {
127
142
 
128
143
  search(searchKey: string): void {
129
144
  if (this.shouldLoadLocalData(searchKey)) return;
130
- let requestBuilder = this.customRequest || (this.group ? new CometChat.GroupMembersRequestBuilder(this.group.getGuid()) : new CometChat.UsersRequestBuilder());
145
+ let requestBuilder = this.customRequest || ((this.group && this.type === MentionsType.usersAndGroupMembers) ? new CometChat.GroupMembersRequestBuilder(this.group.getGuid()) : new CometChat.UsersRequestBuilder());
131
146
 
132
147
  this.searchRequest = requestBuilder.setLimit(10)
133
148
  .setSearchKeyword(searchKey)
@@ -376,6 +391,36 @@ export class CometChatMentionsFormatter extends CometChatTextFormatter {
376
391
  }
377
392
  }
378
393
 
394
+ /**
395
+ * Sets the type of mention list.
396
+ * @param type - The type of mention list.
397
+ */
398
+ setType(type: MentionsType) {
399
+ this.type = type;
400
+ }
401
+
402
+ /**
403
+ * Sets the visibleIn property to determine where the mentions should be visible.
404
+ * @param visibleIn - The visibleIn property to set.
405
+ */
406
+ setVisibleIn(visibleIn: MentionsVisibility) {
407
+ this.visibleIn = visibleIn;
408
+ }
409
+
410
+ /**
411
+ * Retrieves the visibleIn property to determine where the mentions should be visible.
412
+ */
413
+ getVisibleIn() {
414
+ return this.visibleIn;
415
+ }
416
+
417
+ /**
418
+ * Retrieves the type of mention list.
419
+ */
420
+ getType() {
421
+ return this.type;
422
+ }
423
+
379
424
  getErrorString() {
380
425
  return (`${localize("MENTION_UPTO")} ${this.limit} ${this.limit === 1 ? localize("TIME") : localize("TIMES")} ${localize("AT_A_TIME")}.`);
381
426
  }