@cometchat/chat-uikit-react-native 4.3.23 → 5.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/.gradle/7.4/checksums/checksums.lock +0 -0
- package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.4/gc.properties +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.settings/org.eclipse.buildship.core.prefs +2 -0
- package/android/src/main/AndroidManifest.xml +0 -6
- package/android/src/main/java/com/reactnativecometchatuikit/FileManager.java +171 -27
- package/android/src/main/java/com/reactnativecometchatuikit/SoundPlayer.java +31 -15
- package/ios/CometchatUiKit.mm +25 -25
- package/ios/FileManager.m +108 -4
- package/ios/SoundPlayer.m +32 -5
- package/package.json +13 -29
- package/react-native-cometchat-ui-kit.podspec +6 -6
- package/src/CometChatConversations/CometChatConversations.tsx +1376 -1263
- package/src/CometChatConversations/Skeleton.tsx +143 -0
- package/src/CometChatConversations/index.ts +7 -21
- package/src/CometChatConversations/resources/index.ts +22 -36
- package/src/CometChatConversations/style.ts +237 -62
- package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +844 -683
- package/src/CometChatGroupMembers/Skeleton.tsx +197 -0
- package/src/CometChatGroupMembers/index.ts +2 -8
- package/src/CometChatGroupMembers/resources/index.ts +3 -14
- package/src/CometChatGroupMembers/style.ts +532 -22
- package/src/CometChatGroups/CometChatGroups.tsx +417 -562
- package/src/CometChatGroups/GroupsStyle.ts +176 -109
- package/src/CometChatGroups/Skeleton.tsx +328 -0
- package/src/CometChatGroups/index.ts +3 -11
- package/src/CometChatGroups/resources/index.ts +17 -24
- package/src/CometChatGroups/style.ts +15 -16
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +585 -1044
- package/src/CometChatMessageComposer/index.ts +4 -8
- package/src/CometChatMessageComposer/resources/index.ts +21 -31
- package/src/CometChatMessageComposer/styles.tsx +152 -0
- package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +315 -422
- package/src/CometChatMessageHeader/index.ts +3 -15
- package/src/CometChatMessageHeader/listners.ts +50 -26
- package/src/CometChatMessageHeader/styles.ts +57 -10
- package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +350 -295
- package/src/CometChatMessageInformation/Skeleton.tsx +143 -0
- package/src/CometChatMessageInformation/index.ts +5 -9
- package/src/CometChatMessageInformation/resources/index.ts +1 -4
- package/src/CometChatMessageInformation/styles.ts +147 -16
- package/src/CometChatMessageList/CometChatMessageList.tsx +2344 -2080
- package/src/CometChatMessageList/Skeleton.tsx +98 -0
- package/src/CometChatMessageList/index.ts +5 -12
- package/src/CometChatMessageList/resources/index.ts +13 -20
- package/src/CometChatMessageList/style.ts +989 -51
- package/src/CometChatThreadHeader/CometChatThreadHeader.tsx +208 -0
- package/src/CometChatThreadHeader/Header.tsx +47 -0
- package/src/CometChatThreadHeader/index.ts +8 -0
- package/src/CometChatThreadHeader/resources/index.ts +14 -0
- package/src/CometChatThreadHeader/style.ts +70 -0
- package/src/CometChatUsers/CometChatUsers.tsx +276 -114
- package/src/CometChatUsers/Skeleton.tsx +195 -0
- package/src/CometChatUsers/index.ts +3 -11
- package/src/CometChatUsers/style.ts +181 -0
- package/src/calls/CallEvents.ts +9 -9
- package/src/calls/CallUtils.ts +102 -31
- package/src/calls/CallingConfiguration.ts +22 -4
- package/src/calls/CallingExtension.tsx +43 -40
- package/src/calls/CallingExtensionDecorator.tsx +416 -0
- package/src/calls/CallingPackage.ts +11 -12
- package/src/calls/CometChatCallBubble/CometChatCallBubble.tsx +121 -52
- package/src/calls/CometChatCallBubble/index.ts +8 -13
- package/src/calls/CometChatCallBubble/resources/index.ts +1 -8
- package/src/calls/CometChatCallBubble/styles.ts +155 -22
- package/src/calls/CometChatCallButtons/CometChatCallButtonConfiguration.ts +17 -36
- package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +319 -323
- package/src/calls/CometChatCallButtons/index.ts +9 -11
- package/src/calls/CometChatCallButtons/style.ts +34 -12
- package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +429 -377
- package/src/calls/CometChatCallLogs/Skeleton.tsx +143 -0
- package/src/calls/CometChatCallLogs/index.ts +4 -15
- package/src/calls/CometChatCallLogs/resources/index.ts +20 -31
- package/src/calls/CometChatCallLogs/style.ts +169 -22
- package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +279 -217
- package/src/calls/CometChatIncomingCall/index.ts +7 -9
- package/src/calls/CometChatIncomingCall/resources/index.ts +3 -12
- package/src/calls/CometChatIncomingCall/style.ts +75 -0
- package/src/calls/CometChatOngoingCall/CometChatOngoingCall.tsx +74 -56
- package/src/calls/CometChatOngoingCall/index.ts +3 -7
- package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +207 -171
- package/src/calls/CometChatOutgoingCall/OutgoingCallConfiguration.ts +31 -31
- package/src/calls/CometChatOutgoingCall/index.ts +5 -11
- package/src/calls/CometChatOutgoingCall/resources/index.ts +1 -4
- package/src/calls/CometChatOutgoingCall/styles.ts +58 -0
- package/src/calls/index.ts +14 -88
- package/src/calls/resources/index.ts +1 -8
- package/src/extensions/CollaborativeBubble/CometChatCollaborativeBubble.tsx +72 -96
- package/src/extensions/CollaborativeBubble/resources/index.ts +2 -4
- package/src/extensions/CollaborativeBubble/style.ts +112 -0
- package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtension.tsx +21 -35
- package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +220 -189
- package/src/extensions/CollaborativeDocument/index.ts +2 -8
- package/src/extensions/CollaborativeDocument/resources/index.ts +4 -6
- package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtension.tsx +25 -35
- package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +298 -199
- package/src/extensions/CollaborativeWhiteboard/index.ts +2 -8
- package/src/extensions/CollaborativeWhiteboard/resources/index.ts +4 -6
- package/src/extensions/ExtensionConstants.tsx +3 -4
- package/src/extensions/ExtensionModerator.tsx +47 -47
- package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +187 -116
- package/src/extensions/LinkPreview/LinkPreviewExtension.tsx +22 -0
- package/src/extensions/LinkPreview/LinkPreviewExtensionDecorator.tsx +94 -0
- package/src/extensions/LinkPreview/index.ts +6 -16
- package/src/extensions/LinkPreview/resources/index.ts +1 -4
- package/src/extensions/LinkPreview/style.ts +100 -0
- package/src/extensions/MessageTranslation/MessageTranslationBubble.tsx +112 -116
- package/src/extensions/MessageTranslation/MessageTranslationDecorator.tsx +235 -152
- package/src/extensions/MessageTranslation/MessageTranslationExtension.tsx +7 -25
- package/src/extensions/MessageTranslation/index.ts +3 -5
- package/src/extensions/MessageTranslation/resources/index.ts +2 -3
- package/src/extensions/Polls/Header.tsx +56 -21
- package/src/extensions/Polls/Polls.tsx +368 -332
- package/src/extensions/Polls/PollsBubble.tsx +250 -205
- package/src/extensions/Polls/PollsConfigurations.ts +0 -9
- package/src/extensions/Polls/PollsDecorator.tsx +148 -77
- package/src/extensions/Polls/PollsExtension.tsx +5 -12
- package/src/extensions/Polls/index.ts +6 -8
- package/src/extensions/Polls/resources/index.ts +6 -12
- package/src/extensions/Polls/style.ts +185 -1
- package/src/extensions/Stickers/CometChatStickerKeyboard/CometChatStickerKeyboard.tsx +249 -115
- package/src/extensions/Stickers/CometChatStickerKeyboard/Skeleton.tsx +167 -0
- package/src/extensions/Stickers/CometChatStickerKeyboard/StickerKeyboardConfiguration.ts +2 -6
- package/src/extensions/Stickers/CometChatStickerKeyboard/hooks.ts +58 -64
- package/src/extensions/Stickers/CometChatStickerKeyboard/index.ts +2 -3
- package/src/extensions/Stickers/CometChatStickerKeyboard/style.ts +67 -41
- package/src/extensions/Stickers/StickerConfiguration.ts +5 -9
- package/src/extensions/Stickers/StickersBubble.tsx +22 -46
- package/src/extensions/Stickers/StickersExtension.ts +5 -6
- package/src/extensions/Stickers/StickersExtensionDecorator.tsx +290 -104
- package/src/extensions/Stickers/index.ts +7 -9
- package/src/extensions/Stickers/resources/index.ts +1 -4
- package/src/extensions/Stickers/style.ts +53 -0
- package/src/extensions/ThumbnailGeneration/ThumbnailGenerationDecorator.tsx +83 -64
- package/src/extensions/ThumbnailGeneration/ThumbnailGenerationExtension.tsx +5 -25
- package/src/extensions/ThumbnailGeneration/index.ts +1 -3
- package/src/extensions/ThumbnailGeneration/resources/index.ts +1 -4
- package/src/extensions/index.ts +11 -50
- package/src/index.ts +193 -670
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +342 -491
- package/src/shared/CometChatUiKit/CometChatUIKitHelper.ts +147 -117
- package/src/shared/CometChatUiKit/UIKitSettings.ts +38 -38
- package/src/shared/CometChatUiKit/index.ts +2 -6
- package/src/shared/assets/images/index.ts +13 -29
- package/src/shared/base/BaseStyle.ts +9 -8
- package/src/shared/base/BorderStyle.ts +4 -4
- package/src/shared/base/FontStyle.ts +25 -3
- package/src/shared/base/ShadowStyle.ts +1 -1
- package/src/shared/base/Types.ts +16 -22
- package/src/shared/base/index.ts +7 -25
- package/src/shared/base/vars.ts +5 -5
- package/src/shared/constants/UIKitConstants.ts +322 -294
- package/src/shared/events/CometChatMessageEvents/index.ts +83 -87
- package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +260 -238
- package/src/shared/events/CometChatUIEventHandler/Listener.ts +412 -377
- package/src/shared/events/CometChatUIEvents.ts +15 -16
- package/src/shared/events/ListenerInitializer.ts +79 -80
- package/src/shared/events/conversations.ts +2 -2
- package/src/shared/events/groups.ts +8 -8
- package/src/shared/events/index.ts +6 -6
- package/src/shared/events/messages.ts +26 -29
- package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +191 -121
- package/src/shared/formatters/CometChatMentionsFormatter/MentionTextStyle.ts +3 -3
- package/src/shared/formatters/CometChatMentionsFormatter/index.ts +3 -6
- package/src/shared/formatters/CometChatTextFormatter.ts +15 -14
- package/src/shared/formatters/CometChatUrlsFormatter/index.tsx +127 -131
- package/src/shared/formatters/index.ts +7 -8
- package/src/shared/framework/ChatConfigurator.ts +3 -4
- package/src/shared/framework/DataSource.ts +181 -92
- package/src/shared/framework/DataSourceDecorator.tsx +307 -233
- package/src/shared/framework/ExtensionsDataSource.tsx +8 -11
- package/src/shared/framework/MessageDataSource.tsx +1364 -867
- package/src/shared/framework/index.ts +8 -6
- package/src/shared/framework/resources/index.ts +37 -57
- package/src/shared/helper/Toast.tsx +20 -18
- package/src/shared/helper/dateHelper.ts +138 -0
- package/src/shared/helper/functions.js +1 -1
- package/src/shared/helper/helperFunctions.ts +71 -19
- package/src/shared/helper/types/index.ts +49 -15
- package/src/shared/helper/useKeyboard.tsx +12 -23
- package/src/shared/icons/Icon.tsx +73 -0
- package/src/shared/icons/components/ListItemCheck.tsx +18 -0
- package/src/shared/icons/components/StickerBase-icon.tsx +16 -0
- package/src/shared/icons/components/account-circle-fill.tsx +26 -0
- package/src/shared/icons/components/account-circle.tsx +11 -0
- package/src/shared/icons/components/activity.tsx +20 -0
- package/src/shared/icons/components/add-a-photo-fill.tsx +26 -0
- package/src/shared/icons/components/add-a-photo.tsx +11 -0
- package/src/shared/icons/components/add-box-fill.tsx +26 -0
- package/src/shared/icons/components/add-box.tsx +11 -0
- package/src/shared/icons/components/add-call-fill.tsx +26 -0
- package/src/shared/icons/components/add-call.tsx +11 -0
- package/src/shared/icons/components/add-circle-fill.tsx +11 -0
- package/src/shared/icons/components/add-circle.tsx +11 -0
- package/src/shared/icons/components/add-comment-fill.tsx +26 -0
- package/src/shared/icons/components/add-comment.tsx +11 -0
- package/src/shared/icons/components/add-fill.tsx +26 -0
- package/src/shared/icons/components/add-reaction-fill.tsx +26 -0
- package/src/shared/icons/components/add-reaction.tsx +11 -0
- package/src/shared/icons/components/add.tsx +11 -0
- package/src/shared/icons/components/ai-conversation-summary-fill.tsx +13 -0
- package/src/shared/icons/components/ai-conversation-summary.tsx +13 -0
- package/src/shared/icons/components/ai-fill.tsx +11 -0
- package/src/shared/icons/components/ai-suggest-reply-fill.tsx +13 -0
- package/src/shared/icons/components/ai-suggest-reply.tsx +20 -0
- package/src/shared/icons/components/ai.tsx +12 -0
- package/src/shared/icons/components/alternate-email-fill.tsx +26 -0
- package/src/shared/icons/components/alternate-email.tsx +11 -0
- package/src/shared/icons/components/animals-&-nature.tsx +18 -0
- package/src/shared/icons/components/archive-fill.tsx +26 -0
- package/src/shared/icons/components/archive.tsx +11 -0
- package/src/shared/icons/components/arrow-back-fill.tsx +26 -0
- package/src/shared/icons/components/arrow-back.tsx +11 -0
- package/src/shared/icons/components/arrow-forward-fill.tsx +26 -0
- package/src/shared/icons/components/arrow-forward.tsx +11 -0
- package/src/shared/icons/components/attach-file-fill.tsx +26 -0
- package/src/shared/icons/components/attach-file.tsx +11 -0
- package/src/shared/icons/components/audio-file-type.tsx +36 -0
- package/src/shared/icons/components/bar-chart-fill.tsx +11 -0
- package/src/shared/icons/components/bar-chart.tsx +11 -0
- package/src/shared/icons/components/base-icon.tsx +16 -0
- package/src/shared/icons/components/bedtime-fill.tsx +26 -0
- package/src/shared/icons/components/bedtime.tsx +11 -0
- package/src/shared/icons/components/block-fill.tsx +26 -0
- package/src/shared/icons/components/block.tsx +11 -0
- package/src/shared/icons/components/bookmark-add-fill.tsx +26 -0
- package/src/shared/icons/components/bookmark-add.tsx +11 -0
- package/src/shared/icons/components/bookmark-fill.tsx +26 -0
- package/src/shared/icons/components/bookmark.tsx +11 -0
- package/src/shared/icons/components/calendar-add-on-fill.tsx +26 -0
- package/src/shared/icons/components/calendar-add-on.tsx +11 -0
- package/src/shared/icons/components/calendar-today-fill.tsx +26 -0
- package/src/shared/icons/components/calendar-today.tsx +11 -0
- package/src/shared/icons/components/call-end-fill.tsx +26 -0
- package/src/shared/icons/components/call-end.tsx +11 -0
- package/src/shared/icons/components/call-fill.tsx +26 -0
- package/src/shared/icons/components/call-log-fill.tsx +26 -0
- package/src/shared/icons/components/call-log.tsx +11 -0
- package/src/shared/icons/components/call-made-fill.tsx +26 -0
- package/src/shared/icons/components/call-made.tsx +11 -0
- package/src/shared/icons/components/call-missed-fill.tsx +26 -0
- package/src/shared/icons/components/call-missed-outgoing-fill.tsx +26 -0
- package/src/shared/icons/components/call-missed-outgoing.tsx +11 -0
- package/src/shared/icons/components/call-missed.tsx +11 -0
- package/src/shared/icons/components/call-received-fill.tsx +26 -0
- package/src/shared/icons/components/call-received.tsx +11 -0
- package/src/shared/icons/components/call.tsx +11 -0
- package/src/shared/icons/components/cancel-fill.tsx +26 -0
- package/src/shared/icons/components/cancel.tsx +11 -0
- package/src/shared/icons/components/change-circle-fill.tsx +11 -0
- package/src/shared/icons/components/change-circle.tsx +11 -0
- package/src/shared/icons/components/chat-bot-fill.tsx +13 -0
- package/src/shared/icons/components/chat-bot.tsx +17 -0
- package/src/shared/icons/components/chat-fill.tsx +26 -0
- package/src/shared/icons/components/chat.tsx +11 -0
- package/src/shared/icons/components/check-circle-fill.tsx +11 -0
- package/src/shared/icons/components/check-circle.tsx +11 -0
- package/src/shared/icons/components/check-fill.tsx +26 -0
- package/src/shared/icons/components/check.tsx +11 -0
- package/src/shared/icons/components/chevron-left-fill.tsx +26 -0
- package/src/shared/icons/components/chevron-left.tsx +11 -0
- package/src/shared/icons/components/chevron-right-fill.tsx +26 -0
- package/src/shared/icons/components/chevron-right.tsx +11 -0
- package/src/shared/icons/components/close-fill.tsx +26 -0
- package/src/shared/icons/components/close.tsx +11 -0
- package/src/shared/icons/components/collaborative-document-fill.tsx +17 -0
- package/src/shared/icons/components/collaborative-document-icon.tsx +11 -0
- package/src/shared/icons/components/collaborative-document.tsx +13 -0
- package/src/shared/icons/components/collaborative-whiteboard-fill.tsx +15 -0
- package/src/shared/icons/components/collaborative-whiteboard-icon.tsx +15 -0
- package/src/shared/icons/components/collaborative-whiteboard.tsx +12 -0
- package/src/shared/icons/components/content-copy-fill.tsx +26 -0
- package/src/shared/icons/components/content-copy.tsx +11 -0
- package/src/shared/icons/components/crop-fill.tsx +26 -0
- package/src/shared/icons/components/crop.tsx +11 -0
- package/src/shared/icons/components/delete-fill.tsx +26 -0
- package/src/shared/icons/components/delete.tsx +11 -0
- package/src/shared/icons/components/description-fill.tsx +26 -0
- package/src/shared/icons/components/description.tsx +11 -0
- package/src/shared/icons/components/document-file-type.tsx +38 -0
- package/src/shared/icons/components/done-all-fill.tsx +26 -0
- package/src/shared/icons/components/done-all.tsx +11 -0
- package/src/shared/icons/components/download-fill.tsx +26 -0
- package/src/shared/icons/components/download.tsx +11 -0
- package/src/shared/icons/components/edit-calendar-fill.tsx +26 -0
- package/src/shared/icons/components/edit-calendar.tsx +11 -0
- package/src/shared/icons/components/edit-fill.tsx +26 -0
- package/src/shared/icons/components/edit-square-fill.tsx +11 -0
- package/src/shared/icons/components/edit-square.tsx +11 -0
- package/src/shared/icons/components/edit.tsx +11 -0
- package/src/shared/icons/components/empty-state.tsx +82 -0
- package/src/shared/icons/components/error-fill.tsx +34 -0
- package/src/shared/icons/components/error-state.tsx +92 -0
- package/src/shared/icons/components/error.tsx +11 -0
- package/src/shared/icons/components/event-available-fill.tsx +11 -0
- package/src/shared/icons/components/event-available.tsx +11 -0
- package/src/shared/icons/components/event-fill.tsx +26 -0
- package/src/shared/icons/components/event.tsx +11 -0
- package/src/shared/icons/components/favorite-fill.tsx +26 -0
- package/src/shared/icons/components/favorite.tsx +11 -0
- package/src/shared/icons/components/filter-list-fill.tsx +26 -0
- package/src/shared/icons/components/filter-list-off-fill.tsx +26 -0
- package/src/shared/icons/components/filter-list-off.tsx +11 -0
- package/src/shared/icons/components/filter-list.tsx +11 -0
- package/src/shared/icons/components/flags.tsx +13 -0
- package/src/shared/icons/components/flip-camera-ios-fill.tsx +26 -0
- package/src/shared/icons/components/flip-camera-ios.tsx +11 -0
- package/src/shared/icons/components/food-&-drink.tsx +18 -0
- package/src/shared/icons/components/forward-fill.tsx +26 -0
- package/src/shared/icons/components/forward.tsx +11 -0
- package/src/shared/icons/components/gif-fill.tsx +13 -0
- package/src/shared/icons/components/gif.tsx +12 -0
- package/src/shared/icons/components/graphic-eq-fill.tsx +11 -0
- package/src/shared/icons/components/graphic-eq.tsx +11 -0
- package/src/shared/icons/components/group-add.tsx +11 -0
- package/src/shared/icons/components/group-fill.tsx +26 -0
- package/src/shared/icons/components/group.tsx +11 -0
- package/src/shared/icons/components/help-fill.tsx +26 -0
- package/src/shared/icons/components/help.tsx +11 -0
- package/src/shared/icons/components/history-fill.tsx +26 -0
- package/src/shared/icons/components/history.tsx +11 -0
- package/src/shared/icons/components/image-file-type.tsx +35 -0
- package/src/shared/icons/components/incoming-audio-fill.tsx +11 -0
- package/src/shared/icons/components/incoming-audio.tsx +13 -0
- package/src/shared/icons/components/incoming-video-fill.tsx +28 -0
- package/src/shared/icons/components/incoming-video.tsx +15 -0
- package/src/shared/icons/components/info-fill.tsx +26 -0
- package/src/shared/icons/components/info.tsx +11 -0
- package/src/shared/icons/components/keep-fill.tsx +26 -0
- package/src/shared/icons/components/keep-off-fill.tsx +26 -0
- package/src/shared/icons/components/keep-off.tsx +11 -0
- package/src/shared/icons/components/keep.tsx +11 -0
- package/src/shared/icons/components/keyboard-arrow-down-fill.tsx +26 -0
- package/src/shared/icons/components/keyboard-arrow-down.tsx +11 -0
- package/src/shared/icons/components/keyboard-arrow-up-fill.tsx +26 -0
- package/src/shared/icons/components/keyboard-arrow-up.tsx +11 -0
- package/src/shared/icons/components/keyboard-fill.tsx +26 -0
- package/src/shared/icons/components/keyboard.tsx +11 -0
- package/src/shared/icons/components/language-fill.tsx +26 -0
- package/src/shared/icons/components/language.tsx +11 -0
- package/src/shared/icons/components/link-fill.tsx +26 -0
- package/src/shared/icons/components/link.tsx +11 -0
- package/src/shared/icons/components/loading-fill.tsx +12 -0
- package/src/shared/icons/components/loading.tsx +12 -0
- package/src/shared/icons/components/location-on-fill.tsx +26 -0
- package/src/shared/icons/components/location-on.tsx +11 -0
- package/src/shared/icons/components/lock-fill.tsx +26 -0
- package/src/shared/icons/components/lock-open-fill.tsx +26 -0
- package/src/shared/icons/components/lock-open.tsx +11 -0
- package/src/shared/icons/components/lock.tsx +11 -0
- package/src/shared/icons/components/logout-fill.tsx +11 -0
- package/src/shared/icons/components/logout.tsx +11 -0
- package/src/shared/icons/components/mail-fill.tsx +26 -0
- package/src/shared/icons/components/mail.tsx +11 -0
- package/src/shared/icons/components/mic-fill.tsx +26 -0
- package/src/shared/icons/components/mic-off-fill.tsx +26 -0
- package/src/shared/icons/components/mic-off.tsx +11 -0
- package/src/shared/icons/components/mic.tsx +11 -0
- package/src/shared/icons/components/missed-video-call-fill.tsx +26 -0
- package/src/shared/icons/components/missed-video-call.tsx +11 -0
- package/src/shared/icons/components/mood-fill.tsx +26 -0
- package/src/shared/icons/components/mood.tsx +11 -0
- package/src/shared/icons/components/more-vert-fill.tsx +26 -0
- package/src/shared/icons/components/more-vert.tsx +11 -0
- package/src/shared/icons/components/near-me-fill.tsx +11 -0
- package/src/shared/icons/components/near-me.tsx +11 -0
- package/src/shared/icons/components/no-photography-fill.tsx +26 -0
- package/src/shared/icons/components/no-photography.tsx +11 -0
- package/src/shared/icons/components/notifications-fill.tsx +26 -0
- package/src/shared/icons/components/notifications-off-fill.tsx +26 -0
- package/src/shared/icons/components/notifications-off.tsx +11 -0
- package/src/shared/icons/components/notifications.tsx +11 -0
- package/src/shared/icons/components/objects.tsx +20 -0
- package/src/shared/icons/components/outgoing-audio-fill.tsx +15 -0
- package/src/shared/icons/components/outgoing-audio.tsx +15 -0
- package/src/shared/icons/components/outgoing-video-fill.tsx +28 -0
- package/src/shared/icons/components/outgoing-video.tsx +15 -0
- package/src/shared/icons/components/pause-fill.tsx +26 -0
- package/src/shared/icons/components/pause.tsx +11 -0
- package/src/shared/icons/components/pdf-file-type.tsx +36 -0
- package/src/shared/icons/components/person-add-fill.tsx +26 -0
- package/src/shared/icons/components/person-add.tsx +11 -0
- package/src/shared/icons/components/person-fill.tsx +26 -0
- package/src/shared/icons/components/person-off.tsx +16 -0
- package/src/shared/icons/components/person.tsx +11 -0
- package/src/shared/icons/components/phone-in-talk-fill.tsx +26 -0
- package/src/shared/icons/components/phone-in-talk.tsx +11 -0
- package/src/shared/icons/components/phone-incoming-fill.tsx +11 -0
- package/src/shared/icons/components/phone-incoming.tsx +11 -0
- package/src/shared/icons/components/phone-missed-fill.tsx +26 -0
- package/src/shared/icons/components/phone-missed.tsx +11 -0
- package/src/shared/icons/components/phone-outgoing-fill.tsx +15 -0
- package/src/shared/icons/components/phone-outgoing.tsx +15 -0
- package/src/shared/icons/components/photo-camera-fill.tsx +26 -0
- package/src/shared/icons/components/photo-camera.tsx +11 -0
- package/src/shared/icons/components/photo-fill.tsx +26 -0
- package/src/shared/icons/components/photo.tsx +11 -0
- package/src/shared/icons/components/play-arrow-fill.tsx +26 -0
- package/src/shared/icons/components/play-arrow.tsx +11 -0
- package/src/shared/icons/components/play-circle-fill.tsx +26 -0
- package/src/shared/icons/components/play-circle.tsx +11 -0
- package/src/shared/icons/components/poll-Icon.tsx +10 -0
- package/src/shared/icons/components/poll-fill.tsx +11 -0
- package/src/shared/icons/components/poll.tsx +11 -0
- package/src/shared/icons/components/presentation-file-type.tsx +38 -0
- package/src/shared/icons/components/rearrange-fill.tsx +13 -0
- package/src/shared/icons/components/rearrange.tsx +13 -0
- package/src/shared/icons/components/refresh-fill.tsx +26 -0
- package/src/shared/icons/components/refresh.tsx +11 -0
- package/src/shared/icons/components/reply-all-fill.tsx +26 -0
- package/src/shared/icons/components/reply-all.tsx +11 -0
- package/src/shared/icons/components/reply-fill.tsx +26 -0
- package/src/shared/icons/components/reply.tsx +11 -0
- package/src/shared/icons/components/retry-fill.tsx +11 -0
- package/src/shared/icons/components/retry.tsx +11 -0
- package/src/shared/icons/components/schedule-fill.tsx +26 -0
- package/src/shared/icons/components/schedule.tsx +11 -0
- package/src/shared/icons/components/screen-share-fill.tsx +26 -0
- package/src/shared/icons/components/screen-share.tsx +11 -0
- package/src/shared/icons/components/search-fill.tsx +26 -0
- package/src/shared/icons/components/search.tsx +11 -0
- package/src/shared/icons/components/send-fill.tsx +26 -0
- package/src/shared/icons/components/send.tsx +11 -0
- package/src/shared/icons/components/settings-fill.tsx +26 -0
- package/src/shared/icons/components/settings.tsx +11 -0
- package/src/shared/icons/components/share-fill.tsx +26 -0
- package/src/shared/icons/components/share.tsx +11 -0
- package/src/shared/icons/components/shield-fill.tsx +11 -0
- package/src/shared/icons/components/shield.tsx +11 -0
- package/src/shared/icons/components/smileys-&-people.tsx +18 -0
- package/src/shared/icons/components/spreadsheet-file-type.tsx +38 -0
- package/src/shared/icons/components/star-fill.tsx +26 -0
- package/src/shared/icons/components/star.tsx +11 -0
- package/src/shared/icons/components/sticker-fill.tsx +12 -0
- package/src/shared/icons/components/sticker.tsx +11 -0
- package/src/shared/icons/components/stop-circle-fill.tsx +26 -0
- package/src/shared/icons/components/stop-circle.tsx +11 -0
- package/src/shared/icons/components/stop-fill.tsx +26 -0
- package/src/shared/icons/components/stop-screen-share-fill.tsx +26 -0
- package/src/shared/icons/components/stop-screen-share.tsx +11 -0
- package/src/shared/icons/components/stop.tsx +11 -0
- package/src/shared/icons/components/subdirectory-arrow-left-fill.tsx +26 -0
- package/src/shared/icons/components/subdirectory-arrow-left.tsx +11 -0
- package/src/shared/icons/components/subdirectory-arrow-right-fill.tsx +26 -0
- package/src/shared/icons/components/subdirectory-arrow-right.tsx +11 -0
- package/src/shared/icons/components/sunny-fill.tsx +26 -0
- package/src/shared/icons/components/sunny.tsx +11 -0
- package/src/shared/icons/components/symbols.tsx +15 -0
- package/src/shared/icons/components/text-file-type.tsx +35 -0
- package/src/shared/icons/components/thumb-down-fill.tsx +26 -0
- package/src/shared/icons/components/thumb-down.tsx +11 -0
- package/src/shared/icons/components/thumb-up-fill.tsx +26 -0
- package/src/shared/icons/components/thumb-up.tsx +11 -0
- package/src/shared/icons/components/translate-fill.tsx +11 -0
- package/src/shared/icons/components/translate.tsx +11 -0
- package/src/shared/icons/components/travel-&-places.tsx +18 -0
- package/src/shared/icons/components/unknown-file-type.tsx +38 -0
- package/src/shared/icons/components/upload-fill.tsx +11 -0
- package/src/shared/icons/components/upload.tsx +11 -0
- package/src/shared/icons/components/user-empty-icon.tsx +26 -0
- package/src/shared/icons/components/video-call-fill.tsx +26 -0
- package/src/shared/icons/components/video-call.tsx +11 -0
- package/src/shared/icons/components/video-file-type.tsx +38 -0
- package/src/shared/icons/components/videocam-fill.tsx +26 -0
- package/src/shared/icons/components/videocam-off-fill.tsx +26 -0
- package/src/shared/icons/components/videocam-off.tsx +11 -0
- package/src/shared/icons/components/videocam.tsx +11 -0
- package/src/shared/icons/components/visibility-off-fill.tsx +11 -0
- package/src/shared/icons/components/visibility-off.tsx +11 -0
- package/src/shared/icons/components/volume-down-fill.tsx +26 -0
- package/src/shared/icons/components/volume-down.tsx +11 -0
- package/src/shared/icons/components/volume-mute-fill.tsx +26 -0
- package/src/shared/icons/components/volume-mute.tsx +11 -0
- package/src/shared/icons/components/volume-off-fill.tsx +26 -0
- package/src/shared/icons/components/volume-off.tsx +11 -0
- package/src/shared/icons/components/volume-up-fill.tsx +26 -0
- package/src/shared/icons/components/volume-up.tsx +11 -0
- package/src/shared/icons/components/warning-fill.tsx +26 -0
- package/src/shared/icons/components/warning.tsx +11 -0
- package/src/shared/icons/components/wifi-fill.tsx +26 -0
- package/src/shared/icons/components/wifi.tsx +11 -0
- package/src/shared/icons/components/zip-file-type.tsx +38 -0
- package/src/shared/icons/components/zoom-in-map-fill.tsx +26 -0
- package/src/shared/icons/components/zoom-in-map.tsx +11 -0
- package/src/shared/icons/components/zoom-out-map-fill.tsx +26 -0
- package/src/shared/icons/components/zoom-out-map.tsx +11 -0
- package/src/shared/icons/icon-mapping.tsx +620 -0
- package/src/shared/index.ts +114 -333
- package/src/shared/libs/ImageZoom/ReactNativeZoomableView.tsx +0 -1
- package/src/shared/libs/ImageZoom/ReactNativeZoomableViewWithGestures.tsx +19 -26
- package/src/shared/libs/ImageZoom/helper.ts +11 -27
- package/src/shared/libs/ImageZoom/index.tsx +4 -7
- package/src/shared/libs/ImageZoom/types/index.ts +7 -17
- package/src/shared/libs/VideoPlayer/VideoResizeMode.js +1 -1
- package/src/shared/modals/CometChatMessageOption.ts +11 -8
- package/src/shared/modals/CometChatMessageTemplate.ts +180 -140
- package/src/shared/modals/index.ts +2 -57
- package/src/shared/resources/CometChatLocalize/CometChatLocalize.ts +153 -152
- package/src/shared/resources/CometChatLocalize/index.ts +2 -8
- package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +445 -315
- package/src/shared/resources/CometChatLocalize/resources/de/translation.json +445 -316
- package/src/shared/resources/CometChatLocalize/resources/en/translation.json +445 -315
- package/src/shared/resources/CometChatLocalize/resources/es/translation.json +445 -316
- package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +444 -316
- package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +445 -315
- package/src/shared/resources/CometChatLocalize/resources/hu/translation.json +444 -315
- package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +445 -316
- package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +445 -316
- package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +445 -316
- package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +445 -316
- package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +445 -316
- package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +445 -316
- package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +444 -316
- package/src/shared/resources/CometChatSoundManager/index.ts +1 -2
- package/src/shared/resources/index.ts +1 -9
- package/src/shared/utils/CometChatMessageHelper/index.ts +16 -14
- package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +50 -0
- package/src/shared/utils/CometChatMessagePreview/MessagePreviewStyle.js +1 -1
- package/src/shared/utils/CometChatMessagePreview/index.ts +1 -5
- package/src/shared/utils/CometChatMessagePreview/resources/index.ts +1 -4
- package/src/shared/utils/CometChatMessagePreview/style.ts +45 -0
- package/src/shared/utils/CommonUtils.ts +163 -172
- package/src/shared/utils/MessageUtils.tsx +326 -146
- package/src/shared/utils/NetworkUtils.tsx +32 -24
- package/src/shared/utils/PermissionUtil.ts +30 -30
- package/src/shared/utils/conversationUtils.ts +93 -86
- package/src/shared/utils/index.ts +4 -25
- package/src/shared/views/CometChatAICard/CometChatAICard.tsx +100 -66
- package/src/shared/views/CometChatAICard/resources/index.ts +2 -4
- package/src/shared/views/CometChatActionSheet/ActionItem.ts +12 -57
- package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +68 -249
- package/src/shared/views/CometChatActionSheet/hooks.ts +5 -3
- package/src/shared/views/CometChatActionSheet/index.ts +1 -4
- package/src/shared/views/CometChatActionSheet/resources/index.ts +5 -7
- package/src/shared/views/CometChatActionSheet/style.ts +2 -41
- package/src/shared/views/CometChatAudioBubble/AnimatedAudioWaves.tsx +131 -0
- package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +211 -189
- package/src/shared/views/CometChatAudioBubble/index.ts +10 -10
- package/src/shared/views/CometChatAudioBubble/resources/index.ts +2 -7
- package/src/shared/views/CometChatAudioBubble/style.ts +203 -27
- package/src/shared/views/CometChatAvatar/CometChatAvatar.tsx +26 -104
- package/src/shared/views/CometChatAvatar/index.ts +3 -9
- package/src/shared/views/CometChatAvatar/styles.ts +37 -24
- package/src/shared/views/CometChatBadge/CometChatBadge.tsx +27 -46
- package/src/shared/views/CometChatBadge/index.ts +4 -8
- package/src/shared/views/CometChatBadge/styles.ts +29 -16
- package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +133 -152
- package/src/shared/views/CometChatBottomSheet/index.ts +2 -5
- package/src/shared/views/CometChatConfirmDialog/CometChatConfirmDialog.tsx +104 -106
- package/src/shared/views/CometChatConfirmDialog/index.ts +2 -9
- package/src/shared/views/CometChatConfirmDialog/style.ts +121 -62
- package/src/shared/views/CometChatDate/CometChatDate.tsx +23 -157
- package/src/shared/views/CometChatDate/index.ts +4 -12
- package/src/shared/views/CometChatDate/styles.ts +36 -0
- package/src/shared/views/CometChatDateSeperator/CometChatDateSeparator.tsx +48 -0
- package/src/shared/views/CometChatDateSeperator/index.ts +6 -0
- package/src/shared/views/CometChatDateSeperator/styles.ts +52 -0
- package/src/shared/views/CometChatDeletedBubble/CometChatDeletedBubble.tsx +42 -0
- package/src/shared/views/CometChatDeletedBubble/index.ts +5 -0
- package/src/shared/views/CometChatDeletedBubble/styles.ts +42 -0
- package/src/shared/views/CometChatEmojiKeyboard/CometChatEmojiKeyboard.tsx +284 -205
- package/src/shared/views/CometChatEmojiKeyboard/Emoji.ts +1 -1
- package/src/shared/views/CometChatEmojiKeyboard/EmojiCategory.ts +1 -1
- package/src/shared/views/CometChatEmojiKeyboard/emojis.ts +169 -1405
- package/src/shared/views/CometChatEmojiKeyboard/index.ts +1 -3
- package/src/shared/views/CometChatEmojiKeyboard/resources/index.ts +8 -16
- package/src/shared/views/CometChatEmojiKeyboard/style.ts +72 -61
- package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +203 -173
- package/src/shared/views/CometChatFileBubble/index.ts +10 -6
- package/src/shared/views/CometChatFileBubble/resources/index.ts +1 -6
- package/src/shared/views/CometChatFileBubble/style.ts +120 -47
- package/src/shared/views/CometChatImageBubble/CometChatImageBubble.tsx +57 -251
- package/src/shared/views/CometChatImageBubble/CometChatImageLoader.tsx +154 -0
- package/src/shared/views/CometChatImageBubble/assets/index.ts +1 -5
- package/src/shared/views/CometChatImageBubble/index.ts +7 -9
- package/src/shared/views/CometChatImageViewerModal/ImageViewerModal.tsx +28 -43
- package/src/shared/views/CometChatImageViewerModal/index.tsx +1 -1
- package/src/shared/views/CometChatImageViewerModal/resources/index.ts +1 -2
- package/src/shared/views/CometChatList/CometChatList.tsx +667 -700
- package/src/shared/views/CometChatList/Header.tsx +185 -110
- package/src/shared/views/CometChatList/index.ts +7 -4
- package/src/shared/views/CometChatList/resources/index.ts +4 -13
- package/src/shared/views/CometChatList/styles.ts +58 -44
- package/src/shared/views/CometChatListItem/CometChatListItem.tsx +132 -259
- package/src/shared/views/CometChatListItem/index.ts +3 -15
- package/src/shared/views/CometChatListItem/style.ts +25 -29
- package/src/shared/views/CometChatMediaRecorder/AnimatingMic.tsx +129 -0
- package/src/shared/views/CometChatMediaRecorder/CometChatAudioPlayer.tsx +115 -0
- package/src/shared/views/CometChatMediaRecorder/CometChatAudioPreview/CometChatAudioPreview.tsx +233 -0
- package/src/shared/views/CometChatMediaRecorder/CometChatMediaRecorder.tsx +359 -284
- package/src/shared/views/CometChatMediaRecorder/Timer.tsx +83 -0
- package/src/shared/views/CometChatMediaRecorder/index.ts +4 -10
- package/src/shared/views/CometChatMediaRecorder/style.ts +69 -23
- package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +111 -124
- package/src/shared/views/CometChatMessageBubble/index.ts +2 -5
- package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +44 -85
- package/src/shared/views/CometChatMessageInput/index.ts +10 -3
- package/src/shared/views/CometChatMessageInput/styles.ts +2 -2
- package/src/shared/views/CometChatPanel/CometChatPanel.tsx +51 -45
- package/src/shared/views/CometChatPanel/PanelStyle.tsx +36 -36
- package/src/shared/views/CometChatPanel/resources/index.ts +1 -4
- package/src/shared/views/CometChatQuickReactions/CometChatQuickReactions.tsx +51 -73
- package/src/shared/views/CometChatQuickReactions/QuickReactionsStyle.tsx +33 -33
- package/src/shared/views/CometChatQuickReactions/index.ts +4 -5
- package/src/shared/views/CometChatQuickReactions/resources/index.ts +1 -2
- package/src/shared/views/CometChatReactionList/CometChatReactionList.tsx +365 -311
- package/src/shared/views/CometChatReactionList/ReactionListStyle.tsx +152 -64
- package/src/shared/views/CometChatReactionList/Skeleton.tsx +143 -0
- package/src/shared/views/CometChatReactionList/index.ts +6 -5
- package/src/shared/views/CometChatReactionList/resources/index.ts +1 -4
- package/src/shared/views/CometChatReactions/CometChatReactions.tsx +103 -171
- package/src/shared/views/CometChatReactions/index.ts +7 -14
- package/src/shared/views/CometChatReactions/style.ts +193 -41
- package/src/shared/views/CometChatReceipt/CometChatReceipt.tsx +75 -76
- package/src/shared/views/CometChatReceipt/index.ts +4 -10
- package/src/shared/views/CometChatReceipt/resources/blue-double-tick-icon.png +0 -0
- package/src/shared/views/CometChatReceipt/resources/error.png +0 -0
- package/src/shared/views/CometChatReceipt/resources/grey-double-tick-icon.png +0 -0
- package/src/shared/views/CometChatReceipt/resources/grey-tick-icon.png +0 -0
- package/src/shared/views/CometChatReceipt/resources/index.ts +5 -10
- package/src/shared/views/CometChatReceipt/resources/sending.png +0 -0
- package/src/shared/views/CometChatReceipt/style.ts +50 -9
- package/src/shared/views/CometChatStatusIndicator/CometChatStatusIndicator.tsx +56 -59
- package/src/shared/views/CometChatStatusIndicator/index.ts +6 -22
- package/src/shared/views/CometChatStatusIndicator/private.png +0 -0
- package/src/shared/views/CometChatStatusIndicator/protected.png +0 -0
- package/src/shared/views/CometChatStatusIndicator/styles.ts +47 -15
- package/src/shared/views/CometChatSuggestionList/CometChatSuggestionList.tsx +74 -56
- package/src/shared/views/CometChatSuggestionList/Skeleton.tsx +185 -0
- package/src/shared/views/CometChatSuggestionList/SuggestionItem.ts +44 -46
- package/src/shared/views/CometChatSuggestionList/index.ts +3 -7
- package/src/shared/views/CometChatSuggestionList/style.ts +69 -0
- package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +46 -101
- package/src/shared/views/CometChatTextBubble/index.ts +8 -7
- package/src/shared/views/CometChatTooltipMenu/CometChatTooltipMenu.tsx +166 -0
- package/src/shared/views/CometChatTooltipMenu/index.ts +3 -0
- package/src/shared/views/CometChatTooltipMenu/styles.ts +24 -0
- package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +155 -195
- package/src/shared/views/CometChatVideoBubble/index.ts +7 -9
- package/src/shared/views/CometChatVideoBubble/resources/index.ts +2 -7
- package/src/shared/views/CometChatVideoBubble/style.ts +101 -5
- package/src/shared/views/CometChatVideoPlayer/CometChatVideoPlayer.tsx +135 -90
- package/src/shared/views/CometChatVideoPlayer/index.tsx +1 -1
- package/src/shared/views/ErrorEmptyView/ErrorEmptyView.tsx +47 -0
- package/src/shared/views/index.ts +72 -214
- package/src/theme/CometChatThemeHelper.ts +427 -0
- package/src/theme/context.ts +20 -0
- package/src/theme/default/color/dark.ts +99 -0
- package/src/theme/default/color/light.ts +105 -0
- package/src/theme/default/index.ts +242 -0
- package/src/theme/default/resources/icons/Base_Icon.png +0 -0
- package/src/theme/default/resources/icons/collaborative_document_1x.png +0 -0
- package/src/theme/default/resources/icons/collaborative_document_2x.png +0 -0
- package/src/theme/default/resources/icons/collaborative_document_3x.png +0 -0
- package/src/theme/default/resources/icons/collaborative_whiteboard_1x.png +0 -0
- package/src/theme/default/resources/icons/collaborative_whiteboard_2x.png +0 -0
- package/src/theme/default/resources/icons/collaborative_whiteboard_3x.png +0 -0
- package/src/theme/default/resources/icons/dark_error_icon.png +0 -0
- package/src/theme/default/resources/icons/index.ts +19 -0
- package/src/theme/default/resources/icons/light_error_icon.png +0 -0
- package/src/theme/default/resources/icons/thread_replies.png +0 -0
- package/src/theme/default/spacing.ts +86 -0
- package/src/theme/default/typography.ts +184 -0
- package/src/theme/hook.ts +19 -0
- package/src/theme/index.ts +3 -0
- package/src/theme/provider.tsx +135 -0
- package/src/theme/type.ts +446 -0
- package/screenshots/logo.png +0 -0
- package/src/AI/AIAssistBot/AIAssistBotDecorator.tsx +0 -166
- package/src/AI/AIAssistBot/AIAssistBotExtension.tsx +0 -22
- package/src/AI/AIAssistBot/AIAssistBotStyle.ts +0 -43
- package/src/AI/AIAssistBot/AIAssistBotView.tsx +0 -297
- package/src/AI/AIAssistBot/configuration.ts +0 -23
- package/src/AI/AIAssistBot/resources/CloseIcon.png +0 -0
- package/src/AI/AIAssistBot/resources/index.ts +0 -6
- package/src/AI/AIBaseConfiguration.ts +0 -15
- package/src/AI/AIBaseStyle.ts +0 -58
- package/src/AI/AIConversationStarter/AIConversationStarter.ts +0 -19
- package/src/AI/AIConversationStarter/AIConversationStarterDecorator.tsx +0 -249
- package/src/AI/AIConversationStarter/AIConversationStarterStyle.ts +0 -14
- package/src/AI/AIConversationStarter/configuration.ts +0 -11
- package/src/AI/AIConversationStarter/style.ts +0 -74
- package/src/AI/AIConversationSummary/AIConversationSummaryDecorator.tsx +0 -179
- package/src/AI/AIConversationSummary/AIConversationSummaryExtension.ts +0 -21
- package/src/AI/AIConversationSummary/AIConversationSummaryStyle.tsx +0 -20
- package/src/AI/AIConversationSummary/AIConversationSummaryView.tsx +0 -195
- package/src/AI/AIConversationSummary/configuration.ts +0 -14
- package/src/AI/AIConversationSummary/resources/index.ts +0 -6
- package/src/AI/AIExtensionDataSource.ts +0 -18
- package/src/AI/AIOptionsStyle.ts +0 -14
- package/src/AI/AISmartReplies/AISmartReplies.ts +0 -19
- package/src/AI/AISmartReplies/AISmartRepliesDecorator.tsx +0 -306
- package/src/AI/AISmartReplies/AISmartRepliesStyle.ts +0 -16
- package/src/AI/AISmartReplies/configuration.ts +0 -12
- package/src/AI/CardView.tsx +0 -83
- package/src/AI/CardViewStyle.ts +0 -37
- package/src/AI/resources/ai-empty.png +0 -0
- package/src/AI/resources/ai-error.png +0 -0
- package/src/AI/resources/index.ts +0 -12
- package/src/AI/resources/spineer.png +0 -0
- package/src/AI/style.ts +0 -165
- package/src/AI/utils.ts +0 -39
- package/src/CometChatAddMembers/AddMembersConfiguration.tsx +0 -58
- package/src/CometChatAddMembers/CometChatAddMembers.tsx +0 -114
- package/src/CometChatAddMembers/index.ts +0 -10
- package/src/CometChatBannedMembers/BannedMembersConfiguration.tsx +0 -61
- package/src/CometChatBannedMembers/CometChatBannedMembers.tsx +0 -148
- package/src/CometChatBannedMembers/index.ts +0 -13
- package/src/CometChatBannedMembers/resources/clear.png +0 -0
- package/src/CometChatBannedMembers/resources/index.ts +0 -4
- package/src/CometChatContacts/CometChatContacts.tsx +0 -229
- package/src/CometChatContacts/ContactsConfiguration.tsx +0 -69
- package/src/CometChatContacts/ContactsStyle.ts +0 -60
- package/src/CometChatContacts/Header.tsx +0 -167
- package/src/CometChatContacts/index.ts +0 -13
- package/src/CometChatContacts/styles.ts +0 -105
- package/src/CometChatConversations/ConversationsConfiguration.ts +0 -226
- package/src/CometChatConversations/ConversationsStyle.ts +0 -88
- package/src/CometChatConversationsWithMessages/CometChatConversationsWithMessages.tsx +0 -232
- package/src/CometChatConversationsWithMessages/index.ts +0 -6
- package/src/CometChatConversationsWithMessages/resources/index.ts +0 -6
- package/src/CometChatConversationsWithMessages/resources/start.png +0 -0
- package/src/CometChatConversationsWithMessages/styles.ts +0 -15
- package/src/CometChatCreateGroup/CometChatCreateGroup.tsx +0 -382
- package/src/CometChatCreateGroup/CreateGroupConfiguration.ts +0 -36
- package/src/CometChatCreateGroup/Header.tsx +0 -60
- package/src/CometChatCreateGroup/index.ts +0 -15
- package/src/CometChatCreateGroup/resources/close.png +0 -0
- package/src/CometChatCreateGroup/resources/index.ts +0 -11
- package/src/CometChatCreateGroup/resources/rightTick.png +0 -0
- package/src/CometChatCreateGroup/resources/warning.png +0 -0
- package/src/CometChatCreateGroup/style.ts +0 -44
- package/src/CometChatDetails/CometChatDetails.tsx +0 -983
- package/src/CometChatDetails/DetailsConfiguration.tsx +0 -72
- package/src/CometChatDetails/Header.tsx +0 -42
- package/src/CometChatDetails/index.ts +0 -19
- package/src/CometChatDetails/listners.ts +0 -109
- package/src/CometChatDetails/resources/close.png +0 -0
- package/src/CometChatDetails/resources/index.ts +0 -17
- package/src/CometChatDetails/styles.ts +0 -23
- package/src/CometChatGroupMembers/GroupMemberConfiguration.ts +0 -118
- package/src/CometChatGroupMembers/GroupMemberStyle.ts +0 -91
- package/src/CometChatGroupMembers/GroupScopeStyle.ts +0 -68
- package/src/CometChatGroups/GroupsConfiguration.ts +0 -93
- package/src/CometChatGroupsWithMessages/CometChatGroupsWithMessages.tsx +0 -234
- package/src/CometChatGroupsWithMessages/index.ts +0 -6
- package/src/CometChatGroupsWithMessages/resources/index.ts +0 -5
- package/src/CometChatGroupsWithMessages/resources/write.png +0 -0
- package/src/CometChatGroupsWithMessages/styles.ts +0 -15
- package/src/CometChatJoinProtectedGroup/CometChatJoinProtectedGroup.tsx +0 -268
- package/src/CometChatJoinProtectedGroup/Header.tsx +0 -52
- package/src/CometChatJoinProtectedGroup/JoinProtectedGroupConfiguration.ts +0 -30
- package/src/CometChatJoinProtectedGroup/index.ts +0 -15
- package/src/CometChatJoinProtectedGroup/resources/close.png +0 -0
- package/src/CometChatJoinProtectedGroup/resources/index.ts +0 -8
- package/src/CometChatJoinProtectedGroup/resources/rightTick.png +0 -0
- package/src/CometChatJoinProtectedGroup/style.ts +0 -11
- package/src/CometChatMessageComposer/MessageComposerConfiguration.tsx +0 -96
- package/src/CometChatMessageComposer/styles.ts +0 -28
- package/src/CometChatMessageHeader/MessageHeaderConfiguration.tsx +0 -62
- package/src/CometChatMessageHeader/resources/Back.png +0 -0
- package/src/CometChatMessageHeader/resources/index.ts +0 -11
- package/src/CometChatMessageHeader/resources/password.png +0 -0
- package/src/CometChatMessageHeader/resources/private.png +0 -0
- package/src/CometChatMessageInformation/MessageInformationConfiguration.tsx +0 -32
- package/src/CometChatMessageInformation/MessageInformationStyle.ts +0 -12
- package/src/CometChatMessageList/MessageListConfiguration.ts +0 -250
- package/src/CometChatMessageList/MessageListStyle.ts +0 -75
- package/src/CometChatMessages/CometChatMessages.tsx +0 -347
- package/src/CometChatMessages/MessageStyle.ts +0 -34
- package/src/CometChatMessages/MessagesConfiguration.ts +0 -55
- package/src/CometChatMessages/index.ts +0 -16
- package/src/CometChatMessages/resources/index.ts +0 -6
- package/src/CometChatMessages/resources/info.png +0 -0
- package/src/CometChatMessages/style.ts +0 -23
- package/src/CometChatTabs/CometChatTabs.tsx +0 -178
- package/src/CometChatTabs/CometChatTabsStyle.ts +0 -45
- package/src/CometChatTabs/TabItemStyle.ts +0 -55
- package/src/CometChatTabs/TabItems.ts +0 -11
- package/src/CometChatTabs/index.ts +0 -6
- package/src/CometChatThreadedMessages/CometChatThreadedMessages.tsx +0 -345
- package/src/CometChatThreadedMessages/Header.tsx +0 -57
- package/src/CometChatThreadedMessages/ThreadedMessagesConfiguration.ts +0 -45
- package/src/CometChatThreadedMessages/index.ts +0 -15
- package/src/CometChatThreadedMessages/resources/Back.png +0 -0
- package/src/CometChatThreadedMessages/resources/close.png +0 -0
- package/src/CometChatThreadedMessages/resources/index.ts +0 -20
- package/src/CometChatThreadedMessages/resources/password.png +0 -0
- package/src/CometChatThreadedMessages/resources/private.png +0 -0
- package/src/CometChatThreadedMessages/resources/right-arrow.png +0 -0
- package/src/CometChatThreadedMessages/style.ts +0 -29
- package/src/CometChatTransferOwnership/CometChatTransferOwnership.tsx +0 -145
- package/src/CometChatTransferOwnership/TransferOwnershipConfiguration.ts +0 -60
- package/src/CometChatTransferOwnership/index.ts +0 -14
- package/src/CometChatUsers/UsersConfiguration.tsx +0 -59
- package/src/CometChatUsers/UsersStyle.ts +0 -101
- package/src/CometChatUsersWithMessages/CometChatUsersWithMessages.tsx +0 -130
- package/src/CometChatUsersWithMessages/index.ts +0 -6
- package/src/CometChatUsersWithMessages/styles.ts +0 -15
- package/src/calls/CallingDetailsUtils.tsx +0 -158
- package/src/calls/CallingExtentionDecorator.tsx +0 -222
- package/src/calls/CometChatCallBubble/CallBubbleConfiguration.ts +0 -23
- package/src/calls/CometChatCallBubble/CallBubbleStyle.ts +0 -47
- package/src/calls/CometChatCallButtons/CallButtonStyle.ts +0 -35
- package/src/calls/CometChatCallButtons/resources/Call.png +0 -0
- package/src/calls/CometChatCallButtons/resources/Video.png +0 -0
- package/src/calls/CometChatCallButtons/resources/index.ts +0 -9
- package/src/calls/CometChatCallLogDetails/CallLogDetailsConfiguration.ts +0 -118
- package/src/calls/CometChatCallLogDetails/CallLogDetailsStyle.ts +0 -36
- package/src/calls/CometChatCallLogDetails/CometChatCallLogDetails.tsx +0 -309
- package/src/calls/CometChatCallLogDetails/index.ts +0 -23
- package/src/calls/CometChatCallLogDetails/resources/CloseIcon.png +0 -0
- package/src/calls/CometChatCallLogDetails/resources/index.ts +0 -5
- package/src/calls/CometChatCallLogDetails/style.ts +0 -15
- package/src/calls/CometChatCallLogHistory/CallLogHistoryConfiguration.ts +0 -67
- package/src/calls/CometChatCallLogHistory/CallLogHistoryStyle.ts +0 -46
- package/src/calls/CometChatCallLogHistory/CometChatCallLogHistory.tsx +0 -350
- package/src/calls/CometChatCallLogHistory/index.ts +0 -23
- package/src/calls/CometChatCallLogHistory/resources/Back.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/Call.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/Info.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/Selection.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/Spineer.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/Video.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/check.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/incomingcall.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/incomingvideo.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/index.ts +0 -42
- package/src/calls/CometChatCallLogHistory/resources/missedcall.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/missedvideo.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/outgoingcall.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/outgoingvideo.png +0 -0
- package/src/calls/CometChatCallLogHistory/style.ts +0 -24
- package/src/calls/CometChatCallLogParticipants/CallLogParticipantsConfiguration.ts +0 -63
- package/src/calls/CometChatCallLogParticipants/CallLogParticipantsStyle.ts +0 -59
- package/src/calls/CometChatCallLogParticipants/CometChatCallLogParticipants.tsx +0 -221
- package/src/calls/CometChatCallLogParticipants/index.ts +0 -23
- package/src/calls/CometChatCallLogParticipants/resources/Back.png +0 -0
- package/src/calls/CometChatCallLogParticipants/resources/index.ts +0 -5
- package/src/calls/CometChatCallLogParticipants/style.ts +0 -24
- package/src/calls/CometChatCallLogRecordings/CallLogRecordingsConfiguration.ts +0 -65
- package/src/calls/CometChatCallLogRecordings/CallLogRecordingsStyle.ts +0 -63
- package/src/calls/CometChatCallLogRecordings/CometChatCallLogRecordings.tsx +0 -254
- package/src/calls/CometChatCallLogRecordings/index.ts +0 -23
- package/src/calls/CometChatCallLogRecordings/resources/Back.png +0 -0
- package/src/calls/CometChatCallLogRecordings/resources/download.png +0 -0
- package/src/calls/CometChatCallLogRecordings/resources/index.ts +0 -8
- package/src/calls/CometChatCallLogRecordings/style.ts +0 -24
- package/src/calls/CometChatCallLogs/CallLogsConfiguration.ts +0 -89
- package/src/calls/CometChatCallLogs/CallLogsStyle.ts +0 -95
- package/src/calls/CometChatCallLogsWithDetails/CallLogsWithDetailsConfiguration.ts +0 -10
- package/src/calls/CometChatCallLogsWithDetails/CometChatCallLogsWithDetails.tsx +0 -56
- package/src/calls/CometChatCallLogsWithDetails/index.ts +0 -5
- package/src/calls/CometChatCallLogsWithDetails/style.ts +0 -11
- package/src/calls/CometChatIncomingCall/IncomingCallStyle.ts +0 -75
- package/src/calls/CometChatIncomingCall/styles.ts +0 -10
- package/src/calls/CometChatOngoingCall/OngoingCallStyle.ts +0 -25
- package/src/calls/CometChatOutgoingCall/OutgoingCallStyle.ts +0 -39
- package/src/extensions/CollaborativeBubble/CollaborativeBubbleStyle.ts +0 -97
- package/src/extensions/CollaborativeBubble/styles.ts +0 -82
- package/src/extensions/CollaborativeDocument/CollaborativeDocumentConfiguration.tsx +0 -26
- package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardConfiguration.tsx +0 -26
- package/src/extensions/ImageModeration/ImageModerationDecorator.tsx +0 -82
- package/src/extensions/ImageModeration/ImageModerationExtension.tsx +0 -43
- package/src/extensions/ImageModeration/ImageModerationFilter.tsx +0 -145
- package/src/extensions/ImageModeration/index.ts +0 -18
- package/src/extensions/ImageModeration/resources/index.ts +0 -4
- package/src/extensions/ImageModeration/resources/unsafe.png +0 -0
- package/src/extensions/LinkPreview/LInkPreviewBubbleStyle.ts +0 -28
- package/src/extensions/LinkPreview/LinkPreviewConfiguration.ts +0 -27
- package/src/extensions/LinkPreview/LinkPreviewExtention.tsx +0 -25
- package/src/extensions/LinkPreview/LinkPreviewExtentionDecorator.tsx +0 -55
- package/src/extensions/SmartReplies/SmartRepliesDecorator.tsx +0 -144
- package/src/extensions/SmartReplies/SmartRepliesExtension.tsx +0 -52
- package/src/extensions/SmartReplies/SmartRepliesView.tsx +0 -213
- package/src/extensions/SmartReplies/index.ts +0 -7
- package/src/extensions/SmartReplies/resources/close.png +0 -0
- package/src/extensions/SmartReplies/resources/index.ts +0 -6
- package/src/extensions/Stickers/CometChatStickerKeyboard/StickerKeyboardStyle.ts +0 -52
- package/src/extensions/Stickers/StickerStyle.ts +0 -15
- package/src/extensions/TextModeration/TextModerationConfiguration.tsx +0 -25
- package/src/extensions/TextModeration/TextModerationExtension.tsx +0 -51
- package/src/extensions/TextModeration/TextModerationExtensionDecorator.tsx +0 -93
- package/src/extensions/TextModeration/index.ts +0 -6
- package/src/shared/CometChatContext.tsx +0 -43
- package/src/shared/helper/SwipeRow.js +0 -944
- package/src/shared/libs/CometChatCalendar/Calendars/BaseCalendar.tsx +0 -229
- package/src/shared/libs/CometChatCalendar/Calendars/DateSelectionCalendar.tsx +0 -90
- package/src/shared/libs/CometChatCalendar/Calendars/MultiDateSelectionCalendar.tsx +0 -108
- package/src/shared/libs/CometChatCalendar/Calendars/Providers.tsx +0 -27
- package/src/shared/libs/CometChatCalendar/Calendars/index.ts +0 -3
- package/src/shared/libs/CometChatCalendar/Components/Arrow.tsx +0 -46
- package/src/shared/libs/CometChatCalendar/Components/Day.tsx +0 -95
- package/src/shared/libs/CometChatCalendar/Components/Days.tsx +0 -110
- package/src/shared/libs/CometChatCalendar/Components/Month.tsx +0 -47
- package/src/shared/libs/CometChatCalendar/Components/Months.tsx +0 -79
- package/src/shared/libs/CometChatCalendar/Components/Title.tsx +0 -47
- package/src/shared/libs/CometChatCalendar/Components/Weekdays.tsx +0 -29
- package/src/shared/libs/CometChatCalendar/Components/index.ts +0 -7
- package/src/shared/libs/CometChatCalendar/Constants/View.ts +0 -4
- package/src/shared/libs/CometChatCalendar/Constants/index.ts +0 -1
- package/src/shared/libs/CometChatCalendar/Contexts/LocaleContext.tsx +0 -7
- package/src/shared/libs/CometChatCalendar/Contexts/ThemeContext.tsx +0 -7
- package/src/shared/libs/CometChatCalendar/Contexts/index.ts +0 -2
- package/src/shared/libs/CometChatCalendar/Entities/ArrowDirections.ts +0 -1
- package/src/shared/libs/CometChatCalendar/Entities/Calendar.ts +0 -26
- package/src/shared/libs/CometChatCalendar/Entities/Components.ts +0 -13
- package/src/shared/libs/CometChatCalendar/Entities/DateProperties.ts +0 -6
- package/src/shared/libs/CometChatCalendar/Entities/Locale.ts +0 -12
- package/src/shared/libs/CometChatCalendar/Entities/Theme.ts +0 -70
- package/src/shared/libs/CometChatCalendar/Entities/index.ts +0 -6
- package/src/shared/libs/CometChatCalendar/Hooks/index.ts +0 -1
- package/src/shared/libs/CometChatCalendar/Hooks/useSurroundingTimeUnits.ts +0 -63
- package/src/shared/libs/CometChatCalendar/Icons/BackArrow.png +0 -0
- package/src/shared/libs/CometChatCalendar/Icons/chevron-left-16.png +0 -0
- package/src/shared/libs/CometChatCalendar/Icons/index.ts +0 -7
- package/src/shared/libs/CometChatCalendar/Locales/index.ts +0 -4
- package/src/shared/libs/CometChatCalendar/Themes/Colors.ts +0 -31
- package/src/shared/libs/CometChatCalendar/Themes/DarkTheme.ts +0 -79
- package/src/shared/libs/CometChatCalendar/Themes/DefaultTheme.ts +0 -164
- package/src/shared/libs/CometChatCalendar/Themes/index.ts +0 -3
- package/src/shared/libs/CometChatCalendar/Utils/addOpacity.ts +0 -15
- package/src/shared/libs/CometChatCalendar/Utils/checkChangedProps.ts +0 -10
- package/src/shared/libs/CometChatCalendar/Utils/clamp.ts +0 -5
- package/src/shared/libs/CometChatCalendar/Utils/dateRange.ts +0 -23
- package/src/shared/libs/CometChatCalendar/Utils/getExtraDays.ts +0 -25
- package/src/shared/libs/CometChatCalendar/Utils/getSurroundingTimeUnits.ts +0 -20
- package/src/shared/libs/CometChatCalendar/Utils/index.ts +0 -6
- package/src/shared/libs/CometChatCalendar/index.ts +0 -5
- package/src/shared/libs/VideoPlayer/Video.js +0 -494
- package/src/shared/libs/VideoPlayerControls/OSSupport/PlatformSupport.tsx +0 -43
- package/src/shared/libs/VideoPlayerControls/OSSupport/TVOSSupport.tsx +0 -17
- package/src/shared/libs/VideoPlayerControls/OSSupport/index.tsx +0 -1
- package/src/shared/libs/VideoPlayerControls/VideoPlayer.tsx +0 -512
- package/src/shared/libs/VideoPlayerControls/assets/img/back.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/bottom-vignette.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/bottom-vignette@2x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/bottom-vignette@3x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/error-icon.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/error-icon@2x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/error-icon@3x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/expand.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/expand@2x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/expand@3x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/forward.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/forward@2x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/forward@3x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/loader-icon.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/loader-icon@2x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/loader-icon@3x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/pause.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/pause@2x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/pause@3x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/play.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/play@2x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/play@3x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/rewind.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/rewind@2x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/rewind@3x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/shrink.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/shrink@2x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/shrink@3x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/top-vignette.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/top-vignette@2x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/top-vignette@3x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/volume.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/volume@2x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/volume@3x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/components/Back/Back.tsx +0 -28
- package/src/shared/libs/VideoPlayerControls/components/Back/index.ts +0 -1
- package/src/shared/libs/VideoPlayerControls/components/BottomControls.tsx +0 -142
- package/src/shared/libs/VideoPlayerControls/components/Control.tsx +0 -45
- package/src/shared/libs/VideoPlayerControls/components/Error/Error.tsx +0 -22
- package/src/shared/libs/VideoPlayerControls/components/Error/index.ts +0 -1
- package/src/shared/libs/VideoPlayerControls/components/Error/styles.ts +0 -21
- package/src/shared/libs/VideoPlayerControls/components/Fullscreen.tsx +0 -36
- package/src/shared/libs/VideoPlayerControls/components/Loader/Loader.tsx +0 -15
- package/src/shared/libs/VideoPlayerControls/components/Loader/index.ts +0 -1
- package/src/shared/libs/VideoPlayerControls/components/Loader/styles.ts +0 -16
- package/src/shared/libs/VideoPlayerControls/components/NullControl.tsx +0 -7
- package/src/shared/libs/VideoPlayerControls/components/Overlay.tsx +0 -23
- package/src/shared/libs/VideoPlayerControls/components/PlayPause/PlayPause.tsx +0 -109
- package/src/shared/libs/VideoPlayerControls/components/PlayPause/index.ts +0 -1
- package/src/shared/libs/VideoPlayerControls/components/PlayPause/styles.ts +0 -21
- package/src/shared/libs/VideoPlayerControls/components/Seekbar/Seekbar.tsx +0 -47
- package/src/shared/libs/VideoPlayerControls/components/Seekbar/index.ts +0 -1
- package/src/shared/libs/VideoPlayerControls/components/Seekbar/styles.ts +0 -37
- package/src/shared/libs/VideoPlayerControls/components/Timer/Timer.tsx +0 -28
- package/src/shared/libs/VideoPlayerControls/components/Timer/index.ts +0 -1
- package/src/shared/libs/VideoPlayerControls/components/Timer/styles.ts +0 -12
- package/src/shared/libs/VideoPlayerControls/components/Title.tsx +0 -35
- package/src/shared/libs/VideoPlayerControls/components/TopControls.tsx +0 -110
- package/src/shared/libs/VideoPlayerControls/components/Volume/Volume.tsx +0 -37
- package/src/shared/libs/VideoPlayerControls/components/Volume/index.ts +0 -1
- package/src/shared/libs/VideoPlayerControls/components/Volume/styles.ts +0 -31
- package/src/shared/libs/VideoPlayerControls/components/index.ts +0 -14
- package/src/shared/libs/VideoPlayerControls/components/styles.ts +0 -30
- package/src/shared/libs/VideoPlayerControls/hooks/index.ts +0 -3
- package/src/shared/libs/VideoPlayerControls/hooks/useAnimations.ts +0 -68
- package/src/shared/libs/VideoPlayerControls/hooks/useControlTimeout.tsx +0 -67
- package/src/shared/libs/VideoPlayerControls/hooks/usePanResponders.tsx +0 -96
- package/src/shared/libs/VideoPlayerControls/index.ts +0 -4
- package/src/shared/libs/VideoPlayerControls/styles.ts +0 -19
- package/src/shared/libs/VideoPlayerControls/types.ts +0 -290
- package/src/shared/libs/VideoPlayerControls/utils.ts +0 -76
- package/src/shared/libs/datePickerModal/DateTimePickerModal.android.js +0 -75
- package/src/shared/libs/datePickerModal/DateTimePickerModal.ios.js +0 -363
- package/src/shared/libs/datePickerModal/DateTimePickerModal.js +0 -9
- package/src/shared/libs/datePickerModal/Modal.js +0 -180
- package/src/shared/libs/datePickerModal/index.d.ts +0 -310
- package/src/shared/libs/datePickerModal/index.js +0 -5
- package/src/shared/libs/datePickerModal/utils.js +0 -25
- package/src/shared/libs/luxon/src/datetime.js +0 -2422
- package/src/shared/libs/luxon/src/duration.js +0 -990
- package/src/shared/libs/luxon/src/errors.js +0 -61
- package/src/shared/libs/luxon/src/impl/conversions.js +0 -206
- package/src/shared/libs/luxon/src/impl/diff.js +0 -95
- package/src/shared/libs/luxon/src/impl/digits.js +0 -75
- package/src/shared/libs/luxon/src/impl/english.js +0 -233
- package/src/shared/libs/luxon/src/impl/formats.js +0 -176
- package/src/shared/libs/luxon/src/impl/formatter.js +0 -409
- package/src/shared/libs/luxon/src/impl/invalid.js +0 -14
- package/src/shared/libs/luxon/src/impl/locale.js +0 -542
- package/src/shared/libs/luxon/src/impl/regexParser.js +0 -335
- package/src/shared/libs/luxon/src/impl/tokenParser.js +0 -473
- package/src/shared/libs/luxon/src/impl/util.js +0 -309
- package/src/shared/libs/luxon/src/impl/zoneUtil.js +0 -30
- package/src/shared/libs/luxon/src/info.js +0 -205
- package/src/shared/libs/luxon/src/interval.js +0 -657
- package/src/shared/libs/luxon/src/luxon.js +0 -26
- package/src/shared/libs/luxon/src/package.json +0 -4
- package/src/shared/libs/luxon/src/settings.js +0 -175
- package/src/shared/libs/luxon/src/zone.js +0 -91
- package/src/shared/libs/luxon/src/zones/IANAZone.js +0 -189
- package/src/shared/libs/luxon/src/zones/fixedOffsetZone.js +0 -102
- package/src/shared/libs/luxon/src/zones/invalidZone.js +0 -53
- package/src/shared/libs/luxon/src/zones/systemZone.js +0 -61
- package/src/shared/modals/CometChatCallLogDetailsOptions.ts +0 -23
- package/src/shared/modals/CometChatCallLogDetailsTemplate.ts +0 -16
- package/src/shared/modals/CometChatDetailsOption.ts +0 -24
- package/src/shared/modals/CometChatDetailsTemplate.ts +0 -16
- package/src/shared/modals/CometChatOptions.ts +0 -13
- package/src/shared/modals/InteractiveData/InteractiveActions/APIAction.ts +0 -118
- package/src/shared/modals/InteractiveData/InteractiveActions/CustomAction.ts +0 -19
- package/src/shared/modals/InteractiveData/InteractiveActions/URLNavigationAction.ts +0 -34
- package/src/shared/modals/InteractiveData/InteractiveActions/index.ts +0 -3
- package/src/shared/modals/InteractiveData/InteractiveData/InteractiveCardData.ts +0 -69
- package/src/shared/modals/InteractiveData/InteractiveData/InteractiveFormData.ts +0 -119
- package/src/shared/modals/InteractiveData/InteractiveData/index.ts +0 -2
- package/src/shared/modals/InteractiveData/InteractiveElements/BaseInputElement.ts +0 -102
- package/src/shared/modals/InteractiveData/InteractiveElements/BaseInteractiveElement.ts +0 -45
- package/src/shared/modals/InteractiveData/InteractiveElements/ButtonElement.ts +0 -61
- package/src/shared/modals/InteractiveData/InteractiveElements/CheckboxElement.ts +0 -75
- package/src/shared/modals/InteractiveData/InteractiveElements/DateTimeElement.ts +0 -103
- package/src/shared/modals/InteractiveData/InteractiveElements/DropdownElement.ts +0 -83
- package/src/shared/modals/InteractiveData/InteractiveElements/LabelElement.ts +0 -32
- package/src/shared/modals/InteractiveData/InteractiveElements/OptionElement.ts +0 -39
- package/src/shared/modals/InteractiveData/InteractiveElements/RadioButtonElement.ts +0 -76
- package/src/shared/modals/InteractiveData/InteractiveElements/SingleSelectElement.ts +0 -76
- package/src/shared/modals/InteractiveData/InteractiveElements/TextInputElement.ts +0 -101
- package/src/shared/modals/InteractiveData/InteractiveElements/index.ts +0 -11
- package/src/shared/modals/InteractiveData/InteractiveEntities/ActionEntity.ts +0 -41
- package/src/shared/modals/InteractiveData/InteractiveEntities/ElementEntity.ts +0 -66
- package/src/shared/modals/InteractiveData/InteractiveEntities/index.ts +0 -2
- package/src/shared/modals/InteractiveData/InteractiveMessage/CardMessage.ts +0 -143
- package/src/shared/modals/InteractiveData/InteractiveMessage/CustomInteractiveMessage.ts +0 -39
- package/src/shared/modals/InteractiveData/InteractiveMessage/FormMessage.ts +0 -153
- package/src/shared/modals/InteractiveData/InteractiveMessage/SchedulerMessage.ts +0 -150
- package/src/shared/modals/InteractiveData/InteractiveMessage/index.ts +0 -4
- package/src/shared/modals/InteractiveData/index.ts +0 -30
- package/src/shared/resources/CometChatTheme/CometChatTheme.ts +0 -28
- package/src/shared/resources/CometChatTheme/Palette.ts +0 -584
- package/src/shared/resources/CometChatTheme/Typography.ts +0 -396
- package/src/shared/resources/CometChatTheme/index.ts +0 -2
- package/src/shared/utils/CometChatLiveReactions/CometChatLiveReaction.tsx +0 -124
- package/src/shared/utils/CometChatLiveReactions/LiveReactionstyles.ts +0 -37
- package/src/shared/utils/CometChatLiveReactions/index.ts +0 -1
- package/src/shared/utils/CometChatLiveReactions/resources/heart.png +0 -0
- package/src/shared/utils/CometChatLiveReactions/resources/index.ts +0 -5
- package/src/shared/utils/CometChatLiveReactions/style.ts +0 -8
- package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.js +0 -109
- package/src/shared/utils/CometChatMessagePreview/MessagePreviewConfiguration.js +0 -30
- package/src/shared/utils/CometChatMessagePreview/style.js +0 -71
- package/src/shared/utils/DetailsUtils/DetailsUtils.tsx +0 -399
- package/src/shared/utils/DetailsUtils/resources/Back.png +0 -0
- package/src/shared/utils/DetailsUtils/resources/banIcon.png +0 -0
- package/src/shared/utils/DetailsUtils/resources/close.png +0 -0
- package/src/shared/utils/DetailsUtils/resources/index.ts +0 -23
- package/src/shared/utils/DetailsUtils/resources/kickIcon.png +0 -0
- package/src/shared/utils/DetailsUtils/resources/password.png +0 -0
- package/src/shared/utils/DetailsUtils/resources/private.png +0 -0
- package/src/shared/utils/DetailsUtils/resources/right-arrow.png +0 -0
- package/src/shared/utils/InteractiveMessageUtils.ts +0 -60
- package/src/shared/utils/SchedulerUtils.ts +0 -198
- package/src/shared/utils/TypeUtils.ts +0 -3
- package/src/shared/views/CometChatActionSheet/ActionSheetStyle.ts +0 -61
- package/src/shared/views/CometChatAudioBubble/AudioBubbleStyle.ts +0 -43
- package/src/shared/views/CometChatAvatar/AvatarConfiguration.ts +0 -27
- package/src/shared/views/CometChatAvatar/AvatarStyle.ts +0 -57
- package/src/shared/views/CometChatAvatar/resources/default.jpg +0 -0
- package/src/shared/views/CometChatAvatar/resources/index.ts +0 -5
- package/src/shared/views/CometChatBadge/BadgeConfiguration.ts +0 -55
- package/src/shared/views/CometChatBadge/BadgeStyle.ts +0 -39
- package/src/shared/views/CometChatBottomSheet/style.ts +0 -50
- package/src/shared/views/CometChatButton/CometChatButton.tsx +0 -76
- package/src/shared/views/CometChatButton/CometChatButtonStyle.ts +0 -47
- package/src/shared/views/CometChatButton/index.ts +0 -5
- package/src/shared/views/CometChatButton/style.ts +0 -8
- package/src/shared/views/CometChatCard/CometChatCard.tsx +0 -77
- package/src/shared/views/CometChatCard/CometChatCardStyle.ts +0 -31
- package/src/shared/views/CometChatCard/index.ts +0 -8
- package/src/shared/views/CometChatCard/style.ts +0 -13
- package/src/shared/views/CometChatCardBubble/CardBubbleStyle.tsx +0 -47
- package/src/shared/views/CometChatCardBubble/CometChatCardBubble.tsx +0 -174
- package/src/shared/views/CometChatCardBubble/index.tsx +0 -2
- package/src/shared/views/CometChatCheckBox/CheckBoxStyle.tsx +0 -43
- package/src/shared/views/CometChatCheckBox/CometChatCheckBox.tsx +0 -79
- package/src/shared/views/CometChatConfirmDialog/CometChatConfirmDialogStyle.ts +0 -36
- package/src/shared/views/CometChatDate/DateConfiguration.ts +0 -32
- package/src/shared/views/CometChatDate/DateStyle.ts +0 -26
- package/src/shared/views/CometChatDate/style.ts +0 -8
- package/src/shared/views/CometChatDateTimePicker/CometChatDateTimePicker.tsx +0 -206
- package/src/shared/views/CometChatDateTimePicker/DateTimePickerStyle.ts +0 -19
- package/src/shared/views/CometChatDateTimePicker/index.ts +0 -3
- package/src/shared/views/CometChatDropDown/CometChatDropDown.tsx +0 -127
- package/src/shared/views/CometChatDropDown/DropDownStyle.tsx +0 -39
- package/src/shared/views/CometChatDropDown/resources/downArrowIcon.png +0 -0
- package/src/shared/views/CometChatDropDown/resources/index.js +0 -5
- package/src/shared/views/CometChatEmojiKeyboard/EmojiKeyboardConfiguration.ts +0 -27
- package/src/shared/views/CometChatEmojiKeyboard/EmojiKeyboardStyle.ts +0 -44
- package/src/shared/views/CometChatFileBubble/FileBubbleStyle.ts +0 -58
- package/src/shared/views/CometChatFormBubble/CometChatFormBubble.tsx +0 -542
- package/src/shared/views/CometChatFormBubble/FormBubbleStyle.tsx +0 -96
- package/src/shared/views/CometChatFormBubble/index.tsx +0 -2
- package/src/shared/views/CometChatImageBubble/ImageBubbleStyle.ts +0 -34
- package/src/shared/views/CometChatImageBubble/assets/default_image.png +0 -0
- package/src/shared/views/CometChatLabel/CometChatLabel.tsx +0 -27
- package/src/shared/views/CometChatLabel/LabelStyle.ts +0 -19
- package/src/shared/views/CometChatList/resources/Back.png +0 -0
- package/src/shared/views/CometChatList/resources/Search.png +0 -0
- package/src/shared/views/CometChatListItem/ListItemConfiguration.tsx +0 -21
- package/src/shared/views/CometChatListItem/ListItemStyle.ts +0 -47
- package/src/shared/views/CometChatMediaRecorder/MediaRecorderStyle.ts +0 -63
- package/src/shared/views/CometChatMessageBubble/MessageBubbleStyle.ts +0 -26
- package/src/shared/views/CometChatQuickReactions/QuickReactionsConfiguration.tsx +0 -13
- package/src/shared/views/CometChatQuickView/CometChatQuickView.tsx +0 -66
- package/src/shared/views/CometChatQuickView/QuickViewStyle.ts +0 -55
- package/src/shared/views/CometChatRadioButton/CometChatRadioButton.tsx +0 -67
- package/src/shared/views/CometChatRadioButton/RadioButtonStyle.tsx +0 -38
- package/src/shared/views/CometChatReactionList/ReactionListConfiguration.tsx +0 -15
- package/src/shared/views/CometChatReactions/ReactionsConfiguration.tsx +0 -13
- package/src/shared/views/CometChatReactions/ReactionsStyle.tsx +0 -43
- package/src/shared/views/CometChatReceipt/MessageConfiguration.ts +0 -65
- package/src/shared/views/CometChatReceipt/ReceiptStyle.ts +0 -3
- package/src/shared/views/CometChatSchedulerBubble/CometChatSchedulerBubble.tsx +0 -1519
- package/src/shared/views/CometChatSchedulerBubble/index.ts +0 -3
- package/src/shared/views/CometChatSchedulerBubble/styles.ts +0 -92
- package/src/shared/views/CometChatSingleSelect/CometChatSingleSelect.tsx +0 -63
- package/src/shared/views/CometChatSingleSelect/SingleStyle.tsx +0 -35
- package/src/shared/views/CometChatStatusIndicator/StatusIndicatorConfiguration.ts +0 -25
- package/src/shared/views/CometChatStatusIndicator/StatusIndicatorStyle.ts +0 -37
- package/src/shared/views/CometChatSuggestionList/SuggestionListConfiguration.ts +0 -23
- package/src/shared/views/CometChatTextBubble/TextBubbleStyle.ts +0 -37
- package/src/shared/views/CometChatTextInput/CometChatTextInput.tsx +0 -67
- package/src/shared/views/CometChatTextInput/TextInputStyle.tsx +0 -26
- package/src/shared/views/CometChatTimeSlotSelector/CometChatTimeSlotSelector.tsx +0 -113
- package/src/shared/views/CometChatTimeSlotSelector/index.ts +0 -3
- package/src/shared/views/CometChatTimeSlotSelector/styles.ts +0 -30
- package/src/shared/views/CometChatVideoBubble/VideoBubbleStyle.ts +0 -87
- package/src/shared/views/SwipeRow/SwipeRow.tsx +0 -126
- package/src/shared/views/SwipeRow/index.ts +0 -3
- package/src/shared/views/SwipeRow/style.ts +0 -30
- /package/src/{shared/assets/images → CometChatGroups/resources}/search.png +0 -0
- /package/src/{CometChatDetails → CometChatThreadHeader}/resources/Back.png +0 -0
- /package/src/{AI/AIConversationSummary → CometChatThreadHeader}/resources/close.png +0 -0
- /package/src/{CometChatThreadedMessages → CometChatThreadHeader}/resources/more.png +0 -0
- /package/src/{CometChatDetails → CometChatThreadHeader}/resources/password.png +0 -0
- /package/src/{CometChatDetails → CometChatThreadHeader}/resources/private.png +0 -0
- /package/src/{CometChatDetails → CometChatThreadHeader}/resources/right-arrow.png +0 -0
|
@@ -1,1395 +1,1508 @@
|
|
|
1
|
-
import React, { useContext } from "react";
|
|
2
|
-
import { View, Text, TextStyle, ViewProps } from "react-native";
|
|
3
|
-
//@ts-ignore
|
|
4
1
|
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
2
|
+
import React, { useCallback, useMemo } from "react";
|
|
3
|
+
import { GestureResponderEvent, ListRenderItem, Text, View } from "react-native";
|
|
5
4
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
5
|
+
ChatConfigurator,
|
|
6
|
+
CometChatConversationEvents,
|
|
7
|
+
CometChatConversationUtils,
|
|
8
|
+
CometChatList,
|
|
9
|
+
CometChatListActionsInterface,
|
|
10
|
+
CometChatListItem,
|
|
11
|
+
CometChatMentionsFormatter,
|
|
12
|
+
CometChatSoundManager,
|
|
13
|
+
CometChatTextFormatter,
|
|
14
|
+
CometChatUIKit,
|
|
15
|
+
CometChatUiKitConstants,
|
|
16
|
+
CometChatUrlsFormatter,
|
|
17
|
+
localize,
|
|
19
18
|
} from "../shared";
|
|
20
|
-
import {
|
|
19
|
+
import { SelectionMode } from "../shared/base/Types";
|
|
21
20
|
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
import { AvatarStyle, BadgeStyle, CometChatBadge, CometChatDate, CometChatListItem, CometChatReceipt, DateStyle, StatusIndicatorStyle } from "../shared";
|
|
31
|
-
import { ListItemStyle, ListItemStyleInterface } from "../shared";
|
|
32
|
-
import { CometChatContextType, MessageReceipt, SelectionMode } from "../shared/base/Types";
|
|
33
|
-
import { CometChatSoundManager } from "../shared"
|
|
34
|
-
import { CometChatConversationUtils } from "../shared";
|
|
35
|
-
import { CometChatList } from "../shared";
|
|
36
|
-
import { CometChatOptions } from "../shared";
|
|
21
|
+
ConversationTypeConstants,
|
|
22
|
+
GroupTypeConstants,
|
|
23
|
+
MentionsTargetElement,
|
|
24
|
+
MessageCategoryConstants,
|
|
25
|
+
MessageReceipt,
|
|
26
|
+
MessageStatusConstants,
|
|
27
|
+
ReceiverTypeConstants,
|
|
28
|
+
} from "../shared/constants/UIKitConstants";
|
|
37
29
|
import { CometChatUIEventHandler } from "../shared/events/CometChatUIEventHandler/CometChatUIEventHandler";
|
|
38
|
-
import {
|
|
39
|
-
import { DateStyleInterface } from "../shared/views/CometChatDate/DateStyle";
|
|
40
|
-
import { BadgeStyleInterface } from "../shared/views/CometChatBadge";
|
|
41
|
-
import { InteractiveMessageUtils } from "../shared/utils/InteractiveMessageUtils";
|
|
30
|
+
import { Icon } from "../shared/icons/Icon";
|
|
42
31
|
import { CommonUtils } from "../shared/utils/CommonUtils";
|
|
43
|
-
|
|
32
|
+
import { getMessagePreviewInternal } from "../shared/utils/MessageUtils";
|
|
33
|
+
import { CometChatBadge } from "../shared/views/CometChatBadge";
|
|
34
|
+
import { CometChatConfirmDialog } from "../shared/views/CometChatConfirmDialog";
|
|
35
|
+
import { CometChatDate } from "../shared/views/CometChatDate";
|
|
36
|
+
import { CometChatReceipt } from "../shared/views/CometChatReceipt";
|
|
37
|
+
import { TooltipMenu } from "../shared/views/CometChatTooltipMenu";
|
|
38
|
+
import { ErrorEmptyView } from "../shared/views/ErrorEmptyView/ErrorEmptyView";
|
|
39
|
+
import { useTheme } from "../theme";
|
|
40
|
+
import { Skeleton } from "./Skeleton";
|
|
41
|
+
import { ConversationStyle, Style } from "./style";
|
|
42
|
+
import { deepMerge } from "../shared/helper/helperFunctions";
|
|
43
|
+
import Delete from "../shared/icons/components/delete";
|
|
44
|
+
import { DeepPartial } from "../shared/helper/types";
|
|
45
|
+
import { CometChatTheme } from "../theme/type";
|
|
46
|
+
|
|
47
|
+
// Unique listener IDs for conversation, user, group, message and call events.
|
|
44
48
|
const conversationListenerId = "chatlist_" + new Date().getTime();
|
|
45
49
|
const userListenerId = "chatlist_user_" + new Date().getTime();
|
|
46
50
|
const groupListenerId = "chatlist_group_" + new Date().getTime();
|
|
47
51
|
const messageListenerId = "chatlist_message_" + new Date().getTime();
|
|
48
52
|
const callListenerId = "call_" + new Date().getTime();
|
|
49
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Interface defining props for the CometChatConversations component.
|
|
56
|
+
*/
|
|
50
57
|
export interface ConversationInterface {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Custom functional component for error state.
|
|
161
|
-
*/
|
|
162
|
-
ErrorStateView?: () => JSX.Element,
|
|
163
|
-
/**
|
|
164
|
-
* Custom functional component for loading state.
|
|
165
|
-
*/
|
|
166
|
-
LoadingStateView?: () => JSX.Element,
|
|
167
|
-
/**
|
|
168
|
-
* Request builder to fetch conversations.
|
|
169
|
-
*/
|
|
170
|
-
conversationsRequestBuilder?: CometChat.ConversationsRequestBuilder,
|
|
171
|
-
/**
|
|
172
|
-
* Custom subtitle view
|
|
173
|
-
*/
|
|
174
|
-
SubtitleView?: (item: CometChat.Conversation) => JSX.Element,
|
|
175
|
-
/**
|
|
176
|
-
* toogle error view
|
|
177
|
-
*/
|
|
178
|
-
hideError?: boolean,
|
|
179
|
-
/**
|
|
180
|
-
* call back function for
|
|
181
|
-
*/
|
|
182
|
-
onItemPress?: (item: CometChat.Conversation) => void,
|
|
183
|
-
/**
|
|
184
|
-
* callback function for long press
|
|
185
|
-
*/
|
|
186
|
-
onItemLongPress?: (item: CometChat.Conversation) => void,
|
|
187
|
-
/**
|
|
188
|
-
* callback function will be called when error occured while fetching conversations
|
|
189
|
-
*/
|
|
190
|
-
onError?: (e: CometChat.CometChatException) => void,
|
|
191
|
-
/**
|
|
192
|
-
* callback function for on back
|
|
193
|
-
*/
|
|
194
|
-
onBack?: () => void,
|
|
195
|
-
/**
|
|
196
|
-
* style object for conversations
|
|
197
|
-
*/
|
|
198
|
-
conversationsStyle?: ConversationsStyleInterface,
|
|
199
|
-
/**
|
|
200
|
-
* style object for list item
|
|
201
|
-
*/
|
|
202
|
-
listItemStyle?: ListItemStyleInterface,
|
|
203
|
-
/**
|
|
204
|
-
* style object for avatar
|
|
205
|
-
*/
|
|
206
|
-
avatarStyle?: AvatarStyleInterface,
|
|
207
|
-
/**
|
|
208
|
-
* style object for status indicator
|
|
209
|
-
*/
|
|
210
|
-
statusIndicatorStyle?: StatusIndicatorStyleInterface,
|
|
211
|
-
/**
|
|
212
|
-
* style object for date
|
|
213
|
-
*/
|
|
214
|
-
dateStyle?: DateStyleInterface,
|
|
215
|
-
/**
|
|
216
|
-
* style object for receipt
|
|
217
|
-
*/
|
|
218
|
-
receiptStyle?: Object,
|
|
219
|
-
/**
|
|
220
|
-
* style object for badge
|
|
221
|
-
*/
|
|
222
|
-
badgeStyle?: BadgeStyleInterface,
|
|
223
|
-
/**
|
|
224
|
-
* style object for confirm dialog
|
|
225
|
-
*/
|
|
226
|
-
confirmDialogStyle?: CometChatConfirmDialogStyleInterface,
|
|
227
|
-
/**
|
|
228
|
-
* if true, mentions will be disabled. Default: false
|
|
229
|
-
*/
|
|
230
|
-
disableMentions?: boolean,
|
|
231
|
-
/**
|
|
232
|
-
* Collection of text formatter class
|
|
233
|
-
* @type {Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>}
|
|
234
|
-
*/
|
|
235
|
-
textFormatters?: Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>;
|
|
58
|
+
/**
|
|
59
|
+
* Hide the submit (selection) button.
|
|
60
|
+
*/
|
|
61
|
+
hideSubmitButton?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Disable display of message receipts.
|
|
64
|
+
*/
|
|
65
|
+
hideReceipt?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Toggle sound playback for received messages.
|
|
68
|
+
*/
|
|
69
|
+
disableSoundForMessages?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Custom sound file path for received messages.
|
|
72
|
+
*/
|
|
73
|
+
customSoundForMessages?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Function to generate a custom date string for a conversation.
|
|
76
|
+
* @param conversation - The conversation object.
|
|
77
|
+
* @returns A string representing the date.
|
|
78
|
+
*/
|
|
79
|
+
datePattern?: (conversation: CometChat.Conversation) => string;
|
|
80
|
+
/**
|
|
81
|
+
* Custom view for rendering a conversation item.
|
|
82
|
+
*/
|
|
83
|
+
ItemView?: (item: CometChat.Conversation) => JSX.Element;
|
|
84
|
+
/**
|
|
85
|
+
* Functional component for rendering options in the app bar.
|
|
86
|
+
*/
|
|
87
|
+
AppBarOptions?: () => JSX.Element;
|
|
88
|
+
/**
|
|
89
|
+
* Hide the back button.
|
|
90
|
+
*/
|
|
91
|
+
hideBackButton?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Selection mode: "none" | "single" | "multiple".
|
|
94
|
+
*/
|
|
95
|
+
selectionMode?: SelectionMode;
|
|
96
|
+
/**
|
|
97
|
+
* Callback when conversation selection is complete.
|
|
98
|
+
*/
|
|
99
|
+
onSelection?: (item: Array<CometChat.Conversation>) => void;
|
|
100
|
+
/**
|
|
101
|
+
* Custom view for the empty state.
|
|
102
|
+
*/
|
|
103
|
+
EmptyView?: () => JSX.Element;
|
|
104
|
+
/**
|
|
105
|
+
* Custom view for the error state.
|
|
106
|
+
*/
|
|
107
|
+
ErrorView?: () => JSX.Element;
|
|
108
|
+
/**
|
|
109
|
+
* Custom view for the loading state.
|
|
110
|
+
*/
|
|
111
|
+
LoadingView?: () => JSX.Element;
|
|
112
|
+
/**
|
|
113
|
+
* Request builder to fetch conversations.
|
|
114
|
+
*/
|
|
115
|
+
conversationsRequestBuilder?: CometChat.ConversationsRequestBuilder;
|
|
116
|
+
/**
|
|
117
|
+
* Custom leading view for a conversation item.
|
|
118
|
+
*/
|
|
119
|
+
LeadingView?: (conversation: CometChat.Conversation) => JSX.Element;
|
|
120
|
+
/**
|
|
121
|
+
* Custom title view for a conversation item.
|
|
122
|
+
*/
|
|
123
|
+
TitleView?: (conversation: CometChat.Conversation) => JSX.Element;
|
|
124
|
+
/**
|
|
125
|
+
* Custom subtitle view for a conversation item.
|
|
126
|
+
*/
|
|
127
|
+
SubtitleView?: (item: CometChat.Conversation) => JSX.Element;
|
|
128
|
+
/**
|
|
129
|
+
* Custom tail view for a conversation item.
|
|
130
|
+
*/
|
|
131
|
+
TrailingView?: (item: CometChat.Conversation) => JSX.Element;
|
|
132
|
+
/**
|
|
133
|
+
* Hide error view.
|
|
134
|
+
*/
|
|
135
|
+
hideError?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Callback for when a conversation item is pressed.
|
|
138
|
+
*/
|
|
139
|
+
onItemPress?: (item: CometChat.Conversation) => void;
|
|
140
|
+
/**
|
|
141
|
+
* Callback for when a conversation item is long pressed.
|
|
142
|
+
*/
|
|
143
|
+
onItemLongPress?: (item: CometChat.Conversation) => void;
|
|
144
|
+
/**
|
|
145
|
+
* Callback when an error occurs while fetching conversations.
|
|
146
|
+
*/
|
|
147
|
+
onError?: (e: CometChat.CometChatException) => void;
|
|
148
|
+
/**
|
|
149
|
+
* Callback for when the back action is triggered.
|
|
150
|
+
*/
|
|
151
|
+
onBack?: () => void;
|
|
152
|
+
/**
|
|
153
|
+
* Array of text formatter classes.
|
|
154
|
+
*/
|
|
155
|
+
textFormatters?: Array<
|
|
156
|
+
CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter
|
|
157
|
+
>;
|
|
158
|
+
/**
|
|
159
|
+
* Custom styles for the conversation view.
|
|
160
|
+
*/
|
|
161
|
+
style?: DeepPartial<ConversationStyle>;
|
|
162
|
+
/**
|
|
163
|
+
* Hide the header of the conversation list.
|
|
164
|
+
*/
|
|
165
|
+
hideHeader?: boolean;
|
|
236
166
|
}
|
|
237
167
|
|
|
238
168
|
/**
|
|
169
|
+
* CometChatConversations is a container component that wraps and formats the conversation list.
|
|
170
|
+
* It handles events such as new messages, typing indicators, call events, and group events.
|
|
239
171
|
*
|
|
240
|
-
* @
|
|
241
|
-
* @
|
|
242
|
-
* @description CometChatConversations is a container component that wraps and
|
|
243
|
-
* formats CometChatListBase and CometChatConversationList component, with no behavior of its own.
|
|
244
|
-
*
|
|
172
|
+
* @param props - Properties defined by ConversationInterface.
|
|
173
|
+
* @returns A JSX.Element that renders the conversation list.
|
|
245
174
|
*/
|
|
246
175
|
export const CometChatConversations = (props: ConversationInterface) => {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
loadingIconTint: theme?.palette.getPrimary(),
|
|
306
|
-
separatorColor: theme?.palette.getAccent100(),
|
|
307
|
-
titleColor: theme?.palette.getAccent(),
|
|
308
|
-
titleFont: theme?.typography.heading,
|
|
309
|
-
typingIndictorTextColor: theme?.palette.getAccent600(),
|
|
310
|
-
typingIndictorTextFont: theme?.typography.subtitle1,
|
|
311
|
-
threadIndicatorTextColor: theme?.palette.getAccent800(),
|
|
312
|
-
threadIndicatorTextFont: theme?.typography.text1,
|
|
313
|
-
...conversationsStyle
|
|
314
|
-
});
|
|
315
|
-
const _statusIndicatorStyle = new StatusIndicatorStyle(props?.statusIndicatorStyle || {});
|
|
316
|
-
const _avatarStyle = new AvatarStyle({
|
|
317
|
-
backgroundColor: theme?.palette?.getAccent600(),
|
|
318
|
-
nameTextColor: theme?.palette?.getAccent(),
|
|
319
|
-
nameTextFont: theme?.typography.body,
|
|
320
|
-
...props?.avatarStyle
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
const _listItemStyle = new ListItemStyle({
|
|
324
|
-
backgroundColor: theme?.palette?.getBackgroundColor(),
|
|
325
|
-
titleColor: theme?.palette.getAccent(),
|
|
326
|
-
titleFont: theme?.typography.name,
|
|
327
|
-
...props?.listItemStyle
|
|
328
|
-
});
|
|
329
|
-
const _badgeStyle = new BadgeStyle({
|
|
330
|
-
backgroundColor: theme?.palette?.getPrimary(),
|
|
331
|
-
textColor: theme?.palette?.getSecondary(),
|
|
332
|
-
textFont: theme?.typography?.caption2,
|
|
333
|
-
...props?.badgeStyle
|
|
334
|
-
});
|
|
335
|
-
// const _receiptStyle = new ReceiptStyle(props?.receiptStyle || {});
|
|
336
|
-
const _dateStyle = new DateStyle({
|
|
337
|
-
textColor: theme?.palette?.getAccent600(),
|
|
338
|
-
textFont: theme?.typography?.caption1,
|
|
339
|
-
...props?.dateStyle
|
|
340
|
-
});
|
|
341
|
-
|
|
342
|
-
const _confirmDialogStyle = (props?.confirmDialogStyle || {});
|
|
343
|
-
|
|
344
|
-
const ErrorView = () => {
|
|
345
|
-
return (
|
|
346
|
-
<View style={Style.listContainer}>
|
|
347
|
-
<Text style={{ ..._style?.errorTextFont, color: _style?.errorTextColor } as TextStyle}>
|
|
348
|
-
{errorStateText || localize("SOMETHING_WRONG")}
|
|
349
|
-
</Text>
|
|
350
|
-
</View>
|
|
351
|
-
);
|
|
352
|
-
}
|
|
176
|
+
const {
|
|
177
|
+
hideReceipt = false,
|
|
178
|
+
disableSoundForMessages = false,
|
|
179
|
+
hideHeader = false,
|
|
180
|
+
customSoundForMessages,
|
|
181
|
+
datePattern,
|
|
182
|
+
ItemView,
|
|
183
|
+
AppBarOptions,
|
|
184
|
+
hideSubmitButton = false,
|
|
185
|
+
hideBackButton = true,
|
|
186
|
+
selectionMode = "single",
|
|
187
|
+
onSelection,
|
|
188
|
+
EmptyView,
|
|
189
|
+
ErrorView,
|
|
190
|
+
LoadingView,
|
|
191
|
+
conversationsRequestBuilder,
|
|
192
|
+
LeadingView,
|
|
193
|
+
TitleView,
|
|
194
|
+
SubtitleView,
|
|
195
|
+
TrailingView,
|
|
196
|
+
hideError = false,
|
|
197
|
+
onItemPress,
|
|
198
|
+
onItemLongPress,
|
|
199
|
+
onError,
|
|
200
|
+
onBack,
|
|
201
|
+
textFormatters,
|
|
202
|
+
style,
|
|
203
|
+
} = props;
|
|
204
|
+
|
|
205
|
+
// Reference for accessing CometChatList methods
|
|
206
|
+
const conversationListRef = React.useRef<CometChatListActionsInterface>(null);
|
|
207
|
+
// Store the logged in user for comparison and event handling.
|
|
208
|
+
const loggedInUser = React.useRef<CometChat.User>();
|
|
209
|
+
// State to control the confirmation dialog for deleting a conversation.
|
|
210
|
+
const [confirmDelete, setConfirmDelete] = React.useState<string | undefined>(undefined);
|
|
211
|
+
// State to control selection mode for conversation items.
|
|
212
|
+
const [selecting, setSelecting] = React.useState(selectionMode === "none" ? false : true);
|
|
213
|
+
const [selectedConversation, setSelectedConversations] = React.useState<
|
|
214
|
+
Array<CometChat.Conversation>
|
|
215
|
+
>([]);
|
|
216
|
+
// Timer for debouncing member-added events.
|
|
217
|
+
const onMemberAddedToGroupDebounceTimer = React.useRef<ReturnType<typeof setTimeout> | null>(
|
|
218
|
+
null
|
|
219
|
+
);
|
|
220
|
+
// Reference to store long press identifier.
|
|
221
|
+
const longPressId = React.useRef<string | undefined>(undefined);
|
|
222
|
+
// Reference to store tooltip position for long press events.
|
|
223
|
+
const tooltipPositon = React.useRef({
|
|
224
|
+
pageX: 0,
|
|
225
|
+
pageY: 0,
|
|
226
|
+
});
|
|
227
|
+
const [tooltipVisible, setTooltipVisible] = React.useState(false);
|
|
228
|
+
|
|
229
|
+
// Merge theme styles with provided style overrides.
|
|
230
|
+
const theme = useTheme();
|
|
231
|
+
const mergedStyles = useMemo(() => {
|
|
232
|
+
return deepMerge(theme.conversationStyles, style ?? {});
|
|
233
|
+
}, [theme.conversationStyles, style]);
|
|
353
234
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
let updatedConversation = CommonUtils.clone(item);
|
|
373
|
-
updatedConversation.setConversationWith(args[0]);
|
|
374
|
-
conversationListRef.current?.updateList(updatedConversation);
|
|
375
|
-
}
|
|
235
|
+
/**
|
|
236
|
+
* ErrorStateView renders a view to show when an error occurs.
|
|
237
|
+
*/
|
|
238
|
+
const ErrorStateView = useCallback(() => {
|
|
239
|
+
return (
|
|
240
|
+
<ErrorEmptyView
|
|
241
|
+
title='Oops!'
|
|
242
|
+
subTitle='Looks like something went wrong.'
|
|
243
|
+
tertiaryTitle='Please try again.'
|
|
244
|
+
Icon={
|
|
245
|
+
<Icon
|
|
246
|
+
name='error-state'
|
|
247
|
+
size={theme.spacing.margin.m15 << 1}
|
|
248
|
+
containerStyle={{
|
|
249
|
+
marginBottom: theme.spacing.margin.m5,
|
|
250
|
+
}}
|
|
251
|
+
icon={mergedStyles.errorStateStyle.icon}
|
|
252
|
+
/>
|
|
376
253
|
}
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
return (
|
|
384
|
-
(typingIndicator.getReceiverType() == ReceiverTypeConstants.user &&
|
|
385
|
-
item.getConversationType() == ReceiverTypeConstants.user
|
|
386
|
-
&& (item.getConversationWith() as CometChat.User).getUid() == typingIndicator.getSender().getUid())
|
|
387
|
-
|| (typingIndicator.getReceiverType() == ReceiverTypeConstants.group && item.getConversationType() == ReceiverTypeConstants.group
|
|
388
|
-
&& (item.getConversationWith() as CometChat.Group).getGuid() == typingIndicator.getReceiverId())
|
|
389
|
-
)
|
|
390
|
-
})
|
|
391
|
-
}
|
|
254
|
+
containerStyle={mergedStyles.errorStateStyle.containerStyle}
|
|
255
|
+
titleStyle={mergedStyles.errorStateStyle?.titleStyle}
|
|
256
|
+
subTitleStyle={mergedStyles.errorStateStyle?.subTitleStyle}
|
|
257
|
+
/>
|
|
258
|
+
);
|
|
259
|
+
}, [theme, mergedStyles]);
|
|
392
260
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
}
|
|
409
|
-
|
|
261
|
+
/**
|
|
262
|
+
* EmptyStateView renders a view when no conversations are available.
|
|
263
|
+
*/
|
|
264
|
+
const EmptyStateView = useCallback(() => {
|
|
265
|
+
return (
|
|
266
|
+
<ErrorEmptyView
|
|
267
|
+
title='No Conversations Yet'
|
|
268
|
+
subTitle='Start a new chat or invite others to join the conversation.'
|
|
269
|
+
Icon={
|
|
270
|
+
<Icon
|
|
271
|
+
name='empty-state'
|
|
272
|
+
size={theme.spacing.spacing.s15 << 1}
|
|
273
|
+
containerStyle={{
|
|
274
|
+
marginBottom: theme.spacing.spacing.s5,
|
|
275
|
+
}}
|
|
276
|
+
icon={mergedStyles.emptyStateStyle.icon}
|
|
277
|
+
/>
|
|
410
278
|
}
|
|
279
|
+
containerStyle={mergedStyles.emptyStateStyle.containerStyle}
|
|
280
|
+
titleStyle={mergedStyles.emptyStateStyle?.titleStyle}
|
|
281
|
+
subTitleStyle={mergedStyles.emptyStateStyle?.subTitleStyle}
|
|
282
|
+
/>
|
|
283
|
+
);
|
|
284
|
+
}, [theme, mergedStyles]);
|
|
411
285
|
|
|
286
|
+
/**
|
|
287
|
+
* Handler for user online/offline events. Finds the corresponding conversation and updates it.
|
|
288
|
+
* @param args - Contains user details.
|
|
289
|
+
*/
|
|
290
|
+
const userEventHandler = (...args: any) => {
|
|
291
|
+
const { uid, blockedByMe, status } = args[0];
|
|
292
|
+
if (!blockedByMe) {
|
|
293
|
+
let item: CometChat.Conversation =
|
|
294
|
+
conversationListRef.current!.getListItem(`${uid}_user_${loggedInUser.current!.getUid()}`) ||
|
|
295
|
+
conversationListRef.current!.getListItem(`${loggedInUser.current!.getUid()}_user_${uid}`);
|
|
296
|
+
if (item) {
|
|
297
|
+
let updatedConversation = CommonUtils.clone(item);
|
|
298
|
+
updatedConversation.setConversationWith(args[0]);
|
|
299
|
+
conversationListRef.current!.updateList(updatedConversation);
|
|
300
|
+
}
|
|
412
301
|
}
|
|
302
|
+
};
|
|
413
303
|
|
|
414
|
-
|
|
415
|
-
*
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
* @param newMessage message object
|
|
304
|
+
/**
|
|
305
|
+
* Returns a conversation that matches a typing indicator.
|
|
306
|
+
* @param typingIndicator - The typing indicator event.
|
|
307
|
+
* @returns The matching conversation or undefined.
|
|
419
308
|
*/
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
309
|
+
const getConversationRefFromTypingIndicator = (typingIndicator: CometChat.TypingIndicator) => {
|
|
310
|
+
let list = conversationListRef.current!.getAllListItems();
|
|
311
|
+
return list.find((item: CometChat.Conversation) => {
|
|
312
|
+
return (
|
|
313
|
+
(typingIndicator.getReceiverType() == ReceiverTypeConstants.user &&
|
|
314
|
+
item.getConversationType() == ReceiverTypeConstants.user &&
|
|
315
|
+
(item.getConversationWith() as CometChat.User).getUid() ==
|
|
316
|
+
typingIndicator.getSender().getUid()) ||
|
|
317
|
+
(typingIndicator.getReceiverType() == ReceiverTypeConstants.group &&
|
|
318
|
+
item.getConversationType() == ReceiverTypeConstants.group &&
|
|
319
|
+
(item.getConversationWith() as CometChat.Group).getGuid() ==
|
|
320
|
+
typingIndicator.getReceiverId())
|
|
321
|
+
);
|
|
322
|
+
});
|
|
323
|
+
};
|
|
434
324
|
|
|
325
|
+
/**
|
|
326
|
+
* Handler for typing events in conversations.
|
|
327
|
+
* @param args - Typing indicator and a flag indicating whether typing started or ended.
|
|
328
|
+
*/
|
|
329
|
+
const typingEventHandler = (...args: any) => {
|
|
330
|
+
let conversation: CometChat.Conversation = CommonUtils.clone(
|
|
331
|
+
getConversationRefFromTypingIndicator(args[0])
|
|
332
|
+
);
|
|
333
|
+
if (conversation) {
|
|
334
|
+
let isTyping = args[1];
|
|
335
|
+
let newConversation = conversation;
|
|
336
|
+
if (isTyping && !newConversation?.["lastMessage"]?.["typing"]) {
|
|
337
|
+
newConversation["lastMessage"]["typing"] =
|
|
338
|
+
args[0]?.receiverType === "group"
|
|
339
|
+
? `${args[0].sender.name} ${localize("IS_TYPING")}`
|
|
340
|
+
: localize("IS_TYPING");
|
|
341
|
+
} else {
|
|
342
|
+
delete newConversation["lastMessage"]["typing"];
|
|
343
|
+
}
|
|
344
|
+
conversationListRef.current!.updateList(newConversation);
|
|
435
345
|
}
|
|
346
|
+
};
|
|
436
347
|
|
|
348
|
+
/**
|
|
349
|
+
* Checks and updates the last message in a conversation if it matches the provided message.
|
|
350
|
+
* @param newMessage - The new message object.
|
|
351
|
+
*/
|
|
352
|
+
const checkAndUpdateLastMessage = (newMessage: CometChat.BaseMessage) => {
|
|
353
|
+
CometChat.CometChatHelper.getConversationFromMessage(newMessage).then(
|
|
354
|
+
(conversation: CometChat.Conversation) => {
|
|
355
|
+
let conver: CometChat.Conversation = conversationListRef.current!.getListItem(
|
|
356
|
+
conversation.getConversationId()
|
|
357
|
+
);
|
|
358
|
+
if (!conver) return;
|
|
359
|
+
let lastMessageId = conver.getLastMessage().getId();
|
|
360
|
+
if (lastMessageId == newMessage.getId()) {
|
|
361
|
+
conversationListRef.current!.updateList(CommonUtils.clone(conversation));
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
);
|
|
365
|
+
};
|
|
437
366
|
|
|
438
367
|
/**
|
|
439
|
-
*
|
|
440
|
-
*
|
|
441
|
-
*
|
|
368
|
+
* Determines whether the last message and unread count should be updated.
|
|
369
|
+
* @param message - The message to check.
|
|
370
|
+
* @returns True if an update is needed.
|
|
442
371
|
*/
|
|
443
|
-
const shouldUpdateLastMessageAndUnreadCount = (
|
|
444
|
-
|
|
445
|
-
) => {
|
|
446
|
-
const messageReceiverType = message.getReceiverType();
|
|
447
|
-
if (
|
|
448
|
-
conversationsRequestBuilder &&
|
|
449
|
-
conversationsRequestBuilder.build().getConversationType() &&
|
|
450
|
-
conversationsRequestBuilder.build().getConversationType() !=
|
|
451
|
-
messageReceiverType
|
|
452
|
-
) {
|
|
453
|
-
return false;
|
|
454
|
-
}
|
|
455
|
-
/****Start: Should Threaded Messages Update Conversation? */
|
|
372
|
+
const shouldUpdateLastMessageAndUnreadCount = (message: CometChat.BaseMessage) => {
|
|
373
|
+
// Do not update for threaded messages if not enabled.
|
|
456
374
|
if (
|
|
457
375
|
message.getParentMessageId() &&
|
|
458
376
|
!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnMessageReplies()
|
|
459
377
|
) {
|
|
460
378
|
return false;
|
|
461
379
|
}
|
|
462
|
-
/****END: Should Threaded Messages Update Conversation? */
|
|
463
380
|
|
|
464
|
-
|
|
465
|
-
if (
|
|
466
|
-
message.getCategory() ==
|
|
467
|
-
CometChatUiKitConstants.MessageCategoryConstants.custom
|
|
468
|
-
) {
|
|
381
|
+
// Do not update for custom messages if not allowed.
|
|
382
|
+
if (message.getCategory() == CometChatUiKitConstants.MessageCategoryConstants.custom) {
|
|
469
383
|
let customMessage = message as CometChat.CustomMessage;
|
|
470
384
|
if (
|
|
471
385
|
!customMessage.willUpdateConversation() &&
|
|
472
386
|
!(
|
|
473
387
|
customMessage.getMetadata() &&
|
|
474
|
-
(customMessage.getMetadata() as any)[
|
|
388
|
+
(customMessage.getMetadata() as any)["incrementUnreadCount"]
|
|
475
389
|
) &&
|
|
476
390
|
!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCustomMessages()
|
|
477
391
|
) {
|
|
478
392
|
return false;
|
|
479
393
|
}
|
|
480
394
|
}
|
|
481
|
-
/****End: Should Custom Message Update Conversation? */
|
|
482
395
|
|
|
483
|
-
|
|
396
|
+
// Check for group actions.
|
|
484
397
|
if (
|
|
485
|
-
message.getCategory() ==
|
|
486
|
-
|
|
487
|
-
message.getReceiverType() ==
|
|
488
|
-
CometChatUiKitConstants.ReceiverTypeConstants.group
|
|
398
|
+
message.getCategory() == CometChatUiKitConstants.MessageCategoryConstants.action &&
|
|
399
|
+
message.getReceiverType() == CometChatUiKitConstants.ReceiverTypeConstants.group
|
|
489
400
|
) {
|
|
490
401
|
return CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnGroupActions();
|
|
491
402
|
}
|
|
492
|
-
/****End: Should Group Actions sent update conversation? */
|
|
493
403
|
|
|
494
|
-
|
|
404
|
+
// Check for call activities.
|
|
495
405
|
if (
|
|
496
|
-
message.getCategory() ==
|
|
497
|
-
CometChatUiKitConstants.MessageCategoryConstants.call &&
|
|
406
|
+
message.getCategory() == CometChatUiKitConstants.MessageCategoryConstants.call &&
|
|
498
407
|
!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()
|
|
499
408
|
) {
|
|
500
409
|
return false;
|
|
501
410
|
}
|
|
502
|
-
/****End: Should Call Actions sent Update Conversation */
|
|
503
|
-
|
|
504
411
|
return true;
|
|
505
412
|
};
|
|
506
413
|
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
}
|
|
531
|
-
oldConversation['lastMessage'] = newMessage;
|
|
532
|
-
if ((newMessage as any)['sender']['uid'] != loggedInUser.current?.['uid'])
|
|
533
|
-
oldConversation.setUnreadMessageCount(oldConversation.getUnreadMessageCount() + 1);
|
|
534
|
-
conversationListRef.current?.updateAndMoveToFirst(oldConversation);
|
|
535
|
-
})
|
|
536
|
-
.catch((err: any) => {
|
|
537
|
-
console.log("Error", err);
|
|
414
|
+
/**
|
|
415
|
+
* Updates the conversation with a new message and moves it to the top of the list.
|
|
416
|
+
* @param newMessage - The new message to update.
|
|
417
|
+
*/
|
|
418
|
+
const updateLastMessage = (newMessage: CometChat.BaseMessage) => {
|
|
419
|
+
CometChat.CometChatHelper.getConversationFromMessage(newMessage)
|
|
420
|
+
.then((conversation) => {
|
|
421
|
+
if (newMessage.getCategory() === MessageCategoryConstants.interactive) {
|
|
422
|
+
// TODO: Show unsupported message view.
|
|
423
|
+
}
|
|
424
|
+
const oldConversation: CometChat.Conversation = conversationListRef.current!.getListItem(
|
|
425
|
+
conversation.getConversationId()
|
|
426
|
+
);
|
|
427
|
+
if (oldConversation == undefined) {
|
|
428
|
+
// If conversation not found, add it.
|
|
429
|
+
CometChat.CometChatHelper.getConversationFromMessage(newMessage)
|
|
430
|
+
.then((newConversation) => {
|
|
431
|
+
if (
|
|
432
|
+
newConversation?.getLastMessage().getSender().getUid() !==
|
|
433
|
+
loggedInUser.current?.getUid()
|
|
434
|
+
)
|
|
435
|
+
newConversation.setUnreadMessageCount(1);
|
|
436
|
+
conversationListRef.current!.addItemToList(newConversation, 0);
|
|
538
437
|
})
|
|
539
|
-
|
|
438
|
+
.catch((err) => onError && onError(err));
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
// Update last message and unread count.
|
|
442
|
+
oldConversation.setLastMessage(newMessage);
|
|
443
|
+
if (newMessage.getSender().getUid() != loggedInUser.current?.getUid())
|
|
444
|
+
oldConversation.setUnreadMessageCount(oldConversation.getUnreadMessageCount() + 1);
|
|
445
|
+
conversationListRef.current!.updateAndMoveToFirst(CommonUtils.clone(oldConversation));
|
|
446
|
+
})
|
|
447
|
+
.catch((err) => {
|
|
448
|
+
console.log("Error", err);
|
|
449
|
+
});
|
|
450
|
+
};
|
|
540
451
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
452
|
+
/**
|
|
453
|
+
* Plays the notification sound for incoming messages.
|
|
454
|
+
*/
|
|
455
|
+
const playNotificationSound = () => {
|
|
456
|
+
if (disableSoundForMessages) return;
|
|
457
|
+
CometChatSoundManager.play(
|
|
458
|
+
customSoundForMessages || CometChatSoundManager.SoundOutput.incomingMessageFromOther
|
|
459
|
+
);
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Determines if a message should be marked as delivered.
|
|
464
|
+
* @param message - The message object.
|
|
465
|
+
* @returns True if the message does not have a "deliveredAt" property.
|
|
466
|
+
*/
|
|
467
|
+
const shouldMarkAsDelivered = (message: object) => {
|
|
468
|
+
return !message.hasOwnProperty("deliveredAt");
|
|
469
|
+
};
|
|
551
470
|
|
|
552
|
-
|
|
553
|
-
|
|
471
|
+
/**
|
|
472
|
+
* Marks a message as delivered and plays notification sound if applicable.
|
|
473
|
+
* @param message - The message to mark as delivered.
|
|
474
|
+
*/
|
|
475
|
+
const markMessageAsDelivered = (message: CometChat.BaseMessage) => {
|
|
476
|
+
if (message.hasOwnProperty("deletedAt")) return;
|
|
477
|
+
|
|
478
|
+
if (shouldMarkAsDelivered(message)) {
|
|
479
|
+
CometChat.markAsDelivered(message);
|
|
480
|
+
playNotificationSound();
|
|
554
481
|
}
|
|
482
|
+
};
|
|
555
483
|
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
484
|
+
/**
|
|
485
|
+
* Updates message receipt for the conversation.
|
|
486
|
+
* @param receipt - The message receipt.
|
|
487
|
+
*/
|
|
488
|
+
const updateMessageReceipt = (receipt: CometChat.MessageReceipt) => {
|
|
489
|
+
const conv: CometChat.Conversation | boolean =
|
|
490
|
+
receipt?.getReceiverType() === ReceiverTypeConstants.user
|
|
491
|
+
? (conversationListRef.current?.getListItem(
|
|
492
|
+
`${receipt?.getReceiver()}_user_${receipt?.getSender().getUid()}`
|
|
493
|
+
) as unknown as CometChat.Conversation) ||
|
|
494
|
+
(conversationListRef.current?.getListItem(
|
|
495
|
+
`${receipt?.getSender()?.getUid()}_user_${receipt?.getReceiver()}`
|
|
496
|
+
) as unknown as CometChat.Conversation)
|
|
497
|
+
: [
|
|
498
|
+
receipt.RECEIPT_TYPE.DELIVERED_TO_ALL_RECEIPT,
|
|
499
|
+
receipt.RECEIPT_TYPE.READ_BY_ALL_RECEIPT,
|
|
500
|
+
].includes(receipt?.getReceiptType()) &&
|
|
501
|
+
(conversationListRef.current?.getListItem(
|
|
502
|
+
`group_${receipt?.getReceiver()}`
|
|
503
|
+
) as unknown as CometChat.Conversation);
|
|
561
504
|
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
505
|
+
if (
|
|
506
|
+
conv &&
|
|
507
|
+
conv.getConversationType() == ConversationTypeConstants.group &&
|
|
508
|
+
conv.getLastMessage().getSender().getUid() !== loggedInUser.current!.getUid()
|
|
509
|
+
) {
|
|
510
|
+
return;
|
|
566
511
|
}
|
|
567
512
|
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
: [receipt.RECEIPT_TYPE.DELIVERED_TO_ALL_RECEIPT, receipt.RECEIPT_TYPE.READ_BY_ALL_RECEIPT].includes(receipt?.getReceiptType()) &&
|
|
578
|
-
conversationListRef.current?.getListItem(
|
|
579
|
-
`group_${receipt?.getReceiver()}`
|
|
580
|
-
) as unknown as CometChat.Conversation;
|
|
581
|
-
|
|
582
|
-
if (
|
|
583
|
-
conv &&
|
|
584
|
-
conv.getConversationType() == ConversationTypeConstants.group &&
|
|
585
|
-
conv.getLastMessage().getSender().getUid() !== loggedInUser.current.getUid()
|
|
586
|
-
) {
|
|
587
|
-
return;
|
|
513
|
+
if (
|
|
514
|
+
conv &&
|
|
515
|
+
conv?.getLastMessage &&
|
|
516
|
+
(conv.getLastMessage().id == receipt.getMessageId() ||
|
|
517
|
+
conv.getLastMessage().messageId == receipt.getMessageId())
|
|
518
|
+
) {
|
|
519
|
+
let newConversation = CommonUtils.clone(conv);
|
|
520
|
+
if (receipt.getReadAt()) {
|
|
521
|
+
newConversation.getLastMessage().setReadAt(receipt.getReadAt());
|
|
588
522
|
}
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
conv &&
|
|
592
|
-
conv?.getLastMessage &&
|
|
593
|
-
(conv.getLastMessage().id == receipt.getMessageId() ||
|
|
594
|
-
conv.getLastMessage().messageId == receipt.getMessageId())
|
|
595
|
-
) {
|
|
596
|
-
let newConversation = CommonUtils.clone(conv);
|
|
597
|
-
if (receipt.getReadAt()) {
|
|
598
|
-
newConversation.getLastMessage().setReadAt(receipt.getReadAt());
|
|
599
|
-
}
|
|
600
|
-
if (receipt.getDeliveredAt()) {
|
|
601
|
-
newConversation.getLastMessage().setDeliveredAt(receipt.getDeliveredAt());
|
|
602
|
-
}
|
|
603
|
-
conversationListRef.current?.updateList(newConversation);
|
|
523
|
+
if (receipt.getDeliveredAt()) {
|
|
524
|
+
newConversation.getLastMessage().setDeliveredAt(receipt.getDeliveredAt());
|
|
604
525
|
}
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
/**
|
|
609
|
-
*
|
|
610
|
-
* When a text message / media message / custom message is received
|
|
611
|
-
*/
|
|
612
|
-
const messageEventHandler = (...args: any[]) => {
|
|
613
|
-
let message = args[0];
|
|
614
|
-
!disableReceipt && markMessageAsDelivered(message);
|
|
615
|
-
updateLastMessage(message);
|
|
526
|
+
conversationListRef.current?.updateList(newConversation);
|
|
616
527
|
}
|
|
528
|
+
};
|
|
617
529
|
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
) {
|
|
629
|
-
return;
|
|
630
|
-
}
|
|
631
|
-
let conversation : CometChat.Conversation = (conversationListRef.current?.getListItem(message['conversationId']) as unknown as CometChat.Conversation);
|
|
632
|
-
let {action, actionOn, actionBy, group} = otherDetails;
|
|
633
|
-
if (conversation) {
|
|
634
|
-
if ((action && ["kicked", "banned", "left"].includes(action)) && (actionOn?.getUid() == loggedInUser.current?.getUid())){
|
|
635
|
-
conversationListRef.current?.removeItemFromList(message.conversationId);
|
|
636
|
-
return;
|
|
637
|
-
} else {
|
|
638
|
-
if (!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnGroupActions()) {
|
|
639
|
-
return;
|
|
640
|
-
}
|
|
641
|
-
conversation.setLastMessage(message);
|
|
642
|
-
conversationListRef.current?.updateAndMoveToFirst(conversation);
|
|
643
|
-
}
|
|
644
|
-
} else {
|
|
645
|
-
CometChat.CometChatHelper.getConversationFromMessage(message)
|
|
646
|
-
.then((newConversation: any) => {
|
|
647
|
-
const conversation : CometChat.Conversation = (conversationListRef.current?.getListItem(message['conversationId']) as unknown as CometChat.Conversation);
|
|
648
|
-
if (conversation) {
|
|
649
|
-
groupHandler(message);
|
|
650
|
-
} else {
|
|
651
|
-
conversationListRef.current?.addItemToList(newConversation, 0);
|
|
652
|
-
}
|
|
653
|
-
});
|
|
654
|
-
}
|
|
655
|
-
}
|
|
530
|
+
/**
|
|
531
|
+
* Handler for when a message (text/media/custom) is received.
|
|
532
|
+
* Marks the message as delivered and updates the conversation.
|
|
533
|
+
* @param args - Contains the new message.
|
|
534
|
+
*/
|
|
535
|
+
const messageEventHandler = (...args: any) => {
|
|
536
|
+
let message = args[0];
|
|
537
|
+
markMessageAsDelivered(message);
|
|
538
|
+
updateLastMessage(message);
|
|
539
|
+
};
|
|
656
540
|
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
541
|
+
/**
|
|
542
|
+
* Handler for various group actions such as member kicked, banned, left, or scope change.
|
|
543
|
+
* @param message - The action message.
|
|
544
|
+
* @param otherDetails - Additional details about the action.
|
|
545
|
+
*/
|
|
546
|
+
const groupHandler = (
|
|
547
|
+
message: CometChat.Action,
|
|
548
|
+
otherDetails: {
|
|
549
|
+
action?: string;
|
|
550
|
+
actionOn?: CometChat.User;
|
|
551
|
+
actionBy?: CometChat.User;
|
|
552
|
+
group?: CometChat.Group;
|
|
553
|
+
newScope?: CometChat.GroupMemberScope;
|
|
554
|
+
oldScope?: CometChat.GroupMemberScope;
|
|
555
|
+
} = {}
|
|
556
|
+
) => {
|
|
557
|
+
let conversation: CometChat.Conversation = conversationListRef.current!.getListItem(
|
|
558
|
+
message.getConversationId()
|
|
559
|
+
) as unknown as CometChat.Conversation;
|
|
560
|
+
let { action, actionOn, actionBy, group, newScope, oldScope } = otherDetails;
|
|
561
|
+
if (conversation) {
|
|
562
|
+
if (action == "scopeChange" && actionOn?.getUid() !== loggedInUser.current!.getUid()) {
|
|
563
|
+
oldScope = undefined;
|
|
564
|
+
newScope = undefined;
|
|
565
|
+
}
|
|
566
|
+
const oldScopeLocal: any =
|
|
567
|
+
oldScope ?? (conversation.getConversationWith() as CometChat.Group).getScope();
|
|
568
|
+
if (
|
|
569
|
+
action &&
|
|
570
|
+
["kicked", "banned", "left"].includes(action) &&
|
|
571
|
+
actionOn &&
|
|
572
|
+
actionOn.getUid() == loggedInUser.current!.getUid()
|
|
573
|
+
) {
|
|
574
|
+
conversationListRef.current!.removeItemFromList(message.getConversationId());
|
|
575
|
+
return;
|
|
576
|
+
} else {
|
|
577
|
+
if (!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnGroupActions()) {
|
|
578
|
+
return;
|
|
661
579
|
}
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
580
|
+
conversation.setLastMessage(message);
|
|
581
|
+
if (group) {
|
|
582
|
+
!group.getScope() && group.setScope(newScope ?? oldScopeLocal);
|
|
583
|
+
conversation.setConversationWith(group);
|
|
665
584
|
}
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
setSelectedConversations([...selectedConversation, conversation]);
|
|
585
|
+
conversationListRef.current!.updateList(conversation);
|
|
586
|
+
}
|
|
587
|
+
} else {
|
|
588
|
+
CometChat.CometChatHelper.getConversationFromMessage(message).then((newConversation) => {
|
|
589
|
+
const conversation: CometChat.Conversation = conversationListRef.current!.getListItem(
|
|
590
|
+
message.getConversationId()
|
|
591
|
+
) as unknown as CometChat.Conversation;
|
|
592
|
+
if (conversation) {
|
|
593
|
+
groupHandler(message);
|
|
676
594
|
} else {
|
|
677
|
-
|
|
678
|
-
setSelectedConversations([...selectedConversation]);
|
|
595
|
+
conversationListRef.current!.addItemToList(newConversation, 0);
|
|
679
596
|
}
|
|
597
|
+
});
|
|
680
598
|
}
|
|
599
|
+
};
|
|
681
600
|
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
const removeItemFromSelectionList = (id: any) => {
|
|
695
|
-
if (selecting) {
|
|
696
|
-
let index = selectedConversation.find(member => member['uid'] == id);
|
|
697
|
-
if (index > -1) {
|
|
698
|
-
let tmpSelectedConversations = [...selectedConversation];
|
|
699
|
-
tmpSelectedConversations.splice(index, 1);
|
|
700
|
-
setSelectedConversations(tmpSelectedConversations);
|
|
701
|
-
}
|
|
702
|
-
}
|
|
601
|
+
/**
|
|
602
|
+
* Handles the conversation click event.
|
|
603
|
+
* If an onItemPress callback is provided, it is invoked.
|
|
604
|
+
* Else, toggles selection of the conversation.
|
|
605
|
+
* @param conversation - The conversation object that was clicked.
|
|
606
|
+
*/
|
|
607
|
+
const conversationClicked = (conversation: CometChat.Conversation) => {
|
|
608
|
+
if (onItemPress) {
|
|
609
|
+
onItemPress(conversation);
|
|
610
|
+
return;
|
|
703
611
|
}
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
const { conversationWith, conversationType } = conversation;
|
|
708
|
-
let conversationWithId = conversationType == "group" ? conversationWith.guid : conversationWith.uid;
|
|
709
|
-
CometChat.deleteConversation(conversationWithId, conversationType)
|
|
710
|
-
.then((success: any) => {
|
|
711
|
-
conversationListRef.current?.removeItemFromList(id);
|
|
712
|
-
removeItemFromSelectionList(id);
|
|
713
|
-
})
|
|
714
|
-
.catch((err: any) => console.log(err))
|
|
612
|
+
if (!selecting) {
|
|
613
|
+
// Fire event if not selecting.
|
|
614
|
+
return;
|
|
715
615
|
}
|
|
716
616
|
|
|
717
|
-
|
|
617
|
+
if (selectionMode == "none") return;
|
|
718
618
|
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
messageText = ChatConfigurator.getDataSource().getLastConversationMessage(conversations);
|
|
726
|
-
|
|
727
|
-
if (lastMessage) {
|
|
728
|
-
messageText = getFormattedText(lastMessage, messageText?.trim());
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
let groupText = "";
|
|
732
|
-
if (lastMessage.getReceiverType() == ReceiverTypeConstants.group) {
|
|
733
|
-
if (lastMessage.getSender().getUid() == uid) {
|
|
734
|
-
groupText = localize("YOU") + ": "
|
|
735
|
-
} else {
|
|
736
|
-
groupText = (lastMessage.getSender()?.getName() || "").trim() + ": ";
|
|
737
|
-
}
|
|
738
|
-
}
|
|
619
|
+
let index = selectedConversation.findIndex(
|
|
620
|
+
(tmpConver: CometChat.Conversation) =>
|
|
621
|
+
tmpConver.getConversationId() == conversation.getConversationId()
|
|
622
|
+
);
|
|
623
|
+
if (index < 0) {
|
|
624
|
+
if (selectionMode == "single") setSelectedConversations([conversation]);
|
|
739
625
|
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
{groupText}{messageText}
|
|
746
|
-
</Text>
|
|
747
|
-
)
|
|
626
|
+
if (selectionMode == "multiple")
|
|
627
|
+
setSelectedConversations([...selectedConversation, conversation]);
|
|
628
|
+
} else {
|
|
629
|
+
selectedConversation.splice(index, 1);
|
|
630
|
+
setSelectedConversations([...selectedConversation]);
|
|
748
631
|
}
|
|
632
|
+
};
|
|
749
633
|
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
634
|
+
/**
|
|
635
|
+
* Removes a conversation from the selection list.
|
|
636
|
+
* @param id - The conversation ID.
|
|
637
|
+
*/
|
|
638
|
+
const removeItemFromSelectionList = (id: any) => {
|
|
639
|
+
if (selecting) {
|
|
640
|
+
let index = selectedConversation.findIndex((member) => member.getConversationId() == id);
|
|
641
|
+
if (index > -1) {
|
|
642
|
+
let tmpSelectedConversations = [...selectedConversation];
|
|
643
|
+
tmpSelectedConversations.splice(index, 1);
|
|
644
|
+
setSelectedConversations(tmpSelectedConversations);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
};
|
|
753
648
|
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
649
|
+
/**
|
|
650
|
+
* Removes a conversation from the list by calling the delete API and then updating the UI.
|
|
651
|
+
* @param id - The conversation ID to remove.
|
|
652
|
+
*/
|
|
653
|
+
const removeConversation = (id: string) => {
|
|
654
|
+
let conversation = conversationListRef.current!.getListItem(id);
|
|
655
|
+
const { conversationWith, conversationType } = conversation;
|
|
656
|
+
let conversationWithId =
|
|
657
|
+
conversationType == "group" ? conversationWith.guid : conversationWith.uid;
|
|
658
|
+
CometChat.deleteConversation(conversationWithId, conversationType)
|
|
659
|
+
.then((success) => {
|
|
660
|
+
CometChatUIEventHandler.emitConversationEvent(
|
|
661
|
+
CometChatConversationEvents.ccConversationDeleted,
|
|
662
|
+
{ conversation: conversation }
|
|
663
|
+
);
|
|
664
|
+
conversationListRef.current!.removeItemFromList(id);
|
|
665
|
+
removeItemFromSelectionList(id);
|
|
666
|
+
})
|
|
667
|
+
.catch((err) => console.log(err));
|
|
668
|
+
};
|
|
769
669
|
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
670
|
+
/**
|
|
671
|
+
* Returns a formatted preview for the last message in a conversation.
|
|
672
|
+
* @param conversations - The conversation object.
|
|
673
|
+
* @param theme - The theme object.
|
|
674
|
+
* @returns A JSX.Element containing the preview.
|
|
675
|
+
*/
|
|
676
|
+
const getMessagePreview = (conversations: CometChat.Conversation, theme?: CometChatTheme) => {
|
|
677
|
+
const loggedInUserId = CometChatUIKit.loggedInUser!.getUid();
|
|
678
|
+
let lastMessage: CometChat.BaseMessage =
|
|
679
|
+
conversations?.getLastMessage && conversations.getLastMessage();
|
|
680
|
+
if (!lastMessage) return null;
|
|
681
|
+
let messageText: string | JSX.Element = "";
|
|
682
|
+
messageText = ChatConfigurator.getDataSource().getLastConversationMessage(conversations, theme);
|
|
773
683
|
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
let suggestionUsers = allFormatters[i].getSuggestionItems();
|
|
777
|
-
allFormatters[i].setMessage(message);
|
|
778
|
-
suggestionUsers.length > 0 && allFormatters[i].setSuggestionItems(suggestionUsers);
|
|
779
|
-
let _formatter = CommonUtils.clone(allFormatters[i]);
|
|
780
|
-
(messageTextTmp as string | JSX.Element) = _formatter.getFormattedText(messageTextTmp);
|
|
781
|
-
}
|
|
782
|
-
}
|
|
684
|
+
if (lastMessage && typeof messageText === "string") {
|
|
685
|
+
messageText = getFormattedText(lastMessage, messageText?.trim());
|
|
783
686
|
|
|
784
|
-
|
|
687
|
+
if (
|
|
688
|
+
lastMessage instanceof CometChat.TextMessage &&
|
|
689
|
+
lastMessage.getCategory() === "message" &&
|
|
690
|
+
lastMessage
|
|
691
|
+
.getText()
|
|
692
|
+
.substr(0, 50)
|
|
693
|
+
.match(/http[s]{0,1}:\/\//)
|
|
694
|
+
) {
|
|
695
|
+
messageText = getMessagePreviewInternal("link-fill", localize("LINK"), { theme });
|
|
696
|
+
} else {
|
|
697
|
+
// Ensure ellipsis is applied if the text is too long.
|
|
698
|
+
messageText = (
|
|
699
|
+
<Text
|
|
700
|
+
style={[mergedStyles.itemStyle.subtitleStyle, { flexShrink: 2 }]}
|
|
701
|
+
numberOfLines={1}
|
|
702
|
+
ellipsizeMode='tail'
|
|
703
|
+
>
|
|
704
|
+
{messageText}
|
|
705
|
+
</Text>
|
|
706
|
+
);
|
|
707
|
+
}
|
|
785
708
|
}
|
|
786
709
|
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
if (params.typingText) {
|
|
795
|
-
return <View style={Style.row}>
|
|
796
|
-
<Text numberOfLines={1} ellipsizeMode={"tail"} style={[Style.subtitleTextStyle, {
|
|
797
|
-
color: theme.palette.getPrimary(),
|
|
798
|
-
fontSize: theme.typography.subtitle1.fontSize, fontWeight: theme.typography.subtitle1.fontWeight
|
|
799
|
-
}] as TextStyle} >{params.typingText}</Text>
|
|
800
|
-
</View>
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
if (lastMessage && lastMessage['sender']['uid'] == loggedInUser.current?.uid && !lastMessage.getDeletedAt()) {
|
|
804
|
-
let status: MessageReceipt = "ERROR";
|
|
805
|
-
if (lastMessage?.hasOwnProperty('readAt'))
|
|
806
|
-
status = "READ";
|
|
807
|
-
else if (lastMessage?.hasOwnProperty("deliveredAt"))
|
|
808
|
-
status = "DELIVERED";
|
|
809
|
-
else if (lastMessage?.hasOwnProperty("sentAt"))
|
|
810
|
-
status = "SENT";
|
|
811
|
-
readReceipt = (disableReceipt || hideReceipt) ? null : <CometChatReceipt
|
|
812
|
-
receipt={status}
|
|
813
|
-
deliveredIcon={props.deliveredIcon}
|
|
814
|
-
errorIcon={props.errorIcon}
|
|
815
|
-
readIcon={props.readIcon}
|
|
816
|
-
sentIcon={props.sentIcon}
|
|
817
|
-
waitIcon={props.waitingIcon}
|
|
818
|
-
/>;
|
|
710
|
+
let groupText = "";
|
|
711
|
+
if (!(lastMessage instanceof CometChat.Action)) {
|
|
712
|
+
if (lastMessage.getReceiverType() == ReceiverTypeConstants.group) {
|
|
713
|
+
if (lastMessage.getSender().getUid() == loggedInUserId) {
|
|
714
|
+
groupText = localize("YOU") + ": ";
|
|
715
|
+
} else {
|
|
716
|
+
groupText = lastMessage.getSender().getName() + ": ";
|
|
819
717
|
}
|
|
718
|
+
}
|
|
719
|
+
}
|
|
820
720
|
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
721
|
+
return (
|
|
722
|
+
<>
|
|
723
|
+
{groupText && (
|
|
724
|
+
<Text
|
|
725
|
+
style={[mergedStyles.itemStyle.subtitleStyle, { flexShrink: 1 }]}
|
|
726
|
+
numberOfLines={1}
|
|
727
|
+
ellipsizeMode='middle'
|
|
728
|
+
>
|
|
729
|
+
{groupText}
|
|
730
|
+
</Text>
|
|
731
|
+
)}
|
|
732
|
+
{messageText}
|
|
733
|
+
</>
|
|
734
|
+
);
|
|
735
|
+
};
|
|
826
736
|
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
737
|
+
/**
|
|
738
|
+
* Applies text formatters to the message text.
|
|
739
|
+
* @param message - The message object.
|
|
740
|
+
* @param subtitle - The raw text to format.
|
|
741
|
+
* @returns The formatted text.
|
|
742
|
+
*/
|
|
743
|
+
function getFormattedText(message: CometChat.BaseMessage, subtitle: string) {
|
|
744
|
+
let messageTextTmp: string | JSX.Element = subtitle;
|
|
745
|
+
let allFormatters = [...(textFormatters || [])];
|
|
746
|
+
|
|
747
|
+
if (message.getMentionedUsers().length) {
|
|
748
|
+
let mentionsFormatter = ChatConfigurator.getDataSource().getMentionsFormatter();
|
|
749
|
+
mentionsFormatter.setLoggedInUser(CometChatUIKit.loggedInUser!);
|
|
750
|
+
mentionsFormatter.setMentionsStyle(mergedStyles.mentionsStyles);
|
|
751
|
+
mentionsFormatter.setTargetElement(MentionsTargetElement.conversation);
|
|
752
|
+
|
|
753
|
+
mentionsFormatter.setMessage(message);
|
|
754
|
+
allFormatters.push(mentionsFormatter);
|
|
755
|
+
}
|
|
835
756
|
|
|
836
|
-
|
|
757
|
+
if (
|
|
758
|
+
message instanceof CometChat.TextMessage &&
|
|
759
|
+
message.getCategory() === "message" &&
|
|
760
|
+
message
|
|
761
|
+
.getText()
|
|
762
|
+
.substr(0, 50)
|
|
763
|
+
.match(/http[s]{0,1}:\/\//)
|
|
764
|
+
) {
|
|
765
|
+
// For link messages, simply return the text.
|
|
766
|
+
return messageTextTmp;
|
|
837
767
|
}
|
|
838
768
|
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
/>
|
|
851
|
-
<CometChatBadge
|
|
852
|
-
count={params.unreadCount}
|
|
853
|
-
style={_badgeStyle}
|
|
854
|
-
/>
|
|
855
|
-
</View>
|
|
769
|
+
if (allFormatters && allFormatters.length) {
|
|
770
|
+
for (let i = 0; i < allFormatters.length; i++) {
|
|
771
|
+
let suggestionUsers = allFormatters[i].getSuggestionItems();
|
|
772
|
+
allFormatters[i].setMessage(message);
|
|
773
|
+
suggestionUsers.length > 0 && allFormatters[i].setSuggestionItems(suggestionUsers);
|
|
774
|
+
let _formatter = CommonUtils.clone(allFormatters[i]);
|
|
775
|
+
messageTextTmp = _formatter.getFormattedText(
|
|
776
|
+
messageTextTmp,
|
|
777
|
+
mergedStyles.itemStyle.subtitleStyle
|
|
778
|
+
);
|
|
779
|
+
}
|
|
856
780
|
}
|
|
857
781
|
|
|
858
|
-
|
|
782
|
+
return messageTextTmp;
|
|
783
|
+
}
|
|
859
784
|
|
|
860
|
-
|
|
785
|
+
/**
|
|
786
|
+
* Component to render the last message view for a conversation item.
|
|
787
|
+
* @param params - Contains conversation and typing indicator text.
|
|
788
|
+
* @returns A JSX.Element rendering the last message.
|
|
789
|
+
*/
|
|
790
|
+
const LastMessageView = (params: {
|
|
791
|
+
conversations: CometChat.Conversation;
|
|
792
|
+
typingText: string;
|
|
793
|
+
}) => {
|
|
794
|
+
const lastMessage = params.conversations.getLastMessage();
|
|
795
|
+
if (!lastMessage)
|
|
796
|
+
return (
|
|
797
|
+
<Text
|
|
798
|
+
style={[mergedStyles.itemStyle.subtitleStyle]}
|
|
799
|
+
numberOfLines={1}
|
|
800
|
+
ellipsizeMode={"tail"}
|
|
801
|
+
>
|
|
802
|
+
{localize("TAP_TO_START_CONVERSATION")}
|
|
803
|
+
</Text>
|
|
804
|
+
);
|
|
805
|
+
let readReceipt;
|
|
806
|
+
if (params.typingText) {
|
|
807
|
+
return (
|
|
808
|
+
<View style={Style.row}>
|
|
809
|
+
<Text
|
|
810
|
+
numberOfLines={1}
|
|
811
|
+
ellipsizeMode={"tail"}
|
|
812
|
+
style={[mergedStyles.typingIndicatorStyle]}
|
|
813
|
+
>
|
|
814
|
+
{params.typingText}
|
|
815
|
+
</Text>
|
|
816
|
+
</View>
|
|
817
|
+
);
|
|
818
|
+
}
|
|
861
819
|
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
}}
|
|
875
|
-
style={_confirmDialogStyle}
|
|
876
|
-
/>
|
|
820
|
+
if (
|
|
821
|
+
lastMessage &&
|
|
822
|
+
lastMessage.getSender().getUid() == loggedInUser.current!.getUid() &&
|
|
823
|
+
!lastMessage.getDeletedAt()
|
|
824
|
+
) {
|
|
825
|
+
let status: MessageReceipt = MessageReceipt.ERROR;
|
|
826
|
+
if (lastMessage?.hasOwnProperty("readAt")) status = MessageReceipt.READ;
|
|
827
|
+
else if (lastMessage?.hasOwnProperty("deliveredAt")) status = MessageReceipt.DELIVERED;
|
|
828
|
+
else if (lastMessage?.hasOwnProperty("sentAt")) status = MessageReceipt.SENT;
|
|
829
|
+
readReceipt = hideReceipt ? null : (
|
|
830
|
+
<CometChatReceipt receipt={status} style={mergedStyles.itemStyle.receiptStyles} />
|
|
831
|
+
);
|
|
877
832
|
}
|
|
878
833
|
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
834
|
+
let threadView: JSX.Element | null = null;
|
|
835
|
+
|
|
836
|
+
if (lastMessage?.getParentMessageId()) {
|
|
837
|
+
threadView = (
|
|
838
|
+
<>
|
|
839
|
+
<Icon
|
|
840
|
+
name='subdirectory-arrow-right-fill'
|
|
841
|
+
size={theme.spacing.spacing.s4}
|
|
842
|
+
color={mergedStyles.itemStyle.subtitleStyle.color}
|
|
843
|
+
/>
|
|
844
|
+
{/* Optional: Add text for thread indicator */}
|
|
845
|
+
</>
|
|
846
|
+
);
|
|
890
847
|
}
|
|
891
848
|
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
849
|
+
return (
|
|
850
|
+
<View style={[Style.row, { gap: 2, alignItems: "center" }]}>
|
|
851
|
+
{threadView}
|
|
852
|
+
<View style={[Style.row, { gap: 2, alignItems: "center" }]}>
|
|
853
|
+
{!["call", "action"].includes(params["conversations"].getLastMessage().getCategory())
|
|
854
|
+
? readReceipt
|
|
855
|
+
: null}
|
|
856
|
+
{getMessagePreview(params["conversations"], theme)}
|
|
857
|
+
</View>
|
|
858
|
+
</View>
|
|
859
|
+
);
|
|
860
|
+
};
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
* Returns the trailing view (date and badge) for a conversation item.
|
|
864
|
+
* @param conversation - The conversation object.
|
|
865
|
+
* @returns A JSX.Element for the trailing view.
|
|
866
|
+
*/
|
|
867
|
+
const getTrailingView = useCallback(
|
|
868
|
+
(conversation: CometChat.Conversation) => {
|
|
869
|
+
const customPattern = () => datePattern?.(conversation);
|
|
870
|
+
const timestamp = conversation.getLastMessage().getSentAt();
|
|
871
|
+
return (
|
|
872
|
+
<View style={mergedStyles.itemStyle.trailingViewContainerStyle}>
|
|
873
|
+
<CometChatDate
|
|
874
|
+
timeStamp={timestamp * 1000}
|
|
875
|
+
customDateString={customPattern && customPattern()}
|
|
876
|
+
pattern={"dayWeekDayDateTimeFormat"}
|
|
877
|
+
/>
|
|
878
|
+
<CometChatBadge
|
|
879
|
+
count={conversation.getUnreadMessageCount()}
|
|
880
|
+
style={mergedStyles.itemStyle.badgeStyle}
|
|
881
|
+
/>
|
|
882
|
+
</View>
|
|
883
|
+
);
|
|
884
|
+
},
|
|
885
|
+
[mergedStyles, datePattern]
|
|
886
|
+
);
|
|
887
|
+
|
|
888
|
+
/**
|
|
889
|
+
* Updates the conversation's last message for a group conversation.
|
|
890
|
+
* @param message - The new message.
|
|
891
|
+
* @param group - The group the conversation belongs to.
|
|
892
|
+
*/
|
|
893
|
+
const updateConversationLastMessage = (
|
|
894
|
+
message: CometChat.BaseMessage,
|
|
895
|
+
group: CometChat.Group
|
|
896
|
+
) => {
|
|
897
|
+
try {
|
|
898
|
+
let conversation: CometChat.Conversation = conversationListRef.current?.getListItem(
|
|
899
|
+
message.getConversationId()
|
|
900
|
+
);
|
|
901
|
+
if (conversation) {
|
|
902
|
+
conversation = CommonUtils.clone(conversation);
|
|
903
|
+
conversation.setLastMessage(message);
|
|
904
|
+
conversation.setConversationWith(group);
|
|
905
|
+
conversationListRef.current?.updateAndMoveToFirst(conversation);
|
|
906
|
+
} else {
|
|
907
|
+
CometChat.CometChatHelper.getConversationFromMessage(message)
|
|
908
|
+
.then((newConversation) => {
|
|
909
|
+
if (
|
|
910
|
+
newConversation?.getLastMessage().getSender().getUid() !==
|
|
911
|
+
loggedInUser.current?.getUid()
|
|
912
|
+
)
|
|
913
|
+
newConversation.setUnreadMessageCount(1);
|
|
914
|
+
conversationListRef.current!.addItemToList(newConversation, 0);
|
|
915
|
+
})
|
|
916
|
+
.catch((err) => onError && onError(err));
|
|
917
|
+
}
|
|
918
|
+
} catch (error: any) {
|
|
919
|
+
onError && onError(error);
|
|
903
920
|
}
|
|
921
|
+
};
|
|
904
922
|
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
923
|
+
/**
|
|
924
|
+
* Increments the unread message count for a conversation.
|
|
925
|
+
* @param conversation - The conversation to update.
|
|
926
|
+
* @returns The updated conversation.
|
|
927
|
+
*/
|
|
928
|
+
const updateUnreadMessageCount = (conversation: CometChat.Conversation) => {
|
|
929
|
+
const oldConversation: CometChat.Conversation = conversationListRef.current!.getListItem(
|
|
930
|
+
conversation["conversationId"]
|
|
931
|
+
) as unknown as CometChat.Conversation;
|
|
932
|
+
if (oldConversation == undefined) {
|
|
933
|
+
conversation.setUnreadMessageCount(1);
|
|
934
|
+
return conversation;
|
|
913
935
|
}
|
|
936
|
+
oldConversation.setUnreadMessageCount(oldConversation.getUnreadMessageCount() + 1);
|
|
937
|
+
return oldConversation;
|
|
938
|
+
};
|
|
914
939
|
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
940
|
+
// Set up event listeners for user, call, group and message events.
|
|
941
|
+
React.useEffect(() => {
|
|
942
|
+
// Get logged in user.
|
|
943
|
+
CometChat.getLoggedinUser()
|
|
944
|
+
.then((u) => {
|
|
945
|
+
loggedInUser.current = u!;
|
|
946
|
+
})
|
|
947
|
+
.catch((err) => console.log(err));
|
|
948
|
+
|
|
949
|
+
// Listen for user online/offline changes.
|
|
950
|
+
CometChat.addUserListener(
|
|
951
|
+
userListenerId,
|
|
952
|
+
new CometChat.UserListener({
|
|
953
|
+
onUserOnline: (onlineUser: any) => {
|
|
954
|
+
userEventHandler(onlineUser);
|
|
955
|
+
},
|
|
956
|
+
onUserOffline: (offlineUser: any) => {
|
|
957
|
+
userEventHandler(offlineUser);
|
|
958
|
+
},
|
|
959
|
+
})
|
|
960
|
+
);
|
|
919
961
|
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
962
|
+
// Listen for call events.
|
|
963
|
+
CometChat.addCallListener(
|
|
964
|
+
callListenerId,
|
|
965
|
+
new CometChat.CallListener({
|
|
966
|
+
onIncomingCallReceived: (call: CometChat.Call) => {
|
|
967
|
+
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
968
|
+
.then((conversation) => {
|
|
969
|
+
if (!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
970
|
+
return;
|
|
971
|
+
}
|
|
972
|
+
conversation = updateUnreadMessageCount(conversation);
|
|
973
|
+
conversation.setLastMessage(call);
|
|
974
|
+
conversationListRef.current!.updateList(conversation);
|
|
931
975
|
})
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
conversationListRef.current?.updateList(conversation);
|
|
946
|
-
})
|
|
947
|
-
.catch((e: any) => {
|
|
948
|
-
onError && onError(e);
|
|
949
|
-
})
|
|
950
|
-
},
|
|
951
|
-
onOutgoingCallAccepted: (call: any) => {
|
|
952
|
-
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
953
|
-
.then((conversation: any) => {
|
|
954
|
-
if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
955
|
-
return;
|
|
956
|
-
}
|
|
957
|
-
conversation = updateUnreadMessageCount(conversation);
|
|
958
|
-
conversation.setLastMessage(call);
|
|
959
|
-
conversationListRef.current?.updateList(conversation);
|
|
960
|
-
})
|
|
961
|
-
.catch((e: any) => {
|
|
962
|
-
onError && onError(e);
|
|
963
|
-
})
|
|
964
|
-
},
|
|
965
|
-
onOutgoingCallRejected: (call: any) => {
|
|
966
|
-
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
967
|
-
.then((conversation: any) => {
|
|
968
|
-
if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
969
|
-
return;
|
|
970
|
-
}
|
|
971
|
-
conversation = updateUnreadMessageCount(conversation);
|
|
972
|
-
conversation.setLastMessage(call);
|
|
973
|
-
conversationListRef.current?.updateList(conversation);
|
|
974
|
-
})
|
|
975
|
-
.catch((e: any) => {
|
|
976
|
-
onError && onError(e);
|
|
977
|
-
})
|
|
978
|
-
},
|
|
979
|
-
onIncomingCallCancelled: (call: any) => {
|
|
980
|
-
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
981
|
-
.then((conversation: any) => {
|
|
982
|
-
if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
983
|
-
return;
|
|
984
|
-
}
|
|
985
|
-
conversation = updateUnreadMessageCount(conversation);
|
|
986
|
-
conversation.setLastMessage(call);
|
|
987
|
-
conversationListRef.current?.updateList(conversation);
|
|
988
|
-
})
|
|
989
|
-
.catch((e: any) => {
|
|
990
|
-
onError && onError(e);
|
|
991
|
-
})
|
|
992
|
-
}
|
|
976
|
+
.catch((e) => {
|
|
977
|
+
onError && onError(e);
|
|
978
|
+
});
|
|
979
|
+
},
|
|
980
|
+
onOutgoingCallAccepted: (call: any) => {
|
|
981
|
+
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
982
|
+
.then((conversation) => {
|
|
983
|
+
if (!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
984
|
+
return;
|
|
985
|
+
}
|
|
986
|
+
conversation = updateUnreadMessageCount(conversation);
|
|
987
|
+
conversation.setLastMessage(call);
|
|
988
|
+
conversationListRef.current!.updateList(conversation);
|
|
993
989
|
})
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
kickedBy: CometChat.User,
|
|
1008
|
-
kickedFrom: CometChat.Group) => {
|
|
1009
|
-
groupHandler(
|
|
1010
|
-
message,
|
|
1011
|
-
{ action: 'kicked', actionOn: kickedUser, actionBy: kickedBy, group: kickedFrom }
|
|
1012
|
-
);
|
|
1013
|
-
},
|
|
1014
|
-
onGroupMemberLeft: (message: CometChat.Action, leavingUser: CometChat.User, group: CometChat.Group) => {
|
|
1015
|
-
groupHandler(message,
|
|
1016
|
-
{ action: 'left', actionOn: leavingUser, group }
|
|
1017
|
-
);
|
|
1018
|
-
},
|
|
1019
|
-
onGroupMemberUnbanned: (message: any) => {
|
|
1020
|
-
groupHandler(message);
|
|
1021
|
-
},
|
|
1022
|
-
onGroupMemberBanned: (
|
|
1023
|
-
message: CometChat.Action,
|
|
1024
|
-
bannedUser: CometChat.User,
|
|
1025
|
-
bannedBy: CometChat.User,
|
|
1026
|
-
bannedFrom: CometChat.Group) => {
|
|
1027
|
-
groupHandler(
|
|
1028
|
-
message,
|
|
1029
|
-
{ action: 'banned', actionOn: bannedUser, actionBy: bannedBy, group: bannedFrom }
|
|
1030
|
-
);
|
|
1031
|
-
},
|
|
1032
|
-
onMemberAddedToGroup: (
|
|
1033
|
-
message: CometChat.Action,
|
|
1034
|
-
userAdded: CometChat.User,
|
|
1035
|
-
userAddedBy: CometChat.User,
|
|
1036
|
-
userAddedIn: CometChat.Group) => {
|
|
1037
|
-
if (onMemberAddedToGroupDebounceTimer.current) {
|
|
1038
|
-
clearTimeout(onMemberAddedToGroupDebounceTimer.current);
|
|
1039
|
-
}
|
|
1040
|
-
onMemberAddedToGroupDebounceTimer.current = setTimeout(() => {
|
|
1041
|
-
groupHandler(
|
|
1042
|
-
message,
|
|
1043
|
-
{ action: 'joined', actionOn: userAdded, actionBy: userAddedBy, group: userAddedIn }
|
|
1044
|
-
);
|
|
1045
|
-
}, 50)
|
|
1046
|
-
},
|
|
1047
|
-
onGroupMemberJoined: (message: any) => {
|
|
1048
|
-
groupHandler(
|
|
1049
|
-
message
|
|
1050
|
-
);
|
|
1051
|
-
}
|
|
990
|
+
.catch((e) => {
|
|
991
|
+
onError && onError(e);
|
|
992
|
+
});
|
|
993
|
+
},
|
|
994
|
+
onOutgoingCallRejected: (call: any) => {
|
|
995
|
+
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
996
|
+
.then((conversation) => {
|
|
997
|
+
if (!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
998
|
+
return;
|
|
999
|
+
}
|
|
1000
|
+
conversation = updateUnreadMessageCount(conversation);
|
|
1001
|
+
conversation.setLastMessage(call);
|
|
1002
|
+
conversationListRef.current!.updateList(conversation);
|
|
1052
1003
|
})
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
{
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
updateLastMessage(message);
|
|
1074
|
-
}
|
|
1075
|
-
},
|
|
1076
|
-
ccMessageRead: ({ message }: any) => {
|
|
1077
|
-
checkAndUpdateLastMessage(message, true)
|
|
1078
|
-
},
|
|
1079
|
-
ccMessageDeleted: ({ message }: any) => {
|
|
1080
|
-
checkAndUpdateLastMessage(message, true)
|
|
1081
|
-
},
|
|
1082
|
-
ccMessageEdited: ({ message }: any) => {
|
|
1083
|
-
checkAndUpdateLastMessage(message, true)
|
|
1084
|
-
},
|
|
1085
|
-
onTextMessageReceived: (textMessage: any) => {
|
|
1086
|
-
if(!shouldUpdateLastMessageAndUnreadCount(textMessage)) {
|
|
1087
|
-
return;
|
|
1088
|
-
}
|
|
1089
|
-
messageEventHandler(textMessage);
|
|
1090
|
-
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
1091
|
-
},
|
|
1092
|
-
onMediaMessageReceived: (mediaMessage: any) => {
|
|
1093
|
-
if(!shouldUpdateLastMessageAndUnreadCount(mediaMessage)) {
|
|
1094
|
-
return;
|
|
1095
|
-
}
|
|
1096
|
-
messageEventHandler(mediaMessage);
|
|
1097
|
-
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
1098
|
-
},
|
|
1099
|
-
onCustomMessageReceived: (customMessage: any) => {
|
|
1100
|
-
if(!shouldUpdateLastMessageAndUnreadCount(customMessage)) {
|
|
1101
|
-
return;
|
|
1102
|
-
}
|
|
1103
|
-
messageEventHandler(customMessage);
|
|
1104
|
-
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
1105
|
-
},
|
|
1106
|
-
onMessageDeleted: (deletedMessage: any) => {
|
|
1107
|
-
checkAndUpdateLastMessage(deletedMessage, false)
|
|
1108
|
-
},
|
|
1109
|
-
onMessageEdited: (editedMessage: any) => {
|
|
1110
|
-
checkAndUpdateLastMessage(editedMessage, false)
|
|
1111
|
-
},
|
|
1112
|
-
onMessagesRead: (messageReceipt: any) => {
|
|
1113
|
-
updateMessageReceipt(messageReceipt);
|
|
1114
|
-
},
|
|
1115
|
-
onMessagesDelivered: (messageReceipt: any) => {
|
|
1116
|
-
updateMessageReceipt(messageReceipt);
|
|
1117
|
-
},
|
|
1118
|
-
onMessagesDeliveredToAll: (messageReceipt: CometChat.MessageReceipt) => {
|
|
1119
|
-
updateMessageReceipt(messageReceipt);
|
|
1120
|
-
},
|
|
1121
|
-
onMessagesReadByAll: (messageReceipt: CometChat.MessageReceipt) => {
|
|
1122
|
-
updateMessageReceipt(messageReceipt);
|
|
1123
|
-
},
|
|
1124
|
-
onTypingStarted: (typingIndicator: any) => {
|
|
1125
|
-
typingEventHandler(typingIndicator, true);
|
|
1126
|
-
},
|
|
1127
|
-
onTypingEnded: (typingIndicator: any) => {
|
|
1128
|
-
typingEventHandler(typingIndicator, false);
|
|
1129
|
-
},
|
|
1130
|
-
onFormMessageReceived: (formMessage: any) => {
|
|
1131
|
-
if(!shouldUpdateLastMessageAndUnreadCount(formMessage)) {
|
|
1132
|
-
return;
|
|
1133
|
-
}
|
|
1134
|
-
messageEventHandler(formMessage);
|
|
1135
|
-
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
1136
|
-
},
|
|
1137
|
-
onCardMessageReceived: (cardMessage: any) => {
|
|
1138
|
-
if(!shouldUpdateLastMessageAndUnreadCount(cardMessage)) {
|
|
1139
|
-
return;
|
|
1140
|
-
}
|
|
1141
|
-
messageEventHandler(cardMessage);
|
|
1142
|
-
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
1143
|
-
},
|
|
1144
|
-
onSchedulerMessageReceived: (schedulerMessage: any) => {
|
|
1145
|
-
if(!shouldUpdateLastMessageAndUnreadCount(schedulerMessage)) {
|
|
1146
|
-
return;
|
|
1147
|
-
}
|
|
1148
|
-
messageEventHandler(schedulerMessage);
|
|
1149
|
-
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
1150
|
-
},
|
|
1151
|
-
onCustomInteractiveMessageReceived: (customInteractiveMessage: any) => {
|
|
1152
|
-
if(!shouldUpdateLastMessageAndUnreadCount(customInteractiveMessage)) {
|
|
1153
|
-
return;
|
|
1154
|
-
}
|
|
1155
|
-
messageEventHandler(customInteractiveMessage);
|
|
1156
|
-
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
1157
|
-
}
|
|
1158
|
-
}
|
|
1159
|
-
);
|
|
1160
|
-
CometChatUIEventHandler.addGroupListener(
|
|
1161
|
-
groupListenerId,
|
|
1162
|
-
{
|
|
1163
|
-
ccGroupCreated: ({ group }: any) => {
|
|
1164
|
-
CometChat.getConversation(group.getGuid(), CometChatUiKitConstants.ConversationTypeConstants.group).then(
|
|
1165
|
-
(conversation: any) => {
|
|
1166
|
-
conversationListRef.current?.addItemToList(conversation, 0);
|
|
1167
|
-
}
|
|
1168
|
-
)
|
|
1169
|
-
},
|
|
1170
|
-
ccGroupDeleted: ({ group }: any) => {
|
|
1171
|
-
conversationListRef.current?.removeItemFromList(group['conversationId']);
|
|
1172
|
-
removeItemFromSelectionList(group['conversationId'])
|
|
1173
|
-
},
|
|
1174
|
-
ccGroupLeft: ({ leftGroup }: any) => {
|
|
1175
|
-
conversationListRef.current?.removeItemFromList(leftGroup['conversationId']);
|
|
1176
|
-
removeItemFromSelectionList(leftGroup['conversationId'])
|
|
1177
|
-
},
|
|
1178
|
-
ccGroupMemberKicked: ({ message, kickedFrom }: { message: CometChat.BaseMessage, kickedFrom: CometChat.Group }) => {
|
|
1179
|
-
if (!(shouldUpdateLastMessageAndUnreadCount(message))) {
|
|
1180
|
-
return;
|
|
1181
|
-
}
|
|
1182
|
-
updateConversationLastMessage(message)
|
|
1183
|
-
},
|
|
1184
|
-
ccGroupMemberBanned: ({ message }: any) => {
|
|
1185
|
-
if(!(shouldUpdateLastMessageAndUnreadCount(message))) {
|
|
1186
|
-
return;
|
|
1187
|
-
}
|
|
1188
|
-
groupHandler(message);
|
|
1189
|
-
},
|
|
1190
|
-
ccGroupMemberUnBanned: ({ message }: any) => {
|
|
1191
|
-
if(!(shouldUpdateLastMessageAndUnreadCount(message))) {
|
|
1192
|
-
return;
|
|
1193
|
-
}
|
|
1194
|
-
groupHandler(message)
|
|
1195
|
-
},
|
|
1196
|
-
ccOwnershipChanged: ({ message }: any) => {
|
|
1197
|
-
if(!(shouldUpdateLastMessageAndUnreadCount(message))) {
|
|
1198
|
-
return;
|
|
1199
|
-
}
|
|
1200
|
-
CometChat.CometChatHelper.getConversationFromMessage(message)
|
|
1201
|
-
.then((conversation: any) => {
|
|
1202
|
-
conversationListRef.current?.updateList(conversation);
|
|
1203
|
-
})
|
|
1204
|
-
.catch((e: any) => {
|
|
1205
|
-
onError && onError(e);
|
|
1206
|
-
})
|
|
1207
|
-
},
|
|
1208
|
-
ccGroupMemberAdded: ({ message }: { message: CometChat.BaseMessage }) => {
|
|
1209
|
-
updateConversationLastMessage(message)
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
)
|
|
1213
|
-
|
|
1214
|
-
CometChatUIEventHandler.addUserListener(
|
|
1215
|
-
userListenerId,
|
|
1216
|
-
{
|
|
1217
|
-
ccUserBlocked: ({ user }: any) => {
|
|
1218
|
-
if(conversationsRequestBuilder && conversationsRequestBuilder.build().isIncludeBlockedUsers()) {
|
|
1219
|
-
return;
|
|
1220
|
-
}
|
|
1221
|
-
conversationListRef?.current?.removeItemFromList(user['conversationId']);
|
|
1222
|
-
removeItemFromSelectionList(user['conversationId']);
|
|
1223
|
-
}
|
|
1224
|
-
}
|
|
1225
|
-
)
|
|
1004
|
+
.catch((e) => {
|
|
1005
|
+
onError && onError(e);
|
|
1006
|
+
});
|
|
1007
|
+
},
|
|
1008
|
+
onIncomingCallCancelled: (call: any) => {
|
|
1009
|
+
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
1010
|
+
.then((conversation) => {
|
|
1011
|
+
if (!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
1012
|
+
return;
|
|
1013
|
+
}
|
|
1014
|
+
conversation = updateUnreadMessageCount(conversation);
|
|
1015
|
+
conversation.setLastMessage(call);
|
|
1016
|
+
conversationListRef.current!.updateList(conversation);
|
|
1017
|
+
})
|
|
1018
|
+
.catch((e) => {
|
|
1019
|
+
onError && onError(e);
|
|
1020
|
+
});
|
|
1021
|
+
},
|
|
1022
|
+
})
|
|
1023
|
+
);
|
|
1226
1024
|
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1025
|
+
// Listen for group events.
|
|
1026
|
+
CometChat.addGroupListener(
|
|
1027
|
+
groupListenerId,
|
|
1028
|
+
new CometChat.GroupListener({
|
|
1029
|
+
onGroupMemberScopeChanged: (
|
|
1030
|
+
message: CometChat.Action,
|
|
1031
|
+
changedUser: CometChat.GroupMember,
|
|
1032
|
+
newScope: CometChat.GroupMemberScope,
|
|
1033
|
+
oldScope: CometChat.GroupMemberScope,
|
|
1034
|
+
changedGroup: CometChat.Group
|
|
1035
|
+
) => {
|
|
1036
|
+
groupHandler(message, {
|
|
1037
|
+
action: "scopeChange",
|
|
1038
|
+
actionOn: changedUser,
|
|
1039
|
+
newScope: newScope,
|
|
1040
|
+
oldScope: oldScope,
|
|
1041
|
+
group: changedGroup,
|
|
1042
|
+
});
|
|
1043
|
+
},
|
|
1044
|
+
onGroupMemberKicked: (
|
|
1045
|
+
message: CometChat.Action,
|
|
1046
|
+
kickedUser: CometChat.User,
|
|
1047
|
+
kickedBy: CometChat.User,
|
|
1048
|
+
kickedFrom: CometChat.Group
|
|
1049
|
+
) => {
|
|
1050
|
+
groupHandler(message, {
|
|
1051
|
+
action: "kicked",
|
|
1052
|
+
actionOn: kickedUser,
|
|
1053
|
+
actionBy: kickedBy,
|
|
1054
|
+
group: kickedFrom,
|
|
1055
|
+
});
|
|
1056
|
+
},
|
|
1057
|
+
onGroupMemberLeft: (
|
|
1058
|
+
message: CometChat.Action,
|
|
1059
|
+
leavingUser: CometChat.User,
|
|
1060
|
+
group: CometChat.Group
|
|
1061
|
+
) => {
|
|
1062
|
+
groupHandler(message, { action: "left", actionOn: leavingUser, group });
|
|
1063
|
+
},
|
|
1064
|
+
onGroupMemberUnbanned: (message: CometChat.Action) => {
|
|
1065
|
+
groupHandler(message);
|
|
1066
|
+
},
|
|
1067
|
+
onGroupMemberBanned: (
|
|
1068
|
+
message: CometChat.Action,
|
|
1069
|
+
bannedUser: CometChat.User,
|
|
1070
|
+
bannedBy: CometChat.User,
|
|
1071
|
+
bannedFrom: CometChat.Group
|
|
1072
|
+
) => {
|
|
1073
|
+
groupHandler(message, {
|
|
1074
|
+
action: "banned",
|
|
1075
|
+
actionOn: bannedUser,
|
|
1076
|
+
actionBy: bannedBy,
|
|
1077
|
+
group: bannedFrom,
|
|
1078
|
+
});
|
|
1079
|
+
},
|
|
1080
|
+
onMemberAddedToGroup: (
|
|
1081
|
+
message: CometChat.Action,
|
|
1082
|
+
userAdded: CometChat.User,
|
|
1083
|
+
userAddedBy: CometChat.User,
|
|
1084
|
+
userAddedIn: CometChat.Group
|
|
1085
|
+
) => {
|
|
1086
|
+
if (onMemberAddedToGroupDebounceTimer.current) {
|
|
1087
|
+
clearTimeout(onMemberAddedToGroupDebounceTimer.current);
|
|
1088
|
+
}
|
|
1089
|
+
onMemberAddedToGroupDebounceTimer.current = setTimeout(() => {
|
|
1090
|
+
groupHandler(message, {
|
|
1091
|
+
action: "joined",
|
|
1092
|
+
actionOn: userAdded,
|
|
1093
|
+
actionBy: userAddedBy,
|
|
1094
|
+
group: userAddedIn,
|
|
1095
|
+
});
|
|
1096
|
+
}, 50);
|
|
1097
|
+
},
|
|
1098
|
+
onGroupMemberJoined: (message: CometChat.Action) => {
|
|
1099
|
+
groupHandler(message);
|
|
1100
|
+
},
|
|
1101
|
+
})
|
|
1102
|
+
);
|
|
1284
1103
|
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1104
|
+
// Listen for conversation deletion events.
|
|
1105
|
+
CometChatUIEventHandler.addConversationListener(conversationListenerId, {
|
|
1106
|
+
ccConversationDeleted: ({ conversation }: { conversation: CometChat.Conversation }) => {
|
|
1107
|
+
conversationListRef.current!.removeItemFromList(conversation.getConversationId());
|
|
1108
|
+
removeItemFromSelectionList(conversation.getConversationId());
|
|
1109
|
+
},
|
|
1110
|
+
});
|
|
1111
|
+
// Listen for message events.
|
|
1112
|
+
CometChatUIEventHandler.addMessageListener(messageListenerId, {
|
|
1113
|
+
ccMessageSent: ({ message, status }: any) => {
|
|
1114
|
+
if (status == MessageStatusConstants.success) {
|
|
1115
|
+
if (!shouldUpdateLastMessageAndUnreadCount(message)) {
|
|
1116
|
+
return;
|
|
1117
|
+
}
|
|
1118
|
+
updateLastMessage(message);
|
|
1293
1119
|
}
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
if (
|
|
1306
|
-
|
|
1307
|
-
backgroundColor = PASSWORD_GROUP_COLOR;
|
|
1120
|
+
},
|
|
1121
|
+
ccMessageRead: ({ message }: { message: CometChat.BaseMessage }) => {
|
|
1122
|
+
checkAndUpdateLastMessage(message);
|
|
1123
|
+
},
|
|
1124
|
+
ccMessageDeleted: ({ message }: { message: CometChat.BaseMessage }) => {
|
|
1125
|
+
checkAndUpdateLastMessage(message);
|
|
1126
|
+
},
|
|
1127
|
+
ccMessageEdited: ({ message }: { message: CometChat.BaseMessage }) => {
|
|
1128
|
+
checkAndUpdateLastMessage(message);
|
|
1129
|
+
},
|
|
1130
|
+
onTextMessageReceived: (textMessage: CometChat.TextMessage) => {
|
|
1131
|
+
if (!shouldUpdateLastMessageAndUnreadCount(textMessage)) {
|
|
1132
|
+
return;
|
|
1308
1133
|
}
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1134
|
+
messageEventHandler(textMessage);
|
|
1135
|
+
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
1136
|
+
},
|
|
1137
|
+
onMediaMessageReceived: (mediaMessage: CometChat.MediaMessage) => {
|
|
1138
|
+
if (!shouldUpdateLastMessageAndUnreadCount(mediaMessage)) {
|
|
1139
|
+
return;
|
|
1312
1140
|
}
|
|
1313
|
-
|
|
1314
|
-
|
|
1141
|
+
messageEventHandler(mediaMessage);
|
|
1142
|
+
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
1143
|
+
},
|
|
1144
|
+
onCustomMessageReceived: (customMessage: CometChat.CustomMessage) => {
|
|
1145
|
+
if (!shouldUpdateLastMessageAndUnreadCount(customMessage)) {
|
|
1146
|
+
return;
|
|
1315
1147
|
}
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1148
|
+
messageEventHandler(customMessage);
|
|
1149
|
+
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
1150
|
+
},
|
|
1151
|
+
onMessageDeleted: (deletedMessage: CometChat.BaseMessage) => {
|
|
1152
|
+
checkAndUpdateLastMessage(deletedMessage);
|
|
1153
|
+
},
|
|
1154
|
+
onMessageEdited: (editedMessage: CometChat.BaseMessage) => {
|
|
1155
|
+
checkAndUpdateLastMessage(editedMessage);
|
|
1156
|
+
},
|
|
1157
|
+
onMessagesRead: (messageReceipt: CometChat.MessageReceipt) => {
|
|
1158
|
+
updateMessageReceipt(messageReceipt);
|
|
1159
|
+
},
|
|
1160
|
+
onMessagesDelivered: (messageReceipt: CometChat.MessageReceipt) => {
|
|
1161
|
+
updateMessageReceipt(messageReceipt);
|
|
1162
|
+
},
|
|
1163
|
+
onMessagesDeliveredToAll: (messageReceipt: CometChat.MessageReceipt) => {
|
|
1164
|
+
updateMessageReceipt(messageReceipt);
|
|
1165
|
+
},
|
|
1166
|
+
onMessagesReadByAll: (messageReceipt: CometChat.MessageReceipt) => {
|
|
1167
|
+
updateMessageReceipt(messageReceipt);
|
|
1168
|
+
},
|
|
1169
|
+
onTypingStarted: (typingIndicator: CometChat.TypingIndicator) => {
|
|
1170
|
+
typingEventHandler(typingIndicator, true);
|
|
1171
|
+
},
|
|
1172
|
+
onTypingEnded: (typingIndicator: CometChat.TypingIndicator) => {
|
|
1173
|
+
typingEventHandler(typingIndicator, false);
|
|
1174
|
+
},
|
|
1175
|
+
onFormMessageReceived: (formMessage: any) => {
|
|
1176
|
+
if (!shouldUpdateLastMessageAndUnreadCount(formMessage)) {
|
|
1177
|
+
return;
|
|
1178
|
+
}
|
|
1179
|
+
messageEventHandler(formMessage);
|
|
1180
|
+
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
1181
|
+
},
|
|
1182
|
+
onCardMessageReceived: (cardMessage: any) => {
|
|
1183
|
+
if (!shouldUpdateLastMessageAndUnreadCount(cardMessage)) {
|
|
1184
|
+
return;
|
|
1185
|
+
}
|
|
1186
|
+
messageEventHandler(cardMessage);
|
|
1187
|
+
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
1188
|
+
},
|
|
1189
|
+
onSchedulerMessageReceived: (schedulerMessage: any) => {
|
|
1190
|
+
if (!shouldUpdateLastMessageAndUnreadCount(schedulerMessage)) {
|
|
1191
|
+
return;
|
|
1192
|
+
}
|
|
1193
|
+
messageEventHandler(schedulerMessage);
|
|
1194
|
+
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
1195
|
+
},
|
|
1196
|
+
onCustomInteractiveMessageReceived: (customInteractiveMessage: any) => {
|
|
1197
|
+
if (!shouldUpdateLastMessageAndUnreadCount(customInteractiveMessage)) {
|
|
1198
|
+
return;
|
|
1199
|
+
}
|
|
1200
|
+
messageEventHandler(customInteractiveMessage);
|
|
1201
|
+
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
1202
|
+
},
|
|
1203
|
+
});
|
|
1204
|
+
// Listen for additional group events.
|
|
1205
|
+
CometChatUIEventHandler.addGroupListener(groupListenerId, {
|
|
1206
|
+
ccGroupCreated: ({ group }: { group: CometChat.Group }) => {
|
|
1207
|
+
CometChat.getConversation(
|
|
1208
|
+
group.getGuid(),
|
|
1209
|
+
CometChatUiKitConstants.ConversationTypeConstants.group
|
|
1210
|
+
).then((conversation) => {
|
|
1211
|
+
conversationListRef.current?.addItemToList(conversation, 0);
|
|
1212
|
+
});
|
|
1213
|
+
},
|
|
1214
|
+
ccGroupDeleted: ({ group }: { group: CometChat.Group }) => {
|
|
1215
|
+
CometChat.getConversation(
|
|
1216
|
+
group.getGuid(),
|
|
1217
|
+
CometChatUiKitConstants.ConversationTypeConstants.group
|
|
1218
|
+
).then((conversation) => {
|
|
1219
|
+
conversationListRef.current?.removeItemFromList(conversation.getConversationId());
|
|
1220
|
+
removeItemFromSelectionList(conversation.getConversationId());
|
|
1221
|
+
});
|
|
1222
|
+
},
|
|
1223
|
+
ccGroupLeft: ({ leftGroup }: { leftGroup: CometChat.Group }) => {
|
|
1224
|
+
const foundConversation = conversationListRef.current?.getAllListItems().find((conv) => {
|
|
1225
|
+
const convWith = conv.getConversationWith();
|
|
1226
|
+
return convWith instanceof CometChat.Group && convWith.getGuid() === leftGroup.getGuid();
|
|
1227
|
+
});
|
|
1228
|
+
if (foundConversation) {
|
|
1229
|
+
conversationListRef.current?.removeItemFromList(foundConversation.getConversationId());
|
|
1230
|
+
removeItemFromSelectionList(foundConversation.getConversationId());
|
|
1322
1231
|
}
|
|
1232
|
+
},
|
|
1233
|
+
ccGroupMemberKicked: ({
|
|
1234
|
+
message,
|
|
1235
|
+
kickedFrom,
|
|
1236
|
+
}: {
|
|
1237
|
+
message: CometChat.Action;
|
|
1238
|
+
kickedFrom: CometChat.Group;
|
|
1239
|
+
}) => {
|
|
1240
|
+
if (!shouldUpdateLastMessageAndUnreadCount(message)) {
|
|
1241
|
+
return;
|
|
1242
|
+
}
|
|
1243
|
+
updateConversationLastMessage(message, kickedFrom);
|
|
1244
|
+
},
|
|
1245
|
+
ccGroupMemberBanned: ({ message }: { message: CometChat.Action }) => {
|
|
1246
|
+
if (!shouldUpdateLastMessageAndUnreadCount(message)) {
|
|
1247
|
+
return;
|
|
1248
|
+
}
|
|
1249
|
+
groupHandler(message);
|
|
1250
|
+
},
|
|
1251
|
+
ccGroupMemberUnBanned: ({ message }: { message: CometChat.Action }) => {
|
|
1252
|
+
if (!shouldUpdateLastMessageAndUnreadCount(message)) {
|
|
1253
|
+
return;
|
|
1254
|
+
}
|
|
1255
|
+
groupHandler(message);
|
|
1256
|
+
},
|
|
1257
|
+
ccOwnershipChanged: ({ message }: { message: CometChat.Action }) => {
|
|
1258
|
+
if (!shouldUpdateLastMessageAndUnreadCount(message)) {
|
|
1259
|
+
return;
|
|
1260
|
+
}
|
|
1261
|
+
CometChat.CometChatHelper.getConversationFromMessage(message)
|
|
1262
|
+
.then((conversation) => {
|
|
1263
|
+
conversationListRef.current?.updateList(conversation);
|
|
1264
|
+
})
|
|
1265
|
+
.catch((e) => {
|
|
1266
|
+
onError && onError(e);
|
|
1267
|
+
});
|
|
1268
|
+
},
|
|
1269
|
+
ccGroupMemberAdded: ({
|
|
1270
|
+
message,
|
|
1271
|
+
userAddedIn,
|
|
1272
|
+
}: {
|
|
1273
|
+
message: CometChat.Action;
|
|
1274
|
+
userAddedIn: CometChat.Group;
|
|
1275
|
+
}) => {
|
|
1276
|
+
if (!shouldUpdateLastMessageAndUnreadCount(message)) {
|
|
1277
|
+
return;
|
|
1278
|
+
}
|
|
1279
|
+
updateConversationLastMessage(message, userAddedIn);
|
|
1280
|
+
},
|
|
1281
|
+
});
|
|
1323
1282
|
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1283
|
+
// Listen for user block events.
|
|
1284
|
+
CometChatUIEventHandler.addUserListener(userListenerId, {
|
|
1285
|
+
ccUserBlocked: ({ user }: { user: CometChat.User }) => {
|
|
1286
|
+
const foundConversation = conversationListRef.current?.getAllListItems().find((conv) => {
|
|
1287
|
+
const convWith = conv.getConversationWith();
|
|
1288
|
+
return convWith instanceof CometChat.User && convWith.getUid() === user.getUid();
|
|
1289
|
+
});
|
|
1290
|
+
if (foundConversation) {
|
|
1291
|
+
conversationListRef?.current?.removeItemFromList(foundConversation.getConversationId());
|
|
1292
|
+
removeItemFromSelectionList(foundConversation.getConversationId());
|
|
1293
|
+
}
|
|
1294
|
+
},
|
|
1295
|
+
});
|
|
1296
|
+
|
|
1297
|
+
// Listen for call events via UI event handler.
|
|
1298
|
+
CometChatUIEventHandler.addCallListener(callListenerId, {
|
|
1299
|
+
ccOutgoingCall: ({ call }: any) => {
|
|
1300
|
+
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
1301
|
+
.then((conversation) => {
|
|
1302
|
+
if (!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
1303
|
+
return;
|
|
1330
1304
|
}
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1305
|
+
conversation = updateUnreadMessageCount(conversation);
|
|
1306
|
+
conversationListRef.current!.updateList(conversation);
|
|
1307
|
+
})
|
|
1308
|
+
.catch((e) => {
|
|
1309
|
+
onError && onError(e);
|
|
1310
|
+
});
|
|
1311
|
+
},
|
|
1312
|
+
ccCallAccepted: ({ call }: any) => {
|
|
1313
|
+
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
1314
|
+
.then((conversation) => {
|
|
1315
|
+
if (!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
1316
|
+
return;
|
|
1317
|
+
}
|
|
1318
|
+
conversation = updateUnreadMessageCount(conversation);
|
|
1319
|
+
conversationListRef.current!.updateList(conversation);
|
|
1320
|
+
})
|
|
1321
|
+
.catch((e) => {
|
|
1322
|
+
onError && onError(e);
|
|
1323
|
+
});
|
|
1324
|
+
},
|
|
1325
|
+
ccCallRejected: ({ call }: any) => {
|
|
1326
|
+
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
1327
|
+
.then((conversation) => {
|
|
1328
|
+
if (!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
1329
|
+
return;
|
|
1330
|
+
}
|
|
1331
|
+
conversation = updateUnreadMessageCount(conversation);
|
|
1332
|
+
conversationListRef.current!.updateList(conversation);
|
|
1333
|
+
})
|
|
1334
|
+
.catch((e) => {
|
|
1335
|
+
onError && onError(e);
|
|
1336
|
+
});
|
|
1337
|
+
},
|
|
1338
|
+
ccCallEnded: ({ call }: any) => {
|
|
1339
|
+
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
1340
|
+
.then((conversation) => {
|
|
1341
|
+
if (!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
1342
|
+
return;
|
|
1343
|
+
}
|
|
1344
|
+
conversation = updateUnreadMessageCount(conversation);
|
|
1345
|
+
conversationListRef.current!.updateList(conversation);
|
|
1346
|
+
})
|
|
1347
|
+
.catch((e) => {
|
|
1348
|
+
onError && onError(e);
|
|
1349
|
+
});
|
|
1350
|
+
},
|
|
1351
|
+
});
|
|
1352
|
+
|
|
1353
|
+
// Cleanup all listeners on unmount.
|
|
1354
|
+
return () => {
|
|
1355
|
+
CometChat.removeUserListener(userListenerId);
|
|
1356
|
+
CometChat.removeCallListener(callListenerId);
|
|
1357
|
+
CometChat.removeGroupListener(groupListenerId);
|
|
1358
|
+
CometChatUIEventHandler.removeMessageListener(messageListenerId);
|
|
1359
|
+
CometChatUIEventHandler.removeConversationListener(conversationListenerId);
|
|
1360
|
+
CometChatUIEventHandler.removeGroupListener(groupListenerId);
|
|
1361
|
+
CometChatUIEventHandler.removeUserListener(userListenerId);
|
|
1362
|
+
};
|
|
1363
|
+
}, []);
|
|
1364
|
+
|
|
1365
|
+
/**
|
|
1366
|
+
* ConversationItemView renders an individual conversation item.
|
|
1367
|
+
* Uses custom leading, title, subtitle, and trailing views if provided.
|
|
1368
|
+
*/
|
|
1369
|
+
const ConversationItemView = React.memo(({ item: conversation }: any) => {
|
|
1370
|
+
if (!conversation) return null;
|
|
1371
|
+
// Extract conversation details.
|
|
1372
|
+
const { conversationWith, conversationType } = conversation;
|
|
1373
|
+
const lastMessage = CometChatConversationUtils.getLastMessage(conversation);
|
|
1374
|
+
const { name } = conversationWith || {};
|
|
1375
|
+
let avatarIcon = conversationWith[conversationType == "group" ? "icon" : "avatar"];
|
|
1376
|
+
|
|
1377
|
+
// Determine status indicator based on conversation type and user status.
|
|
1378
|
+
const statusIndicatorType = useMemo(() => {
|
|
1379
|
+
if (conversation?.conversationWith?.type == GroupTypeConstants.password) {
|
|
1380
|
+
return "protected";
|
|
1381
|
+
} else if (conversation?.conversationWith?.type == GroupTypeConstants.private) {
|
|
1382
|
+
return "private";
|
|
1383
|
+
} else if (conversationWith.status == "online") {
|
|
1384
|
+
return "online";
|
|
1385
|
+
}
|
|
1386
|
+
return "offline";
|
|
1387
|
+
}, [conversation]);
|
|
1356
1388
|
|
|
1357
|
-
/**
|
|
1358
|
-
* Component template
|
|
1359
|
-
*/
|
|
1360
1389
|
return (
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
ListItemView={ConversationItemView}
|
|
1374
|
-
EmptyStateView={EmptyStateView ? EmptyStateView : () => <EmptyView />}
|
|
1375
|
-
ErrorStateView={ErrorStateView ? ErrorStateView : () => <ErrorView />}
|
|
1376
|
-
onBack={onBack}
|
|
1377
|
-
backButtonIcon={backButtonIcon}
|
|
1378
|
-
showBackButton={showBackButton}
|
|
1379
|
-
onSelection={(items) => {
|
|
1380
|
-
if(!items.length) return
|
|
1381
|
-
onSelection && onSelection(items);
|
|
1382
|
-
setSelecting(false);
|
|
1383
|
-
setSelectedConversations([]);
|
|
1384
|
-
}}
|
|
1385
|
-
SubtitleView={props.SubtitleView}
|
|
1386
|
-
disableUsersPresence={disableUsersPresence}
|
|
1387
|
-
options={options}
|
|
1388
|
-
hideSeparator={hideSeparator}
|
|
1389
|
-
listStyle={{ ..._style, background: _style.backgroundColor }}
|
|
1390
|
-
selectionMode={selecting ? selectionMode : "none"}
|
|
1391
|
-
hideError={hideError}
|
|
1390
|
+
<CometChatListItem
|
|
1391
|
+
id={conversation.conversationId}
|
|
1392
|
+
avatarName={name}
|
|
1393
|
+
avatarURL={avatarIcon}
|
|
1394
|
+
statusIndicatorType={statusIndicatorType}
|
|
1395
|
+
LeadingView={LeadingView && LeadingView(conversation)}
|
|
1396
|
+
TitleView={TitleView && TitleView(conversation)}
|
|
1397
|
+
SubtitleView={
|
|
1398
|
+
(SubtitleView && SubtitleView(conversation)) || (
|
|
1399
|
+
<LastMessageView
|
|
1400
|
+
conversations={conversation}
|
|
1401
|
+
typingText={conversation?.["lastMessage"]?.["typing"]}
|
|
1392
1402
|
/>
|
|
1393
|
-
|
|
1403
|
+
)
|
|
1404
|
+
}
|
|
1405
|
+
title={name}
|
|
1406
|
+
TrailingView={
|
|
1407
|
+
TrailingView
|
|
1408
|
+
? TrailingView(conversation)
|
|
1409
|
+
: lastMessage
|
|
1410
|
+
? getTrailingView(conversation)
|
|
1411
|
+
: null
|
|
1412
|
+
}
|
|
1413
|
+
onPress={conversationClicked.bind(this, conversation)}
|
|
1414
|
+
onLongPress={(id: string | undefined, e?: GestureResponderEvent) => {
|
|
1415
|
+
if (onItemLongPress) {
|
|
1416
|
+
onItemLongPress(conversation);
|
|
1417
|
+
return;
|
|
1418
|
+
}
|
|
1419
|
+
if (id && e && "nativeEvent" in e) {
|
|
1420
|
+
longPressId.current = id;
|
|
1421
|
+
tooltipPositon.current = {
|
|
1422
|
+
pageX: e.nativeEvent.pageX,
|
|
1423
|
+
pageY: e.nativeEvent.pageY,
|
|
1424
|
+
};
|
|
1425
|
+
setTooltipVisible(true);
|
|
1426
|
+
}
|
|
1427
|
+
}}
|
|
1428
|
+
{...mergedStyles.itemStyle}
|
|
1429
|
+
/>
|
|
1394
1430
|
);
|
|
1395
|
-
}
|
|
1431
|
+
});
|
|
1432
|
+
|
|
1433
|
+
return (
|
|
1434
|
+
<View style={mergedStyles.containerStyle}>
|
|
1435
|
+
<TooltipMenu
|
|
1436
|
+
visible={tooltipVisible}
|
|
1437
|
+
onClose={() => {
|
|
1438
|
+
setTooltipVisible(false);
|
|
1439
|
+
}}
|
|
1440
|
+
event={{
|
|
1441
|
+
nativeEvent: tooltipPositon.current,
|
|
1442
|
+
}}
|
|
1443
|
+
menuItems={[
|
|
1444
|
+
{
|
|
1445
|
+
text: "Delete",
|
|
1446
|
+
onPress: () => {
|
|
1447
|
+
setConfirmDelete(longPressId.current);
|
|
1448
|
+
setTooltipVisible(false);
|
|
1449
|
+
},
|
|
1450
|
+
icon: (
|
|
1451
|
+
<Delete
|
|
1452
|
+
color={theme.color.error}
|
|
1453
|
+
height={theme.spacing.spacing.s6}
|
|
1454
|
+
width={theme.spacing.spacing.s6}
|
|
1455
|
+
/>
|
|
1456
|
+
),
|
|
1457
|
+
textColor: theme.color.error,
|
|
1458
|
+
},
|
|
1459
|
+
]}
|
|
1460
|
+
/>
|
|
1461
|
+
<CometChatConfirmDialog
|
|
1462
|
+
titleText={localize("DELETE_THIS_CONVERSATION")}
|
|
1463
|
+
icon={<Icon name='delete' size={theme.spacing.spacing.s12} color={theme.color.error} />}
|
|
1464
|
+
cancelButtonText={localize("CANCEL")}
|
|
1465
|
+
confirmButtonText={localize("DELETE")}
|
|
1466
|
+
messageText={localize("SURE_TO_DELETE_CHAT")}
|
|
1467
|
+
isOpen={confirmDelete != undefined}
|
|
1468
|
+
onCancel={() => setConfirmDelete(undefined)}
|
|
1469
|
+
onConfirm={() => {
|
|
1470
|
+
removeConversation(confirmDelete!);
|
|
1471
|
+
setConfirmDelete(undefined);
|
|
1472
|
+
}}
|
|
1473
|
+
/>
|
|
1474
|
+
<CometChatList
|
|
1475
|
+
AppBarOptions={AppBarOptions}
|
|
1476
|
+
onError={onError}
|
|
1477
|
+
ref={conversationListRef}
|
|
1478
|
+
requestBuilder={
|
|
1479
|
+
conversationsRequestBuilder || new CometChat.ConversationsRequestBuilder().setLimit(30)
|
|
1480
|
+
}
|
|
1481
|
+
title={localize("CHATS")}
|
|
1482
|
+
listStyle={mergedStyles}
|
|
1483
|
+
hideSearch={true}
|
|
1484
|
+
hideSubmitButton={hideSubmitButton}
|
|
1485
|
+
listItemKey={"conversationId"}
|
|
1486
|
+
LoadingView={LoadingView ?? (() => <Skeleton />)}
|
|
1487
|
+
ItemView={
|
|
1488
|
+
ItemView ??
|
|
1489
|
+
((item: CometChat.Conversation) => {
|
|
1490
|
+
return <ConversationItemView item={item} />;
|
|
1491
|
+
})
|
|
1492
|
+
}
|
|
1493
|
+
EmptyView={EmptyView ? EmptyView : () => <EmptyStateView />}
|
|
1494
|
+
ErrorView={ErrorView ? ErrorView : () => <ErrorStateView />}
|
|
1495
|
+
onBack={onBack}
|
|
1496
|
+
hideBackButton={hideBackButton}
|
|
1497
|
+
onSelection={(items) => {
|
|
1498
|
+
onSelection && onSelection(items);
|
|
1499
|
+
setSelecting(false);
|
|
1500
|
+
setSelectedConversations([]);
|
|
1501
|
+
}}
|
|
1502
|
+
selectionMode={selecting ? selectionMode : "none"}
|
|
1503
|
+
hideError={hideError}
|
|
1504
|
+
hideHeader={hideHeader}
|
|
1505
|
+
/>
|
|
1506
|
+
</View>
|
|
1507
|
+
);
|
|
1508
|
+
};
|