@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,249 +0,0 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
2
|
-
import { Image, Text, TouchableOpacity, View } from 'react-native';
|
|
3
|
-
import { FontStyleInterface } from '../../../shared/base';
|
|
4
|
-
import { CometChatContext } from "../../../shared/CometChatContext";
|
|
5
|
-
import { localize } from "../../../shared/resources/CometChatLocalize";
|
|
6
|
-
import { CometChatBottomSheet } from "../../../shared/views";
|
|
7
|
-
import { Styles } from './style';
|
|
8
|
-
import { MetadataConstants } from '../../../shared/constants/UIKitConstants';
|
|
9
|
-
import { getExtentionData } from '../../ExtensionModerator';
|
|
10
|
-
import { ICONS } from '../resources';
|
|
11
|
-
import { CometChatEmojiKeyboard } from '../../../shared/views/CometChatEmojiKeyboard';
|
|
12
|
-
//@ts-ignore
|
|
13
|
-
import { CometChat } from '@cometchat/chat-sdk-react-native';
|
|
14
|
-
|
|
15
|
-
export interface MessageReactionsInterface {
|
|
16
|
-
messageObject?: CometChat.BaseMessage;
|
|
17
|
-
loggedInUser?: CometChat.User;
|
|
18
|
-
updateReaction?: (messageObject, emoji) => void;
|
|
19
|
-
style?: { iconTint?: string; textFont?: FontStyleInterface };
|
|
20
|
-
onReactionClick?: (emoji, messageObject) => void;
|
|
21
|
-
}
|
|
22
|
-
const CometChatMessageReactions = (props: MessageReactionsInterface) => {
|
|
23
|
-
const {
|
|
24
|
-
messageObject,
|
|
25
|
-
loggedInUser,
|
|
26
|
-
updateReaction,
|
|
27
|
-
style,
|
|
28
|
-
onReactionClick,
|
|
29
|
-
// theme,
|
|
30
|
-
} = props;
|
|
31
|
-
const { theme } = useContext(CometChatContext);
|
|
32
|
-
const [reactionList, setReactionList] = React.useState([]);
|
|
33
|
-
const [isVisible, setIsVisible] = React.useState(false);
|
|
34
|
-
const reactionRef = React.useRef([]);
|
|
35
|
-
const reactionData = React.useRef({});
|
|
36
|
-
|
|
37
|
-
const getAddReactionButton = () => {
|
|
38
|
-
let addReactionButtonbackgroundColor = theme?.palette?.getAccent100();
|
|
39
|
-
if (messageObject?.['sender']?.['uid'] === loggedInUser?.['uid']) {
|
|
40
|
-
addReactionButtonbackgroundColor = 'rgba(255, 255, 255, 0.23)';
|
|
41
|
-
}
|
|
42
|
-
let addReactionbackgroundColor = theme?.palette?.getAccent700();
|
|
43
|
-
if (messageObject?.['type'] === 'text') {
|
|
44
|
-
if (messageObject?.['sender']?.['uid'] === loggedInUser?.['uid']) {
|
|
45
|
-
if (reactionData.current?.hasOwnProperty(loggedInUser?.['uid'])) {
|
|
46
|
-
addReactionbackgroundColor = theme?.palette?.getBackgroundColor();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return (
|
|
51
|
-
<TouchableOpacity
|
|
52
|
-
onPress={() => {
|
|
53
|
-
setIsVisible(true);
|
|
54
|
-
}}
|
|
55
|
-
style={[
|
|
56
|
-
Styles.messageAddReactionStyle,
|
|
57
|
-
{
|
|
58
|
-
borderRadius: 20,
|
|
59
|
-
backgroundColor: theme.palette.getAccent200(),
|
|
60
|
-
},
|
|
61
|
-
]}
|
|
62
|
-
>
|
|
63
|
-
<View>
|
|
64
|
-
<Image
|
|
65
|
-
source={ICONS.ADDREACTION}
|
|
66
|
-
style={{
|
|
67
|
-
height: 16,
|
|
68
|
-
width: 16,
|
|
69
|
-
tintColor: style?.iconTint || addReactionbackgroundColor,
|
|
70
|
-
}}
|
|
71
|
-
/>
|
|
72
|
-
</View>
|
|
73
|
-
</TouchableOpacity>
|
|
74
|
-
);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
const reactionView = (reactionObject, reactionData) => {
|
|
78
|
-
const userList = [];
|
|
79
|
-
let count;
|
|
80
|
-
|
|
81
|
-
for (const reaction in reactionObject) {
|
|
82
|
-
const tempReactionData = reactionObject[reaction];
|
|
83
|
-
count = Object.keys(tempReactionData).length;
|
|
84
|
-
for (const user in tempReactionData) {
|
|
85
|
-
userList.push(tempReactionData[user]['name']);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
let reactionTitle = '';
|
|
90
|
-
if (userList.length) {
|
|
91
|
-
reactionTitle = userList.join(',');
|
|
92
|
-
reactionTitle = reactionTitle.concat(' ', localize('REACTED'));
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
let Emoji = Object.keys(reactionObject)[0];
|
|
96
|
-
let countcolor = theme?.palette?.getBackgroundColor();
|
|
97
|
-
if (messageObject?.['type'] === 'text') {
|
|
98
|
-
if (messageObject?.['sender']?.['uid'] === loggedInUser?.['uid']) {
|
|
99
|
-
if (reactionData?.hasOwnProperty(loggedInUser?.['uid'])) {
|
|
100
|
-
countcolor = theme?.palette?.getPrimary();
|
|
101
|
-
}
|
|
102
|
-
} else {
|
|
103
|
-
if (reactionData?.hasOwnProperty(loggedInUser?.['uid'])) {
|
|
104
|
-
countcolor = theme?.palette?.getBackgroundColor();
|
|
105
|
-
} else {
|
|
106
|
-
countcolor = theme?.palette?.getAccent700();
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
} else {
|
|
110
|
-
if (reactionData?.hasOwnProperty(loggedInUser?.['uid'])) {
|
|
111
|
-
countcolor =
|
|
112
|
-
messageObject?.['sender']?.['uid'] == loggedInUser?.['uid']
|
|
113
|
-
? theme?.palette?.getPrimary()
|
|
114
|
-
: theme?.palette?.getBackgroundColor();
|
|
115
|
-
} else {
|
|
116
|
-
countcolor = theme?.palette?.getAccent700();
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
let Count = (
|
|
120
|
-
<Text
|
|
121
|
-
style={[
|
|
122
|
-
Styles.reactionCountStyle,
|
|
123
|
-
{ color: countcolor },
|
|
124
|
-
theme?.typography?.caption1,
|
|
125
|
-
]}
|
|
126
|
-
>
|
|
127
|
-
{count}
|
|
128
|
-
</Text>
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
let messageReactionsbackgroundColor = { backgroundColor: 'transparent' },
|
|
132
|
-
border = {
|
|
133
|
-
borderWidth: 1,
|
|
134
|
-
borderColor: theme?.palette?.getAccent200(),
|
|
135
|
-
};
|
|
136
|
-
if (messageObject?.['type'] === 'text') {
|
|
137
|
-
if (messageObject?.['sender']?.['uid'] === loggedInUser?.['uid']) {
|
|
138
|
-
if (reactionData?.hasOwnProperty(loggedInUser?.['uid'])) {
|
|
139
|
-
messageReactionsbackgroundColor = {
|
|
140
|
-
backgroundColor: theme?.palette?.getBackgroundColor(),
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
} else {
|
|
144
|
-
if (reactionData?.hasOwnProperty(loggedInUser?.['uid'])) {
|
|
145
|
-
messageReactionsbackgroundColor = {
|
|
146
|
-
backgroundColor: theme?.palette?.getPrimary(),
|
|
147
|
-
};
|
|
148
|
-
border = {
|
|
149
|
-
borderWidth: 1,
|
|
150
|
-
borderColor: theme?.palette?.getAccent200(),
|
|
151
|
-
};
|
|
152
|
-
} else {
|
|
153
|
-
messageReactionsbackgroundColor = { backgroundColor: 'transparent' };
|
|
154
|
-
border = {
|
|
155
|
-
borderWidth: 1,
|
|
156
|
-
borderColor: theme?.palette?.getAccent200(),
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
} else {
|
|
161
|
-
if (reactionData?.hasOwnProperty(loggedInUser?.['uid'])) {
|
|
162
|
-
messageReactionsbackgroundColor = {
|
|
163
|
-
backgroundColor:
|
|
164
|
-
messageObject?.['sender']?.['uid'] === loggedInUser?.['uid']
|
|
165
|
-
? theme?.palette?.getBackgroundColor()
|
|
166
|
-
: theme?.palette?.getPrimary(),
|
|
167
|
-
};
|
|
168
|
-
border = {
|
|
169
|
-
borderWidth: 1,
|
|
170
|
-
borderColor: theme?.palette?.getAccent200(),
|
|
171
|
-
};
|
|
172
|
-
} else {
|
|
173
|
-
messageReactionsbackgroundColor = {
|
|
174
|
-
backgroundColor: theme?.palette?.getAccent100(),
|
|
175
|
-
};
|
|
176
|
-
border = {
|
|
177
|
-
borderWidth: 1,
|
|
178
|
-
borderColor: theme?.palette?.getAccent200(),
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
return count >= 1 ? (
|
|
183
|
-
<TouchableOpacity
|
|
184
|
-
onPress={() => {
|
|
185
|
-
onReactionClick(Emoji, messageObject);
|
|
186
|
-
}}
|
|
187
|
-
key={Math.random()}
|
|
188
|
-
style={[
|
|
189
|
-
Styles.messageReactionsStyle,
|
|
190
|
-
messageReactionsbackgroundColor,
|
|
191
|
-
border,
|
|
192
|
-
]}
|
|
193
|
-
>
|
|
194
|
-
<Text style={[Styles.reactionListStyle, style.textFont]}>
|
|
195
|
-
{Emoji} {Count}
|
|
196
|
-
</Text>
|
|
197
|
-
</TouchableOpacity>
|
|
198
|
-
) : null;
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
React.useEffect(() => {
|
|
202
|
-
reactionRef.current = getExtentionData(
|
|
203
|
-
messageObject,
|
|
204
|
-
MetadataConstants.extensions.reactions
|
|
205
|
-
);
|
|
206
|
-
let isEmpty = false;
|
|
207
|
-
if (reactionRef.current) {
|
|
208
|
-
const messageReactions = Object.keys(reactionRef.current).map((data) => {
|
|
209
|
-
if (Object.keys(reactionRef.current[data]).length) {
|
|
210
|
-
isEmpty = true;
|
|
211
|
-
reactionData.current = reactionRef.current[data];
|
|
212
|
-
return reactionView(
|
|
213
|
-
{ [data]: reactionData.current },
|
|
214
|
-
reactionData.current
|
|
215
|
-
);
|
|
216
|
-
} else {
|
|
217
|
-
isEmpty = false;
|
|
218
|
-
}
|
|
219
|
-
return false;
|
|
220
|
-
});
|
|
221
|
-
if (isEmpty) {
|
|
222
|
-
setReactionList(messageReactions);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}, [messageObject]);
|
|
226
|
-
|
|
227
|
-
return reactionList.length ? (
|
|
228
|
-
<View style={Styles.messageReactionListStyle}>
|
|
229
|
-
<CometChatBottomSheet isOpen={isVisible} onClose={() => {}}>
|
|
230
|
-
<CometChatEmojiKeyboard
|
|
231
|
-
onClick={(item) => {
|
|
232
|
-
onReactionClick(item, messageObject);
|
|
233
|
-
}}
|
|
234
|
-
/>
|
|
235
|
-
</CometChatBottomSheet>
|
|
236
|
-
{reactionList}
|
|
237
|
-
{getAddReactionButton()}
|
|
238
|
-
</View>
|
|
239
|
-
) : null;
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
// Specifies the default values for props:
|
|
243
|
-
CometChatMessageReactions.defaultProps = {
|
|
244
|
-
messageObject: null,
|
|
245
|
-
loggedInUser: null,
|
|
246
|
-
style: {},
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
export { CometChatMessageReactions };
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { DataSource, DataSourceDecorator } from '../../shared/framework';
|
|
2
|
-
// @ts-ignore
|
|
3
|
-
import { CometChat } from '@cometchat/chat-sdk-react-native';
|
|
4
|
-
import { CometChatMessageOption } from '../../shared/modals';
|
|
5
|
-
// @ts-ignore
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import {
|
|
8
|
-
MessageBubbleAlignmentType,
|
|
9
|
-
MessageOptionConstants,
|
|
10
|
-
MessageStatusConstants,
|
|
11
|
-
} from '../../shared/constants/UIKitConstants';
|
|
12
|
-
import { CometChatMessageReactions } from './CometChatMessageReactions';
|
|
13
|
-
import { localize } from '../../shared/resources/CometChatLocalize';
|
|
14
|
-
import { CometChatEmojiKeyboard } from '../../shared/views/CometChatEmojiKeyboard';
|
|
15
|
-
import { ExtensionConstants, ExtensionURLs } from '../ExtensionConstants';
|
|
16
|
-
import { CometChatUIEvents, MessageEvents } from '../../shared/events';
|
|
17
|
-
import { CometChatUIEventHandler } from '../../shared/events/CometChatUIEventHandler/CometChatUIEventHandler';
|
|
18
|
-
import { ReactionsConfigurationInterface } from './ReactionsExtension';
|
|
19
|
-
import { ICONS } from './resources';
|
|
20
|
-
export class ReactionsExtensionDecorator extends DataSourceDecorator {
|
|
21
|
-
messageObject: CometChat.BaseMessage;
|
|
22
|
-
loggedInUser: any;
|
|
23
|
-
imageModerationConfiguration?: ReactionsConfigurationInterface;
|
|
24
|
-
|
|
25
|
-
// loggedInUser: CometChat.User;
|
|
26
|
-
|
|
27
|
-
constructor(
|
|
28
|
-
dataSource: DataSource,
|
|
29
|
-
imageModerationConfiguration?: ReactionsConfigurationInterface
|
|
30
|
-
) {
|
|
31
|
-
super(dataSource);
|
|
32
|
-
CometChat.getLoggedinUser()
|
|
33
|
-
.then((u) => {
|
|
34
|
-
this.loggedInUser = u;
|
|
35
|
-
})
|
|
36
|
-
.catch((err) => console.log(err));
|
|
37
|
-
if (imageModerationConfiguration != undefined) {
|
|
38
|
-
this.imageModerationConfiguration = imageModerationConfiguration;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
getId(): string {
|
|
43
|
-
return 'Reactions';
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
getBottomView(
|
|
47
|
-
messageObject: CometChat.BaseMessage,
|
|
48
|
-
alignment: MessageBubbleAlignmentType
|
|
49
|
-
) {
|
|
50
|
-
return (
|
|
51
|
-
<CometChatMessageReactions
|
|
52
|
-
loggedInUser={this.loggedInUser}
|
|
53
|
-
messageObject={messageObject}
|
|
54
|
-
onReactionClick={this.reactToMessages}
|
|
55
|
-
{...this.imageModerationConfiguration}
|
|
56
|
-
/>
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
getReactions(): CometChatMessageOption {
|
|
61
|
-
return {
|
|
62
|
-
id: MessageOptionConstants.reactToMessage,
|
|
63
|
-
title: localize('ADD_REACTION'),
|
|
64
|
-
icon: ICONS.ADDREACTION,
|
|
65
|
-
CustomView: (messageObject) => (
|
|
66
|
-
<CometChatEmojiKeyboard
|
|
67
|
-
onClick={(item) => {
|
|
68
|
-
CometChatUIEventHandler.emitUIEvent(
|
|
69
|
-
CometChatUIEvents.ccToggleBottomSheet,
|
|
70
|
-
{
|
|
71
|
-
isBottomSheetVisible: false,
|
|
72
|
-
}
|
|
73
|
-
);
|
|
74
|
-
this.reactToMessages(item, messageObject);
|
|
75
|
-
|
|
76
|
-
}}
|
|
77
|
-
/>
|
|
78
|
-
),
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
getCommonOptions(
|
|
83
|
-
loggedInUser: CometChat.User,
|
|
84
|
-
messageObject: CometChat.BaseMessage,
|
|
85
|
-
group: CometChat.Group
|
|
86
|
-
): CometChatMessageOption[] {
|
|
87
|
-
let optionsList: CometChatMessageOption[] = super.getCommonOptions(
|
|
88
|
-
loggedInUser,
|
|
89
|
-
messageObject,
|
|
90
|
-
group
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
optionsList.push(this.getReactions());
|
|
94
|
-
return optionsList;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
*
|
|
99
|
-
* @param {*} message
|
|
100
|
-
* @param {*} emoji
|
|
101
|
-
* Calls extension reaction to Messages
|
|
102
|
-
*/
|
|
103
|
-
reactToMessages = (emoji, messageObj) => {
|
|
104
|
-
const userObject = {};
|
|
105
|
-
if (this.loggedInUser?.avatar?.length) {
|
|
106
|
-
userObject['avatar'] = this.loggedInUser.avatar;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (this.loggedInUser?.name?.length) {
|
|
110
|
-
userObject['name'] = this.loggedInUser.name;
|
|
111
|
-
}
|
|
112
|
-
let metaData = messageObj.getMetadata();
|
|
113
|
-
if (!metaData) {
|
|
114
|
-
metaData = {};
|
|
115
|
-
}
|
|
116
|
-
if (metaData && !metaData['@injected']) {
|
|
117
|
-
metaData = {
|
|
118
|
-
...metaData,
|
|
119
|
-
'@injected': { extensions: { reactions: {} } },
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
if (
|
|
123
|
-
metaData &&
|
|
124
|
-
metaData['@injected'] &&
|
|
125
|
-
metaData['@injected']['extensions']['reactions']
|
|
126
|
-
) {
|
|
127
|
-
let tempMetaData = {};
|
|
128
|
-
let reactionData = metaData['@injected']['extensions']['reactions'];
|
|
129
|
-
if (reactionData) {
|
|
130
|
-
if (reactionData[emoji]) {
|
|
131
|
-
reactionData[emoji] = {
|
|
132
|
-
...reactionData[emoji],
|
|
133
|
-
[this.loggedInUser?.uid]: userObject,
|
|
134
|
-
};
|
|
135
|
-
} else {
|
|
136
|
-
reactionData[emoji] = { [this.loggedInUser?.uid]: userObject };
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
tempMetaData = {
|
|
140
|
-
...metaData['@injected']['extensions']['reactions'],
|
|
141
|
-
...reactionData,
|
|
142
|
-
};
|
|
143
|
-
metaData['@injected']['extensions']['reactions'] = tempMetaData;
|
|
144
|
-
}
|
|
145
|
-
messageObj.setMetadata(metaData);
|
|
146
|
-
|
|
147
|
-
CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccMessageEdited, {
|
|
148
|
-
message: messageObj,
|
|
149
|
-
status: MessageStatusConstants.success,
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
CometChat.callExtension(
|
|
153
|
-
ExtensionConstants.reactions,
|
|
154
|
-
'POST',
|
|
155
|
-
ExtensionURLs.reaction,
|
|
156
|
-
{
|
|
157
|
-
msgId: messageObj.id,
|
|
158
|
-
emoji: emoji,
|
|
159
|
-
}
|
|
160
|
-
).catch((error) => {
|
|
161
|
-
console.log('error', error);
|
|
162
|
-
});
|
|
163
|
-
};
|
|
164
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ExtensionsDataSource,
|
|
3
|
-
ChatConfigurator,
|
|
4
|
-
DataSource,
|
|
5
|
-
} from '../../shared/framework';
|
|
6
|
-
import { ReactionsExtensionDecorator } from './ReactionsDecorator';
|
|
7
|
-
import { MessageReactionsInterface } from './CometChatMessageReactions/CometChatMessageReactions';
|
|
8
|
-
import { ExtensionConstants } from '../ExtensionConstants';
|
|
9
|
-
|
|
10
|
-
export interface ReactionsConfigurationInterface
|
|
11
|
-
extends Omit<
|
|
12
|
-
MessageReactionsInterface,
|
|
13
|
-
'messageObject' | 'loggedInUser' | 'updateReaction' | 'onReactionClick'
|
|
14
|
-
> {}
|
|
15
|
-
|
|
16
|
-
export class ReactionsExtension extends ExtensionsDataSource {
|
|
17
|
-
ReactionsConfigurationInterface?: ReactionsConfigurationInterface;
|
|
18
|
-
|
|
19
|
-
constructor(
|
|
20
|
-
ReactionsConfigurationConfiguration?: ReactionsConfigurationInterface
|
|
21
|
-
) {
|
|
22
|
-
super();
|
|
23
|
-
if (ReactionsConfigurationConfiguration != null) {
|
|
24
|
-
this.ReactionsConfigurationInterface =
|
|
25
|
-
ReactionsConfigurationConfiguration;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* enable
|
|
31
|
-
* @description enables the Text moderation extension which includes Data profanity and data masking
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
//override addExtension method from ExtensionsDataSource interface
|
|
35
|
-
override addExtension(): void {
|
|
36
|
-
ChatConfigurator.enable((dataSource: DataSource) => {
|
|
37
|
-
return new ReactionsExtensionDecorator(
|
|
38
|
-
dataSource,
|
|
39
|
-
this.ReactionsConfigurationInterface
|
|
40
|
-
);
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
//override getExtensionId method from ExtensionsDataSource interface
|
|
45
|
-
override getExtensionId(): string {
|
|
46
|
-
return ExtensionConstants.reactions;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
File without changes
|
/package/src/{extensions/Reactions → shared/views/CometChatQuickReactions}/resources/index.ts
RENAMED
|
File without changes
|