@cometchat/chat-uikit-react-native 4.3.13 → 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.
- package/lib/AI/AIConversationStarter/style.d.ts +8 -8
- package/lib/AI/style.d.ts +15 -15
- package/lib/CometChatAddMembers/CometChatAddMembers.js +1 -0
- package/lib/CometChatAddMembers/CometChatAddMembers.js.map +1 -1
- package/lib/CometChatDetails/CometChatDetails.js +4 -2
- package/lib/CometChatDetails/CometChatDetails.js.map +1 -1
- package/lib/CometChatGroupMembers/CometChatGroupMembers.js +15 -4
- package/lib/CometChatGroupMembers/CometChatGroupMembers.js.map +1 -1
- package/lib/CometChatMessageComposer/CometChatMessageComposer.js +11 -3
- package/lib/CometChatMessageComposer/CometChatMessageComposer.js.map +1 -1
- package/lib/CometChatMessageHeader/CometChatMessageHeader.js +1 -1
- package/lib/CometChatMessageHeader/CometChatMessageHeader.js.map +1 -1
- package/lib/CometChatMessageInformation/CometChatMessageInformation.js +3 -1
- package/lib/CometChatMessageInformation/CometChatMessageInformation.js.map +1 -1
- package/lib/CometChatMessageList/CometChatMessageList.js +3 -1
- package/lib/CometChatMessageList/CometChatMessageList.js.map +1 -1
- package/lib/CometChatMessageList/MessageListConfiguration.js +1 -0
- package/lib/CometChatMessageList/MessageListConfiguration.js.map +1 -1
- package/lib/calls/CallingPackage.d.ts +1 -1
- package/lib/extensions/CollaborativeBubble/CometChatCollaborativeBubble.d.ts +2 -2
- package/lib/extensions/ExtensionModerator.d.ts +1 -1
- package/lib/extensions/SmartReplies/SmartRepliesView.d.ts +2 -2
- package/lib/extensions/Stickers/CometChatStickerKeyboard/StickerKeyboardConfiguration.d.ts +2 -2
- package/lib/extensions/ThumbnailGeneration/ThumbnailGenerationDecorator.js +5 -5
- package/lib/extensions/ThumbnailGeneration/ThumbnailGenerationDecorator.js.map +1 -1
- package/lib/extensions/ThumbnailGeneration/resources/index.d.ts +2 -2
- package/lib/extensions/ThumbnailGeneration/resources/index.js +2 -2
- package/lib/extensions/ThumbnailGeneration/resources/index.js.map +1 -1
- package/lib/shared/constants/UIKitConstants.d.ts +9 -0
- package/lib/shared/constants/UIKitConstants.js +12 -1
- package/lib/shared/constants/UIKitConstants.js.map +1 -1
- package/lib/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.js +40 -1
- package/lib/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.js.map +1 -1
- package/lib/shared/helper/SwipeRow.d.ts +5 -5
- package/lib/shared/helper/functions.d.ts +1 -1
- package/lib/shared/libs/ImageZoom/ReactNativeZoomableView.d.ts +8 -5
- package/lib/shared/libs/ImageZoom/ReactNativeZoomableViewWithGestures.d.ts +2 -2
- package/lib/shared/libs/VideoPlayerControls/OSSupport/TVOSSupport.d.ts +1 -1
- package/lib/shared/libs/datePickerModal/DateTimePickerModal.d.ts +1 -1
- package/lib/shared/libs/datePickerModal/DateTimePickerModal.ios.d.ts +2 -2
- package/lib/shared/libs/datePickerModal/Modal.d.ts +3 -3
- package/lib/shared/libs/luxon/src/datetime.d.ts +81 -81
- package/lib/shared/libs/luxon/src/duration.d.ts +24 -24
- package/lib/shared/libs/luxon/src/impl/english.d.ts +3 -3
- package/lib/shared/libs/luxon/src/impl/locale.d.ts +1 -1
- package/lib/shared/libs/luxon/src/impl/util.d.ts +7 -7
- package/lib/shared/libs/luxon/src/info.d.ts +28 -28
- package/lib/shared/libs/luxon/src/interval.d.ts +14 -14
- package/lib/shared/libs/luxon/src/settings.d.ts +2 -2
- package/lib/shared/libs/luxon/src/zones/IANAZone.d.ts +1 -1
- package/lib/shared/libs/luxon/src/zones/invalidZone.d.ts +1 -1
- package/lib/shared/libs/luxon/src/zones/systemZone.d.ts +1 -1
- package/lib/shared/modals/InteractiveData/InteractiveMessage/SchedulerMessage.d.ts +8 -8
- package/lib/shared/resources/CometChatSoundManager/CometChatSoundManager.d.ts +2 -2
- package/lib/shared/resources/CometChatTheme/CometChatTheme.d.ts +2 -2
- package/lib/shared/resources/CometChatTheme/Palette.d.ts +24 -24
- package/lib/shared/resources/CometChatTheme/Typography.d.ts +23 -23
- package/lib/shared/utils/CometChatMessagePreview/CometChatMessagePreview.d.ts +1 -1
- package/lib/shared/utils/CometChatMessagePreview/MessagePreviewConfiguration.d.ts +3 -3
- package/lib/shared/utils/CometChatMessagePreview/MessagePreviewStyle.d.ts +10 -10
- package/lib/shared/utils/DetailsUtils/DetailsUtils.d.ts +1 -1
- package/lib/shared/utils/SchedulerUtils.d.ts +4 -4
- package/lib/shared/views/CometChatActionSheet/ActionItem.d.ts +9 -9
- package/lib/shared/views/CometChatActionSheet/CometChatActionSheet.d.ts +3 -3
- package/lib/shared/views/CometChatDate/CometChatDate.d.ts +1 -1
- package/lib/shared/views/CometChatEmojiKeyboard/Emoji.d.ts +1 -1
- package/lib/shared/views/CometChatEmojiKeyboard/EmojiKeyboardConfiguration.d.ts +3 -3
- package/lib/shared/views/CometChatEmojiKeyboard/EmojiKeyboardStyle.d.ts +3 -3
- package/lib/shared/views/CometChatImageBubble/CometChatImageBubble.js +8 -2
- package/lib/shared/views/CometChatImageBubble/CometChatImageBubble.js.map +1 -1
- package/lib/shared/views/CometChatList/CometChatList.js +0 -1
- package/lib/shared/views/CometChatList/CometChatList.js.map +1 -1
- package/lib/shared/views/CometChatMessageBubble/style.js +1 -0
- package/lib/shared/views/CometChatReactions/CometChatReactions.d.ts +1 -1
- package/lib/shared/views/CometChatReceipt/CometChatReceipt.d.ts +1 -1
- package/lib/shared/views/CometChatVideoBubble/CometChatVideoBubble.js +7 -1
- package/lib/shared/views/CometChatVideoBubble/CometChatVideoBubble.js.map +1 -1
- package/lib/shared/views/CometChatVideoBubble/VideoBubbleStyle.js +1 -1
- package/lib/shared/views/CometChatVideoBubble/VideoBubbleStyle.js.map +1 -1
- package/package.json +1 -1
- package/src/AI/AIConversationSummary/resources/close.png +0 -0
- package/src/CometChatConversations/CometChatConversations.tsx +85 -72
- package/src/CometChatConversations/resources/close.png +0 -0
- package/src/CometChatConversations/resources/rightTick.png +0 -0
- package/src/CometChatCreateGroup/resources/close.png +0 -0
- package/src/CometChatCreateGroup/resources/rightTick.png +0 -0
- package/src/CometChatDetails/resources/close.png +0 -0
- package/src/CometChatGroupMembers/resources/rightTick.png +0 -0
- package/src/CometChatGroups/resources/close.png +0 -0
- package/src/CometChatGroups/resources/rightTick.png +0 -0
- package/src/CometChatJoinProtectedGroup/resources/close.png +0 -0
- package/src/CometChatJoinProtectedGroup/resources/rightTick.png +0 -0
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +34 -47
- package/src/CometChatMessageComposer/resources/Info.png +0 -0
- package/src/CometChatMessageComposer/resources/circle_add.png +0 -0
- package/src/CometChatMessageComposer/resources/close.png +0 -0
- package/src/CometChatMessageComposer/resources/image.png +0 -0
- package/src/CometChatMessageComposer/resources/send_message.png +0 -0
- package/src/CometChatMessageComposer/resources/stickers.png +0 -0
- package/src/CometChatMessageList/CometChatMessageList.tsx +50 -64
- package/src/CometChatMessageList/resources/close.png +0 -0
- package/src/CometChatMessageList/resources/leftarrowcurve.png +0 -0
- package/src/CometChatMessages/CometChatMessages.tsx +1 -2
- package/src/CometChatMessages/resources/info.png +0 -0
- package/src/CometChatMessages/style.ts +0 -1
- package/src/CometChatThreadedMessages/resources/close.png +0 -0
- package/src/calls/CometChatCallButtons/resources/Call.png +0 -0
- package/src/calls/CometChatCallButtons/resources/Video.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/Info.png +0 -0
- package/src/calls/CometChatCallLogRecordings/resources/download.png +0 -0
- package/src/calls/CometChatCallLogs/CallLogsConfiguration.ts +4 -4
- package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +2 -2
- package/src/calls/CometChatCallLogs/resources/Info.png +0 -0
- package/src/calls/CometChatOutgoingCall/resources/Close.png +0 -0
- package/src/calls/resources/Call.png +0 -0
- package/src/calls/resources/Video.png +0 -0
- package/src/extensions/CollaborativeDocument/resources/collaborative_document.png +0 -0
- package/src/extensions/CollaborativeWhiteboard/resources/collaborative_whiteboard.png +0 -0
- package/src/extensions/MessageTranslation/resources/translate.png +0 -0
- package/src/extensions/Polls/resources/close.png +0 -0
- package/src/extensions/Polls/resources/document.png +0 -0
- package/src/extensions/Polls/resources/kickIcon.png +0 -0
- package/src/extensions/Polls/resources/rightTick.png +0 -0
- package/src/extensions/SmartReplies/resources/close.png +0 -0
- package/src/extensions/Stickers/resources/Stickers.png +0 -0
- package/src/shared/assets/images/checkmark.png +0 -0
- package/src/shared/assets/images/grey-double-tick-icon.png +0 -0
- package/src/shared/assets/images/grey-tick-icon.png +0 -0
- package/src/shared/framework/resources/audio-file.png +0 -0
- package/src/shared/framework/resources/circle_add.png +0 -0
- package/src/shared/framework/resources/copy.png +0 -0
- package/src/shared/framework/resources/delete.png +0 -0
- package/src/shared/framework/resources/edit.png +0 -0
- package/src/shared/framework/resources/file_upload.png +0 -0
- package/src/shared/framework/resources/image.png +0 -0
- package/src/shared/framework/resources/info.png +0 -0
- package/src/shared/framework/resources/messageInPrivate.png +0 -0
- package/src/shared/framework/resources/pause.png +0 -0
- package/src/shared/framework/resources/play.png +0 -0
- package/src/shared/framework/resources/send_message.png +0 -0
- package/src/shared/framework/resources/share.png +0 -0
- package/src/shared/framework/resources/thread.png +0 -0
- package/src/shared/framework/resources/video_upload.png +0 -0
- package/src/shared/utils/CometChatMessagePreview/resources/close.png +0 -0
- package/src/shared/utils/CommonUtils.ts +43 -9
- package/src/shared/utils/DetailsUtils/resources/close.png +0 -0
- package/src/shared/views/CometChatActionSheet/resources/grid.png +0 -0
- package/src/shared/views/CometChatActionSheet/resources/list.png +0 -0
- package/src/shared/views/CometChatAudioBubble/resources/pause.png +0 -0
- package/src/shared/views/CometChatAudioBubble/resources/play.png +0 -0
- package/src/shared/views/CometChatFileBubble/resources/download.png +0 -0
- package/src/shared/views/CometChatFileBubble/resources/file_upload.png +0 -0
- package/src/shared/views/CometChatFileBubble/style.ts +2 -0
- package/src/shared/views/CometChatList/CometChatList.tsx +13 -3
- package/src/shared/views/CometChatList/resources/checkmark.png +0 -0
- package/src/shared/views/CometChatSchedulerBubble/CometChatSchedulerBubble.tsx +7 -4
- package/src/shared/views/CometChatVideoBubble/resources/play.png +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useContext, useEffect, useLayoutEffect } from 'react';
|
|
1
|
+
import React, { useContext, useEffect, useLayoutEffect, useRef } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
View,
|
|
4
4
|
Image,
|
|
@@ -662,7 +662,7 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
662
662
|
...aiOptionsStyle,
|
|
663
663
|
})
|
|
664
664
|
|
|
665
|
-
|
|
665
|
+
const isTyping = useRef<NodeJS.Timeout | null>(null);
|
|
666
666
|
|
|
667
667
|
/**
|
|
668
668
|
* Event callback
|
|
@@ -877,7 +877,6 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
877
877
|
textMessage.setReceiver(chatWith.current);
|
|
878
878
|
textMessage.setText(finalTextInput);
|
|
879
879
|
textMessage.setMuid(String(getUnixTimestampInMilliseconds()));
|
|
880
|
-
textMessage.setSentAt(getUnixTimestamp());
|
|
881
880
|
parentMessageId && textMessage.setParentMessageId(parentMessageId as number);
|
|
882
881
|
|
|
883
882
|
allFormatters.current.forEach(item => {
|
|
@@ -887,21 +886,24 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
887
886
|
setMentionsSearchData([]);
|
|
888
887
|
plainTextInput.current = ""
|
|
889
888
|
|
|
890
|
-
if (
|
|
891
|
-
onSendButtonPress(textMessage);
|
|
889
|
+
if (finalTextInput.trim().length == 0) {
|
|
892
890
|
return;
|
|
893
891
|
}
|
|
894
892
|
|
|
895
|
-
|
|
893
|
+
clearInputBox();
|
|
894
|
+
|
|
895
|
+
if (onSendButtonPress) {
|
|
896
|
+
onSendButtonPress(textMessage);
|
|
896
897
|
return;
|
|
897
898
|
}
|
|
899
|
+
|
|
898
900
|
CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccMessageSent, {
|
|
899
901
|
message: textMessage,
|
|
900
902
|
status: messageStatus.inprogress,
|
|
901
903
|
});
|
|
902
904
|
|
|
903
905
|
if (!disableSoundForMessages) playAudio();
|
|
904
|
-
|
|
906
|
+
|
|
905
907
|
CometChat.sendMessage(textMessage)
|
|
906
908
|
.then((message: any) => {
|
|
907
909
|
CometChatUIEventHandler.emitMessageEvent(
|
|
@@ -945,10 +947,15 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
945
947
|
setInputMessage('');
|
|
946
948
|
messageInputRef.current.textContent = '';
|
|
947
949
|
|
|
948
|
-
if (!disableSoundForMessages) playAudio();
|
|
949
|
-
|
|
950
950
|
setMessagePreview(null);
|
|
951
951
|
|
|
952
|
+
if (onSendButtonPress) {
|
|
953
|
+
onSendButtonPress(textMessage);
|
|
954
|
+
return;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
if (!disableSoundForMessages) playAudio();
|
|
958
|
+
|
|
952
959
|
CometChat.editMessage(textMessage)
|
|
953
960
|
.then((editedMessage: any) => {
|
|
954
961
|
inputValueRef.current = '';
|
|
@@ -984,11 +991,7 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
984
991
|
mediaMessage.setSender(loggedInUser.current);
|
|
985
992
|
mediaMessage.setReceiver(receiverType);
|
|
986
993
|
mediaMessage.setType(messageType);
|
|
987
|
-
mediaMessage['_composedAt'] = Date.now();
|
|
988
|
-
mediaMessage['_id'] = '_' + Math.random().toString(36).substr(2, 9);
|
|
989
|
-
mediaMessage.setId(mediaMessage['_id']);
|
|
990
994
|
mediaMessage.setMuid(String(getUnixTimestampInMilliseconds()));
|
|
991
|
-
mediaMessage.setSentAt(getUnixTimestamp());
|
|
992
995
|
mediaMessage.setData({
|
|
993
996
|
type: messageType,
|
|
994
997
|
category: CometChat.CATEGORY_MESSAGE,
|
|
@@ -1009,11 +1012,7 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
1009
1012
|
localMessage.setSender(loggedInUser.current);
|
|
1010
1013
|
localMessage.setReceiver(receiverType);
|
|
1011
1014
|
localMessage.setType(messageType);
|
|
1012
|
-
localMessage['_composedAt'] = Date.now();
|
|
1013
|
-
localMessage['_id'] = '_' + Math.random().toString(36).substr(2, 9);
|
|
1014
|
-
localMessage.setId(localMessage['_id']);
|
|
1015
1015
|
localMessage.setMuid(String(getUnixTimestampInMilliseconds()));
|
|
1016
|
-
localMessage.setSentAt(getUnixTimestamp());
|
|
1017
1016
|
localMessage.setData({
|
|
1018
1017
|
type: messageType,
|
|
1019
1018
|
category: CometChat.CATEGORY_MESSAGE,
|
|
@@ -1041,7 +1040,6 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
1041
1040
|
if (!disableSoundForMessages) playAudio();
|
|
1042
1041
|
CometChat.sendMediaMessage(mediaMessage)
|
|
1043
1042
|
.then((message: any) => {
|
|
1044
|
-
setTimeout(() => {
|
|
1045
1043
|
CometChatUIEventHandler.emitMessageEvent(
|
|
1046
1044
|
MessageEvents.ccMessageSent,
|
|
1047
1045
|
{
|
|
@@ -1050,7 +1048,6 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
1050
1048
|
}
|
|
1051
1049
|
);
|
|
1052
1050
|
setShowRecordAudio(false);
|
|
1053
|
-
}, 1000);
|
|
1054
1051
|
})
|
|
1055
1052
|
.catch((error: any) => {
|
|
1056
1053
|
setShowRecordAudio(false);
|
|
@@ -1073,22 +1070,25 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
1073
1070
|
return false;
|
|
1074
1071
|
}
|
|
1075
1072
|
|
|
1076
|
-
//if typing is in progress
|
|
1077
|
-
if (isTyping) {
|
|
1078
|
-
return false;
|
|
1079
|
-
}
|
|
1080
1073
|
|
|
1081
|
-
|
|
1082
|
-
|
|
1074
|
+
//if typing is in progress, clear the previous timeout and set new timeout
|
|
1075
|
+
if (isTyping.current) {
|
|
1076
|
+
clearTimeout(isTyping.current);
|
|
1077
|
+
isTyping.current = null;
|
|
1078
|
+
} else {
|
|
1079
|
+
let metadata = typingMetadata || undefined;
|
|
1080
|
+
|
|
1081
|
+
let typingNotification = new CometChat.TypingIndicator(
|
|
1082
|
+
chatWithId.current,
|
|
1083
|
+
chatWith.current,
|
|
1084
|
+
metadata
|
|
1085
|
+
);
|
|
1086
|
+
CometChat.startTyping(typingNotification);
|
|
1087
|
+
}
|
|
1083
1088
|
|
|
1084
|
-
let typingNotification = new CometChat.TypingIndicator(
|
|
1085
|
-
chatWithId.current,
|
|
1086
|
-
chatWith.current,
|
|
1087
|
-
metadata
|
|
1088
|
-
);
|
|
1089
|
-
CometChat.startTyping(typingNotification);
|
|
1090
1089
|
|
|
1091
|
-
|
|
1090
|
+
let typingInterval = endTypingTimeout || 500;
|
|
1091
|
+
isTyping.current = setTimeout(() => {
|
|
1092
1092
|
endTyping(null, typingMetadata);
|
|
1093
1093
|
}, typingInterval);
|
|
1094
1094
|
return false;
|
|
@@ -1112,24 +1112,11 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
1112
1112
|
);
|
|
1113
1113
|
CometChat.endTyping(typingNotification);
|
|
1114
1114
|
|
|
1115
|
-
clearTimeout(isTyping);
|
|
1116
|
-
isTyping = null;
|
|
1115
|
+
clearTimeout(isTyping.current!);
|
|
1116
|
+
isTyping.current = null;
|
|
1117
1117
|
return false;
|
|
1118
1118
|
};
|
|
1119
1119
|
|
|
1120
|
-
// const getActionSheetStyle = () => {
|
|
1121
|
-
// return new ActionSheetStyles({
|
|
1122
|
-
// layoutModeIconTint:
|
|
1123
|
-
// messageComposerStyle.actionSheetLayoutModeIconTint ??
|
|
1124
|
-
// theme.palette.getPrimary(),
|
|
1125
|
-
// titleFont:
|
|
1126
|
-
// messageComposerStyle.actionSheetTitleFont ?? theme.typography.text1,
|
|
1127
|
-
// titleColor:
|
|
1128
|
-
// messageComposerStyle.actionSheetTitleColor ??
|
|
1129
|
-
// theme.palette.getAccent800(),
|
|
1130
|
-
// });
|
|
1131
|
-
// };
|
|
1132
|
-
|
|
1133
1120
|
const GetEmojiIconView = () => {
|
|
1134
1121
|
return (
|
|
1135
1122
|
<ImageButton
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -189,6 +189,8 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
189
189
|
const uiEventListenerShow = "uiEvent_show_" + new Date().getTime();
|
|
190
190
|
const uiEventListenerHide = "uiEvent_hide_" + new Date().getTime();
|
|
191
191
|
const connectionListenerId = 'connectionListener_' + new Date().getTime();
|
|
192
|
+
const messageEventListener = "messageEvent_" + new Date().getTime();
|
|
193
|
+
const groupEventListener = "groupEvent_" + new Date().getTime();
|
|
192
194
|
|
|
193
195
|
useLayoutEffect(() => {
|
|
194
196
|
if (user) {
|
|
@@ -437,10 +439,10 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
437
439
|
messagesRequest.build()
|
|
438
440
|
.fetchNext()
|
|
439
441
|
.then(updatedMessages => {
|
|
440
|
-
let tmpList = [...
|
|
442
|
+
let tmpList = [...messagesContentListRef.current];
|
|
441
443
|
for (let i = 0; i < updatedMessages.length; i++) {
|
|
442
444
|
let condition = (msg) => msg.getId() == updatedMessages[i]?.actionOn.getId()
|
|
443
|
-
let msgIndex =
|
|
445
|
+
let msgIndex = messagesContentListRef.current.findIndex(condition);
|
|
444
446
|
if (msgIndex > -1) {
|
|
445
447
|
tmpList[msgIndex] = updatedMessages[i]?.actionOn;
|
|
446
448
|
}
|
|
@@ -461,19 +463,10 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
461
463
|
.fetchNext()
|
|
462
464
|
.then(newMessages => {
|
|
463
465
|
let cleanUpdatedList = [...updatedList];
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
}
|
|
469
|
-
// console.log("newMessages", newMessages.length, JSON.stringify(newMessages))
|
|
470
|
-
if (cleanUpdatedList?.length > 0 && cleanUpdatedList?.[cleanUpdatedList.length - 1]?.["muid"]) {
|
|
471
|
-
let localFileExists = newMessages.findIndex(msg => msg?.["muid"] == cleanUpdatedList?.[cleanUpdatedList.length - 1]?.["muid"]);
|
|
472
|
-
if (localFileExists > -1) {
|
|
473
|
-
cleanUpdatedList.shift();
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
let tmpList = [...cleanUpdatedList, ...newMessages];
|
|
466
|
+
|
|
467
|
+
let finalOutput = CommonUtils.mergeArrays(cleanUpdatedList, newMessages, "muid");
|
|
468
|
+
|
|
469
|
+
let tmpList = [...finalOutput];
|
|
477
470
|
tmpList = tmpList.map((item: CometChat.BaseMessage, index) => {
|
|
478
471
|
if (item.getCategory() === MessageCategoryConstants.interactive) {
|
|
479
472
|
return InteractiveMessageUtils.convertInteractiveMessage(item);
|
|
@@ -485,7 +478,7 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
485
478
|
const filteredInProgressMessages = inProgressMessages.current.filter(secondItem =>
|
|
486
479
|
!tmpList.some(firstItem => firstItem.muid === secondItem.muid)
|
|
487
480
|
);
|
|
488
|
-
const combinedArray =
|
|
481
|
+
const combinedArray = CommonUtils.mergeArrays(tmpList, filteredInProgressMessages, "muid");
|
|
489
482
|
tmpList = combinedArray
|
|
490
483
|
}
|
|
491
484
|
messagesContentListRef.current = tmpList;
|
|
@@ -761,9 +754,9 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
761
754
|
}
|
|
762
755
|
else
|
|
763
756
|
condition = (msg) => msg.getId() == editedMessage.getId()
|
|
764
|
-
let msgIndex =
|
|
757
|
+
let msgIndex = messagesContentListRef.current.findIndex(condition);
|
|
765
758
|
if (msgIndex > -1) {
|
|
766
|
-
let tmpList = [...
|
|
759
|
+
let tmpList = [...messagesContentListRef.current];
|
|
767
760
|
if (editedMessage.getCategory() === MessageCategoryConstants.interactive) {
|
|
768
761
|
editedMessage = InteractiveMessageUtils.convertInteractiveMessage(editedMessage);
|
|
769
762
|
}
|
|
@@ -798,29 +791,31 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
798
791
|
const createActionMessage = () => { }
|
|
799
792
|
|
|
800
793
|
const updateMessageReceipt = (receipt) => {
|
|
801
|
-
let index =
|
|
802
|
-
|
|
794
|
+
let index = messagesContentListRef.current.findIndex((msg, index) => msg['id'] == receipt['messageId'] || msg['messageId'] == receipt['messageId']);
|
|
803
795
|
if (index == -1) return;
|
|
804
796
|
|
|
805
|
-
let tmpList: Array<CometChat.BaseMessage> = [...
|
|
797
|
+
let tmpList: Array<CometChat.BaseMessage> = [...messagesContentListRef.current];
|
|
806
798
|
|
|
807
799
|
for (let i = index; i > 0; i--) {
|
|
808
800
|
|
|
809
801
|
if (tmpList[i]?.getReadAt && tmpList[i]?.getReadAt()) break;
|
|
810
802
|
|
|
811
803
|
let tmpMsg = tmpList[i];
|
|
812
|
-
if ((tmpMsg
|
|
813
|
-
return;
|
|
814
|
-
if (tmpMsg.getCategory() === MessageCategoryConstants.interactive) {
|
|
815
|
-
tmpMsg = InteractiveMessageUtils.convertInteractiveMessage(tmpMsg);
|
|
816
|
-
}
|
|
817
|
-
if (receipt.getDeliveredAt) {
|
|
818
|
-
tmpMsg.setDeliveredAt(receipt.getDeliveredAt());
|
|
819
|
-
}
|
|
820
|
-
if (receipt.getReadAt) {
|
|
821
|
-
tmpMsg.setReadAt(receipt.getReadAt());
|
|
822
|
-
}
|
|
804
|
+
if (!Number.isNaN(Number(tmpMsg.getId()))) {
|
|
823
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
|
+
}
|
|
824
819
|
tmpList[i] = CommonUtils.clone(tmpMsg);
|
|
825
820
|
}
|
|
826
821
|
|
|
@@ -863,12 +858,6 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
863
858
|
bottomSheetRef.current?.togglePanel()
|
|
864
859
|
},
|
|
865
860
|
});
|
|
866
|
-
CometChatUIEventHandler.addCallListener(callEventListener, {
|
|
867
|
-
ccShowOngoingCall: (CometChatOngoingComponent) => {
|
|
868
|
-
//show ongoing call
|
|
869
|
-
setOngoingCallView(CometChatOngoingComponent?.child);
|
|
870
|
-
},
|
|
871
|
-
});
|
|
872
861
|
CometChat.getLoggedinUser()
|
|
873
862
|
.then(u => {
|
|
874
863
|
loggedInUser.current = u;
|
|
@@ -888,7 +877,6 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
888
877
|
CometChatUIEventHandler.removeUIListener(uiEventListenerShow)
|
|
889
878
|
CometChatUIEventHandler.removeUIListener(uiEventListenerHide)
|
|
890
879
|
CometChatUIEventHandler.removeUIListener(uiEventListener);
|
|
891
|
-
CometChatUIEventHandler.removeCallListener(callEventListener);
|
|
892
880
|
onBack && onBack();
|
|
893
881
|
}
|
|
894
882
|
}, [])
|
|
@@ -932,7 +920,7 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
932
920
|
);
|
|
933
921
|
|
|
934
922
|
CometChatUIEventHandler.addMessageListener(
|
|
935
|
-
|
|
923
|
+
messageEventListener,
|
|
936
924
|
{
|
|
937
925
|
ccMessageSent: ({ message, status }) => {
|
|
938
926
|
if (status == MessageStatusConstants.inprogress) {
|
|
@@ -1011,7 +999,7 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1011
999
|
}
|
|
1012
1000
|
)
|
|
1013
1001
|
CometChatUIEventHandler.addGroupListener(
|
|
1014
|
-
|
|
1002
|
+
groupEventListener,
|
|
1015
1003
|
{
|
|
1016
1004
|
ccGroupMemberUnBanned: ({ message }) => {
|
|
1017
1005
|
newMessage(message, false)
|
|
@@ -1058,7 +1046,7 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1058
1046
|
);
|
|
1059
1047
|
|
|
1060
1048
|
CometChatUIEventHandler.addCallListener(
|
|
1061
|
-
|
|
1049
|
+
callEventListener,
|
|
1062
1050
|
{
|
|
1063
1051
|
ccCallInitiated: ({ call }) => {
|
|
1064
1052
|
if (call['type'] == CallTypeConstants.audio || call['type'] == CallTypeConstants.video) {
|
|
@@ -1084,21 +1072,22 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1084
1072
|
if (call['type'] == CallTypeConstants.audio || call['type'] == CallTypeConstants.video) {
|
|
1085
1073
|
newMessage(call);
|
|
1086
1074
|
}
|
|
1087
|
-
}
|
|
1075
|
+
},
|
|
1076
|
+
ccShowOngoingCall: (CometChatOngoingComponent) => {
|
|
1077
|
+
//show ongoing call
|
|
1078
|
+
setOngoingCallView(CometChatOngoingComponent?.child);
|
|
1079
|
+
},
|
|
1088
1080
|
}
|
|
1089
1081
|
)
|
|
1090
1082
|
CometChat.addConnectionListener(
|
|
1091
1083
|
connectionListenerId,
|
|
1092
1084
|
new CometChat.ConnectionListener({
|
|
1093
1085
|
onConnected: () => {
|
|
1094
|
-
console.log("ConnectionListener => On Connected - Message List", messagesList.length);
|
|
1095
1086
|
getUpdatedPreviousMessages();
|
|
1096
1087
|
},
|
|
1097
1088
|
inConnecting: () => {
|
|
1098
|
-
console.log("ConnectionListener => In connecting");
|
|
1099
1089
|
},
|
|
1100
1090
|
onDisconnected: () => {
|
|
1101
|
-
console.log("ConnectionListener => On Disconnected");
|
|
1102
1091
|
if (!messagesList[messagesList.length - 1].id) {
|
|
1103
1092
|
for (let i = (messagesList.length - 1); i >= 0; i--) {
|
|
1104
1093
|
if (messagesList[i].id) {
|
|
@@ -1115,9 +1104,9 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1115
1104
|
|
|
1116
1105
|
return () => {
|
|
1117
1106
|
// clean up code like removing listeners
|
|
1118
|
-
CometChatUIEventHandler.removeMessageListener(
|
|
1119
|
-
CometChatUIEventHandler.removeGroupListener(
|
|
1120
|
-
CometChatUIEventHandler.removeCallListener(
|
|
1107
|
+
CometChatUIEventHandler.removeMessageListener(messageEventListener);
|
|
1108
|
+
CometChatUIEventHandler.removeGroupListener(groupEventListener);
|
|
1109
|
+
CometChatUIEventHandler.removeCallListener(callEventListener);
|
|
1121
1110
|
|
|
1122
1111
|
CometChat.removeGroupListener(groupListenerId);
|
|
1123
1112
|
CometChat.removeCallListener(callListenerId);
|
|
@@ -1263,15 +1252,17 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1263
1252
|
)
|
|
1264
1253
|
}, [])
|
|
1265
1254
|
|
|
1266
|
-
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 => {
|
|
1267
1256
|
// return null if time alignment is top
|
|
1268
1257
|
if (timeStampAlignment == "top" || item['category'] == "action" || item['deletedAt']) return null
|
|
1269
1258
|
|
|
1270
1259
|
let isSender = (item.getSender()?.getUid() || item?.['sender']?.['uid']) == loggedInUser.current['uid'];
|
|
1271
1260
|
let messageState;
|
|
1272
|
-
|
|
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)
|
|
1273
1264
|
messageState = "READ";
|
|
1274
|
-
else if (item.getDeliveredAt())
|
|
1265
|
+
else if (item.getDeliveredAt() || nextItemIsDelivered)
|
|
1275
1266
|
messageState = "DELIVERED";
|
|
1276
1267
|
else if (item.getSentAt())
|
|
1277
1268
|
messageState = "SENT";
|
|
@@ -1384,8 +1375,6 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1384
1375
|
|
|
1385
1376
|
let style = [{
|
|
1386
1377
|
color: theme?.palette.getAccent900(),
|
|
1387
|
-
marginRight: alignment === "right" ? 3 : 0,
|
|
1388
|
-
marginLeft: alignment === "left" ? 3 : 0
|
|
1389
1378
|
}, theme?.typography?.subtitle1];
|
|
1390
1379
|
|
|
1391
1380
|
// let unreadReplyCount = item?.getUnreadReplyCount && item?.getUnreadReplyCount();
|
|
@@ -1401,7 +1390,7 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1401
1390
|
alignSelf: alignment === "right" ? "flex-end" : "flex-start",
|
|
1402
1391
|
}}
|
|
1403
1392
|
>
|
|
1404
|
-
{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} />}
|
|
1405
1394
|
<Text style={style}>{`${item.getReplyCount()} ${item.getReplyCount() > 1 ? localize("REPLIES") : localize("REPLY")}`}</Text>
|
|
1406
1395
|
|
|
1407
1396
|
{/** NOTE: uncomment below code when want unread count in thread view **/}
|
|
@@ -1432,7 +1421,7 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1432
1421
|
} */}
|
|
1433
1422
|
{/** NOTE: uncomment above code when want unread count in thread view **/}
|
|
1434
1423
|
|
|
1435
|
-
{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 },
|
|
1436
1425
|
{
|
|
1437
1426
|
transform: [{ scaleX: -1 }]
|
|
1438
1427
|
}
|
|
@@ -1623,8 +1612,8 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1623
1612
|
setShowMessageOptions(optionsWithPressHandling);
|
|
1624
1613
|
}, [])
|
|
1625
1614
|
|
|
1626
|
-
const MessageView = useCallback((params: { message: CometChat.BaseMessage, showOptions?: boolean, isThreaded?: boolean }) => {
|
|
1627
|
-
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;
|
|
1628
1617
|
let hasTemplate = templatesMap.get(`${message.getCategory()}_${message.getType()}`)
|
|
1629
1618
|
if (templates?.length > 0) {
|
|
1630
1619
|
let customTemplate = templates.find(template => template.type == message.getType() && template.category == message.getCategory())
|
|
@@ -1653,7 +1642,7 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1653
1642
|
ContentView={hasTemplate.ContentView?.bind(this, message, bubbleAlignment)}
|
|
1654
1643
|
ThreadView={() => !isThreaded && !message.getDeletedBy() && getThreadView(message, bubbleAlignment)}
|
|
1655
1644
|
BottomView={hasTemplate.BottomView && hasTemplate.BottomView?.bind(this, message, bubbleAlignment)}
|
|
1656
|
-
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)}
|
|
1657
1646
|
style={getStyle(message)}
|
|
1658
1647
|
/>
|
|
1659
1648
|
</TouchableOpacity>
|
|
@@ -1663,10 +1652,7 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1663
1652
|
}, []);
|
|
1664
1653
|
|
|
1665
1654
|
const getSentAtTimestamp = useCallback((item) => {
|
|
1666
|
-
|
|
1667
|
-
return item['_composedAt'];
|
|
1668
|
-
}
|
|
1669
|
-
return item['sentAt'] * 1000;
|
|
1655
|
+
return Date.now();
|
|
1670
1656
|
}, [])
|
|
1671
1657
|
|
|
1672
1658
|
|
|
@@ -1772,7 +1758,7 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1772
1758
|
|
|
1773
1759
|
return <React.Fragment key={index}>
|
|
1774
1760
|
{seperatorView}
|
|
1775
|
-
<MessageView message={item} />
|
|
1761
|
+
<MessageView message={item} currentIndex={index} />
|
|
1776
1762
|
</React.Fragment>
|
|
1777
1763
|
}), []);
|
|
1778
1764
|
|
|
Binary file
|
|
Binary file
|
|
@@ -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
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -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
|
|
16
|
-
dateSeparatorPattern
|
|
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
|
|
52
|
-
dateSeparatorPattern
|
|
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
|
|
28
|
-
dateSeparatorPattern
|
|
27
|
+
datePattern?: DatePattern,
|
|
28
|
+
dateSeparatorPattern?: DatePattern,
|
|
29
29
|
hideSeperator?: boolean,
|
|
30
30
|
BackButton?: JSX.Element,
|
|
31
31
|
showBackButton?: boolean,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|