@cometchat/chat-uikit-react-native 4.3.16 → 4.3.18
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/package.json +1 -1
- package/src/AI/AIAssistBot/AIAssistBotDecorator.tsx +20 -15
- package/src/AI/AIAssistBot/AIAssistBotStyle.ts +2 -2
- package/src/AI/AIAssistBot/AIAssistBotView.tsx +16 -14
- package/src/AI/AIAssistBot/configuration.ts +8 -7
- package/src/AI/AIAssistBot/resources/index.ts +1 -0
- package/src/AI/AIBaseConfiguration.ts +1 -0
- package/src/AI/AIConversationStarter/AIConversationStarterDecorator.tsx +27 -26
- package/src/AI/AIConversationStarter/AIConversationStarterStyle.ts +1 -0
- package/src/AI/AIConversationStarter/style.ts +29 -31
- package/src/AI/AIConversationSummary/AIConversationSummaryDecorator.tsx +14 -13
- package/src/AI/AIConversationSummary/AIConversationSummaryView.tsx +5 -4
- package/src/AI/AIConversationSummary/resources/index.ts +1 -0
- package/src/AI/AIExtensionDataSource.ts +1 -0
- package/src/AI/AISmartReplies/AISmartRepliesDecorator.tsx +28 -27
- package/src/AI/AISmartReplies/configuration.ts +2 -0
- package/src/AI/CardView.tsx +5 -5
- package/src/AI/resources/index.ts +3 -0
- package/src/AI/style.ts +68 -80
- package/src/CometChatAddMembers/AddMembersConfiguration.tsx +1 -0
- package/src/CometChatAddMembers/CometChatAddMembers.tsx +14 -13
- package/src/CometChatAddMembers/index.ts +10 -8
- package/src/CometChatBannedMembers/BannedMembersConfiguration.tsx +1 -0
- package/src/CometChatBannedMembers/CometChatBannedMembers.tsx +11 -8
- package/src/CometChatBannedMembers/index.ts +12 -7
- package/src/CometChatBannedMembers/resources/index.ts +1 -0
- package/src/CometChatContacts/CometChatContacts.tsx +9 -9
- package/src/CometChatContacts/ContactsConfiguration.tsx +1 -0
- package/src/CometChatContacts/Header.tsx +4 -4
- package/src/CometChatContacts/index.ts +5 -3
- package/src/CometChatConversations/CometChatConversations.tsx +289 -221
- package/src/CometChatConversations/ConversationsConfiguration.ts +14 -0
- package/src/CometChatConversations/index.ts +21 -10
- package/src/CometChatConversations/resources/index.ts +14 -0
- package/src/CometChatConversationsWithMessages/CometChatConversationsWithMessages.tsx +7 -5
- package/src/CometChatConversationsWithMessages/index.ts +6 -5
- package/src/CometChatConversationsWithMessages/resources/index.ts +1 -0
- package/src/CometChatCreateGroup/CometChatCreateGroup.tsx +30 -30
- package/src/CometChatCreateGroup/CreateGroupConfiguration.ts +1 -0
- package/src/CometChatCreateGroup/Header.tsx +1 -1
- package/src/CometChatCreateGroup/index.ts +5 -6
- package/src/CometChatCreateGroup/resources/index.ts +3 -0
- package/src/CometChatDetails/CometChatDetails.tsx +29 -28
- package/src/CometChatDetails/DetailsConfiguration.tsx +1 -0
- package/src/CometChatDetails/Header.tsx +1 -1
- package/src/CometChatDetails/index.ts +17 -15
- package/src/CometChatDetails/listners.ts +16 -16
- package/src/CometChatDetails/resources/index.ts +5 -0
- package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +62 -52
- package/src/CometChatGroupMembers/GroupMemberConfiguration.ts +1 -1
- package/src/CometChatGroupMembers/GroupMemberStyle.ts +3 -3
- package/src/CometChatGroupMembers/index.ts +8 -16
- package/src/CometChatGroupMembers/resources/index.ts +5 -0
- package/src/CometChatGroups/CometChatGroups.tsx +46 -46
- package/src/CometChatGroups/GroupsConfiguration.ts +10 -9
- package/src/CometChatGroups/GroupsStyle.ts +1 -1
- package/src/CometChatGroups/index.ts +11 -10
- package/src/CometChatGroups/resources/index.ts +10 -0
- package/src/CometChatGroupsWithMessages/CometChatGroupsWithMessages.tsx +9 -8
- package/src/CometChatGroupsWithMessages/index.ts +6 -5
- package/src/CometChatGroupsWithMessages/resources/index.ts +1 -0
- package/src/CometChatJoinProtectedGroup/CometChatJoinProtectedGroup.tsx +22 -21
- package/src/CometChatJoinProtectedGroup/Header.tsx +1 -1
- package/src/CometChatJoinProtectedGroup/JoinProtectedGroupConfiguration.ts +1 -0
- package/src/CometChatJoinProtectedGroup/index.ts +5 -6
- package/src/CometChatJoinProtectedGroup/resources/index.ts +2 -0
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +62 -59
- package/src/CometChatMessageComposer/MessageComposerConfiguration.tsx +1 -0
- package/src/CometChatMessageComposer/index.ts +6 -7
- package/src/CometChatMessageComposer/resources/index.ts +10 -0
- package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +33 -31
- package/src/CometChatMessageHeader/MessageHeaderConfiguration.tsx +1 -0
- package/src/CometChatMessageHeader/index.ts +12 -13
- package/src/CometChatMessageHeader/listners.ts +18 -18
- package/src/CometChatMessageHeader/resources/index.ts +3 -0
- package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +28 -24
- package/src/CometChatMessageInformation/index.ts +8 -8
- package/src/CometChatMessageInformation/resources/index.ts +1 -0
- package/src/CometChatMessageList/CometChatMessageList.tsx +289 -227
- package/src/CometChatMessageList/MessageListConfiguration.ts +50 -25
- package/src/CometChatMessageList/index.ts +16 -18
- package/src/CometChatMessageList/resources/index.ts +7 -0
- package/src/CometChatMessages/CometChatMessages.tsx +29 -26
- package/src/CometChatMessages/MessagesConfiguration.ts +2 -0
- package/src/CometChatMessages/index.ts +8 -7
- package/src/CometChatMessages/resources/index.ts +1 -0
- package/src/CometChatTabs/CometChatTabs.tsx +13 -23
- package/src/CometChatTabs/CometChatTabsStyle.ts +2 -0
- package/src/CometChatTabs/index.ts +3 -8
- package/src/CometChatThreadedMessages/CometChatThreadedMessages.tsx +37 -37
- package/src/CometChatThreadedMessages/Header.tsx +2 -2
- package/src/CometChatThreadedMessages/ThreadedMessagesConfiguration.ts +1 -0
- package/src/CometChatThreadedMessages/index.ts +11 -12
- package/src/CometChatThreadedMessages/resources/index.ts +6 -0
- package/src/CometChatTransferOwnership/CometChatTransferOwnership.tsx +5 -5
- package/src/CometChatTransferOwnership/TransferOwnershipConfiguration.ts +1 -0
- package/src/CometChatTransferOwnership/index.ts +10 -11
- package/src/CometChatUsers/CometChatUsers.tsx +11 -11
- package/src/CometChatUsers/UsersConfiguration.tsx +1 -0
- package/src/CometChatUsers/index.ts +8 -6
- package/src/CometChatUsersWithMessages/CometChatUsersWithMessages.tsx +6 -5
- package/src/CometChatUsersWithMessages/index.ts +6 -5
- package/src/calls/CallUtils.ts +4 -3
- package/src/calls/CallingDetailsUtils.tsx +9 -8
- package/src/calls/CallingExtension.tsx +2 -2
- package/src/calls/CallingExtentionDecorator.tsx +17 -17
- package/src/calls/CometChatCallBubble/CometChatCallBubble.tsx +3 -2
- package/src/calls/CometChatCallBubble/index.ts +14 -10
- package/src/calls/CometChatCallBubble/resources/index.ts +3 -0
- package/src/calls/CometChatCallButtons/CometChatCallButtonConfiguration.ts +1 -0
- package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +19 -18
- package/src/calls/CometChatCallButtons/index.ts +10 -8
- package/src/calls/CometChatCallButtons/resources/index.ts +2 -0
- package/src/calls/CometChatCallLogDetails/CallLogDetailsConfiguration.ts +2 -0
- package/src/calls/CometChatCallLogDetails/CometChatCallLogDetails.tsx +14 -13
- package/src/calls/CometChatCallLogDetails/index.ts +21 -10
- package/src/calls/CometChatCallLogDetails/resources/index.ts +1 -0
- package/src/calls/CometChatCallLogHistory/CallLogHistoryConfiguration.ts +3 -1
- package/src/calls/CometChatCallLogHistory/CometChatCallLogHistory.tsx +25 -24
- package/src/calls/CometChatCallLogHistory/index.ts +21 -10
- package/src/calls/CometChatCallLogHistory/resources/index.ts +13 -0
- package/src/calls/CometChatCallLogParticipants/CallLogParticipantsConfiguration.ts +4 -2
- package/src/calls/CometChatCallLogParticipants/CometChatCallLogParticipants.tsx +13 -12
- package/src/calls/CometChatCallLogParticipants/index.ts +21 -10
- package/src/calls/CometChatCallLogParticipants/resources/index.ts +1 -0
- package/src/calls/CometChatCallLogRecordings/CallLogRecordingsConfiguration.ts +5 -3
- package/src/calls/CometChatCallLogRecordings/CometChatCallLogRecordings.tsx +14 -13
- package/src/calls/CometChatCallLogRecordings/index.ts +21 -10
- package/src/calls/CometChatCallLogRecordings/resources/index.ts +2 -0
- package/src/calls/CometChatCallLogs/CallLogsConfiguration.ts +5 -3
- package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +37 -36
- package/src/calls/CometChatCallLogs/index.ts +14 -10
- package/src/calls/CometChatCallLogs/resources/index.ts +11 -0
- package/src/calls/CometChatCallLogsWithDetails/CallLogsWithDetailsConfiguration.ts +1 -0
- package/src/calls/CometChatCallLogsWithDetails/CometChatCallLogsWithDetails.tsx +3 -2
- package/src/calls/CometChatCallLogsWithDetails/index.ts +2 -4
- package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +19 -15
- package/src/calls/CometChatIncomingCall/index.ts +10 -8
- package/src/calls/CometChatIncomingCall/resources/index.ts +4 -0
- package/src/calls/CometChatIncomingCall/styles.ts +0 -1
- package/src/calls/CometChatOngoingCall/CometChatOngoingCall.tsx +5 -4
- package/src/calls/CometChatOngoingCall/index.ts +6 -6
- package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +15 -13
- package/src/calls/CometChatOutgoingCall/index.ts +8 -6
- package/src/calls/CometChatOutgoingCall/resources/index.ts +1 -0
- package/src/calls/index.ts +99 -60
- package/src/calls/resources/index.ts +3 -0
- package/src/extensions/CollaborativeBubble/CometChatCollaborativeBubble.tsx +1 -0
- package/src/extensions/CollaborativeBubble/resources/index.ts +1 -0
- package/src/extensions/CollaborativeBubble/styles.ts +1 -1
- package/src/extensions/CollaborativeDocument/CollaborativeDocumentConfiguration.tsx +1 -1
- package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +10 -9
- package/src/extensions/CollaborativeDocument/index.ts +12 -9
- package/src/extensions/CollaborativeDocument/resources/index.ts +2 -0
- package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardConfiguration.tsx +1 -1
- package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +15 -14
- package/src/extensions/CollaborativeWhiteboard/index.ts +12 -9
- package/src/extensions/CollaborativeWhiteboard/resources/index.ts +2 -0
- package/src/extensions/ExtensionModerator.tsx +4 -4
- package/src/extensions/ImageModeration/ImageModerationDecorator.tsx +1 -1
- package/src/extensions/ImageModeration/ImageModerationFilter.tsx +2 -1
- package/src/extensions/ImageModeration/index.ts +15 -7
- package/src/extensions/ImageModeration/resources/index.ts +1 -0
- package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +8 -8
- package/src/extensions/LinkPreview/LinkPreviewExtention.tsx +1 -1
- package/src/extensions/LinkPreview/LinkPreviewExtentionDecorator.tsx +2 -1
- package/src/extensions/LinkPreview/index.ts +18 -10
- package/src/extensions/LinkPreview/resources/index.ts +1 -0
- package/src/extensions/MessageTranslation/MessageTranslationBubble.tsx +7 -7
- package/src/extensions/MessageTranslation/MessageTranslationDecorator.tsx +19 -17
- package/src/extensions/MessageTranslation/index.ts +7 -7
- package/src/extensions/MessageTranslation/resources/index.ts +1 -0
- package/src/extensions/Polls/Header.tsx +8 -8
- package/src/extensions/Polls/Polls.tsx +38 -33
- package/src/extensions/Polls/PollsBubble.tsx +35 -33
- package/src/extensions/Polls/PollsDecorator.tsx +7 -7
- package/src/extensions/Polls/index.ts +4 -5
- package/src/extensions/Polls/resources/index.ts +5 -0
- package/src/extensions/SmartReplies/SmartRepliesDecorator.tsx +11 -11
- package/src/extensions/SmartReplies/SmartRepliesView.tsx +4 -3
- package/src/extensions/SmartReplies/index.ts +6 -2
- package/src/extensions/SmartReplies/resources/index.ts +1 -0
- package/src/extensions/Stickers/CometChatStickerKeyboard/CometChatStickerKeyboard.tsx +12 -10
- package/src/extensions/Stickers/CometChatStickerKeyboard/StickerKeyboardConfiguration.ts +2 -1
- package/src/extensions/Stickers/CometChatStickerKeyboard/hooks.ts +19 -17
- package/src/extensions/Stickers/StickersBubble.tsx +4 -4
- package/src/extensions/Stickers/StickersExtensionDecorator.tsx +11 -10
- package/src/extensions/Stickers/index.ts +13 -8
- package/src/extensions/Stickers/resources/index.ts +1 -0
- package/src/extensions/TextModeration/TextModerationConfiguration.tsx +1 -1
- package/src/extensions/TextModeration/TextModerationExtension.tsx +1 -0
- package/src/extensions/TextModeration/TextModerationExtensionDecorator.tsx +1 -0
- package/src/extensions/TextModeration/index.ts +5 -4
- package/src/extensions/ThumbnailGeneration/ThumbnailGenerationDecorator.tsx +5 -5
- package/src/extensions/ThumbnailGeneration/index.ts +6 -2
- package/src/extensions/ThumbnailGeneration/resources/index.ts +1 -0
- package/src/extensions/index.ts +92 -47
- package/src/index.ts +225 -232
- package/src/shared/CometChatContext.tsx +1 -1
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +40 -36
- package/src/shared/CometChatUiKit/CometChatUIKitHelper.ts +1 -0
- package/src/shared/assets/images/index.ts +16 -0
- package/src/shared/assets/images/search.png +0 -0
- package/src/shared/base/FontStyle.ts +2 -2
- package/src/shared/base/index.ts +8 -11
- package/src/shared/base/vars.ts +2 -2
- package/src/shared/constants/UIKitConstants.ts +16 -1
- package/src/shared/events/CometChatMessageEvents/index.ts +6 -4
- package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +221 -219
- package/src/shared/events/CometChatUIEventHandler/Listener.ts +39 -37
- package/src/shared/events/ListenerInitializer.ts +8 -1
- package/src/shared/events/messages.ts +2 -0
- package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +11 -15
- package/src/shared/formatters/CometChatTextFormatter.ts +6 -5
- package/src/shared/formatters/CometChatUrlsFormatter/index.tsx +8 -10
- package/src/shared/framework/DataSource.ts +17 -17
- package/src/shared/framework/DataSourceDecorator.tsx +3 -2
- package/src/shared/framework/ExtensionsDataSource.tsx +1 -0
- package/src/shared/framework/MessageDataSource.tsx +125 -117
- package/src/shared/framework/index.ts +12 -6
- package/src/shared/framework/resources/index.ts +20 -0
- package/src/shared/helper/helperFunctions.ts +7 -5
- package/src/shared/index.ts +109 -100
- package/src/shared/libs/CometChatCalendar/Calendars/BaseCalendar.tsx +6 -3
- package/src/shared/libs/CometChatCalendar/Calendars/DateSelectionCalendar.tsx +2 -0
- package/src/shared/libs/CometChatCalendar/Calendars/MultiDateSelectionCalendar.tsx +2 -0
- package/src/shared/libs/CometChatCalendar/Components/Day.tsx +2 -0
- package/src/shared/libs/CometChatCalendar/Components/Days.tsx +1 -0
- package/src/shared/libs/CometChatCalendar/Components/Month.tsx +1 -0
- package/src/shared/libs/CometChatCalendar/Components/Months.tsx +1 -0
- package/src/shared/libs/CometChatCalendar/Components/Title.tsx +2 -0
- package/src/shared/libs/CometChatCalendar/Hooks/useSurroundingTimeUnits.ts +3 -0
- package/src/shared/libs/CometChatCalendar/Locales/index.ts +1 -0
- package/src/shared/libs/CometChatCalendar/Utils/dateRange.ts +1 -0
- package/src/shared/libs/CometChatCalendar/Utils/getExtraDays.ts +1 -0
- package/src/shared/libs/CometChatCalendar/Utils/getSurroundingTimeUnits.ts +1 -0
- package/src/shared/libs/ImageZoom/ReactNativeZoomableView.tsx +45 -42
- package/src/shared/libs/ImageZoom/ReactNativeZoomableViewWithGestures.tsx +13 -11
- package/src/shared/libs/ImageZoom/types/index.ts +12 -12
- package/src/shared/libs/VideoPlayerControls/OSSupport/TVOSSupport.tsx +1 -0
- package/src/shared/libs/VideoPlayerControls/VideoPlayer.tsx +1 -0
- package/src/shared/libs/datePickerModal/Modal.js +1 -1
- package/src/shared/modals/CometChatDetailsOption.ts +2 -2
- package/src/shared/modals/CometChatMessageTemplate.ts +13 -12
- package/src/shared/modals/InteractiveData/InteractiveElements/DateTimeElement.ts +7 -7
- package/src/shared/modals/InteractiveData/InteractiveMessage/CardMessage.ts +1 -0
- package/src/shared/modals/InteractiveData/InteractiveMessage/CustomInteractiveMessage.ts +1 -0
- package/src/shared/modals/InteractiveData/InteractiveMessage/FormMessage.ts +1 -0
- package/src/shared/modals/InteractiveData/InteractiveMessage/SchedulerMessage.ts +6 -7
- package/src/shared/modals/index.ts +37 -14
- package/src/shared/resources/CometChatLocalize/CometChatLocalize.ts +5 -5
- package/src/shared/resources/CometChatSoundManager/index.ts +1 -0
- package/src/shared/resources/CometChatTheme/Palette.ts +57 -55
- package/src/shared/resources/CometChatTheme/Typography.ts +30 -30
- package/src/shared/utils/CometChatLiveReactions/CometChatLiveReaction.tsx +17 -13
- package/src/shared/utils/CometChatLiveReactions/resources/index.ts +1 -0
- package/src/shared/utils/CometChatMessageHelper/index.ts +2 -2
- package/src/shared/utils/CometChatMessagePreview/{index.js → index.ts} +3 -0
- package/src/shared/utils/CometChatMessagePreview/resources/index.ts +1 -0
- package/src/shared/utils/CommonUtils.ts +85 -1
- package/src/shared/utils/DetailsUtils/DetailsUtils.tsx +3 -2
- package/src/shared/utils/DetailsUtils/resources/index.ts +7 -0
- package/src/shared/utils/InteractiveMessageUtils.ts +6 -5
- package/src/shared/utils/MessageUtils.tsx +108 -18
- package/src/shared/utils/NetworkUtils.tsx +1 -1
- package/src/shared/utils/PermissionUtil.ts +7 -6
- package/src/shared/utils/SchedulerUtils.ts +8 -6
- package/src/shared/utils/TypeUtils.ts +3 -0
- package/src/shared/utils/conversationUtils.ts +7 -5
- package/src/shared/utils/index.ts +2 -0
- package/src/shared/views/CometChatAICard/CometChatAICard.tsx +7 -6
- package/src/shared/views/CometChatAICard/resources/index.ts +2 -0
- package/src/shared/views/CometChatActionSheet/ActionSheetStyle.ts +3 -0
- package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +5 -5
- package/src/shared/views/CometChatActionSheet/hooks.ts +2 -2
- package/src/shared/views/CometChatActionSheet/index.ts +5 -3
- package/src/shared/views/CometChatActionSheet/resources/index.ts +2 -0
- package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +6 -6
- package/src/shared/views/CometChatAudioBubble/index.ts +8 -12
- package/src/shared/views/CometChatAudioBubble/resources/index.ts +2 -0
- package/src/shared/views/CometChatAvatar/CometChatAvatar.tsx +6 -5
- package/src/shared/views/CometChatAvatar/index.ts +7 -9
- package/src/shared/views/CometChatBadge/CometChatBadge.tsx +3 -3
- package/src/shared/views/CometChatBadge/index.ts +7 -9
- package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +51 -48
- package/src/shared/views/CometChatBottomSheet/index.ts +6 -2
- package/src/shared/views/CometChatButton/CometChatButton.tsx +5 -5
- package/src/shared/views/CometChatButton/index.ts +4 -14
- package/src/shared/views/CometChatCard/CometChatCard.tsx +3 -3
- package/src/shared/views/CometChatCard/index.ts +6 -7
- package/src/shared/views/CometChatCardBubble/CometChatCardBubble.tsx +11 -10
- package/src/shared/views/CometChatCardBubble/index.tsx +2 -1
- package/src/shared/views/CometChatCheckBox/CometChatCheckBox.tsx +6 -6
- package/src/shared/views/CometChatConfirmDialog/CometChatConfirmDialog.tsx +9 -9
- package/src/shared/views/CometChatConfirmDialog/CometChatConfirmDialogStyle.ts +1 -0
- package/src/shared/views/CometChatConfirmDialog/index.ts +9 -6
- package/src/shared/views/CometChatDate/CometChatDate.tsx +2 -2
- package/src/shared/views/CometChatDate/index.ts +12 -11
- package/src/shared/views/CometChatDateTimePicker/CometChatDateTimePicker.tsx +20 -17
- package/src/shared/views/CometChatDateTimePicker/index.ts +3 -5
- package/src/shared/views/CometChatDropDown/CometChatDropDown.tsx +8 -7
- package/src/shared/views/CometChatEmojiKeyboard/CometChatEmojiKeyboard.tsx +24 -33
- package/src/shared/views/CometChatEmojiKeyboard/Emoji.ts +1 -1
- package/src/shared/views/CometChatEmojiKeyboard/EmojiCategory.ts +1 -1
- package/src/shared/views/CometChatEmojiKeyboard/EmojiKeyboardConfiguration.ts +2 -1
- package/src/shared/views/CometChatEmojiKeyboard/EmojiKeyboardStyle.ts +2 -1
- package/src/shared/views/CometChatEmojiKeyboard/emojis.ts +8 -0
- package/src/shared/views/CometChatEmojiKeyboard/resources/index.ts +8 -0
- package/src/shared/views/CometChatEmojiKeyboard/style.ts +2 -2
- package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +3 -3
- package/src/shared/views/CometChatFileBubble/FileBubbleStyle.ts +1 -1
- package/src/shared/views/CometChatFileBubble/index.ts +7 -8
- package/src/shared/views/CometChatFileBubble/resources/index.ts +2 -0
- package/src/shared/views/CometChatFormBubble/CometChatFormBubble.tsx +33 -29
- package/src/shared/views/CometChatFormBubble/index.tsx +2 -1
- package/src/shared/views/CometChatImageBubble/CometChatImageBubble.tsx +63 -17
- package/src/shared/views/CometChatImageBubble/ImageBubbleStyle.ts +1 -1
- package/src/shared/views/CometChatImageBubble/assets/default_image.png +0 -0
- package/src/shared/views/CometChatImageBubble/assets/index.ts +3 -0
- package/src/shared/views/CometChatImageBubble/index.ts +10 -8
- package/src/shared/views/CometChatImageViewerModal/ImageViewerModal.tsx +1 -1
- package/src/shared/views/CometChatImageViewerModal/resources/index.ts +1 -0
- package/src/shared/views/CometChatLabel/CometChatLabel.tsx +2 -2
- package/src/shared/views/CometChatList/CometChatList.tsx +46 -42
- package/src/shared/views/CometChatList/index.ts +3 -3
- package/src/shared/views/CometChatList/resources/index.ts +5 -0
- package/src/shared/views/CometChatListItem/CometChatListItem.tsx +18 -13
- package/src/shared/views/CometChatListItem/ListItemConfiguration.tsx +1 -0
- package/src/shared/views/CometChatListItem/index.ts +8 -7
- package/src/shared/views/CometChatMediaRecorder/CometChatMediaRecorder.tsx +34 -31
- package/src/shared/views/CometChatMediaRecorder/index.ts +8 -9
- package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +22 -15
- package/src/shared/views/CometChatMessageBubble/MessageBubbleStyle.ts +4 -0
- package/src/shared/views/CometChatMessageBubble/index.ts +6 -5
- package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +10 -9
- package/src/shared/views/CometChatMessageInput/index.ts +2 -1
- package/src/shared/views/CometChatPanel/CometChatPanel.tsx +3 -3
- package/src/shared/views/CometChatPanel/resources/index.ts +1 -0
- package/src/shared/views/CometChatQuickReactions/CometChatQuickReactions.tsx +4 -4
- package/src/shared/views/CometChatQuickReactions/QuickReactionsConfiguration.tsx +1 -0
- package/src/shared/views/CometChatQuickReactions/index.ts +3 -7
- package/src/shared/views/CometChatQuickReactions/resources/index.ts +1 -0
- package/src/shared/views/CometChatQuickView/CometChatQuickView.tsx +6 -6
- package/src/shared/views/CometChatRadioButton/CometChatRadioButton.tsx +4 -4
- package/src/shared/views/CometChatReactionList/CometChatReactionList.tsx +29 -28
- package/src/shared/views/CometChatReactionList/ReactionListConfiguration.tsx +1 -0
- package/src/shared/views/CometChatReactionList/index.ts +3 -7
- package/src/shared/views/CometChatReactionList/resources/index.ts +1 -0
- package/src/shared/views/CometChatReactions/CometChatReactions.tsx +14 -14
- package/src/shared/views/CometChatReactions/ReactionsConfiguration.tsx +1 -0
- package/src/shared/views/CometChatReactions/index.ts +15 -11
- package/src/shared/views/CometChatReceipt/CometChatReceipt.tsx +5 -5
- package/src/shared/views/CometChatReceipt/index.ts +10 -8
- package/src/shared/views/CometChatSchedulerBubble/CometChatSchedulerBubble.tsx +59 -53
- package/src/shared/views/CometChatSchedulerBubble/index.ts +3 -5
- package/src/shared/views/CometChatSchedulerBubble/styles.ts +1 -1
- package/src/shared/views/CometChatSingleSelect/CometChatSingleSelect.tsx +4 -4
- package/src/shared/views/CometChatStatusIndicator/CometChatStatusIndicator.tsx +4 -4
- package/src/shared/views/CometChatStatusIndicator/StatusIndicatorConfiguration.ts +2 -2
- package/src/shared/views/CometChatStatusIndicator/index.ts +21 -10
- package/src/shared/views/CometChatSuggestionList/CometChatSuggestionList.tsx +1 -1
- package/src/shared/views/CometChatSuggestionList/SuggestionItem.ts +5 -5
- package/src/shared/views/CometChatSuggestionList/SuggestionListConfiguration.ts +3 -3
- package/src/shared/views/CometChatSuggestionList/index.ts +14 -10
- package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +6 -5
- package/src/shared/views/CometChatTextBubble/index.ts +6 -7
- package/src/shared/views/CometChatTextInput/CometChatTextInput.tsx +2 -2
- package/src/shared/views/CometChatTimeSlotSelector/CometChatTimeSlotSelector.tsx +5 -5
- package/src/shared/views/CometChatTimeSlotSelector/index.ts +3 -5
- package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +9 -8
- package/src/shared/views/CometChatVideoBubble/index.ts +10 -8
- package/src/shared/views/CometChatVideoBubble/resources/index.ts +2 -0
- package/src/shared/views/CometChatVideoPlayer/CometChatVideoPlayer.tsx +1 -1
- package/src/shared/views/SwipeRow/SwipeRow.tsx +4 -3
- package/src/shared/views/index.ts +151 -86
- package/ios/CometchatUiKit.xcodeproj/project.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/CometchatUiKit.xcodeproj/xcuserdata/admin.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
- package/src/shared/libs/CometChatCalendar/Components/Arrow.test.tsx +0 -112
- package/src/shared/libs/CometChatCalendar/Components/Day.test.tsx +0 -396
- package/src/shared/libs/CometChatCalendar/Components/Days.test.tsx +0 -216
- package/src/shared/libs/CometChatCalendar/Components/Month.test.tsx +0 -160
- package/src/shared/libs/CometChatCalendar/Components/Months.test.tsx +0 -262
- package/src/shared/libs/CometChatCalendar/Components/Title.test.tsx +0 -111
- package/src/shared/libs/CometChatCalendar/Components/Weekdays.test.tsx +0 -69
- package/src/shared/libs/CometChatCalendar/Hooks/useSurroundingTimeUnits.test.ts +0 -44
- package/src/shared/libs/CometChatCalendar/Utils/addOpacity.test.ts +0 -49
- package/src/shared/libs/CometChatCalendar/Utils/clamp.test.ts +0 -39
- package/src/shared/libs/CometChatCalendar/Utils/dateRange.test.ts +0 -20
- package/src/shared/libs/CometChatCalendar/Utils/getExtraDays.test.ts +0 -48
- package/src/shared/libs/CometChatCalendar/Utils/getSurroundingTimeUnits.test.ts +0 -60
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useContext } from "react";
|
|
2
|
-
import { View, Text } from "react-native";
|
|
2
|
+
import { View, Text, TextStyle, ViewProps } from "react-native";
|
|
3
3
|
//@ts-ignore
|
|
4
4
|
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
5
5
|
import {
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
} from "./resources";
|
|
27
27
|
import { ConversationsStyle, ConversationsStyleInterface } from "./ConversationsStyle";
|
|
28
28
|
import { ImageType } from "../shared";
|
|
29
|
-
import { GroupTypeConstants, MessageCategoryConstants, MessageStatusConstants, PASSWORD_GROUP_COLOR, PRIVATE_GROUP_COLOR, ReceiverTypeConstants } from "../shared/constants/UIKitConstants";
|
|
29
|
+
import { ConversationTypeConstants, GroupTypeConstants, MessageCategoryConstants, MessageStatusConstants, PASSWORD_GROUP_COLOR, PRIVATE_GROUP_COLOR, ReceiverTypeConstants } from "../shared/constants/UIKitConstants";
|
|
30
30
|
import { AvatarStyle, BadgeStyle, CometChatBadge, CometChatDate, CometChatListItem, CometChatReceipt, DateStyle, StatusIndicatorStyle } from "../shared";
|
|
31
31
|
import { ListItemStyle, ListItemStyleInterface } from "../shared";
|
|
32
32
|
import { CometChatContextType, MessageReceipt, SelectionMode } from "../shared/base/Types";
|
|
@@ -57,13 +57,12 @@ export interface ConversationInterface {
|
|
|
57
57
|
*/
|
|
58
58
|
disableUsersPresence?: boolean,
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
* disable message receipts
|
|
65
|
-
*/
|
|
60
|
+
* @deprecated
|
|
61
|
+
*
|
|
62
|
+
* This property is deprecated as of version 4.3.18 due to newer property 'hideReceipt'. It will be removed in subsequent versions.
|
|
63
|
+
*/
|
|
66
64
|
disableReceipt?: boolean,
|
|
65
|
+
hideReceipt?: boolean,
|
|
67
66
|
/**
|
|
68
67
|
* toggle typing indicator
|
|
69
68
|
*/
|
|
@@ -250,8 +249,8 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
250
249
|
*/
|
|
251
250
|
const {
|
|
252
251
|
disableUsersPresence = false,
|
|
253
|
-
disableReadReceipt = false,
|
|
254
252
|
disableReceipt = false,
|
|
253
|
+
hideReceipt = false,
|
|
255
254
|
disableTyping = false,
|
|
256
255
|
disableSoundForMessages = false,
|
|
257
256
|
customSoundForMessages,
|
|
@@ -285,13 +284,13 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
285
284
|
|
|
286
285
|
//context
|
|
287
286
|
const { theme } = useContext<CometChatContextType>(CometChatContext);
|
|
288
|
-
const activeSwipeRows = React.useRef({});
|
|
287
|
+
const activeSwipeRows = React.useRef<any>({});
|
|
289
288
|
|
|
290
289
|
const conversationListRef = React.useRef<CometChatListActionsInterface>(null);
|
|
291
|
-
const loggedInUser = React.useRef(null);
|
|
290
|
+
const loggedInUser = React.useRef<CometChat.User | null | any>(null);
|
|
292
291
|
const [confirmDelete, setConfirmDelete] = React.useState(undefined);
|
|
293
292
|
const [selecting, setSelecting] = React.useState(selectionMode === 'none' ? false : true);
|
|
294
|
-
const [selectedConversation, setSelectedConversations] = React.useState([]);
|
|
293
|
+
const [selectedConversation, setSelectedConversations] = React.useState<any[]>([]);
|
|
295
294
|
const onMemberAddedToGroupDebounceTimer = React.useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
296
295
|
|
|
297
296
|
const _style = new ConversationsStyle({
|
|
@@ -345,7 +344,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
345
344
|
const ErrorView = () => {
|
|
346
345
|
return (
|
|
347
346
|
<View style={Style.listContainer}>
|
|
348
|
-
<Text style={{ ..._style?.errorTextFont, color: _style?.errorTextColor }}>
|
|
347
|
+
<Text style={{ ..._style?.errorTextFont, color: _style?.errorTextColor } as TextStyle}>
|
|
349
348
|
{errorStateText || localize("SOMETHING_WRONG")}
|
|
350
349
|
</Text>
|
|
351
350
|
</View>
|
|
@@ -358,17 +357,17 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
358
357
|
else
|
|
359
358
|
return (
|
|
360
359
|
<View style={Style.listContainer}>
|
|
361
|
-
<Text style={{ ..._style.emptyTextFont, color: _style.emptyTextColor }}>
|
|
360
|
+
<Text style={{ ..._style.emptyTextFont, color: _style.emptyTextColor } as TextStyle}>
|
|
362
361
|
{emptyStateText || localize("NO_CHATS_FOUND")}
|
|
363
362
|
</Text>
|
|
364
363
|
</View>
|
|
365
364
|
)
|
|
366
365
|
}
|
|
367
366
|
|
|
368
|
-
const userEventHandler = (...args) => {
|
|
367
|
+
const userEventHandler = (...args: any[]) => {
|
|
369
368
|
const { uid, blockedByMe, status } = args[0];
|
|
370
369
|
if (!blockedByMe) {
|
|
371
|
-
let item: CometChat.Conversation = conversationListRef.current
|
|
370
|
+
let item: CometChat.Conversation | any = conversationListRef.current?.getListItem(`${uid}_user_${loggedInUser.current?.uid}`) || conversationListRef.current?.getListItem(`${loggedInUser.current?.uid}_user_${uid}`);
|
|
372
371
|
if (item) {
|
|
373
372
|
let updatedConversation = CommonUtils.clone(item);
|
|
374
373
|
updatedConversation.setConversationWith(args[0]);
|
|
@@ -379,8 +378,8 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
379
378
|
|
|
380
379
|
|
|
381
380
|
const getConversationRefFromTypingIndicator = (typingIndicator: CometChat.TypingIndicator) => {
|
|
382
|
-
let list = conversationListRef.current
|
|
383
|
-
return list
|
|
381
|
+
let list = conversationListRef.current?.getAllListItems();
|
|
382
|
+
return list?.find((item: CometChat.Conversation) => {
|
|
384
383
|
return (
|
|
385
384
|
(typingIndicator.getReceiverType() == ReceiverTypeConstants.user &&
|
|
386
385
|
item.getConversationType() == ReceiverTypeConstants.user
|
|
@@ -395,19 +394,19 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
395
394
|
* Listener callback for typing event
|
|
396
395
|
* @param {...any} args
|
|
397
396
|
*/
|
|
398
|
-
const typingEventHandler = (...args) => {
|
|
397
|
+
const typingEventHandler = (...args: any[]) => {
|
|
399
398
|
let conversation: CometChat.Conversation = getConversationRefFromTypingIndicator(args[0]);
|
|
400
399
|
if (conversation) {
|
|
401
400
|
let isTyping = args[1];
|
|
402
401
|
let newConversation = conversation
|
|
403
402
|
if (isTyping && !newConversation?.['lastMessage']?.["typing"]) {
|
|
404
403
|
newConversation['lastMessage']["typing"] = args[0]?.receiverType === 'group' ?
|
|
405
|
-
`${args[0].sender.name} ${localize("IS_TYPING")}` :
|
|
404
|
+
`${args[0].sender.name.trim()} ${localize("IS_TYPING")}` :
|
|
406
405
|
localize("IS_TYPING");
|
|
407
406
|
} else {
|
|
408
407
|
delete newConversation['lastMessage']['typing'];
|
|
409
408
|
}
|
|
410
|
-
conversationListRef.current
|
|
409
|
+
conversationListRef.current?.updateList(newConversation);
|
|
411
410
|
}
|
|
412
411
|
|
|
413
412
|
}
|
|
@@ -420,60 +419,86 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
420
419
|
*/
|
|
421
420
|
const checkAndUpdateLastMessage = (newMessage: CometChat.BaseMessage) => {
|
|
422
421
|
CometChat.CometChatHelper.getConversationFromMessage(newMessage)
|
|
423
|
-
.then(conversation => {
|
|
424
|
-
let conver: any = conversationListRef.current
|
|
422
|
+
.then((conversation: any) => {
|
|
423
|
+
let conver: any = conversationListRef.current?.getListItem(conversation.getConversationId())
|
|
425
424
|
if (!conver) return;
|
|
426
425
|
let lastMessageId = conver['lastMessage']['id']
|
|
427
426
|
if (lastMessageId == newMessage['id']) {
|
|
428
|
-
conversationListRef.current
|
|
427
|
+
conversationListRef.current?.updateList(conversation)
|
|
429
428
|
}
|
|
430
429
|
})
|
|
431
430
|
|
|
432
431
|
}
|
|
433
432
|
|
|
434
433
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
if (!customMessage.willUpdateConversation() &&
|
|
452
|
-
!(customMessage.getMetadata() && (customMessage.getMetadata() as any)["incrementUnreadCount"]) &&
|
|
453
|
-
!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCustomMessages()) {
|
|
454
|
-
return false;
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
/****End: Should Custom Message Update Conversation? */
|
|
458
|
-
|
|
459
|
-
/****Start: Should Group Actions sent update conversation? */
|
|
460
|
-
if (message.getCategory() == CometChatUiKitConstants.MessageCategoryConstants.action
|
|
461
|
-
&& message.getReceiverType() == CometChatUiKitConstants.ReceiverTypeConstants.group
|
|
462
|
-
) {
|
|
463
|
-
return CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnGroupActions();
|
|
464
|
-
}
|
|
465
|
-
/****End: Should Group Actions sent update conversation? */
|
|
466
|
-
|
|
467
|
-
/****Start: Should Call Actions sent Update Conversation? */
|
|
468
|
-
if (message.getCategory() == CometChatUiKitConstants.MessageCategoryConstants.call
|
|
469
|
-
&& !CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()
|
|
470
|
-
) {
|
|
471
|
-
return false;
|
|
472
|
-
}
|
|
473
|
-
/****End: Should Call Actions sent Update Conversation */
|
|
474
|
-
|
|
475
|
-
return true;
|
|
434
|
+
/**
|
|
435
|
+
* Check if last message/unread count should be updated
|
|
436
|
+
*
|
|
437
|
+
* @param newMessage message object
|
|
438
|
+
*/
|
|
439
|
+
const shouldUpdateLastMessageAndUnreadCount = (
|
|
440
|
+
message: CometChat.BaseMessage
|
|
441
|
+
) => {
|
|
442
|
+
const messageReceiverType = message.getReceiverType();
|
|
443
|
+
if (
|
|
444
|
+
conversationsRequestBuilder &&
|
|
445
|
+
conversationsRequestBuilder.build().getConversationType() &&
|
|
446
|
+
conversationsRequestBuilder.build().getConversationType() !=
|
|
447
|
+
messageReceiverType
|
|
448
|
+
) {
|
|
449
|
+
return false;
|
|
476
450
|
}
|
|
451
|
+
/****Start: Should Threaded Messages Update Conversation? */
|
|
452
|
+
if (
|
|
453
|
+
message.getParentMessageId() &&
|
|
454
|
+
!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnMessageReplies()
|
|
455
|
+
) {
|
|
456
|
+
return false;
|
|
457
|
+
}
|
|
458
|
+
/****END: Should Threaded Messages Update Conversation? */
|
|
459
|
+
|
|
460
|
+
/****Start: Should Custom Message Update Conversation? */
|
|
461
|
+
if (
|
|
462
|
+
message.getCategory() ==
|
|
463
|
+
CometChatUiKitConstants.MessageCategoryConstants.custom
|
|
464
|
+
) {
|
|
465
|
+
let customMessage = message as CometChat.CustomMessage;
|
|
466
|
+
if (
|
|
467
|
+
!customMessage.willUpdateConversation() &&
|
|
468
|
+
!(
|
|
469
|
+
customMessage.getMetadata() &&
|
|
470
|
+
(customMessage.getMetadata() as any)['incrementUnreadCount']
|
|
471
|
+
) &&
|
|
472
|
+
!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCustomMessages()
|
|
473
|
+
) {
|
|
474
|
+
return false;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
/****End: Should Custom Message Update Conversation? */
|
|
478
|
+
|
|
479
|
+
/****Start: Should Group Actions sent update conversation? */
|
|
480
|
+
if (
|
|
481
|
+
message.getCategory() ==
|
|
482
|
+
CometChatUiKitConstants.MessageCategoryConstants.action &&
|
|
483
|
+
message.getReceiverType() ==
|
|
484
|
+
CometChatUiKitConstants.ReceiverTypeConstants.group
|
|
485
|
+
) {
|
|
486
|
+
return CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnGroupActions();
|
|
487
|
+
}
|
|
488
|
+
/****End: Should Group Actions sent update conversation? */
|
|
489
|
+
|
|
490
|
+
/****Start: Should Call Actions sent Update Conversation? */
|
|
491
|
+
if (
|
|
492
|
+
message.getCategory() ==
|
|
493
|
+
CometChatUiKitConstants.MessageCategoryConstants.call &&
|
|
494
|
+
!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()
|
|
495
|
+
) {
|
|
496
|
+
return false;
|
|
497
|
+
}
|
|
498
|
+
/****End: Should Call Actions sent Update Conversation */
|
|
499
|
+
|
|
500
|
+
return true;
|
|
501
|
+
};
|
|
477
502
|
|
|
478
503
|
/**
|
|
479
504
|
* Find conversation from state and udpate its last message object.
|
|
@@ -484,27 +509,27 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
484
509
|
const updateLastMessage = (newMessage: CometChat.BaseMessage) => {
|
|
485
510
|
|
|
486
511
|
CometChat.CometChatHelper.getConversationFromMessage(newMessage)
|
|
487
|
-
.then(conversation => {
|
|
512
|
+
.then((conversation: any) => {
|
|
488
513
|
if (newMessage.getCategory() === MessageCategoryConstants.interactive) {
|
|
489
514
|
newMessage = InteractiveMessageUtils.convertInteractiveMessage(newMessage);
|
|
490
515
|
}
|
|
491
|
-
const oldConversation: CometChat.Conversation = conversationListRef.current
|
|
516
|
+
const oldConversation: CometChat.Conversation | any = conversationListRef.current?.getListItem(conversation['conversationId']);
|
|
492
517
|
if (oldConversation == undefined) {
|
|
493
518
|
CometChat.CometChatHelper.getConversationFromMessage(newMessage)
|
|
494
|
-
.then(newConversation => {
|
|
519
|
+
.then((newConversation: any) => {
|
|
495
520
|
if (newConversation?.lastMessage?.sender?.uid !== loggedInUser.current?.['uid'])
|
|
496
521
|
newConversation.setUnreadMessageCount(1);
|
|
497
|
-
conversationListRef.current
|
|
522
|
+
conversationListRef.current?.updateAndMoveToFirst(newConversation);
|
|
498
523
|
})
|
|
499
|
-
.catch(err => onError && onError(err))
|
|
524
|
+
.catch((err: any) => onError && onError(err))
|
|
500
525
|
return;
|
|
501
526
|
}
|
|
502
527
|
oldConversation['lastMessage'] = newMessage;
|
|
503
|
-
if (newMessage['sender']['uid'] != loggedInUser.current?.['uid'])
|
|
528
|
+
if ((newMessage as any)['sender']['uid'] != loggedInUser.current?.['uid'])
|
|
504
529
|
oldConversation.setUnreadMessageCount(oldConversation.getUnreadMessageCount() + 1);
|
|
505
|
-
conversationListRef.current
|
|
530
|
+
conversationListRef.current?.updateAndMoveToFirst(oldConversation);
|
|
506
531
|
})
|
|
507
|
-
.catch(err => {
|
|
532
|
+
.catch((err: any) => {
|
|
508
533
|
console.log("Error", err);
|
|
509
534
|
})
|
|
510
535
|
}
|
|
@@ -527,7 +552,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
527
552
|
/**
|
|
528
553
|
* marking the incoming messages as delivered
|
|
529
554
|
*/
|
|
530
|
-
const markMessageAsDelivered = (message) => {
|
|
555
|
+
const markMessageAsDelivered = (message: object) => {
|
|
531
556
|
if (message.hasOwnProperty('deletedAt')) return;
|
|
532
557
|
|
|
533
558
|
if (shouldMarkAsDelivered(message)) {
|
|
@@ -536,27 +561,53 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
536
561
|
}
|
|
537
562
|
}
|
|
538
563
|
|
|
539
|
-
const updateMessageReceipt = (receipt) => {
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
conversationListRef.current.
|
|
564
|
+
const updateMessageReceipt = (receipt: CometChat.MessageReceipt) => {
|
|
565
|
+
const conv: CometChat.Conversation =
|
|
566
|
+
receipt?.getReceiverType() === ReceiverTypeConstants.user
|
|
567
|
+
? conversationListRef.current.getListItem(
|
|
568
|
+
`${receipt?.getReceiver()}_user_${receipt?.getSender().getUid()}`
|
|
569
|
+
) ||
|
|
570
|
+
conversationListRef.current.getListItem(
|
|
571
|
+
`${receipt?.getSender()?.getUid()}_user_${receipt?.getReceiver()}`
|
|
572
|
+
)
|
|
573
|
+
: [receipt.RECEIPT_TYPE.DELIVERED_TO_ALL_RECEIPT, receipt.RECEIPT_TYPE.READ_BY_ALL_RECEIPT].includes(receipt?.getReceiptType()) &&
|
|
574
|
+
conversationListRef.current.getListItem(
|
|
575
|
+
`group_${receipt?.getReceiver()}`
|
|
576
|
+
);
|
|
577
|
+
|
|
578
|
+
if (
|
|
579
|
+
conv &&
|
|
580
|
+
conv.getConversationType() == ConversationTypeConstants.group &&
|
|
581
|
+
conv.getLastMessage().getSender().getUid() !== loggedInUser.current.getUid()
|
|
582
|
+
) {
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
if (
|
|
587
|
+
conv &&
|
|
588
|
+
conv?.getLastMessage &&
|
|
589
|
+
(conv.getLastMessage().id == receipt['messageId'] ||
|
|
590
|
+
conv.getLastMessage().messageId == receipt['messageId'])
|
|
591
|
+
) {
|
|
592
|
+
let newConversation = CommonUtils.clone(conv);
|
|
593
|
+
if (receipt['readAt']) {
|
|
594
|
+
newConversation.getLastMessage().setReadAt(receipt['readAt']);
|
|
550
595
|
}
|
|
551
|
-
|
|
596
|
+
if (receipt['deliveredAt']) {
|
|
597
|
+
newConversation.getLastMessage().setDeliveredAt(receipt['deliveredAt']);
|
|
598
|
+
}
|
|
599
|
+
conversationListRef.current.updateList(newConversation);
|
|
600
|
+
}
|
|
601
|
+
};
|
|
602
|
+
|
|
552
603
|
|
|
553
604
|
/**
|
|
554
605
|
*
|
|
555
606
|
* When a text message / media message / custom message is received
|
|
556
607
|
*/
|
|
557
|
-
const messageEventHandler = (...args) => {
|
|
608
|
+
const messageEventHandler = (...args: any[]) => {
|
|
558
609
|
let message = args[0];
|
|
559
|
-
!
|
|
610
|
+
!disableReceipt && markMessageAsDelivered(message);
|
|
560
611
|
updateLastMessage(message);
|
|
561
612
|
}
|
|
562
613
|
|
|
@@ -564,34 +615,42 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
564
615
|
* callback handler for group Add / Kicked / Banned / Scope Change
|
|
565
616
|
* @param {obj} message
|
|
566
617
|
*/
|
|
567
|
-
const groupHandler = (message, otherDetails: {
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
618
|
+
const groupHandler = (message: any, otherDetails: {action?: string, actionOn?: CometChat.User, actionBy?: CometChat.User, group?: CometChat.Group} = {}) => {
|
|
619
|
+
if (
|
|
620
|
+
conversationsRequestBuilder &&
|
|
621
|
+
conversationsRequestBuilder.build().getConversationType() &&
|
|
622
|
+
conversationsRequestBuilder.build().getConversationType() !=
|
|
623
|
+
CometChatUiKitConstants.ReceiverTypeConstants.group
|
|
624
|
+
) {
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
627
|
+
let conversation : CometChat.Conversation = (conversationListRef.current?.getListItem(message['conversationId']) as unknown as CometChat.Conversation);
|
|
628
|
+
let {action, actionOn, actionBy, group} = otherDetails;
|
|
629
|
+
if (conversation) {
|
|
630
|
+
if ((action && ["kicked", "banned", "left"].includes(action)) && (actionOn?.getUid() == loggedInUser.current?.getUid())){
|
|
631
|
+
conversationListRef.current?.removeItemFromList(message.conversationId);
|
|
573
632
|
return;
|
|
574
633
|
} else {
|
|
575
634
|
if (!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnGroupActions()) {
|
|
576
635
|
return;
|
|
577
636
|
}
|
|
578
637
|
conversation.setLastMessage(message);
|
|
579
|
-
conversationListRef.current
|
|
638
|
+
conversationListRef.current?.updateList(conversation);
|
|
580
639
|
}
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
640
|
+
} else {
|
|
641
|
+
CometChat.CometChatHelper.getConversationFromMessage(message)
|
|
642
|
+
.then((newConversation: any) => {
|
|
643
|
+
const conversation : CometChat.Conversation = (conversationListRef.current?.getListItem(message['conversationId']) as unknown as CometChat.Conversation);
|
|
644
|
+
if (conversation) {
|
|
645
|
+
groupHandler(message);
|
|
646
|
+
} else {
|
|
647
|
+
conversationListRef.current?.addItemToList(newConversation, 0);
|
|
648
|
+
}
|
|
649
|
+
});
|
|
650
|
+
}
|
|
592
651
|
}
|
|
593
652
|
|
|
594
|
-
const conversationClicked = (conversation) => {
|
|
653
|
+
const conversationClicked = (conversation: any) => {
|
|
595
654
|
if (onItemPress) {
|
|
596
655
|
onItemPress(conversation);
|
|
597
656
|
return;
|
|
@@ -603,7 +662,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
603
662
|
|
|
604
663
|
if (selectionMode == "none") return;
|
|
605
664
|
|
|
606
|
-
let index = selectedConversation.findIndex(tmpConver => tmpConver.conversationWith.conversationId == conversation.conversationWith.conversationId);
|
|
665
|
+
let index = selectedConversation.findIndex((tmpConver: any) => tmpConver.conversationWith.conversationId == conversation.conversationWith.conversationId);
|
|
607
666
|
if (index < 0) {
|
|
608
667
|
if (selectionMode == "single")
|
|
609
668
|
setSelectedConversations([conversation])
|
|
@@ -616,7 +675,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
616
675
|
}
|
|
617
676
|
}
|
|
618
677
|
|
|
619
|
-
const conversationLongPressed = (conversation) => {
|
|
678
|
+
const conversationLongPressed = (conversation: any) => {
|
|
620
679
|
if (onItemLongPress) {
|
|
621
680
|
onItemLongPress(conversation);
|
|
622
681
|
return;
|
|
@@ -628,7 +687,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
628
687
|
setSelectedConversations([...selectedConversation, conversation]);
|
|
629
688
|
}
|
|
630
689
|
|
|
631
|
-
const removeItemFromSelectionList = (id) => {
|
|
690
|
+
const removeItemFromSelectionList = (id: any) => {
|
|
632
691
|
if (selecting) {
|
|
633
692
|
let index = selectedConversation.find(member => member['uid'] == id);
|
|
634
693
|
if (index > -1) {
|
|
@@ -639,19 +698,19 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
639
698
|
}
|
|
640
699
|
}
|
|
641
700
|
|
|
642
|
-
const removeConversation = (id) => {
|
|
643
|
-
let conversation = conversationListRef.current
|
|
701
|
+
const removeConversation = (id: string | number) => {
|
|
702
|
+
let conversation: any = conversationListRef.current?.getListItem(id);
|
|
644
703
|
const { conversationWith, conversationType } = conversation;
|
|
645
704
|
let conversationWithId = conversationType == "group" ? conversationWith.guid : conversationWith.uid;
|
|
646
705
|
CometChat.deleteConversation(conversationWithId, conversationType)
|
|
647
|
-
.then(success => {
|
|
648
|
-
conversationListRef.current
|
|
706
|
+
.then((success: any) => {
|
|
707
|
+
conversationListRef.current?.removeItemFromList(id);
|
|
649
708
|
removeItemFromSelectionList(id);
|
|
650
709
|
})
|
|
651
|
-
.catch(err => console.log(err))
|
|
710
|
+
.catch((err: any) => console.log(err))
|
|
652
711
|
}
|
|
653
712
|
|
|
654
|
-
const getMessagePreview = (conversations: CometChat.Conversation, uid) => {
|
|
713
|
+
const getMessagePreview = (conversations: CometChat.Conversation, uid: any) => {
|
|
655
714
|
|
|
656
715
|
let lastMessage: CometChat.BaseMessage = conversations?.getLastMessage && conversations.getLastMessage();
|
|
657
716
|
if (!lastMessage) return null;
|
|
@@ -670,7 +729,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
670
729
|
if (lastMessage.getSender().getUid() == uid) {
|
|
671
730
|
groupText = localize("YOU") + ": "
|
|
672
731
|
} else {
|
|
673
|
-
groupText = lastMessage.getSender()
|
|
732
|
+
groupText = (lastMessage.getSender()?.getName() || "").trim() + ": ";
|
|
674
733
|
}
|
|
675
734
|
}
|
|
676
735
|
|
|
@@ -678,7 +737,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
678
737
|
<Text numberOfLines={1} ellipsizeMode={"tail"} style={[Style.subtitleTextStyle, {
|
|
679
738
|
color: theme.palette.getAccent600(), fontSize: theme.typography.subtitle1.fontSize,
|
|
680
739
|
fontWeight: theme.typography.subtitle1.fontWeight
|
|
681
|
-
}]}>
|
|
740
|
+
}] as TextStyle}>
|
|
682
741
|
{groupText}{messageText}
|
|
683
742
|
</Text>
|
|
684
743
|
)
|
|
@@ -690,17 +749,17 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
690
749
|
|
|
691
750
|
if (!disableMentions && message.getMentionedUsers().length) {
|
|
692
751
|
let mentionsFormatter = ChatConfigurator.getDataSource().getMentionsFormatter();
|
|
693
|
-
mentionsFormatter.setLoggedInUser(CometChatUIKit.loggedInUser);
|
|
752
|
+
CometChatUIKit.loggedInUser && mentionsFormatter.setLoggedInUser(CometChatUIKit.loggedInUser);
|
|
694
753
|
mentionsFormatter.setMentionsStyle(
|
|
695
754
|
new MentionTextStyle({
|
|
696
755
|
loggedInUserTextStyle: {
|
|
697
756
|
color: theme.palette.getPrimary(),
|
|
698
757
|
...theme.typography.title2,
|
|
699
|
-
},
|
|
758
|
+
} as TextStyle,
|
|
700
759
|
textStyle: {
|
|
701
760
|
color: theme.palette.getPrimary(),
|
|
702
761
|
...theme.typography.subtitle1,
|
|
703
|
-
}
|
|
762
|
+
} as TextStyle
|
|
704
763
|
})
|
|
705
764
|
);
|
|
706
765
|
|
|
@@ -733,11 +792,11 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
733
792
|
<Text numberOfLines={1} ellipsizeMode={"tail"} style={[Style.subtitleTextStyle, {
|
|
734
793
|
color: theme.palette.getPrimary(),
|
|
735
794
|
fontSize: theme.typography.subtitle1.fontSize, fontWeight: theme.typography.subtitle1.fontWeight
|
|
736
|
-
}]} >{params.typingText}</Text>
|
|
795
|
+
}] as TextStyle} >{params.typingText}</Text>
|
|
737
796
|
</View>
|
|
738
797
|
}
|
|
739
798
|
|
|
740
|
-
if (lastMessage &&
|
|
799
|
+
if (lastMessage && lastMessage['sender']['uid'] == loggedInUser.current?.uid && !lastMessage.getDeletedAt()) {
|
|
741
800
|
let status: MessageReceipt = "ERROR";
|
|
742
801
|
if (lastMessage?.hasOwnProperty('readAt'))
|
|
743
802
|
status = "READ";
|
|
@@ -745,7 +804,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
745
804
|
status = "DELIVERED";
|
|
746
805
|
else if (lastMessage?.hasOwnProperty("sentAt"))
|
|
747
806
|
status = "SENT";
|
|
748
|
-
readReceipt = disableReceipt ? null : <CometChatReceipt
|
|
807
|
+
readReceipt = (disableReceipt || hideReceipt) ? null : <CometChatReceipt
|
|
749
808
|
receipt={status}
|
|
750
809
|
deliveredIcon={props.deliveredIcon}
|
|
751
810
|
errorIcon={props.errorIcon}
|
|
@@ -813,34 +872,34 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
813
872
|
/>
|
|
814
873
|
}
|
|
815
874
|
|
|
816
|
-
const getDefaultOptions = (conversation) => {
|
|
875
|
+
const getDefaultOptions = (conversation: any) => {
|
|
817
876
|
let _defaultOptions = CometChatConversationUtils.getDefaultOptions();
|
|
818
877
|
_defaultOptions[0].backgroundColor = theme?.palette.getError();
|
|
819
878
|
_defaultOptions[0].icon = deleteIcon;
|
|
820
879
|
_defaultOptions[0].title = localize("DELETE");
|
|
821
880
|
_defaultOptions[0].titleStyle = { fontSize: 14, color: theme?.palette.getSecondary() };
|
|
822
881
|
_defaultOptions[0].iconTint = theme?.palette.getSecondary();
|
|
823
|
-
_defaultOptions[0].onPress = (id) => {
|
|
882
|
+
_defaultOptions[0].onPress = (id: any) => {
|
|
824
883
|
setConfirmDelete(id);
|
|
825
884
|
};
|
|
826
885
|
return _defaultOptions
|
|
827
886
|
}
|
|
828
887
|
|
|
829
|
-
const updateConversationLastMessage = (message) => {
|
|
830
|
-
if
|
|
888
|
+
const updateConversationLastMessage = (message: any) => {
|
|
889
|
+
if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnGroupActions()) {
|
|
831
890
|
return;
|
|
832
891
|
}
|
|
833
892
|
try {
|
|
834
|
-
let conversation: CometChat.Conversation = conversationListRef.current?.getListItem(message.conversationId)
|
|
893
|
+
let conversation: CometChat.Conversation | any = conversationListRef.current?.getListItem(message.conversationId)
|
|
835
894
|
conversation.lastMessage = message
|
|
836
895
|
conversationListRef.current?.updateAndMoveToFirst(conversation);
|
|
837
|
-
} catch (error) {
|
|
896
|
+
} catch (error: any) {
|
|
838
897
|
onError && onError(error)
|
|
839
898
|
}
|
|
840
899
|
}
|
|
841
900
|
|
|
842
901
|
const updateUnreadMessageCount = (conversation: CometChat.Conversation) => {
|
|
843
|
-
const oldConversation: CometChat.Conversation = (conversationListRef.current
|
|
902
|
+
const oldConversation: CometChat.Conversation = (conversationListRef.current?.getListItem(conversation['conversationId']) as unknown as CometChat.Conversation);
|
|
844
903
|
if (oldConversation == undefined) {
|
|
845
904
|
conversation.setUnreadMessageCount(1);
|
|
846
905
|
return conversation;
|
|
@@ -851,8 +910,8 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
851
910
|
|
|
852
911
|
React.useEffect(() => {
|
|
853
912
|
CometChat.getLoggedinUser()
|
|
854
|
-
.then(u => { loggedInUser.current = u })
|
|
855
|
-
.catch(err => console.log(err));
|
|
913
|
+
.then((u: any) => { loggedInUser.current = u })
|
|
914
|
+
.catch((err: any) => console.log(err));
|
|
856
915
|
|
|
857
916
|
CometChat.addUserListener(
|
|
858
917
|
userListenerId,
|
|
@@ -871,59 +930,59 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
871
930
|
CometChat.addCallListener(
|
|
872
931
|
callListenerId,
|
|
873
932
|
new CometChat.CallListener({
|
|
874
|
-
onIncomingCallReceived: (call) => {
|
|
933
|
+
onIncomingCallReceived: (call: any) => {
|
|
875
934
|
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
876
|
-
.then((conversation) => {
|
|
877
|
-
if
|
|
935
|
+
.then((conversation: any) => {
|
|
936
|
+
if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
878
937
|
return;
|
|
879
938
|
}
|
|
880
939
|
conversation = updateUnreadMessageCount(conversation);
|
|
881
940
|
conversation.setLastMessage(call);
|
|
882
|
-
conversationListRef.current
|
|
941
|
+
conversationListRef.current?.updateList(conversation);
|
|
883
942
|
})
|
|
884
|
-
.catch((e) => {
|
|
943
|
+
.catch((e: any) => {
|
|
885
944
|
onError && onError(e);
|
|
886
945
|
})
|
|
887
946
|
},
|
|
888
|
-
onOutgoingCallAccepted: (call) => {
|
|
947
|
+
onOutgoingCallAccepted: (call: any) => {
|
|
889
948
|
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
890
|
-
.then((conversation) => {
|
|
891
|
-
if
|
|
949
|
+
.then((conversation: any) => {
|
|
950
|
+
if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
892
951
|
return;
|
|
893
952
|
}
|
|
894
953
|
conversation = updateUnreadMessageCount(conversation);
|
|
895
954
|
conversation.setLastMessage(call);
|
|
896
|
-
conversationListRef.current
|
|
955
|
+
conversationListRef.current?.updateList(conversation);
|
|
897
956
|
})
|
|
898
|
-
.catch((e) => {
|
|
957
|
+
.catch((e: any) => {
|
|
899
958
|
onError && onError(e);
|
|
900
959
|
})
|
|
901
960
|
},
|
|
902
|
-
onOutgoingCallRejected: (call) => {
|
|
961
|
+
onOutgoingCallRejected: (call: any) => {
|
|
903
962
|
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
904
|
-
.then((conversation) => {
|
|
905
|
-
if
|
|
963
|
+
.then((conversation: any) => {
|
|
964
|
+
if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
906
965
|
return;
|
|
907
966
|
}
|
|
908
967
|
conversation = updateUnreadMessageCount(conversation);
|
|
909
968
|
conversation.setLastMessage(call);
|
|
910
|
-
conversationListRef.current
|
|
969
|
+
conversationListRef.current?.updateList(conversation);
|
|
911
970
|
})
|
|
912
|
-
.catch((e) => {
|
|
971
|
+
.catch((e: any) => {
|
|
913
972
|
onError && onError(e);
|
|
914
973
|
})
|
|
915
974
|
},
|
|
916
|
-
onIncomingCallCancelled: (call) => {
|
|
975
|
+
onIncomingCallCancelled: (call: any) => {
|
|
917
976
|
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
918
|
-
.then((conversation) => {
|
|
919
|
-
if
|
|
977
|
+
.then((conversation: any) => {
|
|
978
|
+
if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
920
979
|
return;
|
|
921
980
|
}
|
|
922
981
|
conversation = updateUnreadMessageCount(conversation);
|
|
923
982
|
conversation.setLastMessage(call);
|
|
924
|
-
conversationListRef.current
|
|
983
|
+
conversationListRef.current?.updateList(conversation);
|
|
925
984
|
})
|
|
926
|
-
.catch((e) => {
|
|
985
|
+
.catch((e: any) => {
|
|
927
986
|
onError && onError(e);
|
|
928
987
|
})
|
|
929
988
|
}
|
|
@@ -933,7 +992,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
933
992
|
CometChat.addGroupListener(
|
|
934
993
|
groupListenerId,
|
|
935
994
|
new CometChat.GroupListener({
|
|
936
|
-
onGroupMemberScopeChanged: (message) => {
|
|
995
|
+
onGroupMemberScopeChanged: (message: any) => {
|
|
937
996
|
groupHandler(
|
|
938
997
|
message
|
|
939
998
|
);
|
|
@@ -953,7 +1012,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
953
1012
|
{ action: 'left', actionOn: leavingUser, group }
|
|
954
1013
|
);
|
|
955
1014
|
},
|
|
956
|
-
onGroupMemberUnbanned: (message) => {
|
|
1015
|
+
onGroupMemberUnbanned: (message: any) => {
|
|
957
1016
|
groupHandler(message);
|
|
958
1017
|
},
|
|
959
1018
|
onGroupMemberBanned: (
|
|
@@ -981,7 +1040,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
981
1040
|
);
|
|
982
1041
|
}, 50)
|
|
983
1042
|
},
|
|
984
|
-
onGroupMemberJoined: (message) => {
|
|
1043
|
+
onGroupMemberJoined: (message: any) => {
|
|
985
1044
|
groupHandler(
|
|
986
1045
|
message
|
|
987
1046
|
);
|
|
@@ -993,13 +1052,13 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
993
1052
|
conversationListenerId,
|
|
994
1053
|
{
|
|
995
1054
|
ccConversationDeleted:
|
|
996
|
-
({ conversation }: { conversation: CometChat.Conversation }) => {
|
|
1055
|
+
({ conversation }: { conversation: CometChat.Conversation | any }) => {
|
|
997
1056
|
CometChat.deleteConversation(conversation.getConversationId(), conversation.getConversationType())
|
|
998
|
-
.then(res => {
|
|
999
|
-
conversationListRef.current
|
|
1057
|
+
.then((res: any) => {
|
|
1058
|
+
conversationListRef.current?.removeItemFromList(conversation);
|
|
1000
1059
|
removeItemFromSelectionList(conversation.getConversationId())
|
|
1001
1060
|
})
|
|
1002
|
-
.catch(err => {
|
|
1061
|
+
.catch((err: any) => {
|
|
1003
1062
|
console.log("Error", err);
|
|
1004
1063
|
});
|
|
1005
1064
|
}
|
|
@@ -1008,7 +1067,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
1008
1067
|
CometChatUIEventHandler.addMessageListener(
|
|
1009
1068
|
messageListenerId,
|
|
1010
1069
|
{
|
|
1011
|
-
ccMessageSent: ({ message, status }) => {
|
|
1070
|
+
ccMessageSent: ({ message, status }: any) => {
|
|
1012
1071
|
if (status == MessageStatusConstants.success) {
|
|
1013
1072
|
if (!shouldUpdateLastMessageAndUnreadCount(message)) {
|
|
1014
1073
|
return;
|
|
@@ -1016,77 +1075,83 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
1016
1075
|
updateLastMessage(message);
|
|
1017
1076
|
}
|
|
1018
1077
|
},
|
|
1019
|
-
ccMessageRead: ({ message }) => {
|
|
1078
|
+
ccMessageRead: ({ message }: any) => {
|
|
1020
1079
|
checkAndUpdateLastMessage(message)
|
|
1021
1080
|
},
|
|
1022
|
-
ccMessageDeleted: ({ message }) => {
|
|
1081
|
+
ccMessageDeleted: ({ message }: any) => {
|
|
1023
1082
|
checkAndUpdateLastMessage(message)
|
|
1024
1083
|
},
|
|
1025
|
-
ccMessageEdited: ({ message }) => {
|
|
1084
|
+
ccMessageEdited: ({ message }: any) => {
|
|
1026
1085
|
checkAndUpdateLastMessage(message)
|
|
1027
1086
|
},
|
|
1028
|
-
onTextMessageReceived: (textMessage) => {
|
|
1029
|
-
if
|
|
1087
|
+
onTextMessageReceived: (textMessage: any) => {
|
|
1088
|
+
if(!shouldUpdateLastMessageAndUnreadCount(textMessage)) {
|
|
1030
1089
|
return;
|
|
1031
1090
|
}
|
|
1032
1091
|
messageEventHandler(textMessage);
|
|
1033
1092
|
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
1034
1093
|
},
|
|
1035
|
-
onMediaMessageReceived: (mediaMessage) => {
|
|
1036
|
-
if
|
|
1094
|
+
onMediaMessageReceived: (mediaMessage: any) => {
|
|
1095
|
+
if(!shouldUpdateLastMessageAndUnreadCount(mediaMessage)) {
|
|
1037
1096
|
return;
|
|
1038
1097
|
}
|
|
1039
1098
|
messageEventHandler(mediaMessage);
|
|
1040
1099
|
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
1041
1100
|
},
|
|
1042
|
-
onCustomMessageReceived: (customMessage) => {
|
|
1043
|
-
if
|
|
1101
|
+
onCustomMessageReceived: (customMessage: any) => {
|
|
1102
|
+
if(!shouldUpdateLastMessageAndUnreadCount(customMessage)) {
|
|
1044
1103
|
return;
|
|
1045
1104
|
}
|
|
1046
1105
|
messageEventHandler(customMessage);
|
|
1047
1106
|
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
1048
1107
|
},
|
|
1049
|
-
onMessageDeleted: (deletedMessage) => {
|
|
1108
|
+
onMessageDeleted: (deletedMessage: any) => {
|
|
1050
1109
|
checkAndUpdateLastMessage(deletedMessage)
|
|
1051
1110
|
},
|
|
1052
|
-
onMessageEdited: (editedMessage) => {
|
|
1111
|
+
onMessageEdited: (editedMessage: any) => {
|
|
1053
1112
|
checkAndUpdateLastMessage(editedMessage)
|
|
1054
1113
|
},
|
|
1055
|
-
onMessagesRead: (messageReceipt) => {
|
|
1114
|
+
onMessagesRead: (messageReceipt: any) => {
|
|
1056
1115
|
updateMessageReceipt(messageReceipt);
|
|
1057
1116
|
},
|
|
1058
|
-
onMessagesDelivered: (messageReceipt) => {
|
|
1117
|
+
onMessagesDelivered: (messageReceipt: any) => {
|
|
1059
1118
|
updateMessageReceipt(messageReceipt);
|
|
1060
1119
|
},
|
|
1061
|
-
|
|
1120
|
+
onMessagesDeliveredToAll: (messageReceipt: CometChat.MessageReceipt) => {
|
|
1121
|
+
updateMessageReceipt(messageReceipt);
|
|
1122
|
+
},
|
|
1123
|
+
onMessagesReadByAll: (messageReceipt: CometChat.MessageReceipt) => {
|
|
1124
|
+
updateMessageReceipt(messageReceipt);
|
|
1125
|
+
},
|
|
1126
|
+
onTypingStarted: (typingIndicator: any) => {
|
|
1062
1127
|
typingEventHandler(typingIndicator, true);
|
|
1063
1128
|
},
|
|
1064
|
-
onTypingEnded: (typingIndicator) => {
|
|
1129
|
+
onTypingEnded: (typingIndicator: any) => {
|
|
1065
1130
|
typingEventHandler(typingIndicator, false);
|
|
1066
1131
|
},
|
|
1067
|
-
onFormMessageReceived: (formMessage) => {
|
|
1068
|
-
if
|
|
1132
|
+
onFormMessageReceived: (formMessage: any) => {
|
|
1133
|
+
if(!shouldUpdateLastMessageAndUnreadCount(formMessage)) {
|
|
1069
1134
|
return;
|
|
1070
1135
|
}
|
|
1071
1136
|
messageEventHandler(formMessage);
|
|
1072
1137
|
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
1073
1138
|
},
|
|
1074
|
-
onCardMessageReceived: (cardMessage) => {
|
|
1075
|
-
if
|
|
1139
|
+
onCardMessageReceived: (cardMessage: any) => {
|
|
1140
|
+
if(!shouldUpdateLastMessageAndUnreadCount(cardMessage)) {
|
|
1076
1141
|
return;
|
|
1077
1142
|
}
|
|
1078
1143
|
messageEventHandler(cardMessage);
|
|
1079
1144
|
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
1080
1145
|
},
|
|
1081
|
-
onSchedulerMessageReceived: (schedulerMessage) => {
|
|
1082
|
-
if
|
|
1146
|
+
onSchedulerMessageReceived: (schedulerMessage: any) => {
|
|
1147
|
+
if(!shouldUpdateLastMessageAndUnreadCount(schedulerMessage)) {
|
|
1083
1148
|
return;
|
|
1084
1149
|
}
|
|
1085
1150
|
messageEventHandler(schedulerMessage);
|
|
1086
1151
|
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
1087
1152
|
},
|
|
1088
|
-
onCustomInteractiveMessageReceived: (customInteractiveMessage) => {
|
|
1089
|
-
if
|
|
1153
|
+
onCustomInteractiveMessageReceived: (customInteractiveMessage: any) => {
|
|
1154
|
+
if(!shouldUpdateLastMessageAndUnreadCount(customInteractiveMessage)) {
|
|
1090
1155
|
return;
|
|
1091
1156
|
}
|
|
1092
1157
|
messageEventHandler(customInteractiveMessage);
|
|
@@ -1097,18 +1162,18 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
1097
1162
|
CometChatUIEventHandler.addGroupListener(
|
|
1098
1163
|
groupListenerId,
|
|
1099
1164
|
{
|
|
1100
|
-
ccGroupCreated: ({ group }) => {
|
|
1165
|
+
ccGroupCreated: ({ group }: any) => {
|
|
1101
1166
|
CometChat.getConversation(group.getGuid(), CometChatUiKitConstants.ConversationTypeConstants.group).then(
|
|
1102
|
-
conversation => {
|
|
1167
|
+
(conversation: any) => {
|
|
1103
1168
|
conversationListRef.current?.addItemToList(conversation, 0);
|
|
1104
1169
|
}
|
|
1105
1170
|
)
|
|
1106
1171
|
},
|
|
1107
|
-
ccGroupDeleted: ({ group }) => {
|
|
1172
|
+
ccGroupDeleted: ({ group }: any) => {
|
|
1108
1173
|
conversationListRef.current?.removeItemFromList(group['conversationId']);
|
|
1109
1174
|
removeItemFromSelectionList(group['conversationId'])
|
|
1110
1175
|
},
|
|
1111
|
-
ccGroupLeft: ({ leftGroup }) => {
|
|
1176
|
+
ccGroupLeft: ({ leftGroup }: any) => {
|
|
1112
1177
|
conversationListRef.current?.removeItemFromList(leftGroup['conversationId']);
|
|
1113
1178
|
removeItemFromSelectionList(leftGroup['conversationId'])
|
|
1114
1179
|
},
|
|
@@ -1118,27 +1183,27 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
1118
1183
|
}
|
|
1119
1184
|
updateConversationLastMessage(message)
|
|
1120
1185
|
},
|
|
1121
|
-
ccGroupMemberBanned: ({ message }) => {
|
|
1122
|
-
if
|
|
1186
|
+
ccGroupMemberBanned: ({ message }: any) => {
|
|
1187
|
+
if(!(shouldUpdateLastMessageAndUnreadCount(message))) {
|
|
1123
1188
|
return;
|
|
1124
1189
|
}
|
|
1125
1190
|
groupHandler(message);
|
|
1126
1191
|
},
|
|
1127
|
-
ccGroupMemberUnBanned: ({ message }) => {
|
|
1128
|
-
if
|
|
1192
|
+
ccGroupMemberUnBanned: ({ message }: any) => {
|
|
1193
|
+
if(!(shouldUpdateLastMessageAndUnreadCount(message))) {
|
|
1129
1194
|
return;
|
|
1130
1195
|
}
|
|
1131
1196
|
groupHandler(message)
|
|
1132
1197
|
},
|
|
1133
|
-
ccOwnershipChanged: ({ message }) => {
|
|
1134
|
-
if
|
|
1198
|
+
ccOwnershipChanged: ({ message }: any) => {
|
|
1199
|
+
if(!(shouldUpdateLastMessageAndUnreadCount(message))) {
|
|
1135
1200
|
return;
|
|
1136
1201
|
}
|
|
1137
1202
|
CometChat.CometChatHelper.getConversationFromMessage(message)
|
|
1138
|
-
.then(conversation => {
|
|
1203
|
+
.then((conversation: any) => {
|
|
1139
1204
|
conversationListRef.current?.updateList(conversation);
|
|
1140
1205
|
})
|
|
1141
|
-
.catch(e => {
|
|
1206
|
+
.catch((e: any) => {
|
|
1142
1207
|
onError && onError(e);
|
|
1143
1208
|
})
|
|
1144
1209
|
},
|
|
@@ -1151,7 +1216,10 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
1151
1216
|
CometChatUIEventHandler.addUserListener(
|
|
1152
1217
|
userListenerId,
|
|
1153
1218
|
{
|
|
1154
|
-
ccUserBlocked: ({ user }) => {
|
|
1219
|
+
ccUserBlocked: ({ user }: any) => {
|
|
1220
|
+
if(conversationsRequestBuilder && conversationsRequestBuilder.build().isIncludeBlockedUsers()) {
|
|
1221
|
+
return;
|
|
1222
|
+
}
|
|
1155
1223
|
conversationListRef?.current?.removeItemFromList(user['conversationId']);
|
|
1156
1224
|
removeItemFromSelectionList(user['conversationId']);
|
|
1157
1225
|
}
|
|
@@ -1161,55 +1229,55 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
1161
1229
|
CometChatUIEventHandler.addCallListener(
|
|
1162
1230
|
callListenerId,
|
|
1163
1231
|
{
|
|
1164
|
-
ccOutgoingCall: ({ call }) => {
|
|
1232
|
+
ccOutgoingCall: ({ call }: any) => {
|
|
1165
1233
|
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
1166
|
-
.then((conversation) => {
|
|
1167
|
-
if
|
|
1234
|
+
.then((conversation: any) => {
|
|
1235
|
+
if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
1168
1236
|
return;
|
|
1169
1237
|
}
|
|
1170
1238
|
conversation = updateUnreadMessageCount(conversation);
|
|
1171
|
-
conversationListRef.current
|
|
1239
|
+
conversationListRef.current?.updateList(conversation);
|
|
1172
1240
|
})
|
|
1173
|
-
.catch((e) => {
|
|
1241
|
+
.catch((e: any) => {
|
|
1174
1242
|
onError && onError(e);
|
|
1175
1243
|
})
|
|
1176
1244
|
},
|
|
1177
|
-
ccCallAccepted: ({ call }) => {
|
|
1245
|
+
ccCallAccepted: ({ call }: any) => {
|
|
1178
1246
|
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
1179
|
-
.then((conversation) => {
|
|
1180
|
-
if
|
|
1247
|
+
.then((conversation: any) => {
|
|
1248
|
+
if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
1181
1249
|
return;
|
|
1182
1250
|
}
|
|
1183
1251
|
conversation = updateUnreadMessageCount(conversation);
|
|
1184
|
-
conversationListRef.current
|
|
1252
|
+
conversationListRef.current?.updateList(conversation);
|
|
1185
1253
|
})
|
|
1186
|
-
.catch((e) => {
|
|
1254
|
+
.catch((e: any) => {
|
|
1187
1255
|
onError && onError(e);
|
|
1188
1256
|
})
|
|
1189
1257
|
},
|
|
1190
|
-
ccCallRejected: ({ call }) => {
|
|
1258
|
+
ccCallRejected: ({ call }: any) => {
|
|
1191
1259
|
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
1192
|
-
.then((conversation) => {
|
|
1193
|
-
if
|
|
1260
|
+
.then((conversation: any) => {
|
|
1261
|
+
if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
1194
1262
|
return;
|
|
1195
1263
|
}
|
|
1196
1264
|
conversation = updateUnreadMessageCount(conversation);
|
|
1197
|
-
conversationListRef.current
|
|
1265
|
+
conversationListRef.current?.updateList(conversation);
|
|
1198
1266
|
})
|
|
1199
|
-
.catch((e) => {
|
|
1267
|
+
.catch((e: any) => {
|
|
1200
1268
|
onError && onError(e);
|
|
1201
1269
|
})
|
|
1202
1270
|
},
|
|
1203
|
-
ccCallEnded: ({ call }) => {
|
|
1271
|
+
ccCallEnded: ({ call }: any) => {
|
|
1204
1272
|
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
1205
|
-
.then((conversation) => {
|
|
1206
|
-
if
|
|
1273
|
+
.then((conversation: any) => {
|
|
1274
|
+
if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
1207
1275
|
return;
|
|
1208
1276
|
}
|
|
1209
1277
|
conversation = updateUnreadMessageCount(conversation);
|
|
1210
|
-
conversationListRef.current
|
|
1278
|
+
conversationListRef.current?.updateList(conversation);
|
|
1211
1279
|
})
|
|
1212
|
-
.catch((e) => {
|
|
1280
|
+
.catch((e: any) => {
|
|
1213
1281
|
onError && onError(e);
|
|
1214
1282
|
})
|
|
1215
1283
|
}
|
|
@@ -1227,7 +1295,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
1227
1295
|
}
|
|
1228
1296
|
}, []);
|
|
1229
1297
|
|
|
1230
|
-
const ConversationItemView = ({ item: conversation }) => {
|
|
1298
|
+
const ConversationItemView = ({ item: conversation }: any) => {
|
|
1231
1299
|
if (!conversation) return null;
|
|
1232
1300
|
//custom view check
|
|
1233
1301
|
if (ListItemView)
|
|
@@ -1235,7 +1303,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
1235
1303
|
const { conversationWith, conversationType } = conversation;
|
|
1236
1304
|
const lastMessage = CometChatConversationUtils.getLastMessage(conversation);
|
|
1237
1305
|
const { name, type, conversationId } = conversationWith || {};
|
|
1238
|
-
let image
|
|
1306
|
+
let image!: ImageType, backgroundColor!: string, avatarIcon = conversationWith[conversationType == "group" ? 'icon' : "avatar"];
|
|
1239
1307
|
if (type == GroupTypeConstants.password) {
|
|
1240
1308
|
image = props?.protectedGroupIcon || passwordGroupIcon;
|
|
1241
1309
|
backgroundColor = PASSWORD_GROUP_COLOR;
|
|
@@ -1267,12 +1335,12 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
1267
1335
|
statusIndicatorColor={disableUsersPresence ? "transparent" : backgroundColor}
|
|
1268
1336
|
listItemStyle={_listItemStyle}
|
|
1269
1337
|
TailView={() => <TailView
|
|
1270
|
-
customPattern={() => datePattern &&
|
|
1338
|
+
customPattern={() => datePattern && datePattern(conversation)}
|
|
1271
1339
|
timestamp={lastMessage && lastMessage['sentAt'] || conversationWith['createdAt']}
|
|
1272
1340
|
unreadCount={conversation.unreadMessageCount}
|
|
1273
1341
|
/>}
|
|
1274
1342
|
avatarStyle={_avatarStyle}
|
|
1275
|
-
statusIndicatorStyle={_statusIndicatorStyle}
|
|
1343
|
+
statusIndicatorStyle={_statusIndicatorStyle as ViewProps}
|
|
1276
1344
|
onPress={conversationClicked.bind(this, conversation)}
|
|
1277
1345
|
onLongPress={conversationLongPressed.bind(this, conversation)}
|
|
1278
1346
|
options={() => options ? options(conversation) : getDefaultOptions(conversation)}
|