@cometchat/chat-uikit-react-native 4.2.2 → 4.3.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/README.md +26 -67
- package/android/.gradle/7.4/checksums/checksums.lock +0 -0
- package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/reactnativecometchatuikit/CometchatUiKitPackage.java +2 -1
- package/android/src/main/java/com/reactnativecometchatuikit/ReactVideoView.java +796 -0
- package/android/src/main/java/com/reactnativecometchatuikit/ReactVideoViewManager.java +172 -0
- package/android/src/main/java/com/scalablevideoview/BuildConfig.java +10 -0
- package/android/src/main/java/com/scalablevideoview/PivotPoint.java +13 -0
- package/android/src/main/java/com/scalablevideoview/ScalableType.java +34 -0
- package/android/src/main/java/com/scalablevideoview/ScalableVideoView.java +255 -0
- package/android/src/main/java/com/scalablevideoview/ScaleManager.java +188 -0
- package/android/src/main/java/com/scalablevideoview/Size.java +20 -0
- package/android/src/main/java/com/zipfile/APEZProvider.java +287 -0
- package/android/src/main/java/com/zipfile/APKExpansionSupport.java +81 -0
- package/android/src/main/java/com/zipfile/ZipResourceFile.java +428 -0
- package/android/src/main/res/values/attrs.xml +37 -0
- package/ios/FileManager.m +75 -5
- package/ios/Video/CCRCTVideo.h +67 -0
- package/ios/Video/CCRCTVideo.m +2031 -0
- package/ios/Video/CCRCTVideoManager.h +6 -0
- package/ios/Video/CCRCTVideoManager.m +133 -0
- package/ios/Video/CCRCTVideoPlayerViewController.h +20 -0
- package/ios/Video/CCRCTVideoPlayerViewController.m +43 -0
- package/ios/Video/CCRCTVideoPlayerViewControllerDelegate.h +7 -0
- package/ios/Video/UIView+FindUIViewController.h +15 -0
- package/ios/Video/UIView+FindUIViewController.m +21 -0
- package/ios/VideoCaching/RCTVideoCache.h +38 -0
- package/ios/VideoCaching/RCTVideoCache.m +174 -0
- package/ios/VideoPickerModule.h +7 -0
- package/ios/VideoPickerModule.mm +95 -0
- package/package.json +3 -4
- package/react-native-cometchat-ui-kit.podspec +24 -10
- package/src/CometChatContacts/CometChatContacts.tsx +12 -9
- package/src/CometChatConversations/CometChatConversations.tsx +84 -64
- package/src/CometChatDetails/CometChatDetails.tsx +14 -12
- package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +8 -4
- package/src/CometChatGroupMembers/resources/check.png +0 -0
- package/src/CometChatGroupMembers/resources/index.ts +2 -0
- package/src/CometChatGroups/CometChatGroups.tsx +4 -4
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +57 -15
- package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +9 -2
- package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +1 -1
- package/src/CometChatMessageList/CometChatMessageList.tsx +596 -181
- package/src/CometChatMessageList/MessageListConfiguration.ts +55 -4
- package/src/CometChatMessageList/resources/index.ts +5 -1
- package/src/CometChatMessageList/resources/leftarrowcurve.png +0 -0
- package/src/CometChatMessageList/resources/rightarrowcurve.png +0 -0
- package/src/CometChatMessages/CometChatMessages.tsx +1 -1
- package/src/CometChatThreadedMessages/CometChatThreadedMessages.tsx +4 -12
- package/src/CometChatThreadedMessages/style.ts +3 -1
- package/src/CometChatUsers/CometChatUsers.tsx +1 -1
- package/src/calls/CallUtils.ts +4 -8
- package/src/calls/CallingExtentionDecorator.tsx +5 -2
- package/src/calls/CometChatCallBubble/styles.ts +2 -1
- package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +14 -3
- package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +9 -9
- package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +80 -73
- package/src/extensions/CollaborativeBubble/styles.ts +2 -0
- package/src/extensions/SmartReplies/SmartRepliesDecorator.tsx +11 -0
- package/src/extensions/index.ts +0 -4
- package/src/index.ts +53 -8
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +14 -2
- package/src/shared/constants/UIKitConstants.ts +1 -0
- package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +6 -0
- package/src/shared/events/CometChatUIEventHandler/Listener.ts +8 -0
- package/src/shared/events/ListenerInitializer.ts +6 -0
- package/src/shared/events/messages.ts +2 -0
- package/src/shared/framework/MessageDataSource.tsx +29 -25
- package/src/shared/index.ts +49 -1
- package/src/shared/libs/VideoPlayer/DRMType.js +6 -0
- package/src/shared/libs/VideoPlayer/FilterType.js +18 -0
- package/src/shared/libs/VideoPlayer/TextTrackType.js +5 -0
- package/src/shared/libs/VideoPlayer/Video.js +519 -0
- package/src/shared/libs/VideoPlayer/VideoResizeMode.js +5 -0
- package/src/shared/libs/VideoPlayerControls/OSSupport/PlatformSupport.tsx +43 -0
- package/src/shared/libs/VideoPlayerControls/OSSupport/TVOSSupport.tsx +16 -0
- package/src/shared/libs/VideoPlayerControls/OSSupport/index.tsx +1 -0
- package/src/shared/libs/VideoPlayerControls/VideoPlayer.tsx +511 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/back.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/back@2x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/back@3x.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 +28 -0
- package/src/shared/libs/VideoPlayerControls/components/Back/index.ts +1 -0
- package/src/shared/libs/VideoPlayerControls/components/BottomControls.tsx +142 -0
- package/src/shared/libs/VideoPlayerControls/components/Control.tsx +45 -0
- package/src/shared/libs/VideoPlayerControls/components/Error/Error.tsx +22 -0
- package/src/shared/libs/VideoPlayerControls/components/Error/index.ts +1 -0
- package/src/shared/libs/VideoPlayerControls/components/Error/styles.ts +21 -0
- package/src/shared/libs/VideoPlayerControls/components/Fullscreen.tsx +36 -0
- package/src/shared/libs/VideoPlayerControls/components/Loader/Loader.tsx +15 -0
- package/src/shared/libs/VideoPlayerControls/components/Loader/index.ts +1 -0
- package/src/shared/libs/VideoPlayerControls/components/Loader/styles.ts +16 -0
- package/src/shared/libs/VideoPlayerControls/components/NullControl.tsx +7 -0
- package/src/shared/libs/VideoPlayerControls/components/Overlay.tsx +23 -0
- package/src/shared/libs/VideoPlayerControls/components/PlayPause/PlayPause.tsx +109 -0
- package/src/shared/libs/VideoPlayerControls/components/PlayPause/index.ts +1 -0
- package/src/shared/libs/VideoPlayerControls/components/PlayPause/styles.ts +21 -0
- package/src/shared/libs/VideoPlayerControls/components/Seekbar/Seekbar.tsx +47 -0
- package/src/shared/libs/VideoPlayerControls/components/Seekbar/index.ts +1 -0
- package/src/shared/libs/VideoPlayerControls/components/Seekbar/styles.ts +37 -0
- package/src/shared/libs/VideoPlayerControls/components/Timer/Timer.tsx +28 -0
- package/src/shared/libs/VideoPlayerControls/components/Timer/index.ts +1 -0
- package/src/shared/libs/VideoPlayerControls/components/Timer/styles.ts +12 -0
- package/src/shared/libs/VideoPlayerControls/components/Title.tsx +35 -0
- package/src/shared/libs/VideoPlayerControls/components/TopControls.tsx +110 -0
- package/src/shared/libs/VideoPlayerControls/components/Volume/Volume.tsx +37 -0
- package/src/shared/libs/VideoPlayerControls/components/Volume/index.ts +1 -0
- package/src/shared/libs/VideoPlayerControls/components/Volume/styles.ts +31 -0
- package/src/shared/libs/VideoPlayerControls/components/index.ts +14 -0
- package/src/shared/libs/VideoPlayerControls/components/styles.ts +30 -0
- package/src/shared/libs/VideoPlayerControls/hooks/index.ts +3 -0
- package/src/shared/libs/VideoPlayerControls/hooks/useAnimations.ts +68 -0
- package/src/shared/libs/VideoPlayerControls/hooks/useControlTimeout.tsx +67 -0
- package/src/shared/libs/VideoPlayerControls/hooks/usePanResponders.tsx +96 -0
- package/src/shared/libs/VideoPlayerControls/index.ts +4 -0
- package/src/shared/libs/VideoPlayerControls/styles.ts +19 -0
- package/src/shared/libs/VideoPlayerControls/types.ts +290 -0
- package/src/shared/libs/VideoPlayerControls/utils.ts +76 -0
- package/src/shared/modals/CometChatMessageTemplate.ts +113 -9
- package/src/shared/modals/InteractiveData/InteractiveMessage/SchedulerMessage.ts +23 -21
- package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +4 -1
- package/src/shared/resources/CometChatLocalize/resources/de/translation.json +4 -1
- package/src/shared/resources/CometChatLocalize/resources/en/translation.json +6 -3
- package/src/shared/resources/CometChatLocalize/resources/es/translation.json +4 -1
- package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +4 -1
- package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +4 -1
- package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +4 -1
- package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +4 -1
- package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +4 -1
- package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +4 -1
- package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +4 -1
- package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +4 -1
- package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +4 -1
- package/src/shared/resources/CometChatTheme/Palette.ts +79 -45
- package/src/shared/resources/CometChatTheme/Typography.ts +18 -0
- package/src/shared/utils/CommonUtils.ts +71 -0
- package/src/shared/utils/PermissionUtilIOS.ts +104 -0
- package/src/shared/views/CometChatActionSheet/ActionSheetStyle.ts +3 -1
- package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +6 -6
- package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +28 -5
- package/src/shared/views/CometChatAudioBubble/style.ts +4 -2
- package/src/shared/views/CometChatAvatar/AvatarStyle.ts +1 -1
- package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +4 -3
- package/src/shared/views/CometChatEmojiKeyboard/CometChatEmojiKeyboard.tsx +47 -31
- package/src/shared/views/CometChatEmojiKeyboard/EmojiKeyboardConfiguration.ts +5 -5
- package/src/shared/views/CometChatEmojiKeyboard/EmojiKeyboardStyle.ts +12 -13
- package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +52 -5
- package/src/shared/views/CometChatFileBubble/style.ts +4 -2
- package/src/shared/views/CometChatImageBubble/CometChatImageBubble.tsx +25 -2
- package/src/shared/views/CometChatList/CometChatList.tsx +2 -1
- package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +51 -2
- package/src/shared/views/CometChatQuickReactions/CometChatQuickReactions.tsx +76 -0
- package/src/shared/views/CometChatQuickReactions/QuickReactionsConfiguration.tsx +12 -0
- package/src/shared/views/CometChatQuickReactions/QuickReactionsStyle.tsx +35 -0
- package/src/shared/views/CometChatQuickReactions/index.ts +12 -0
- package/src/shared/views/CometChatReactions/CometChatReactions.tsx +166 -0
- package/src/shared/views/CometChatReactions/ReactionsConfiguration.tsx +12 -0
- package/src/shared/views/CometChatReactions/ReactionsStyle.tsx +43 -0
- package/src/shared/views/CometChatReactions/index.ts +12 -0
- package/src/{extensions/Reactions/CometChatMessageReactions → shared/views/CometChatReactions}/style.ts +7 -7
- package/src/shared/views/CometChatReactionsList/CometChatReactionsList.tsx +335 -0
- package/src/shared/views/CometChatReactionsList/ReactionsListConfiguration.tsx +14 -0
- package/src/shared/views/CometChatReactionsList/ReactionsListStyle.tsx +67 -0
- package/src/shared/views/CometChatReactionsList/index.ts +12 -0
- package/src/shared/views/CometChatReactionsList/resources/Spineer.png +0 -0
- package/src/shared/views/CometChatReactionsList/resources/index.ts +5 -0
- package/src/shared/views/CometChatReceipt/CometChatReceipt.tsx +21 -4
- package/src/shared/views/CometChatReceipt/MessageConfiguration.ts +12 -0
- package/src/shared/views/CometChatReceipt/resources/error.png +0 -0
- package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +1 -1
- package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +78 -12
- package/src/shared/views/CometChatVideoBubble/VideoBubbleStyle.ts +52 -2
- package/src/shared/views/CometChatVideoPlayer/CometChatVideoPlayer.tsx +134 -0
- package/src/shared/views/CometChatVideoPlayer/index.tsx +1 -0
- package/src/shared/views/index.ts +30 -0
- package/android/.gradle/7.4.2/checksums/checksums.lock +0 -0
- package/android/.gradle/7.4.2/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.4.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.4.2/gc.properties +0 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.idea/gradle.xml +0 -13
- package/android/.idea/misc.xml +0 -8
- package/android/.idea/modules/android.iml +0 -18
- package/android/.idea/modules.xml +0 -8
- package/android/.idea/vcs.xml +0 -6
- package/android/local.properties +0 -8
- package/src/extensions/Reactions/CometChatMessageReactions/CometChatMessageReactions.tsx +0 -249
- package/src/extensions/Reactions/CometChatMessageReactions/index.ts +0 -3
- package/src/extensions/Reactions/ReactionsDecorator.tsx +0 -164
- package/src/extensions/Reactions/ReactionsExtension.tsx +0 -48
- package/src/extensions/Reactions/index.ts +0 -4
- /package/src/{extensions/Reactions → shared/views/CometChatQuickReactions}/resources/AddReactions.png +0 -0
- /package/src/{extensions/Reactions → shared/views/CometChatQuickReactions}/resources/index.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Image, TouchableOpacity, View } from 'react-native'
|
|
2
2
|
import React, { useContext, useEffect, useRef, useState } from 'react'
|
|
3
|
-
import { CometChatUsers, UsersConfigurationInterface } from '../CometChatUsers'
|
|
4
|
-
import { CometChatGroups, GroupsConfigurationInterface } from '../CometChatGroups'
|
|
3
|
+
import { CometChatUsers, UsersConfiguration, UsersConfigurationInterface } from '../CometChatUsers'
|
|
4
|
+
import { CometChatGroups, GroupsConfiguration, GroupsConfigurationInterface } from '../CometChatGroups'
|
|
5
5
|
import { CometChat } from '@cometchat/chat-sdk-react-native'
|
|
6
6
|
import { ImageType } from '../shared/helper/types'
|
|
7
7
|
import { ContactsStyleInterface } from './ContactsStyle'
|
|
@@ -79,8 +79,8 @@ export const CometChatContacts = (props: CometChatContactsInterface) => {
|
|
|
79
79
|
backIcon = ICONS.BACK,
|
|
80
80
|
userTabTitle = localize('USERS'),
|
|
81
81
|
groupTabTitle = localize('GROUPS'),
|
|
82
|
-
usersConfiguration,
|
|
83
|
-
groupsConfiguration,
|
|
82
|
+
usersConfiguration = new UsersConfiguration({}),
|
|
83
|
+
groupsConfiguration = new GroupsConfiguration({}),
|
|
84
84
|
onItemPress,
|
|
85
85
|
onClose,
|
|
86
86
|
contactsStyle = {},
|
|
@@ -140,6 +140,10 @@ export const CometChatContacts = (props: CometChatContactsInterface) => {
|
|
|
140
140
|
|
|
141
141
|
useEffect(() => {
|
|
142
142
|
let tabOptions = [];
|
|
143
|
+
groupsConfiguration!.groupsRequestBuilder = groupsConfiguration?.groupsRequestBuilder || new CometChat.GroupsRequestBuilder().setLimit(30).joinedOnly(true);
|
|
144
|
+
groupsConfiguration!.searchRequestBuilder = groupsConfiguration?.searchRequestBuilder || new CometChat.GroupsRequestBuilder().setLimit(30).joinedOnly(true);
|
|
145
|
+
usersConfiguration!.usersRequestBuilder = usersConfiguration?.usersRequestBuilder || new CometChat.UsersRequestBuilder().setLimit(30).hideBlockedUsers(true);
|
|
146
|
+
usersConfiguration!.searchRequestBuilder = usersConfiguration?.searchRequestBuilder || new CometChat.UsersRequestBuilder().setLimit(30).hideBlockedUsers(true);
|
|
143
147
|
let userTab = {
|
|
144
148
|
id: "user",
|
|
145
149
|
isActive: true,
|
|
@@ -164,14 +168,13 @@ export const CometChatContacts = (props: CometChatContactsInterface) => {
|
|
|
164
168
|
childView: () => {
|
|
165
169
|
return <CometChatGroups
|
|
166
170
|
ref={groupList}
|
|
167
|
-
selectionMode={selectionMode}
|
|
168
|
-
// groupRequestBuilder={new CometChat.GroupsRequestBuilder().}
|
|
169
|
-
onItemPress={(group) => {
|
|
170
|
-
onItemPress && onItemPress({group});
|
|
171
|
-
}}
|
|
172
171
|
title=''
|
|
173
172
|
hideSubmitIcon={true}
|
|
174
173
|
{...groupsConfiguration}
|
|
174
|
+
selectionMode={groupsConfiguration.selectionMode ?? selectionMode}
|
|
175
|
+
onItemPress={groupsConfiguration.onItemPress ?? ((group) => {
|
|
176
|
+
onItemPress && onItemPress({group});
|
|
177
|
+
})}
|
|
175
178
|
/>
|
|
176
179
|
}
|
|
177
180
|
}
|
|
@@ -170,7 +170,7 @@ export interface ConversationInterface {
|
|
|
170
170
|
*/
|
|
171
171
|
hideError?: boolean,
|
|
172
172
|
/**
|
|
173
|
-
* call back function for
|
|
173
|
+
* call back function for
|
|
174
174
|
*/
|
|
175
175
|
onItemPress?: (item: CometChat.Conversation) => void,
|
|
176
176
|
/**
|
|
@@ -272,6 +272,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
272
272
|
const [confirmDelete, setConfirmDelete] = React.useState(undefined);
|
|
273
273
|
const [selecting, setSelecting] = React.useState(false);
|
|
274
274
|
const [selectedConversation, setSelectedConversations] = React.useState([]);
|
|
275
|
+
const onMemberAddedToGroupDebounceTimer = React.useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
275
276
|
|
|
276
277
|
const _style = new ConversationsStyle({
|
|
277
278
|
backgroundColor: theme?.palette?.getBackgroundColor(),
|
|
@@ -364,7 +365,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
364
365
|
|
|
365
366
|
/**
|
|
366
367
|
* Listener callback for typing event
|
|
367
|
-
* @param {...any} args
|
|
368
|
+
* @param {...any} args
|
|
368
369
|
*/
|
|
369
370
|
const typingEventHandler = (...args) => {
|
|
370
371
|
// console.log("typing event", args[1], args[0].receiverId);
|
|
@@ -382,10 +383,29 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
382
383
|
conversationListRef.current.updateList(conversation);
|
|
383
384
|
}
|
|
384
385
|
|
|
386
|
+
/**
|
|
387
|
+
* Find conversation from state , check and udpate its last message object.
|
|
388
|
+
* conversation list item remains at the same place
|
|
389
|
+
*
|
|
390
|
+
* @param newMessage message object
|
|
391
|
+
*/
|
|
392
|
+
const checkAndUpdateLastMessage = (newMessage: CometChat.BaseMessage) => {
|
|
393
|
+
CometChat.CometChatHelper.getConversationFromMessage(newMessage)
|
|
394
|
+
.then(conversation => {
|
|
395
|
+
let conver = conversationListRef.current.getListItem(conversation.getConversationId())
|
|
396
|
+
if (!conver) return;
|
|
397
|
+
let lastMessageId = conver['lastMessage']['id']
|
|
398
|
+
if (lastMessageId == newMessage['id']) {
|
|
399
|
+
conversationListRef.current.updateList(conversation)
|
|
400
|
+
}
|
|
401
|
+
})
|
|
402
|
+
|
|
403
|
+
}
|
|
404
|
+
|
|
385
405
|
/**
|
|
386
406
|
* Find conversation from state and udpate its last message object.
|
|
387
407
|
* Also remove from the current location and put it to 1st location.
|
|
388
|
-
*
|
|
408
|
+
*
|
|
389
409
|
* @param newMessage message object
|
|
390
410
|
*/
|
|
391
411
|
const updateLastMessage = (newMessage) => {
|
|
@@ -398,7 +418,8 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
398
418
|
if (oldConversation == undefined) {
|
|
399
419
|
CometChat.CometChatHelper.getConversationFromMessage(newMessage)
|
|
400
420
|
.then(newConversation => {
|
|
401
|
-
newConversation.
|
|
421
|
+
if(newConversation?.lastMessage?.sender?.uid !== loggedInUser.current?.['uid'])
|
|
422
|
+
newConversation.setUnreadMessageCount(1);
|
|
402
423
|
conversationListRef.current.updateAndMoveToFirst(newConversation);
|
|
403
424
|
})
|
|
404
425
|
.catch(err => onError && onError(err))
|
|
@@ -455,16 +476,24 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
455
476
|
* callback handler for group Add / Kicked / Banned / Scope Change
|
|
456
477
|
* @param {obj} message
|
|
457
478
|
*/
|
|
458
|
-
const groupHandler = (message) => {
|
|
479
|
+
const groupHandler = (message, action?: string) => {
|
|
459
480
|
let conversation = conversationListRef.current.getListItem(message['conversationId'])
|
|
460
481
|
|
|
461
482
|
if (conversation) {
|
|
462
483
|
conversation.setLastMessage(message);
|
|
463
|
-
|
|
484
|
+
if(action === 'kicked' || action === 'banned')
|
|
485
|
+
conversationListRef.current.removeItemFromList(message.conversationId);
|
|
486
|
+
else
|
|
487
|
+
conversationListRef.current.updateList(conversation);
|
|
464
488
|
} else {
|
|
465
489
|
CometChat.CometChatHelper.getConversationFromMessage(message)
|
|
466
490
|
.then(newConversation => {
|
|
467
|
-
conversationListRef.current.
|
|
491
|
+
const conversation = conversationListRef.current.getListItem(message['conversationId']);
|
|
492
|
+
if (conversation) {
|
|
493
|
+
groupHandler(message);
|
|
494
|
+
} else {
|
|
495
|
+
conversationListRef.current.addItemToList(newConversation, 0);
|
|
496
|
+
}
|
|
468
497
|
});
|
|
469
498
|
}
|
|
470
499
|
}
|
|
@@ -534,8 +563,12 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
534
563
|
|
|
535
564
|
let lastMessage: CometChat.BaseMessage = conversations['lastMessage'];
|
|
536
565
|
if (!lastMessage) return null;
|
|
537
|
-
let messageText: string
|
|
538
|
-
|
|
566
|
+
let messageText: string ;
|
|
567
|
+
if(lastMessage.getDeletedAt() !== undefined){
|
|
568
|
+
messageText = localize("THIS_MESSAGE_DELETED");
|
|
569
|
+
}else{
|
|
570
|
+
messageText = ChatConfigurator.getDataSource().getLastConversationMessage(conversations);
|
|
571
|
+
}
|
|
539
572
|
let groupText = "";
|
|
540
573
|
if (lastMessage['receiverType'] == 'group') {
|
|
541
574
|
if (lastMessage['receiverId'] == uid) {
|
|
@@ -560,28 +593,33 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
560
593
|
const lastMessage = params['conversations']['lastMessage'];
|
|
561
594
|
if (!lastMessage) return null;
|
|
562
595
|
let readReceipt;
|
|
596
|
+
|
|
563
597
|
if (!disableTyping && params.typingText) {
|
|
564
598
|
return <View style={Style.row}>
|
|
565
599
|
<Text>{params.typingText}</Text>
|
|
566
600
|
</View>
|
|
567
601
|
}
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
602
|
+
|
|
603
|
+
if (lastMessage && !disableReadReceipt && lastMessage['sender']['uid'] == loggedInUser.current?.uid && !lastMessage.getDeletedAt()) {
|
|
604
|
+
let status: MessageReceipt = "ERROR";
|
|
605
|
+
if (lastMessage?.hasOwnProperty('readAt'))
|
|
606
|
+
status = "READ";
|
|
607
|
+
else if (lastMessage?.hasOwnProperty("deliveredAt"))
|
|
608
|
+
status = "DELIVERED";
|
|
609
|
+
else if (lastMessage?.hasOwnProperty("sentAt"))
|
|
610
|
+
status = "SENT";
|
|
611
|
+
readReceipt = disableReceipt ? null : <CometChatReceipt
|
|
612
|
+
receipt={status}
|
|
613
|
+
deliveredIcon={props.deliveredIcon}
|
|
614
|
+
errorIcon={props.errorIcon}
|
|
615
|
+
readIcon={props.readIcon}
|
|
616
|
+
sentIcon={props.sentIcon}
|
|
617
|
+
waitIcon={props.waitingIcon}
|
|
618
|
+
/>;
|
|
584
619
|
}
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
|
|
585
623
|
return (
|
|
586
624
|
<View style={Style.row}>
|
|
587
625
|
{readReceipt}
|
|
@@ -714,7 +752,8 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
714
752
|
},
|
|
715
753
|
onGroupMemberKicked: (message) => {
|
|
716
754
|
groupHandler(
|
|
717
|
-
message
|
|
755
|
+
message,
|
|
756
|
+
'kicked'
|
|
718
757
|
);
|
|
719
758
|
},
|
|
720
759
|
onGroupMemberLeft: (message) => {
|
|
@@ -725,13 +764,19 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
725
764
|
},
|
|
726
765
|
onGroupMemberBanned: (message) => {
|
|
727
766
|
groupHandler(
|
|
728
|
-
message
|
|
767
|
+
message,
|
|
768
|
+
'banned'
|
|
729
769
|
);
|
|
730
770
|
},
|
|
731
771
|
onMemberAddedToGroup: (message) => {
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
772
|
+
if (onMemberAddedToGroupDebounceTimer.current) {
|
|
773
|
+
clearTimeout(onMemberAddedToGroupDebounceTimer.current);
|
|
774
|
+
}
|
|
775
|
+
onMemberAddedToGroupDebounceTimer.current = setTimeout(() => {
|
|
776
|
+
groupHandler(
|
|
777
|
+
message
|
|
778
|
+
);
|
|
779
|
+
}, 50)
|
|
735
780
|
},
|
|
736
781
|
onGroupMemberJoined: (message) => {
|
|
737
782
|
groupHandler(
|
|
@@ -766,40 +811,15 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
766
811
|
}
|
|
767
812
|
},
|
|
768
813
|
ccMessageRead: ({ message }) => {
|
|
769
|
-
|
|
770
|
-
.then(conversation => {
|
|
771
|
-
let conver = conversationListRef.current.getListItem(conversation.getConversationId())
|
|
772
|
-
if (!conver) return;
|
|
773
|
-
let lastMessageId = conver['lastMessage']['id'];
|
|
774
|
-
if (lastMessageId == message['id']) {
|
|
775
|
-
conversationListRef.current.updateList(conversation)
|
|
776
|
-
}
|
|
777
|
-
})
|
|
814
|
+
checkAndUpdateLastMessage(message)
|
|
778
815
|
},
|
|
779
816
|
ccMessageDeleted: ({ message }) => {
|
|
780
|
-
|
|
781
|
-
.then(conversation => {
|
|
782
|
-
let conver = conversationListRef.current.getListItem(conversation.getConversationId())
|
|
783
|
-
if (!conver) return;
|
|
784
|
-
let lastMessageId = conver['lastMessage']['id'];
|
|
785
|
-
if (lastMessageId == message['id']) {
|
|
786
|
-
conversationListRef.current.updateList(conversation)
|
|
787
|
-
}
|
|
788
|
-
})
|
|
817
|
+
checkAndUpdateLastMessage(message)
|
|
789
818
|
},
|
|
790
819
|
ccMessageEdited: ({ message }) => {
|
|
791
|
-
|
|
792
|
-
.then(conversation => {
|
|
793
|
-
let conver = conversationListRef.current.getListItem(conversation.getConversationId())
|
|
794
|
-
if (!conver) return;
|
|
795
|
-
let lastMessageId = conver['lastMessage']['id']
|
|
796
|
-
if (lastMessageId == message['id']) {
|
|
797
|
-
conversationListRef.current.updateList(conversation)
|
|
798
|
-
}
|
|
799
|
-
})
|
|
820
|
+
checkAndUpdateLastMessage(message)
|
|
800
821
|
},
|
|
801
822
|
onTextMessageReceived: (textMessage) => {
|
|
802
|
-
console.log("onTextMessageReceived", textMessage);
|
|
803
823
|
messageEventHandler(textMessage);
|
|
804
824
|
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
805
825
|
},
|
|
@@ -812,16 +832,16 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
812
832
|
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
813
833
|
},
|
|
814
834
|
onMessageDeleted: (deletedMessage) => {
|
|
815
|
-
|
|
835
|
+
checkAndUpdateLastMessage(deletedMessage)
|
|
816
836
|
},
|
|
817
837
|
onMessageEdited: (editedMessage) => {
|
|
818
|
-
|
|
838
|
+
checkAndUpdateLastMessage(editedMessage)
|
|
819
839
|
},
|
|
820
840
|
onMessagesRead: (messageReceipt) => {
|
|
821
841
|
messageEventHandler(messageReceipt);
|
|
822
842
|
},
|
|
823
|
-
onMessagesDelivered: (
|
|
824
|
-
messageEventHandler(
|
|
843
|
+
onMessagesDelivered: (messageReceipt) => {
|
|
844
|
+
messageEventHandler(messageReceipt);
|
|
825
845
|
},
|
|
826
846
|
onTypingStarted: (typingIndicator) => {
|
|
827
847
|
typingEventHandler(typingIndicator, true);
|
|
@@ -897,8 +917,8 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
897
917
|
userListenerId,
|
|
898
918
|
{
|
|
899
919
|
ccUserBlocked: ({ user }) => {
|
|
900
|
-
|
|
901
|
-
|
|
920
|
+
conversationListRef?.current?.removeItemFromList(user['conversationId']);
|
|
921
|
+
removeItemFromSelectionList(user['conversationId']);
|
|
902
922
|
}
|
|
903
923
|
}
|
|
904
924
|
)
|
|
@@ -511,18 +511,20 @@ export const CometChatDetails = (props: CometChatDetailsInterface) => {
|
|
|
511
511
|
}
|
|
512
512
|
);
|
|
513
513
|
return;
|
|
514
|
+
} else {
|
|
515
|
+
CometChat.blockUsers(usersList).then(
|
|
516
|
+
(list: Object) => {
|
|
517
|
+
updateUserBlockStatus(list, true);
|
|
518
|
+
CometChatUIEventHandler.emitUserEvent(CometChatUIEvents.ccUserBlocked, {
|
|
519
|
+
user: userDetails,
|
|
520
|
+
});
|
|
521
|
+
},
|
|
522
|
+
(error: CometChat.CometChatException) => {
|
|
523
|
+
onError && onError(error);
|
|
524
|
+
}
|
|
525
|
+
);
|
|
526
|
+
return;
|
|
514
527
|
}
|
|
515
|
-
CometChat.blockUsers(usersList).then(
|
|
516
|
-
(list: Object) => {
|
|
517
|
-
updateUserBlockStatus(list, true);
|
|
518
|
-
CometChatUIEventHandler.emitUserEvent(CometChatUIEvents.ccUserBlocked, {
|
|
519
|
-
user: userDetails,
|
|
520
|
-
});
|
|
521
|
-
},
|
|
522
|
-
(error: CometChat.CometChatException) => {
|
|
523
|
-
onError && onError(error);
|
|
524
|
-
}
|
|
525
|
-
);
|
|
526
528
|
};
|
|
527
529
|
const handleOnClickFncDeclaration = (item?: any) => {
|
|
528
530
|
switch (item.id) {
|
|
@@ -898,7 +900,7 @@ export const CometChatDetails = (props: CometChatDetailsInterface) => {
|
|
|
898
900
|
listItemStyle ? listItemStyle : { titleFont: { fontWeight: '600' } }
|
|
899
901
|
}
|
|
900
902
|
avatarName={userDetails?.getName() || groupDetails?.getName()}
|
|
901
|
-
avatarURL={{uri: userDetails?.getAvatar() || groupDetails?.getIcon()}}
|
|
903
|
+
avatarURL={{ uri: userDetails?.getAvatar() || groupDetails?.getIcon() }}
|
|
902
904
|
headViewContainerStyle={{
|
|
903
905
|
paddingRight: 15,
|
|
904
906
|
paddingLeft: 0,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View, Text, Alert, TouchableOpacity, Image, Modal } from "react-native";
|
|
3
|
-
import { kickIcon, banIcon, downArrowIcon,
|
|
3
|
+
import { kickIcon, banIcon, downArrowIcon, checkIcon } from "./resources";
|
|
4
4
|
import { CometChatOptions } from "../shared/modals/CometChatOptions";
|
|
5
5
|
import { AvatarStyle, AvatarStyleInterface, CometChatContext, ListItemStyle, ListItemStyleInterface, StatusIndicatorStyle } from "../shared";
|
|
6
6
|
import { GroupMembersStyle, GroupMembersStyleInterface } from "./GroupMemberStyle";
|
|
@@ -184,7 +184,11 @@ export const CometChatGroupsMembers = (props: CometChatGroupsMembersInterface) =
|
|
|
184
184
|
nameTextFont: theme?.typography.title1,
|
|
185
185
|
...avatarStyle
|
|
186
186
|
});
|
|
187
|
-
const _statusIndicatorStyle = new StatusIndicatorStyle(statusIndicatorStyle || {
|
|
187
|
+
const _statusIndicatorStyle = new StatusIndicatorStyle(statusIndicatorStyle || {
|
|
188
|
+
borderRadius: 10,
|
|
189
|
+
height: 15,
|
|
190
|
+
width: 15,
|
|
191
|
+
});
|
|
188
192
|
const _listItemStyle = new ListItemStyle({
|
|
189
193
|
backgroundColor: theme?.palette?.getBackgroundColor(),
|
|
190
194
|
titleColor: theme?.palette.getAccent(),
|
|
@@ -268,7 +272,7 @@ export const CometChatGroupsMembers = (props: CometChatGroupsMembersInterface) =
|
|
|
268
272
|
//reducing members count by one
|
|
269
273
|
group.setMembersCount(group.getMembersCount() - 1);
|
|
270
274
|
|
|
271
|
-
let action: CometChat.Action = new CometChat.Action(group['guid'], MessageTypeConstants.
|
|
275
|
+
let action: CometChat.Action = new CometChat.Action(group['guid'], MessageTypeConstants.groupMember, CometChat.RECEIVER_TYPE.GROUP, CometChat.CATEGORY_ACTION as CometChat.MessageCategory);
|
|
272
276
|
action.setActionBy(loggedInUser.current);
|
|
273
277
|
action.setActionOn(user);
|
|
274
278
|
action.setActionFor(group);
|
|
@@ -326,7 +330,7 @@ export const CometChatGroupsMembers = (props: CometChatGroupsMembersInterface) =
|
|
|
326
330
|
if (selecting) {
|
|
327
331
|
let index: number = selectedMembers.findIndex((value) => value.uid == member.uid);
|
|
328
332
|
if (index >= 0) {
|
|
329
|
-
image =
|
|
333
|
+
image = checkIcon;
|
|
330
334
|
backgroundColor = theme?.palette.getBackgroundColor();
|
|
331
335
|
}
|
|
332
336
|
}
|
|
Binary file
|
|
@@ -2,10 +2,12 @@ import kickIcon from "./kickIcon.png";
|
|
|
2
2
|
import banIcon from "./banIcon.png";
|
|
3
3
|
import downArrowIcon from "./downArrowIcon.png";
|
|
4
4
|
import rightTickIcon from "./rightTick.png";
|
|
5
|
+
import checkIcon from "./check.png";
|
|
5
6
|
|
|
6
7
|
export {
|
|
7
8
|
rightTickIcon,
|
|
8
9
|
kickIcon,
|
|
9
10
|
banIcon,
|
|
10
11
|
downArrowIcon,
|
|
12
|
+
checkIcon,
|
|
11
13
|
}
|
|
@@ -122,7 +122,7 @@ export interface CometChatGroupsInterface {
|
|
|
122
122
|
/**
|
|
123
123
|
* Request builder to fetch groups.
|
|
124
124
|
*/
|
|
125
|
-
|
|
125
|
+
groupsRequestBuilder?: CometChat.GroupsRequestBuilder,
|
|
126
126
|
/**
|
|
127
127
|
* request builder for search
|
|
128
128
|
*/
|
|
@@ -185,7 +185,7 @@ export const CometChatGroups = React.forwardRef((props: CometChatGroupsInterface
|
|
|
185
185
|
ErrorStateView,
|
|
186
186
|
errorStateText,
|
|
187
187
|
LoadingStateView,
|
|
188
|
-
|
|
188
|
+
groupsRequestBuilder,
|
|
189
189
|
searchRequestBuilder,
|
|
190
190
|
privateGroupIcon,
|
|
191
191
|
passwordGroupIcon,
|
|
@@ -556,7 +556,7 @@ export const CometChatGroups = React.forwardRef((props: CometChatGroupsInterface
|
|
|
556
556
|
ListItemView={GroupItemView}
|
|
557
557
|
EmptyStateView={EmptyView}
|
|
558
558
|
ErrorStateView={ErrorView}
|
|
559
|
-
requestBuilder={
|
|
559
|
+
requestBuilder={ groupsRequestBuilder || new CometChat.GroupsRequestBuilder()
|
|
560
560
|
.setLimit(30)
|
|
561
561
|
.setSearchKeyword("")}
|
|
562
562
|
searchRequestBuilder={searchRequestBuilder}
|
|
@@ -600,7 +600,7 @@ CometChatGroups.defaultProps = {
|
|
|
600
600
|
EmptyStateView: undefined,
|
|
601
601
|
emptyStateText: undefined,
|
|
602
602
|
LoadingStateView: undefined,
|
|
603
|
-
|
|
603
|
+
groupsRequestBuilder: undefined,
|
|
604
604
|
privateGroupIcon: privateGroupIcon,
|
|
605
605
|
passwordGroupIcon: passwordGroupIcon,
|
|
606
606
|
hideError: false,
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
Platform,
|
|
8
8
|
KeyboardAvoidingView,
|
|
9
9
|
Modal,
|
|
10
|
+
KeyboardAvoidingViewProps,
|
|
10
11
|
} from 'react-native';
|
|
11
12
|
import { Style } from './styles';
|
|
12
13
|
import {
|
|
@@ -50,6 +51,7 @@ import { CometChatUIEventHandler } from '../shared/events/CometChatUIEventHandle
|
|
|
50
51
|
import { CometChatMessageComposerActionInterface } from '../shared/helper/types';
|
|
51
52
|
import { CometChatMediaRecorder, MediaRecorderStyle } from '../shared/views/CometChatMediaRecorder';
|
|
52
53
|
import { AIOptionsStyle } from '../AI/AIOptionsStyle';
|
|
54
|
+
import { permissionUtilIOS } from '../shared/utils/PermissionUtilIOS';
|
|
53
55
|
const { FileManager } = NativeModules;
|
|
54
56
|
|
|
55
57
|
const uiEventListenerShow = 'uiEvent_show_' + new Date().getTime();
|
|
@@ -69,9 +71,9 @@ const MessagePreviewTray = (props: any) => {
|
|
|
69
71
|
};
|
|
70
72
|
|
|
71
73
|
const ImageButton = (props: any) => {
|
|
72
|
-
const { image, onClick, buttonStyle, imageStyle } = props;
|
|
74
|
+
const { image, onClick, buttonStyle, imageStyle, disable } = props;
|
|
73
75
|
return (
|
|
74
|
-
<TouchableOpacity onPress={onClick} style={buttonStyle}>
|
|
76
|
+
<TouchableOpacity activeOpacity={disable ? 1 : undefined} onPress={disable ? () => { } : onClick} style={buttonStyle}>
|
|
75
77
|
<Image source={image} style={[{ height: 24, width: 24 }, imageStyle]} />
|
|
76
78
|
</TouchableOpacity>
|
|
77
79
|
);
|
|
@@ -502,6 +504,10 @@ export interface CometChatMessageComposerInterface {
|
|
|
502
504
|
* AI Options Style.
|
|
503
505
|
*/
|
|
504
506
|
aiOptionsStyle?: AIOptionsStyle;
|
|
507
|
+
/**
|
|
508
|
+
* To override keyboardAvoidingViewProps.
|
|
509
|
+
*/
|
|
510
|
+
keyboardAvoidingViewProps?: KeyboardAvoidingViewProps
|
|
505
511
|
}
|
|
506
512
|
export const CometChatMessageComposer = React.forwardRef(
|
|
507
513
|
(props: CometChatMessageComposerInterface, ref) => {
|
|
@@ -544,7 +550,8 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
544
550
|
stopIconUrl,
|
|
545
551
|
submitIconUrl,
|
|
546
552
|
AIIconURL,
|
|
547
|
-
aiOptionsStyle
|
|
553
|
+
aiOptionsStyle,
|
|
554
|
+
keyboardAvoidingViewProps
|
|
548
555
|
} = props;
|
|
549
556
|
|
|
550
557
|
const defaultAttachmentOptions =
|
|
@@ -616,7 +623,10 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
616
623
|
};
|
|
617
624
|
|
|
618
625
|
const fileInputHandler = async (fileType: string) => {
|
|
619
|
-
if (fileType === MessageTypeConstants.takePhoto)
|
|
626
|
+
if (fileType === MessageTypeConstants.takePhoto) {
|
|
627
|
+
if (!(await permissionUtilIOS.startResourceBasedTask(["camera"]))) {
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
620
630
|
FileManager.openCamera(fileType, async (cameraImage: any) => {
|
|
621
631
|
if (CheckPropertyExists(cameraImage, 'error')) {
|
|
622
632
|
return;
|
|
@@ -634,6 +644,18 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
634
644
|
chatWith.current
|
|
635
645
|
);
|
|
636
646
|
});
|
|
647
|
+
}
|
|
648
|
+
else if (Platform.OS === 'ios' && fileType === MessageTypeConstants.video) {
|
|
649
|
+
NativeModules.VideoPickerModule.pickVideo(((file) => {
|
|
650
|
+
if(file.uri)
|
|
651
|
+
sendMediaMessage(
|
|
652
|
+
chatWithId.current,
|
|
653
|
+
file,
|
|
654
|
+
MessageTypeConstants.video,
|
|
655
|
+
chatWith.current
|
|
656
|
+
);
|
|
657
|
+
}))
|
|
658
|
+
}
|
|
637
659
|
else
|
|
638
660
|
FileManager.openFileChooser(fileType, async (fileInfo: any) => {
|
|
639
661
|
if (CheckPropertyExists(fileInfo, 'error')) {
|
|
@@ -750,6 +772,14 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
750
772
|
})
|
|
751
773
|
.catch((error: any) => {
|
|
752
774
|
onError && onError(error);
|
|
775
|
+
textMessage.data.metaData = {error: true}
|
|
776
|
+
CometChatUIEventHandler.emitMessageEvent(
|
|
777
|
+
MessageEvents.ccMessageSent,
|
|
778
|
+
{
|
|
779
|
+
message: textMessage,
|
|
780
|
+
status: messageStatus.error,
|
|
781
|
+
}
|
|
782
|
+
);
|
|
753
783
|
clearInputBox();
|
|
754
784
|
});
|
|
755
785
|
};
|
|
@@ -863,18 +893,28 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
863
893
|
if (!disableSoundForMessages) playAudio();
|
|
864
894
|
CometChat.sendMediaMessage(mediaMessage)
|
|
865
895
|
.then((message: any) => {
|
|
896
|
+
setTimeout(() => {
|
|
897
|
+
CometChatUIEventHandler.emitMessageEvent(
|
|
898
|
+
MessageEvents.ccMessageSent,
|
|
899
|
+
{
|
|
900
|
+
message: message,
|
|
901
|
+
status: messageStatus.success,
|
|
902
|
+
}
|
|
903
|
+
);
|
|
904
|
+
setShowRecordAudio(false);
|
|
905
|
+
}, 1000);
|
|
906
|
+
})
|
|
907
|
+
.catch((error: any) => {
|
|
908
|
+
setShowRecordAudio(false);
|
|
909
|
+
onError && onError(error);
|
|
910
|
+
localMessage.data.metaData = {error: true}
|
|
866
911
|
CometChatUIEventHandler.emitMessageEvent(
|
|
867
912
|
MessageEvents.ccMessageSent,
|
|
868
913
|
{
|
|
869
|
-
message:
|
|
870
|
-
status: messageStatus.
|
|
914
|
+
message: localMessage,
|
|
915
|
+
status: messageStatus.error,
|
|
871
916
|
}
|
|
872
917
|
);
|
|
873
|
-
setShowRecordAudio(false);
|
|
874
|
-
})
|
|
875
|
-
.catch((error: any) => {
|
|
876
|
-
setShowRecordAudio(false);
|
|
877
|
-
onError && onError(error);
|
|
878
918
|
console.log('media message sent error', error);
|
|
879
919
|
});
|
|
880
920
|
};
|
|
@@ -980,11 +1020,12 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
980
1020
|
imageStyle={[
|
|
981
1021
|
Style.imageStyle,
|
|
982
1022
|
{
|
|
983
|
-
tintColor:
|
|
1023
|
+
tintColor: !inputMessage.length ? theme.palette.getAccent400() :
|
|
984
1024
|
messageComposerStyle.sendIconTint ||
|
|
985
1025
|
theme.palette.getPrimary(),
|
|
986
1026
|
},
|
|
987
1027
|
]}
|
|
1028
|
+
disable={!inputMessage.length}
|
|
988
1029
|
onClick={sendTextMessage}
|
|
989
1030
|
/>
|
|
990
1031
|
);
|
|
@@ -1006,7 +1047,7 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
1006
1047
|
resizeMode: 'contain',
|
|
1007
1048
|
tintColor: messageComposerStyle.attachIcontint
|
|
1008
1049
|
? messageComposerStyle.attachIcontint
|
|
1009
|
-
: theme.palette.
|
|
1050
|
+
: theme.palette.getAccent(),
|
|
1010
1051
|
}}
|
|
1011
1052
|
/>
|
|
1012
1053
|
);
|
|
@@ -1246,7 +1287,8 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
1246
1287
|
<KeyboardAvoidingView
|
|
1247
1288
|
key={id}
|
|
1248
1289
|
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
1249
|
-
keyboardVerticalOffset={Platform.select({
|
|
1290
|
+
keyboardVerticalOffset={Platform.select({ios: 60})}
|
|
1291
|
+
{...keyboardAvoidingViewProps}
|
|
1250
1292
|
>
|
|
1251
1293
|
<View
|
|
1252
1294
|
style={[
|
|
@@ -1378,7 +1420,7 @@ CometChatMessageComposer.defaultProps = {
|
|
|
1378
1420
|
// style: new MessageComposerStyle({}),
|
|
1379
1421
|
attachmentIcon: ICONS.ADD,
|
|
1380
1422
|
liveReactionIcon: ICONS.HEART,
|
|
1381
|
-
hideLiveReaction:
|
|
1423
|
+
hideLiveReaction: true,
|
|
1382
1424
|
disableSoundForMessages: true,
|
|
1383
1425
|
messageComposerStyle: {},
|
|
1384
1426
|
};
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
//@ts-ignore
|
|
11
11
|
} from 'react-native';
|
|
12
12
|
import React, { useEffect, useState, useRef, useContext } from 'react';
|
|
13
|
-
import { CometChatContext, CometChatListItem } from '../shared';
|
|
13
|
+
import { AvatarStyle, CometChatContext, CometChatListItem } from '../shared';
|
|
14
14
|
import { localize } from '../shared';
|
|
15
15
|
import { ICONS } from './resources';
|
|
16
16
|
import { styles } from './styles';
|
|
@@ -211,6 +211,13 @@ export const CometChatMessageHeader = (
|
|
|
211
211
|
tailViewContainerStyle,
|
|
212
212
|
} = props;
|
|
213
213
|
|
|
214
|
+
const _avatarStyle = new AvatarStyle({
|
|
215
|
+
backgroundColor: theme?.palette?.getAccent600(),
|
|
216
|
+
nameTextColor: theme?.palette?.getAccent(),
|
|
217
|
+
nameTextFont: theme?.typography.body,
|
|
218
|
+
...props?.avatarStyle
|
|
219
|
+
});
|
|
220
|
+
|
|
214
221
|
const [groupObj, setGroupObj] = useState(group);
|
|
215
222
|
const [userStatus, setUserStatus] = useState(user ? user.getStatus() : '');
|
|
216
223
|
const [groupMemberCount, setGroupMemberCount] = useState(
|
|
@@ -489,7 +496,7 @@ export const CometChatMessageHeader = (
|
|
|
489
496
|
}
|
|
490
497
|
headViewContainerStyle={headViewContainerStyle}
|
|
491
498
|
tailViewContainerStyle={tailViewContainerStyle}
|
|
492
|
-
avatarStyle={
|
|
499
|
+
avatarStyle={_avatarStyle}
|
|
493
500
|
/>
|
|
494
501
|
)}
|
|
495
502
|
</View>
|
|
@@ -157,7 +157,7 @@ export const CometChatMessageInformation = (props: CometChatMessageInformationIn
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
const isGroup = () => {
|
|
160
|
-
return message
|
|
160
|
+
return message?.getReceiverType() == "group";
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
const populateRecipients = () => {
|