@cometchat/chat-uikit-react-native 4.0.2 → 4.1.0
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/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 +33 -24
- package/src/CometChatMessages/CometChatMessages.tsx +4 -13
- package/src/CometChatMessages/MessagesConfiguration.ts +2 -2
- package/src/calls/CallUtils.ts +106 -45
- package/src/calls/CallingDetailsUtils.tsx +133 -15
- 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 +1 -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/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/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
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { CometChat } from '@cometchat/chat-sdk-react-native'
|
|
2
|
+
import React, { useContext, useEffect, useRef, useState } from 'react'
|
|
3
|
+
import { FlatList, Image, StyleProp, Text, TouchableOpacity, View, ViewStyle } from 'react-native'
|
|
4
|
+
import { DatePattern, ImageType } from '../../shared/base/Types'
|
|
5
|
+
import { CometChatContext, CometChatDate, CometChatListItem, CometChatOptions, ListItemStyleInterface, localize } from '../../shared'
|
|
6
|
+
import { CallLogHistoryStyle, CallLogHistoryStyleInterface } from './CallLogHistoryStyle'
|
|
7
|
+
import { LoadingIcon, BackIcon } from "./resources";
|
|
8
|
+
import { Style } from './style'
|
|
9
|
+
import { CallingPackage } from '../CallingPackage'
|
|
10
|
+
import { CallUtils } from '../CallUtils'
|
|
11
|
+
|
|
12
|
+
const CometChatCalls = CallingPackage.CometChatCalls;
|
|
13
|
+
|
|
14
|
+
export interface CometChatCallLogHistoryInterface {
|
|
15
|
+
title?: string,
|
|
16
|
+
SubtitleView?: (param: { call?: CometChat.BaseMessage }) => JSX.Element,
|
|
17
|
+
TailView?: (param: { call?: CometChat.BaseMessage }) => JSX.Element,
|
|
18
|
+
ListItemView?: (param: { call?: CometChat.BaseMessage }) => JSX.Element,
|
|
19
|
+
AppBarOptions?: () => JSX.Element,
|
|
20
|
+
options?: (param: { message: CometChat.BaseMessage }) => CometChatOptions[],
|
|
21
|
+
callLogHistoryRequestBuilder?: any,
|
|
22
|
+
user?: any,
|
|
23
|
+
group?: any,
|
|
24
|
+
hideSeperator?: boolean,
|
|
25
|
+
datePattern?: DatePattern,
|
|
26
|
+
dateSeparatorPattern?: DatePattern,
|
|
27
|
+
BackButton?: JSX.Element,
|
|
28
|
+
showBackButton?: boolean,
|
|
29
|
+
EmptyStateView?: () => JSX.Element,
|
|
30
|
+
emptyStateText?: string,
|
|
31
|
+
ErrorStateView?: () => JSX.Element,
|
|
32
|
+
errorStateText?: string,
|
|
33
|
+
loadingIcon?: ImageType,
|
|
34
|
+
LoadingStateView?: () => JSX.Element,
|
|
35
|
+
hideError?: boolean,
|
|
36
|
+
onItemPress?: (item: CometChat.BaseMessage) => void,
|
|
37
|
+
onError?: (e: CometChat.CometChatException) => void,
|
|
38
|
+
onBack?: () => void,
|
|
39
|
+
listItemStyle?: ListItemStyleInterface,
|
|
40
|
+
callLogHistoryStyle?: CallLogHistoryStyleInterface,
|
|
41
|
+
bodyViewContainerStyle?: StyleProp<ViewStyle>,
|
|
42
|
+
tailViewContainerStyle?: StyleProp<ViewStyle>,
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const CometChatCallLogHistory = (props: CometChatCallLogHistoryInterface) => {
|
|
46
|
+
|
|
47
|
+
const {
|
|
48
|
+
title = localize("CALL_HISTORY"),
|
|
49
|
+
SubtitleView,
|
|
50
|
+
TailView,
|
|
51
|
+
ListItemView,
|
|
52
|
+
AppBarOptions,
|
|
53
|
+
options,
|
|
54
|
+
callLogHistoryRequestBuilder,
|
|
55
|
+
user,
|
|
56
|
+
group,
|
|
57
|
+
hideSeperator,
|
|
58
|
+
datePattern,
|
|
59
|
+
dateSeparatorPattern,
|
|
60
|
+
BackButton,
|
|
61
|
+
showBackButton,
|
|
62
|
+
EmptyStateView,
|
|
63
|
+
emptyStateText,
|
|
64
|
+
ErrorStateView,
|
|
65
|
+
errorStateText,
|
|
66
|
+
loadingIcon,
|
|
67
|
+
LoadingStateView,
|
|
68
|
+
hideError,
|
|
69
|
+
onItemPress,
|
|
70
|
+
onError,
|
|
71
|
+
onBack,
|
|
72
|
+
listItemStyle,
|
|
73
|
+
callLogHistoryStyle,
|
|
74
|
+
bodyViewContainerStyle,
|
|
75
|
+
tailViewContainerStyle,
|
|
76
|
+
} = props;
|
|
77
|
+
|
|
78
|
+
const { theme } = useContext(CometChatContext);
|
|
79
|
+
|
|
80
|
+
const _style = new CallLogHistoryStyle({
|
|
81
|
+
titleFont: theme.typography.heading,
|
|
82
|
+
titleColor: theme.palette.getAccent(),
|
|
83
|
+
backgroundColor: theme.palette.getBackgroundColor(),
|
|
84
|
+
emptyTextColor: theme?.palette?.getAccent400(),
|
|
85
|
+
emptyTextFont: theme?.typography?.subtitle1,
|
|
86
|
+
errorTextColor: theme?.palette?.getError(),
|
|
87
|
+
errorTextFont: theme?.typography?.subtitle1,
|
|
88
|
+
backIconTint: theme.palette.getPrimary(),
|
|
89
|
+
callDurationTextColor: theme.palette.getAccent(),
|
|
90
|
+
callDurationTextFont: theme.typography.text1,
|
|
91
|
+
dateTextColor: theme.palette.getAccent(),
|
|
92
|
+
dateTextFont: theme.typography.subtitle1,
|
|
93
|
+
loadingTint: theme.palette.getPrimary(),
|
|
94
|
+
dateSeparatorTextColor: theme.palette.getAccent600(),
|
|
95
|
+
dateSeparatorTextFont: theme.typography.text2,
|
|
96
|
+
callStatusTextColor: theme.palette.getAccent(),
|
|
97
|
+
callStatusTextFont: theme.typography.text1,
|
|
98
|
+
...callLogHistoryStyle
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
const {
|
|
102
|
+
backgroundColor,
|
|
103
|
+
height,
|
|
104
|
+
width,
|
|
105
|
+
border,
|
|
106
|
+
borderRadius,
|
|
107
|
+
titleColor,
|
|
108
|
+
titleFont,
|
|
109
|
+
loadingTint,
|
|
110
|
+
backIconTint,
|
|
111
|
+
callDurationTextColor,
|
|
112
|
+
callDurationTextFont,
|
|
113
|
+
callStatusTextColor,
|
|
114
|
+
callStatusTextFont,
|
|
115
|
+
dateSeparatorTextColor,
|
|
116
|
+
dateSeparatorTextFont,
|
|
117
|
+
dateTextColor,
|
|
118
|
+
dateTextFont,
|
|
119
|
+
emptyTextColor,
|
|
120
|
+
emptyTextFont,
|
|
121
|
+
errorTextColor,
|
|
122
|
+
errorTextFont,
|
|
123
|
+
separatorColor
|
|
124
|
+
} = _style;
|
|
125
|
+
|
|
126
|
+
const [list, setList] = useState([]);
|
|
127
|
+
const [listState, setListState] = useState<"loading" | "error" | "done">("loading");
|
|
128
|
+
|
|
129
|
+
const loggedInUser = useRef(null);
|
|
130
|
+
const callRequestBuilderRef = useRef(null);
|
|
131
|
+
|
|
132
|
+
function setRequestBuilder() {
|
|
133
|
+
callRequestBuilderRef.current
|
|
134
|
+
let builder = callLogHistoryRequestBuilder ?? new CometChatCalls.CallLogRequestBuilder()
|
|
135
|
+
.setLimit(30)
|
|
136
|
+
// .setUid("superhero2")
|
|
137
|
+
.setAuthToken(loggedInUser.current.getAuthToken() || "")
|
|
138
|
+
// .setHasRecording(true)
|
|
139
|
+
.setCallCategory("call")
|
|
140
|
+
// .setCallDirection("outgoing")
|
|
141
|
+
// .setCallStatus("rejected")
|
|
142
|
+
// .setCallType("video")
|
|
143
|
+
// .setGuid("group_123456")
|
|
144
|
+
;
|
|
145
|
+
if (user) {
|
|
146
|
+
builder = builder.setUid(user?.getUid());
|
|
147
|
+
} else if (group) {
|
|
148
|
+
builder = builder.setGuid(group?.getGuid());
|
|
149
|
+
}
|
|
150
|
+
callRequestBuilderRef.current = builder.build();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const fetchCallLogHistory = () => {
|
|
154
|
+
setListState("loading");
|
|
155
|
+
callRequestBuilderRef.current.fetchNext()
|
|
156
|
+
.then(CallLogHistory => {
|
|
157
|
+
console.log(CallLogHistory.length);
|
|
158
|
+
if (CallLogHistory.length > 0) {
|
|
159
|
+
setList([...list, ...CallLogHistory]);
|
|
160
|
+
}
|
|
161
|
+
setListState("done");
|
|
162
|
+
})
|
|
163
|
+
.catch(err => {
|
|
164
|
+
onError && onError(err);
|
|
165
|
+
setListState("error");
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
useEffect(() => {
|
|
170
|
+
CometChat.getLoggedinUser()
|
|
171
|
+
.then(u => {
|
|
172
|
+
loggedInUser.current = u;
|
|
173
|
+
setRequestBuilder();
|
|
174
|
+
fetchCallLogHistory();
|
|
175
|
+
})
|
|
176
|
+
.catch(e => {
|
|
177
|
+
onError(e);
|
|
178
|
+
});
|
|
179
|
+
}, []);
|
|
180
|
+
|
|
181
|
+
const DefaultSubtitleView = ({ call }) => {
|
|
182
|
+
|
|
183
|
+
if (SubtitleView)
|
|
184
|
+
return SubtitleView(call);
|
|
185
|
+
return (
|
|
186
|
+
<View style={[Style.row]}>
|
|
187
|
+
<View style={{ width: 70 }}>
|
|
188
|
+
<CometChatDate timeStamp={call['initiatedAt'] * 1000} pattern={datePattern || 'timeFormat'} style={{ textColor: dateTextColor, textFont: dateTextFont }} />
|
|
189
|
+
</View>
|
|
190
|
+
<Text style={[{ color: callStatusTextColor, marginStart: 2 }, callStatusTextFont]}>
|
|
191
|
+
{
|
|
192
|
+
CallUtils.getCallStatus(call as CometChat.Call, loggedInUser.current)
|
|
193
|
+
}
|
|
194
|
+
</Text>
|
|
195
|
+
</View>
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const DefaultTailView = ({ call }) => {
|
|
200
|
+
return (
|
|
201
|
+
<View style={[Style.row, { alignItems: "center" }]}>
|
|
202
|
+
<Text style={[{ color: callDurationTextColor, marginStart: 2 }, callDurationTextFont]}>
|
|
203
|
+
{
|
|
204
|
+
CallUtils.convertMinutesToHoursMinutesSeconds(call['totalDurationInMinutes'])
|
|
205
|
+
}
|
|
206
|
+
</Text>
|
|
207
|
+
</View>
|
|
208
|
+
)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const onPress = (item) => {
|
|
212
|
+
onItemPress && onItemPress(item);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const getInitiatedAtTimestamp = (item) => {
|
|
217
|
+
return item['initiatedAt'] * 1000;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const _render = ({ item, index }) => {
|
|
221
|
+
|
|
222
|
+
if (ListItemView)
|
|
223
|
+
return <ListItemView call={item} />
|
|
224
|
+
|
|
225
|
+
let seperatorView = null;
|
|
226
|
+
const previousMessageDate = list[index - 1] ? new Date(getInitiatedAtTimestamp(list[index - 1])) : null;
|
|
227
|
+
const currentMessageDate = new Date(getInitiatedAtTimestamp(item));
|
|
228
|
+
|
|
229
|
+
const currentDate = isNaN(currentMessageDate.getDate()) ? undefined : `${currentMessageDate.getDate()}-${currentMessageDate.getMonth()}-${currentMessageDate.getFullYear()}`;
|
|
230
|
+
|
|
231
|
+
const previousDate = `${previousMessageDate?.getDate()}-${previousMessageDate?.getMonth()}-${previousMessageDate?.getFullYear()}`;
|
|
232
|
+
|
|
233
|
+
if (currentDate != undefined && previousDate !== currentDate) {
|
|
234
|
+
seperatorView = (
|
|
235
|
+
<View style={{ marginHorizontal: 10, marginVertical: 5 }}>
|
|
236
|
+
<CometChatDate
|
|
237
|
+
timeStamp={getInitiatedAtTimestamp(item)}
|
|
238
|
+
pattern={dateSeparatorPattern || "dayDateFormat"}
|
|
239
|
+
style={{ textColor: dateSeparatorTextColor, textFont: dateSeparatorTextFont }}
|
|
240
|
+
/>
|
|
241
|
+
</View>
|
|
242
|
+
)
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return <React.Fragment key={index}>
|
|
246
|
+
{seperatorView}
|
|
247
|
+
<CometChatListItem
|
|
248
|
+
id={item.sessionId}
|
|
249
|
+
listItemStyle={listItemStyle ? listItemStyle : { height: 50 }}
|
|
250
|
+
bodyViewContainerStyle={
|
|
251
|
+
bodyViewContainerStyle ? bodyViewContainerStyle : {
|
|
252
|
+
marginHorizontal: 10,
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
tailViewContainerStyle={
|
|
256
|
+
tailViewContainerStyle ? tailViewContainerStyle : {
|
|
257
|
+
marginHorizontal: 10,
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
SubtitleView={() =>
|
|
261
|
+
SubtitleView ? <SubtitleView {...item} /> : <DefaultSubtitleView call={item} />
|
|
262
|
+
}
|
|
263
|
+
TailView={TailView ? () => <TailView call={item} /> : () => <DefaultTailView call={item} />}
|
|
264
|
+
options={() => options && options(item)}
|
|
265
|
+
onPress={() => onPress(item)}
|
|
266
|
+
hideSeparator={hideSeperator}
|
|
267
|
+
separatorColor={separatorColor}
|
|
268
|
+
/>
|
|
269
|
+
</React.Fragment>
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
const EmptyView = () => {
|
|
273
|
+
if (EmptyStateView)
|
|
274
|
+
return <EmptyStateView />
|
|
275
|
+
return (
|
|
276
|
+
<View style={[Style.container]}>
|
|
277
|
+
<Text style={[{ color: emptyTextColor, ...emptyTextFont }]}>{emptyStateText || localize("NO_CALL_HISTORY")}</Text>
|
|
278
|
+
</View>
|
|
279
|
+
)
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
const ErrorView = () => {
|
|
283
|
+
if (hideError) return null;
|
|
284
|
+
if (ErrorStateView)
|
|
285
|
+
return <ErrorStateView />
|
|
286
|
+
return <View style={[Style.container]}>
|
|
287
|
+
<Text style={[{ color: errorTextColor, ...errorTextFont }]}>{errorStateText || localize("SOMETHING_WRONG")}</Text>
|
|
288
|
+
</View>
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
const LoadingView = () => {
|
|
292
|
+
if (LoadingStateView)
|
|
293
|
+
return <LoadingStateView />
|
|
294
|
+
return <View style={[Style.container]}>
|
|
295
|
+
<Image source={loadingIcon || LoadingIcon} style={[Style.imageStyle, { tintColor: loadingTint }]} />
|
|
296
|
+
</View>
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
return (
|
|
300
|
+
<View style={{ backgroundColor, height, width, borderRadius, ...border }}>
|
|
301
|
+
<View style={[Style.row, Style.headerStyle, { height: 60 }]}>
|
|
302
|
+
<View style={Style.row}>
|
|
303
|
+
{
|
|
304
|
+
showBackButton ?
|
|
305
|
+
BackButton ??
|
|
306
|
+
<TouchableOpacity style={Style.imageStyle} onPress={onBack}>
|
|
307
|
+
<Image
|
|
308
|
+
source={BackIcon}
|
|
309
|
+
style={[Style.imageStyle, { tintColor: backIconTint }]}
|
|
310
|
+
/>
|
|
311
|
+
</TouchableOpacity> : null
|
|
312
|
+
}
|
|
313
|
+
<Text style={[{ color: titleColor, ...titleFont }]}>{title}</Text>
|
|
314
|
+
</View>
|
|
315
|
+
<View style={Style.row}>
|
|
316
|
+
{
|
|
317
|
+
AppBarOptions && <AppBarOptions />
|
|
318
|
+
}
|
|
319
|
+
</View>
|
|
320
|
+
</View>
|
|
321
|
+
{
|
|
322
|
+
listState == "loading" && list.length == 0 ?
|
|
323
|
+
<LoadingView /> :
|
|
324
|
+
listState == "error" && list.length == 0 ?
|
|
325
|
+
<ErrorView /> :
|
|
326
|
+
list.length == 0 ?
|
|
327
|
+
<EmptyView /> :
|
|
328
|
+
<FlatList
|
|
329
|
+
data={list}
|
|
330
|
+
keyExtractor={(item) => item.sessionId}
|
|
331
|
+
renderItem={_render}
|
|
332
|
+
onEndReached={fetchCallLogHistory}
|
|
333
|
+
/>
|
|
334
|
+
}
|
|
335
|
+
</View>
|
|
336
|
+
)
|
|
337
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CallLogHistoryConfiguration, CallLogHistoryConfigurationInterface } from "./CallLogHistoryConfiguration";
|
|
2
|
+
import { CallLogHistoryStyle, CallLogHistoryStyleInterface } from "./CallLogHistoryStyle";
|
|
3
|
+
import { CometChatCallLogHistory, CometChatCallLogHistoryInterface } from "./CometChatCallLogHistory";
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
CallLogHistoryConfiguration,
|
|
7
|
+
CallLogHistoryConfigurationInterface,
|
|
8
|
+
CallLogHistoryStyle,
|
|
9
|
+
CallLogHistoryStyleInterface,
|
|
10
|
+
CometChatCallLogHistory,
|
|
11
|
+
CometChatCallLogHistoryInterface
|
|
12
|
+
}
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
import IncomingCallIcon from './incomingcall.png';
|
|
9
|
+
import OutgoingCallIcon from './outgoingcall.png';
|
|
10
|
+
import MissedCallIcon from './missedcall.png';
|
|
11
|
+
import MissedVideoIcon from './missedvideo.png';
|
|
12
|
+
import IncomingVideoIcon from './incomingvideo.png';
|
|
13
|
+
import OutgoingVideoIcon from './outgoingvideo.png';
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
SelectionIcon,
|
|
17
|
+
CheckIcon,
|
|
18
|
+
DetailIcon,
|
|
19
|
+
AudioCallIcon,
|
|
20
|
+
VideoCallIcon,
|
|
21
|
+
LoadingIcon,
|
|
22
|
+
BackIcon,
|
|
23
|
+
IncomingCallIcon,
|
|
24
|
+
OutgoingCallIcon,
|
|
25
|
+
MissedCallIcon,
|
|
26
|
+
MissedVideoIcon,
|
|
27
|
+
IncomingVideoIcon,
|
|
28
|
+
OutgoingVideoIcon
|
|
29
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle } from "react-native/types";
|
|
2
|
+
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
3
|
+
import { AvatarStyleInterface, CometChatOptions, ImageType, ListItemStyleInterface } from "../../shared";
|
|
4
|
+
import { CallParticipantsStyleInterface } from "./CallLogParticipantsStyle";
|
|
5
|
+
|
|
6
|
+
export interface CallLogParticipantsConfigurationInterface {
|
|
7
|
+
SubtitleView?: (param: { participant?: CometChat.BaseMessage }) => JSX.Element,
|
|
8
|
+
TailView?: (param: { participant?: CometChat.BaseMessage }) => JSX.Element,
|
|
9
|
+
ListItemView?: (param: { participant?: CometChat.BaseMessage }) => JSX.Element,
|
|
10
|
+
AppBarOptions?: () => JSX.Element,
|
|
11
|
+
/**
|
|
12
|
+
* Participant list
|
|
13
|
+
*/
|
|
14
|
+
data: any[],
|
|
15
|
+
call: any,
|
|
16
|
+
hideSeperator?: boolean,
|
|
17
|
+
BackButton?: JSX.Element,
|
|
18
|
+
showBackButton?: boolean,
|
|
19
|
+
EmptyStateView?: () => JSX.Element,
|
|
20
|
+
onItemPress?: (item: CometChat.BaseMessage) => void,
|
|
21
|
+
onError?: (e: CometChat.CometChatException) => void,
|
|
22
|
+
onBack?: () => void,
|
|
23
|
+
avatarStyle?: AvatarStyleInterface,
|
|
24
|
+
listItemStyle?: ListItemStyleInterface,
|
|
25
|
+
callLogParticipantsStyle?: CallParticipantsStyleInterface,
|
|
26
|
+
headViewContainerStyle?: StyleProp<ViewStyle>,
|
|
27
|
+
bodyViewContainerStyle?: StyleProp<ViewStyle>,
|
|
28
|
+
tailViewContainerStyle?: StyleProp<ViewStyle>,
|
|
29
|
+
}
|
|
30
|
+
export class CallLogParticipantsConfiguration implements CallLogParticipantsConfigurationInterface {
|
|
31
|
+
SubtitleView?: (param: { participant?: CometChat.BaseMessage }) => JSX.Element
|
|
32
|
+
TailView?: (param: { participant?: CometChat.BaseMessage }) => JSX.Element
|
|
33
|
+
ListItemView?: (param: { participant?: CometChat.BaseMessage }) => JSX.Element
|
|
34
|
+
AppBarOptions?: () => JSX.Element
|
|
35
|
+
/**
|
|
36
|
+
* Participant list
|
|
37
|
+
*/
|
|
38
|
+
data: any[]
|
|
39
|
+
call: any
|
|
40
|
+
hideSeperator?: boolean
|
|
41
|
+
BackButton?: JSX.Element
|
|
42
|
+
showBackButton?: boolean
|
|
43
|
+
EmptyStateView?: () => JSX.Element
|
|
44
|
+
onItemPress?: (item: CometChat.BaseMessage) => void
|
|
45
|
+
onError?: (e: CometChat.CometChatException) => void
|
|
46
|
+
onBack?: () => void
|
|
47
|
+
avatarStyle?: AvatarStyleInterface
|
|
48
|
+
listItemStyle?: ListItemStyleInterface
|
|
49
|
+
callLogParticipantsStyle?: CallParticipantsStyleInterface
|
|
50
|
+
headViewContainerStyle?: StyleProp<ViewStyle>
|
|
51
|
+
bodyViewContainerStyle?: StyleProp<ViewStyle>
|
|
52
|
+
tailViewContainerStyle?: StyleProp<ViewStyle>
|
|
53
|
+
|
|
54
|
+
constructor(props: CallLogParticipantsConfigurationInterface) {
|
|
55
|
+
if (props) {
|
|
56
|
+
for (const [key, value] of Object.entries(props)) {
|
|
57
|
+
this[key] = value;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { BaseStyle, BaseStyleInterface, FontStyle, FontStyleInterface } from "../../shared";
|
|
2
|
+
|
|
3
|
+
export interface CallParticipantsStyleInterface extends BaseStyleInterface {
|
|
4
|
+
titleFont?: FontStyleInterface,
|
|
5
|
+
titleColor?: string,
|
|
6
|
+
dateTextFont?: FontStyleInterface;
|
|
7
|
+
dateTextColor?: string;
|
|
8
|
+
emptyTextFont?: FontStyleInterface;
|
|
9
|
+
emptyTextColor?: string;
|
|
10
|
+
backIconTint?: string;
|
|
11
|
+
durationTextFont?: FontStyleInterface;
|
|
12
|
+
durationTextColor?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export class CallParticipantsStyle extends BaseStyle {
|
|
16
|
+
titleFont?: FontStyleInterface;
|
|
17
|
+
titleColor?: string;
|
|
18
|
+
emptyTextFont?: FontStyleInterface;
|
|
19
|
+
emptyTextColor?: string;
|
|
20
|
+
dateTextFont?: FontStyleInterface;
|
|
21
|
+
dateTextColor?: string;
|
|
22
|
+
backIconTint?: string;
|
|
23
|
+
durationTextFont?: FontStyleInterface;
|
|
24
|
+
durationTextColor?: string;
|
|
25
|
+
|
|
26
|
+
constructor({
|
|
27
|
+
titleFont = { fontSize: 20, fontWeight: "600" },
|
|
28
|
+
backgroundColor = "white",
|
|
29
|
+
border,
|
|
30
|
+
borderRadius,
|
|
31
|
+
height,
|
|
32
|
+
titleColor = "#000",
|
|
33
|
+
dateTextFont,
|
|
34
|
+
dateTextColor,
|
|
35
|
+
emptyTextColor,
|
|
36
|
+
emptyTextFont,
|
|
37
|
+
backIconTint,
|
|
38
|
+
durationTextColor,
|
|
39
|
+
durationTextFont,
|
|
40
|
+
width
|
|
41
|
+
}: CallParticipantsStyleInterface) {
|
|
42
|
+
super({
|
|
43
|
+
backgroundColor: backgroundColor,
|
|
44
|
+
border: border,
|
|
45
|
+
borderRadius: borderRadius,
|
|
46
|
+
height: height,
|
|
47
|
+
width: width
|
|
48
|
+
});
|
|
49
|
+
this.titleColor = titleColor;
|
|
50
|
+
this.titleFont = titleFont;
|
|
51
|
+
this.dateTextFont = dateTextFont;
|
|
52
|
+
this.dateTextColor = dateTextColor;
|
|
53
|
+
this.emptyTextColor = emptyTextColor;
|
|
54
|
+
this.emptyTextFont = emptyTextFont;
|
|
55
|
+
this.backIconTint = backIconTint;
|
|
56
|
+
this.durationTextColor = durationTextColor;
|
|
57
|
+
this.durationTextFont = durationTextFont;
|
|
58
|
+
}
|
|
59
|
+
}
|