@cometchat/chat-uikit-react-native 4.0.2 → 4.1.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 +1 -1
- package/ios/FileManager.m +1 -1
- package/package.json +3 -3
- package/src/AI/AIAssistBot/AIAssistBotDecorator.tsx +164 -0
- package/src/AI/AIAssistBot/AIAssistBotExtension.tsx +22 -0
- package/src/AI/AIAssistBot/AIAssistBotStyle.ts +43 -0
- package/src/AI/AIAssistBot/AIAssistBotView.tsx +294 -0
- package/src/AI/AIAssistBot/configuration.ts +22 -0
- package/src/AI/AIAssistBot/resources/index.ts +5 -0
- package/src/AI/{configuration.ts → AIBaseConfiguration.ts} +3 -6
- package/src/AI/AIBaseStyle.ts +58 -0
- package/src/AI/AIConversationStarter/AIConversationStarter.ts +5 -19
- package/src/AI/AIConversationStarter/AIConversationStarterDecorator.tsx +144 -130
- package/src/AI/AIConversationStarter/AIConversationStarterStyle.ts +11 -6
- package/src/AI/AIConversationStarter/configuration.ts +10 -17
- package/src/AI/AIConversationSummary/AIConversationSummaryDecorator.tsx +175 -0
- package/src/AI/AIConversationSummary/AIConversationSummaryExtension.ts +21 -0
- package/src/AI/AIConversationSummary/AIConversationSummaryStyle.tsx +20 -0
- package/src/AI/AIConversationSummary/AIConversationSummaryView.tsx +190 -0
- package/src/AI/AIConversationSummary/configuration.ts +14 -0
- package/src/AI/AIConversationSummary/resources/close.png +0 -0
- package/src/AI/AIConversationSummary/resources/index.ts +5 -0
- package/src/AI/AIExtensionDataSource.ts +17 -12
- package/src/AI/AIOptionsStyle.ts +14 -0
- package/src/AI/AISmartReplies/AISmartReplies.ts +6 -15
- package/src/AI/AISmartReplies/AISmartRepliesDecorator.tsx +302 -0
- package/src/AI/AISmartReplies/AISmartRepliesStyle.ts +1 -1
- package/src/AI/AISmartReplies/configuration.ts +4 -11
- package/src/AI/resources/index.ts +0 -2
- package/src/AI/utils.ts +3 -3
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +118 -5
- package/src/CometChatMessageComposer/MessageComposerConfiguration.tsx +3 -0
- package/src/CometChatMessageComposer/resources/index.ts +2 -0
- package/src/CometChatMessageComposer/styles.ts +1 -4
- package/src/CometChatMessageList/CometChatMessageList.tsx +52 -35
- package/src/CometChatMessages/CometChatMessages.tsx +4 -13
- package/src/CometChatMessages/MessagesConfiguration.ts +2 -2
- package/src/calls/CallEvents.ts +1 -0
- package/src/calls/CallUtils.ts +106 -45
- package/src/calls/CallingDetailsUtils.tsx +133 -15
- package/src/calls/CallingExtentionDecorator.tsx +56 -45
- package/src/calls/CallingPackage.ts +16 -2
- package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +9 -10
- package/src/calls/CometChatCallLogDetails/CallLogDetailsConfiguration.ts +116 -0
- package/src/calls/CometChatCallLogDetails/CallLogDetailsStyle.ts +36 -0
- package/src/calls/CometChatCallLogDetails/CometChatCallLogDetails.tsx +308 -0
- package/src/calls/CometChatCallLogDetails/index.ts +12 -0
- package/src/calls/CometChatCallLogDetails/resources/CloseIcon.png +0 -0
- package/src/calls/{CometChatCallDetails → CometChatCallLogDetails}/style.ts +1 -0
- package/src/calls/{CometChatCallHistory/CallHistoryConfiguration.ts → CometChatCallLogHistory/CallLogHistoryConfiguration.ts} +15 -27
- package/src/calls/CometChatCallLogHistory/CallLogHistoryStyle.ts +46 -0
- package/src/calls/CometChatCallLogHistory/CometChatCallLogHistory.tsx +337 -0
- package/src/calls/CometChatCallLogHistory/index.ts +12 -0
- package/src/calls/CometChatCallLogHistory/resources/incomingcall.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/incomingvideo.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/index.ts +29 -0
- package/src/calls/CometChatCallLogHistory/resources/missedcall.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/missedvideo.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/outgoingcall.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/outgoingvideo.png +0 -0
- package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/style.ts +2 -1
- package/src/calls/CometChatCallLogParticipants/CallLogParticipantsConfiguration.ts +61 -0
- package/src/calls/CometChatCallLogParticipants/CallLogParticipantsStyle.ts +59 -0
- package/src/calls/CometChatCallLogParticipants/CometChatCallLogParticipants.tsx +220 -0
- package/src/calls/CometChatCallLogParticipants/index.ts +12 -0
- package/src/calls/CometChatCallLogParticipants/resources/Back.png +0 -0
- package/src/calls/CometChatCallLogParticipants/resources/index.ts +4 -0
- package/src/calls/CometChatCallLogParticipants/style.ts +24 -0
- package/src/calls/CometChatCallLogRecordings/CallLogRecordingsConfiguration.ts +63 -0
- package/src/calls/CometChatCallLogRecordings/CallLogRecordingsStyle.ts +63 -0
- package/src/calls/CometChatCallLogRecordings/CometChatCallLogRecordings.tsx +253 -0
- package/src/calls/CometChatCallLogRecordings/index.ts +12 -0
- package/src/calls/CometChatCallLogRecordings/resources/Back.png +0 -0
- package/src/calls/CometChatCallLogRecordings/resources/download.png +0 -0
- package/src/calls/CometChatCallLogRecordings/resources/index.ts +6 -0
- package/src/calls/CometChatCallLogRecordings/style.ts +24 -0
- package/src/calls/CometChatCallLogs/CallLogsConfiguration.ts +87 -0
- package/src/calls/CometChatCallLogs/CallLogsStyle.ts +95 -0
- package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +482 -0
- package/src/calls/CometChatCallLogs/index.ts +12 -0
- package/src/calls/CometChatCallLogs/resources/Back.png +0 -0
- package/src/calls/CometChatCallLogs/resources/Info.png +0 -0
- package/src/calls/CometChatCallLogs/resources/Selection.png +0 -0
- package/src/calls/CometChatCallLogs/resources/Spinner.png +0 -0
- package/src/calls/CometChatCallLogs/resources/check.png +0 -0
- package/src/calls/CometChatCallLogs/resources/incomingcall.png +0 -0
- package/src/calls/CometChatCallLogs/resources/incomingvideo.png +0 -0
- package/src/calls/CometChatCallLogs/resources/index.ts +25 -0
- package/src/calls/CometChatCallLogs/resources/missedcall.png +0 -0
- package/src/calls/CometChatCallLogs/resources/missedvideo.png +0 -0
- package/src/calls/CometChatCallLogs/resources/outgoingcall.png +0 -0
- package/src/calls/CometChatCallLogs/resources/outgoingvideo.png +0 -0
- package/src/calls/CometChatCallLogs/style.ts +24 -0
- package/src/calls/CometChatCallLogsWithDetails/CallLogsWithDetailsConfiguration.ts +9 -0
- package/src/calls/{CometChatCallHistoryWithDetails/CometChatCallHistoryWithDetails.tsx → CometChatCallLogsWithDetails/CometChatCallLogsWithDetails.tsx} +17 -16
- package/src/calls/CometChatCallLogsWithDetails/index.ts +7 -0
- package/src/calls/index.ts +40 -1
- package/src/calls/resources/index.ts +3 -1
- package/src/calls/resources/nextarrow.png +0 -0
- package/src/extensions/SmartReplies/SmartRepliesDecorator.tsx +3 -5
- package/src/extensions/Stickers/StickersExtensionDecorator.tsx +1 -1
- package/src/extensions/ThumbnailGeneration/ThumbnailGenerationDecorator.tsx +5 -3
- package/src/extensions/ThumbnailGeneration/resources/empty.png +0 -0
- package/src/extensions/ThumbnailGeneration/resources/index.ts +5 -0
- package/src/index.ts +79 -4
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +154 -130
- package/src/shared/CometChatUiKit/UIKitSettings.ts +2 -2
- package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +4 -1
- package/src/shared/events/CometChatUIEventHandler/Listener.ts +5 -1
- package/src/shared/framework/DataSource.ts +4 -0
- package/src/shared/framework/DataSourceDecorator.tsx +5 -0
- package/src/shared/framework/MessageDataSource.tsx +4 -1
- package/src/shared/index.ts +4 -0
- package/src/shared/modals/CometChatCallLogDetailsOptions.ts +23 -0
- package/src/shared/modals/CometChatCallLogDetailsTemplate.ts +16 -0
- package/src/shared/modals/index.ts +5 -1
- package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +19 -5
- package/src/shared/resources/CometChatLocalize/resources/de/translation.json +19 -5
- package/src/shared/resources/CometChatLocalize/resources/en/translation.json +21 -7
- package/src/shared/resources/CometChatLocalize/resources/es/translation.json +19 -5
- package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +19 -5
- package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +19 -5
- package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +19 -5
- package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +19 -5
- package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +19 -5
- package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +19 -5
- package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +19 -5
- package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +19 -4
- package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +19 -5
- package/src/shared/resources/CometChatTheme/Palette.ts +16 -0
- package/src/shared/utils/DetailsUtils/DetailsUtils.tsx +1 -1
- package/src/shared/utils/conversationUtils.ts +1 -1
- package/src/shared/views/CometChatAICard/CometChatAICard.tsx +71 -0
- package/src/shared/views/CometChatAICard/resources/errormessage.png +0 -0
- package/src/shared/views/CometChatAICard/resources/index.ts +4 -0
- package/src/shared/views/CometChatAICard/resources/nomessage.png +0 -0
- package/src/shared/views/CometChatActionSheet/ActionSheetStyle.ts +4 -0
- package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +11 -7
- package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +56 -47
- package/src/shared/views/CometChatBottomSheet/style.ts +0 -2
- package/src/shared/views/CometChatDate/CometChatDate.tsx +7 -3
- package/src/shared/views/CometChatDate/DateConfiguration.ts +4 -0
- package/src/shared/views/CometChatDate/style.ts +1 -1
- package/src/shared/views/CometChatListItem/CometChatListItem.tsx +31 -19
- package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +1 -2
- package/src/shared/views/CometChatPanel/CometChatPanel.tsx +51 -0
- package/src/shared/views/CometChatPanel/PanelStyle.tsx +43 -0
- package/src/shared/views/CometChatPanel/resources/CloseIcon.png +0 -0
- package/src/shared/views/CometChatPanel/resources/index.ts +5 -0
- package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +7 -5
- package/src/AI/AIEnabler.ts +0 -115
- package/src/AI/AIEnablerDecorator.tsx +0 -324
- package/src/AI/AISmartReplies/AISmartRepliesDecorator.ts +0 -18
- package/src/calls/CometChatCallDetails/CallDetailsConfiguration.ts +0 -68
- package/src/calls/CometChatCallDetails/CallDetailsStyle.ts +0 -52
- package/src/calls/CometChatCallDetails/CometChatCallDetails.tsx +0 -268
- package/src/calls/CometChatCallDetails/index.ts +0 -9
- package/src/calls/CometChatCallHistory/CallHistoryStyle.ts +0 -34
- package/src/calls/CometChatCallHistory/CometChatCallHistory.tsx +0 -422
- package/src/calls/CometChatCallHistory/index.ts +0 -9
- package/src/calls/CometChatCallHistory/resources/index.ts +0 -17
- package/src/calls/CometChatCallHistoryWithDetails/HistoryWithDetailsConfiguration.ts +0 -7
- package/src/calls/CometChatCallHistoryWithDetails/HistoryWithDetailsStyle.ts +0 -3
- package/src/calls/CometChatCallHistoryWithDetails/index.ts +0 -8
- /package/src/{calls/CometChatCallDetails → AI/AIAssistBot}/resources/CloseIcon.png +0 -0
- /package/src/{AI → CometChatMessageComposer}/resources/ai.png +0 -0
- /package/src/calls/{CometChatCallDetails → CometChatCallLogDetails}/resources/index.ts +0 -0
- /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Back.png +0 -0
- /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Call.png +0 -0
- /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Info.png +0 -0
- /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Selection.png +0 -0
- /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Spineer.png +0 -0
- /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Video.png +0 -0
- /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/check.png +0 -0
- /package/src/calls/{CometChatCallHistoryWithDetails → CometChatCallLogsWithDetails}/style.ts +0 -0
|
@@ -1,422 +0,0 @@
|
|
|
1
|
-
import { CometChat } from '@cometchat/chat-sdk-react-native'
|
|
2
|
-
import React, { useContext, useEffect, useRef, useState } from 'react'
|
|
3
|
-
import { FlatList, Image, ImageStyle, StyleProp, Text, TouchableOpacity, View, ViewStyle } from 'react-native'
|
|
4
|
-
import { ImageType, SelectionMode } from '../../shared/base/Types'
|
|
5
|
-
import { AvatarStyleInterface, CometChatContext, CometChatDate, CometChatList, CometChatListItem, CometChatOptions, ListItemStyleInterface, localize } from '../../shared'
|
|
6
|
-
import { StatusIndicatorStyleInterface } from '../../shared/views/CometChatStatusIndicator/StatusIndicatorStyle'
|
|
7
|
-
import { CallHistoryStyle, CallHistoryStyleInterface } from './CallHistoryStyle'
|
|
8
|
-
import { CometChatUIEventHandler } from '../../shared/events/CometChatUIEventHandler/CometChatUIEventHandler'
|
|
9
|
-
import { AudioCallIcon, VideoCallIcon, LoadingIcon, DetailIcon, BackIcon, CheckIcon, SelectionIcon } from "./resources";
|
|
10
|
-
import { CallContstatnts } from '../../shared/constants/UIKitConstants'
|
|
11
|
-
import { Style } from './style'
|
|
12
|
-
import { messageStatus } from '../../shared/utils/CometChatMessageHelper'
|
|
13
|
-
import { MessageCategoryConstants } from '../../shared/constants/UIKitConstants'
|
|
14
|
-
import { MessageTypeConstants } from '../../shared/constants/UIKitConstants'
|
|
15
|
-
|
|
16
|
-
const callListenerId = "uiEvents_" + new Date().getTime();
|
|
17
|
-
|
|
18
|
-
interface CometChatCallHistoryInterface {
|
|
19
|
-
title?: string,
|
|
20
|
-
SubtitleView?: (param: { call?: CometChat.BaseMessage }) => JSX.Element,
|
|
21
|
-
ListItemView?: (param: { call?: CometChat.BaseMessage }) => JSX.Element,
|
|
22
|
-
AppBarOptions?: () => JSX.Element,
|
|
23
|
-
options?: (param: { message: CometChat.BaseMessage }) => CometChatOptions[],
|
|
24
|
-
messageRequestBuilder?: CometChat.MessagesRequestBuilder,
|
|
25
|
-
hideSeperator?: boolean,
|
|
26
|
-
BackButton?: JSX.Element,
|
|
27
|
-
showBackButton?: boolean,
|
|
28
|
-
selectionMode?: SelectionMode,
|
|
29
|
-
onSelection?: (items: Array<CometChat.BaseMessage>) => void,
|
|
30
|
-
EmptyStateView?: () => JSX.Element,
|
|
31
|
-
emptyStateText?: string,
|
|
32
|
-
ErrorStateView?: () => JSX.Element,
|
|
33
|
-
errorStateText?: string,
|
|
34
|
-
loadingIcon?: ImageType,
|
|
35
|
-
LoadingStateView?: () => JSX.Element,
|
|
36
|
-
hideError?: boolean,
|
|
37
|
-
onItemPress?: (item: CometChat.BaseMessage) => void,
|
|
38
|
-
onItemLongPress?: (item: CometChat.BaseMessage) => void,
|
|
39
|
-
onError?: (e: CometChat.CometChatException) => void,
|
|
40
|
-
onBack?: () => void,
|
|
41
|
-
onInfoIconPress?: (prop: { call: CometChat.BaseMessage }) => void,
|
|
42
|
-
infoIcon?: ImageStyle,
|
|
43
|
-
avatarStyle?: AvatarStyleInterface,
|
|
44
|
-
statusIndicatorStyle?: StatusIndicatorStyleInterface,
|
|
45
|
-
listItemStyle?: ListItemStyleInterface,
|
|
46
|
-
callHistoryStyle?: CallHistoryStyleInterface,
|
|
47
|
-
headViewContainerStyle?: StyleProp<ViewStyle>,
|
|
48
|
-
bodyViewContainerStyle?: StyleProp<ViewStyle>,
|
|
49
|
-
tailViewContainerStyle?: StyleProp<ViewStyle>,
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const CometChatCallHistory = (props: CometChatCallHistoryInterface) => {
|
|
53
|
-
|
|
54
|
-
const {
|
|
55
|
-
title = localize("CALL_HISTORY"),
|
|
56
|
-
SubtitleView,
|
|
57
|
-
ListItemView,
|
|
58
|
-
AppBarOptions,
|
|
59
|
-
options,
|
|
60
|
-
messageRequestBuilder,
|
|
61
|
-
hideSeperator = false,
|
|
62
|
-
BackButton,
|
|
63
|
-
showBackButton = true,
|
|
64
|
-
selectionMode = "multiple",
|
|
65
|
-
onSelection,
|
|
66
|
-
EmptyStateView,
|
|
67
|
-
emptyStateText,
|
|
68
|
-
ErrorStateView,
|
|
69
|
-
errorStateText,
|
|
70
|
-
loadingIcon,
|
|
71
|
-
LoadingStateView,
|
|
72
|
-
hideError,
|
|
73
|
-
onItemPress,
|
|
74
|
-
onItemLongPress,
|
|
75
|
-
onInfoIconPress,
|
|
76
|
-
infoIcon,
|
|
77
|
-
onError,
|
|
78
|
-
onBack,
|
|
79
|
-
avatarStyle,
|
|
80
|
-
statusIndicatorStyle,
|
|
81
|
-
listItemStyle,
|
|
82
|
-
callHistoryStyle,
|
|
83
|
-
headViewContainerStyle,
|
|
84
|
-
bodyViewContainerStyle,
|
|
85
|
-
tailViewContainerStyle,
|
|
86
|
-
} = props;
|
|
87
|
-
|
|
88
|
-
const { theme } = useContext(CometChatContext);
|
|
89
|
-
|
|
90
|
-
const _style = new CallHistoryStyle({
|
|
91
|
-
titleFont: theme.typography.heading,
|
|
92
|
-
titleColor: theme.palette.getAccent(),
|
|
93
|
-
backgroundColor: theme.palette.getBackgroundColor(),
|
|
94
|
-
...callHistoryStyle
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
const {
|
|
98
|
-
backgroundColor,
|
|
99
|
-
height,
|
|
100
|
-
width,
|
|
101
|
-
border,
|
|
102
|
-
borderRadius,
|
|
103
|
-
titleColor,
|
|
104
|
-
titleFont,
|
|
105
|
-
loadingTint,
|
|
106
|
-
} = _style;
|
|
107
|
-
|
|
108
|
-
const [list, setList] = useState([]);
|
|
109
|
-
const [listState, setListState] = useState<"loading" | "error" | "done">("loading");
|
|
110
|
-
const [selecting, setSelecting] = useState(false);
|
|
111
|
-
const [selectedItems, setSelectedItems] = useState({});
|
|
112
|
-
|
|
113
|
-
const loggedInUser = useRef(null);
|
|
114
|
-
const callRequestBuilderRef = useRef((messageRequestBuilder && messageRequestBuilder.build()) ?? new CometChat.MessagesRequestBuilder()
|
|
115
|
-
.setCategories([MessageCategoryConstants.call, MessageCategoryConstants.custom])
|
|
116
|
-
.setTypes([MessageTypeConstants.audio, MessageTypeConstants.video, MessageTypeConstants.meeting])
|
|
117
|
-
.setLimit(30)
|
|
118
|
-
.build());
|
|
119
|
-
|
|
120
|
-
const fetchCallHistory = () => {
|
|
121
|
-
setListState("loading");
|
|
122
|
-
callRequestBuilderRef.current.fetchPrevious()
|
|
123
|
-
.then(callLogs => {
|
|
124
|
-
console.log(callLogs.length);
|
|
125
|
-
setList([...list, ...callLogs.reverse()]);
|
|
126
|
-
setListState("done");
|
|
127
|
-
})
|
|
128
|
-
.catch(err => {
|
|
129
|
-
onError && onError(err);
|
|
130
|
-
setListState("error");
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
useEffect(() => {
|
|
135
|
-
CometChat.getLoggedinUser()
|
|
136
|
-
.then(u => {
|
|
137
|
-
loggedInUser.current = u;
|
|
138
|
-
fetchCallHistory();
|
|
139
|
-
})
|
|
140
|
-
.catch(e => {
|
|
141
|
-
onError(e);
|
|
142
|
-
});
|
|
143
|
-
CometChat.addCallListener(
|
|
144
|
-
callListenerId,
|
|
145
|
-
new CometChat.CallListener({
|
|
146
|
-
onIncomingCallReceived: (call) => {
|
|
147
|
-
addNewCall(call);
|
|
148
|
-
},
|
|
149
|
-
onOutgoingCallAccepted: (call) => {
|
|
150
|
-
addNewCall(call);
|
|
151
|
-
},
|
|
152
|
-
onOutgoingCallRejected: (call) => {
|
|
153
|
-
addNewCall(call);
|
|
154
|
-
},
|
|
155
|
-
onIncomingCallCancelled: (call) => {
|
|
156
|
-
addNewCall(call);
|
|
157
|
-
}
|
|
158
|
-
})
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
CometChatUIEventHandler.addMessageListener(
|
|
162
|
-
callListenerId,
|
|
163
|
-
{
|
|
164
|
-
ccMessageSent: ({ message, status }) => {
|
|
165
|
-
status == messageStatus.success && addNewCall(message)
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
)
|
|
169
|
-
|
|
170
|
-
CometChatUIEventHandler.addCallListener(
|
|
171
|
-
callListenerId,
|
|
172
|
-
{
|
|
173
|
-
ccOutgoingCall: ({ call }) => { addNewCall(call) },
|
|
174
|
-
ccCallAccepted: ({ call }) => { addNewCall(call) },
|
|
175
|
-
ccCallRejected: ({ call }) => { addNewCall(call) },
|
|
176
|
-
ccCallEnded: ({ call }) => { addNewCall(call) }
|
|
177
|
-
}
|
|
178
|
-
)
|
|
179
|
-
|
|
180
|
-
return () => {
|
|
181
|
-
CometChat.removeCallListener(callListenerId);
|
|
182
|
-
CometChatUIEventHandler.removeMessageListener(callListenerId);
|
|
183
|
-
}
|
|
184
|
-
}, []);
|
|
185
|
-
|
|
186
|
-
const addNewCall = (call) => {
|
|
187
|
-
setList([call, ...list]);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
const DefaultSubtitleView = ({ call }) => {
|
|
191
|
-
if (SubtitleView)
|
|
192
|
-
return SubtitleView(call);
|
|
193
|
-
return (
|
|
194
|
-
<View style={[Style.row]}>
|
|
195
|
-
<Image source={call['type'] == CallContstatnts.audioCall ? AudioCallIcon : VideoCallIcon} style={{ height: 16, width: 16, alignSelf: "center", tintColor: theme.palette.getAccent700() }} />
|
|
196
|
-
<Text style={{ color: theme.palette.getAccent(), marginStart: 8 }}>
|
|
197
|
-
{
|
|
198
|
-
call['type'] == "meeting" ?
|
|
199
|
-
"conference call" :
|
|
200
|
-
call['status']
|
|
201
|
-
}
|
|
202
|
-
</Text>
|
|
203
|
-
</View>
|
|
204
|
-
);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
const TailView = ({ call }) => {
|
|
208
|
-
return (
|
|
209
|
-
<View style={[Style.row, { alignItems: "center" }]}>
|
|
210
|
-
<CometChatDate timeStamp={call['updatedAt'] * 1000} pattern={'dayDateFormat'} style={{ textColor: theme.palette.getAccent() }} />
|
|
211
|
-
<TouchableOpacity onPress={() => onInfoIconPress && onInfoIconPress({ call })} style={{ marginStart: 8 }}>
|
|
212
|
-
<Image source={infoIcon || DetailIcon} style={{ height: 24, width: 24, tintColor: theme.palette.getPrimary() }} />
|
|
213
|
-
</TouchableOpacity>
|
|
214
|
-
</View>
|
|
215
|
-
)
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
//returns index from selected items
|
|
219
|
-
const isSelected = (item) => {
|
|
220
|
-
return Object.keys(selectedItems).includes(item.id);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
const longPress = (item) => {
|
|
224
|
-
if (onItemLongPress) {
|
|
225
|
-
onItemLongPress(item);
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
setSelecting(true);
|
|
230
|
-
if (selectionMode == "none") return;
|
|
231
|
-
|
|
232
|
-
if (selectionMode == "single")
|
|
233
|
-
setSelectedItems({ [item['id']]: item });
|
|
234
|
-
else {
|
|
235
|
-
// let index = isSelected(item);
|
|
236
|
-
if (isSelected(item)) {
|
|
237
|
-
let tmp = { ...selectedItems };
|
|
238
|
-
delete tmp[item.id];
|
|
239
|
-
setSelectedItems({ [tmp['id']]: tmp });
|
|
240
|
-
} else {
|
|
241
|
-
setSelectedItems({
|
|
242
|
-
...selectedItems,
|
|
243
|
-
[item['id']]: item
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
const onPress = (item) => {
|
|
250
|
-
if (!selecting) {
|
|
251
|
-
onItemPress && onItemPress(item);
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
//add to selected
|
|
255
|
-
switch (selectionMode) {
|
|
256
|
-
case "single":
|
|
257
|
-
setSelectedItems({ [item['id']]: item });
|
|
258
|
-
break;
|
|
259
|
-
case "multiple":
|
|
260
|
-
if (isSelected(item)) {
|
|
261
|
-
let tmp = { ...selectedItems };
|
|
262
|
-
delete tmp[item.id];
|
|
263
|
-
setSelectedItems(tmp);
|
|
264
|
-
} else {
|
|
265
|
-
setSelectedItems({
|
|
266
|
-
...selectedItems,
|
|
267
|
-
[item['id']]: item
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
break;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
const getCallDetails = (call) => {
|
|
275
|
-
const { category, type, callInitiator, callReceiver, receiverId, receiver } = call;
|
|
276
|
-
|
|
277
|
-
if (category == "custom" && type == "meeting") {
|
|
278
|
-
return {
|
|
279
|
-
title: receiver['name'],
|
|
280
|
-
avatarUrl: receiver['icon']
|
|
281
|
-
}
|
|
282
|
-
} else if (category == "call") {
|
|
283
|
-
return {
|
|
284
|
-
title: loggedInUser.current['uid'] == receiverId ? callInitiator['name'] : callReceiver['name'],
|
|
285
|
-
avatarUrl: loggedInUser.current['uid'] == receiverId ? callInitiator['avatar'] : callReceiver['avatar'],
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
return { title: "", avatarUrl: undefined }
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
const _render = ({ item, index }) => {
|
|
292
|
-
|
|
293
|
-
if (ListItemView)
|
|
294
|
-
return <ListItemView call={item} />
|
|
295
|
-
|
|
296
|
-
const { title, avatarUrl } = getCallDetails(item);
|
|
297
|
-
|
|
298
|
-
return <CometChatListItem
|
|
299
|
-
id={item.id}
|
|
300
|
-
avatarName={title}
|
|
301
|
-
title={title}
|
|
302
|
-
listItemStyle={listItemStyle ? listItemStyle : { height: 70 }}
|
|
303
|
-
headViewContainerStyle={
|
|
304
|
-
headViewContainerStyle
|
|
305
|
-
? headViewContainerStyle
|
|
306
|
-
: { marginHorizontal: 9 }
|
|
307
|
-
}
|
|
308
|
-
bodyViewContainerStyle={
|
|
309
|
-
bodyViewContainerStyle ? bodyViewContainerStyle : {}
|
|
310
|
-
}
|
|
311
|
-
tailViewContainerStyle={
|
|
312
|
-
tailViewContainerStyle ? tailViewContainerStyle : {}
|
|
313
|
-
}
|
|
314
|
-
avatarURL={avatarUrl}
|
|
315
|
-
statusIndicatorIcon={
|
|
316
|
-
selectedItems[item.id] && CheckIcon
|
|
317
|
-
}
|
|
318
|
-
SubtitleView={() =>
|
|
319
|
-
SubtitleView ? <SubtitleView {...item} /> : <DefaultSubtitleView call={item} />
|
|
320
|
-
}
|
|
321
|
-
TailView={TailView ? () => <TailView call={item} /> : null}
|
|
322
|
-
statusIndicatorStyle={
|
|
323
|
-
selectedItems[item.id]
|
|
324
|
-
? {
|
|
325
|
-
...(statusIndicatorStyle as object),
|
|
326
|
-
borderRadius: 10,
|
|
327
|
-
height: 20,
|
|
328
|
-
width: 20,
|
|
329
|
-
}
|
|
330
|
-
: statusIndicatorStyle
|
|
331
|
-
}
|
|
332
|
-
avatarStyle={avatarStyle}
|
|
333
|
-
options={() => options && options(item)}
|
|
334
|
-
onPress={() => onPress(item)}
|
|
335
|
-
onLongPress={() => longPress(item)}
|
|
336
|
-
hideSeparator={hideSeperator}
|
|
337
|
-
/>
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
const EmptyView = () => {
|
|
341
|
-
if (EmptyStateView)
|
|
342
|
-
return <EmptyStateView />
|
|
343
|
-
return (
|
|
344
|
-
<View style={[Style.container]}>
|
|
345
|
-
<Text>{emptyStateText || localize("NO_CALL_HISTORY")}</Text>
|
|
346
|
-
</View>
|
|
347
|
-
)
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
const ErrorView = () => {
|
|
351
|
-
if (hideError) return null;
|
|
352
|
-
if (ErrorStateView)
|
|
353
|
-
return <ErrorStateView />
|
|
354
|
-
return <View style={[Style.container]}>
|
|
355
|
-
<Text>{errorStateText || localize("SOMETHING_WRONG")}</Text>
|
|
356
|
-
</View>
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
const LoadingView = () => {
|
|
360
|
-
if (LoadingStateView)
|
|
361
|
-
return <LoadingStateView />
|
|
362
|
-
return <View style={[Style.container]}>
|
|
363
|
-
<Image source={loadingIcon || LoadingIcon} style={[Style.imageStyle, { tintColor: "black" || loadingTint }]} />
|
|
364
|
-
</View>
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
const selection = () => {
|
|
368
|
-
if (onSelection)
|
|
369
|
-
onSelection(Object.values(selectedItems));
|
|
370
|
-
setSelecting(false);
|
|
371
|
-
setSelectedItems({});
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
return (
|
|
375
|
-
<View style={{ backgroundColor, height, width, borderRadius, ...border }}>
|
|
376
|
-
<View style={[Style.row, Style.headerStyle, { height: 60 }]}>
|
|
377
|
-
<View style={Style.row}>
|
|
378
|
-
{
|
|
379
|
-
showBackButton ?
|
|
380
|
-
BackButton ??
|
|
381
|
-
<TouchableOpacity style={Style.imageStyle} onPress={onBack}>
|
|
382
|
-
<Image
|
|
383
|
-
source={BackIcon}
|
|
384
|
-
style={[Style.imageStyle, { tintColor: theme.palette.getPrimary() }]}
|
|
385
|
-
/>
|
|
386
|
-
</TouchableOpacity> : null
|
|
387
|
-
}
|
|
388
|
-
<Text style={[{ color: titleColor, ...titleFont }]}>{title}</Text>
|
|
389
|
-
</View>
|
|
390
|
-
<View style={Style.row}>
|
|
391
|
-
{
|
|
392
|
-
AppBarOptions && <AppBarOptions />
|
|
393
|
-
}
|
|
394
|
-
{
|
|
395
|
-
selecting ?
|
|
396
|
-
<TouchableOpacity onPress={selection}>
|
|
397
|
-
<Image
|
|
398
|
-
source={SelectionIcon}
|
|
399
|
-
resizeMode='contain'
|
|
400
|
-
style={[Style.imageStyle, { tintColor: theme.palette.getPrimary() }]}
|
|
401
|
-
/>
|
|
402
|
-
</TouchableOpacity> : null
|
|
403
|
-
}
|
|
404
|
-
</View>
|
|
405
|
-
</View>
|
|
406
|
-
{
|
|
407
|
-
listState == "loading" && list.length == 0 ?
|
|
408
|
-
<LoadingView /> :
|
|
409
|
-
listState == "error" && list.length == 0 ?
|
|
410
|
-
<ErrorView /> :
|
|
411
|
-
list.length == 0 ?
|
|
412
|
-
<EmptyView /> :
|
|
413
|
-
<FlatList
|
|
414
|
-
data={list}
|
|
415
|
-
keyExtractor={(item) => item.id}
|
|
416
|
-
renderItem={_render}
|
|
417
|
-
onEndReached={fetchCallHistory}
|
|
418
|
-
/>
|
|
419
|
-
}
|
|
420
|
-
</View>
|
|
421
|
-
)
|
|
422
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CallHistoryConfiguration, CallHistoryConfigurationInterface } from "./CallHistoryConfiguration";
|
|
2
|
-
import { CallHistoryStyle, CallHistoryStyleInterface } from "./CallHistoryStyle";
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
CallHistoryConfiguration,
|
|
6
|
-
CallHistoryConfigurationInterface,
|
|
7
|
-
CallHistoryStyle,
|
|
8
|
-
CallHistoryStyleInterface
|
|
9
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import AudioCallIcon from "./Call.png";
|
|
2
|
-
import VideoCallIcon from "./Video.png";
|
|
3
|
-
import LoadingIcon from "./Spineer.png";
|
|
4
|
-
import DetailIcon from "./Info.png";
|
|
5
|
-
import BackIcon from "./Back.png";
|
|
6
|
-
import CheckIcon from "./check.png";
|
|
7
|
-
import SelectionIcon from "./Selection.png";
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
SelectionIcon,
|
|
11
|
-
CheckIcon,
|
|
12
|
-
DetailIcon,
|
|
13
|
-
AudioCallIcon,
|
|
14
|
-
VideoCallIcon,
|
|
15
|
-
LoadingIcon,
|
|
16
|
-
BackIcon
|
|
17
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { CallDetailsConfigurationInterface } from "../CometChatCallDetails";
|
|
2
|
-
import { CallHistoryConfigurationInterface } from "../CometChatCallHistory/CallHistoryConfiguration";
|
|
3
|
-
|
|
4
|
-
export interface HistoryWithDetailsConfigurationInterface {
|
|
5
|
-
callHistoryConfiguration?: CallHistoryConfigurationInterface,
|
|
6
|
-
callDetailsConfiguration?: CallDetailsConfigurationInterface,
|
|
7
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { HistoryWithDetailsConfigurationInterface } from "./HistoryWithDetailsConfiguration";
|
|
2
|
-
import { HistoryWithDetailsStyleInterface } from "./HistoryWithDetailsStyle";
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
{
|
|
6
|
-
HistoryWithDetailsConfigurationInterface,
|
|
7
|
-
HistoryWithDetailsStyleInterface,
|
|
8
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/calls/{CometChatCallHistoryWithDetails → CometChatCallLogsWithDetails}/style.ts
RENAMED
|
File without changes
|