@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,24 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
|
|
3
|
+
export const Style = StyleSheet.create({
|
|
4
|
+
container: {
|
|
5
|
+
flex: 1,
|
|
6
|
+
justifyContent: "center",
|
|
7
|
+
alignItems: "center",
|
|
8
|
+
},
|
|
9
|
+
headerStyle : {
|
|
10
|
+
alignItems: "center",
|
|
11
|
+
justifyContent: "space-between",
|
|
12
|
+
paddingEnd: 8,
|
|
13
|
+
paddingStart: 8
|
|
14
|
+
},
|
|
15
|
+
row: {
|
|
16
|
+
flexDirection: "row",
|
|
17
|
+
alignItems: "center",
|
|
18
|
+
},
|
|
19
|
+
imageStyle: {
|
|
20
|
+
height: 24,
|
|
21
|
+
width: 24,
|
|
22
|
+
alignSelf: "center",
|
|
23
|
+
}
|
|
24
|
+
});
|
|
@@ -0,0 +1,87 @@
|
|
|
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 { CallLogsStyleInterface } from "./CallLogsStyle";
|
|
5
|
+
import { DatePattern } from "../../shared/base/Types";
|
|
6
|
+
import { CometChatOutgoingCallInterface } from "../CometChatOutgoingCall";
|
|
7
|
+
|
|
8
|
+
export interface CallLogsConfigurationInterface {
|
|
9
|
+
SubtitleView?: (param: { call?: CometChat.BaseMessage }) => JSX.Element,
|
|
10
|
+
ListItemView?: (param: { call?: CometChat.BaseMessage }) => JSX.Element,
|
|
11
|
+
TailView?: (param: { call?: CometChat.BaseMessage }) => JSX.Element,
|
|
12
|
+
AppBarOptions?: () => JSX.Element,
|
|
13
|
+
options?: (param: { message: CometChat.BaseMessage }) => CometChatOptions[],
|
|
14
|
+
callRequestBuilder?: any,
|
|
15
|
+
datePattern: DatePattern,
|
|
16
|
+
dateSeparatorPattern: DatePattern,
|
|
17
|
+
hideSeperator?: boolean,
|
|
18
|
+
BackButton?: JSX.Element,
|
|
19
|
+
showBackButton?: boolean,
|
|
20
|
+
EmptyStateView?: () => JSX.Element,
|
|
21
|
+
ErrorStateView?: () => JSX.Element,
|
|
22
|
+
loadingIcon?: ImageType,
|
|
23
|
+
LoadingStateView?: () => JSX.Element,
|
|
24
|
+
hideError?: boolean,
|
|
25
|
+
onItemPress?: (item: CometChat.BaseMessage) => void,
|
|
26
|
+
onError?: (e: CometChat.CometChatException) => void,
|
|
27
|
+
onBack?: () => void,
|
|
28
|
+
onInfoIconPress?: (prop: { call: CometChat.BaseMessage }) => void,
|
|
29
|
+
infoIcon?: ImageType,
|
|
30
|
+
avatarStyle?: AvatarStyleInterface,
|
|
31
|
+
listItemStyle?: ListItemStyleInterface,
|
|
32
|
+
callLogsStyle?: CallLogsStyleInterface,
|
|
33
|
+
headViewContainerStyle?: StyleProp<ViewStyle>,
|
|
34
|
+
bodyViewContainerStyle?: StyleProp<ViewStyle>,
|
|
35
|
+
tailViewContainerStyle?: StyleProp<ViewStyle>,
|
|
36
|
+
missedAudioCallIconUrl?: string,
|
|
37
|
+
missedVideoCallIconUrl?: string,
|
|
38
|
+
incomingAudioCallIconUrl?: string,
|
|
39
|
+
incomingVideoCallIconUrl?: string,
|
|
40
|
+
outgoingAudioCallIconUrl?: string,
|
|
41
|
+
outgoingVideoCallIconUrl?: string,
|
|
42
|
+
outgoingCallConfiguration?: CometChatOutgoingCallInterface,
|
|
43
|
+
}
|
|
44
|
+
export class CallLogsConfiguration implements CallLogsConfigurationInterface {
|
|
45
|
+
SubtitleView?: (param: { call?: CometChat.BaseMessage }) => JSX.Element
|
|
46
|
+
ListItemView?: (param: { call?: CometChat.BaseMessage }) => JSX.Element
|
|
47
|
+
TailView?: (param: { call?: CometChat.BaseMessage }) => JSX.Element
|
|
48
|
+
AppBarOptions?: () => JSX.Element
|
|
49
|
+
options?: (param: { message: CometChat.BaseMessage }) => CometChatOptions[]
|
|
50
|
+
callRequestBuilder?: any
|
|
51
|
+
datePattern: DatePattern
|
|
52
|
+
dateSeparatorPattern: DatePattern
|
|
53
|
+
hideSeperator?: boolean
|
|
54
|
+
BackButton?: JSX.Element
|
|
55
|
+
showBackButton?: boolean
|
|
56
|
+
EmptyStateView?: () => JSX.Element
|
|
57
|
+
ErrorStateView?: () => JSX.Element
|
|
58
|
+
loadingIcon?: ImageType
|
|
59
|
+
LoadingStateView?: () => JSX.Element
|
|
60
|
+
hideError?: boolean
|
|
61
|
+
onItemPress?: (item: CometChat.BaseMessage) => void
|
|
62
|
+
onError?: (e: CometChat.CometChatException) => void
|
|
63
|
+
onBack?: () => void
|
|
64
|
+
onInfoIconPress?: (prop: { call: CometChat.BaseMessage }) => void
|
|
65
|
+
infoIcon?: ImageType
|
|
66
|
+
avatarStyle?: AvatarStyleInterface
|
|
67
|
+
listItemStyle?: ListItemStyleInterface
|
|
68
|
+
callLogsStyle?: CallLogsStyleInterface
|
|
69
|
+
headViewContainerStyle?: StyleProp<ViewStyle>
|
|
70
|
+
bodyViewContainerStyle?: StyleProp<ViewStyle>
|
|
71
|
+
tailViewContainerStyle?: StyleProp<ViewStyle>
|
|
72
|
+
missedAudioCallIconUrl?: string
|
|
73
|
+
missedVideoCallIconUrl?: string
|
|
74
|
+
incomingAudioCallIconUrl?: string
|
|
75
|
+
incomingVideoCallIconUrl?: string
|
|
76
|
+
outgoingAudioCallIconUrl?: string
|
|
77
|
+
outgoingVideoCallIconUrl?: string
|
|
78
|
+
outgoingCallConfiguration?: CometChatOutgoingCallInterface
|
|
79
|
+
|
|
80
|
+
constructor(props: CallLogsConfigurationInterface) {
|
|
81
|
+
if (props) {
|
|
82
|
+
for (const [key, value] of Object.entries(props)) {
|
|
83
|
+
this[key] = value;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { BaseStyle, BaseStyleInterface, FontStyle, FontStyleInterface } from "../../shared";
|
|
2
|
+
|
|
3
|
+
export interface CallLogsStyleInterface extends BaseStyleInterface {
|
|
4
|
+
titleFont?: FontStyleInterface,
|
|
5
|
+
titleColor?: string,
|
|
6
|
+
loadingTint?: string,
|
|
7
|
+
emptyTextFont?: FontStyleInterface,
|
|
8
|
+
emptyTextColor?: string,
|
|
9
|
+
errorTextColor?: string,
|
|
10
|
+
errorTextFont?: FontStyleInterface,
|
|
11
|
+
separatorColor?: string,
|
|
12
|
+
infoIconTint?: string,
|
|
13
|
+
missedCallIconTint?: string,
|
|
14
|
+
outgoingCallIconTint?: string,
|
|
15
|
+
incomingCallIconTint?: string,
|
|
16
|
+
subtitleTextFont?: FontStyleInterface,
|
|
17
|
+
subtitleTextColor?: string,
|
|
18
|
+
dateTextFont?: FontStyleInterface,
|
|
19
|
+
dateTextColor?: string,
|
|
20
|
+
dateSeparatorTextFont?: FontStyleInterface,
|
|
21
|
+
dateSeparatorTextColor?: string,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export class CallLogsStyle extends BaseStyle {
|
|
25
|
+
titleFont?: FontStyleInterface;
|
|
26
|
+
titleColor?: string;
|
|
27
|
+
loadingTint?: string;
|
|
28
|
+
emptyTextFont?: FontStyleInterface;
|
|
29
|
+
emptyTextColor?: string
|
|
30
|
+
errorTextColor?: string;
|
|
31
|
+
errorTextFont?: FontStyleInterface;
|
|
32
|
+
separatorColor?: string;
|
|
33
|
+
infoIconTint?: string;
|
|
34
|
+
missedCallIconTint?: string;
|
|
35
|
+
outgoingCallIconTint?: string;
|
|
36
|
+
incomingCallIconTint?: string;
|
|
37
|
+
subtitleTextFont?: FontStyleInterface;
|
|
38
|
+
subtitleTextColor?: string;
|
|
39
|
+
dateTextFont?: FontStyleInterface;
|
|
40
|
+
dateTextColor?: string;
|
|
41
|
+
dateSeparatorTextFont?: FontStyleInterface;
|
|
42
|
+
dateSeparatorTextColor?: string;
|
|
43
|
+
|
|
44
|
+
constructor({
|
|
45
|
+
titleFont = { fontSize: 20, fontWeight: "600" },
|
|
46
|
+
backgroundColor = "white",
|
|
47
|
+
border,
|
|
48
|
+
borderRadius,
|
|
49
|
+
height,
|
|
50
|
+
titleColor = "#000",
|
|
51
|
+
width,
|
|
52
|
+
loadingTint,
|
|
53
|
+
emptyTextFont,
|
|
54
|
+
emptyTextColor,
|
|
55
|
+
errorTextColor,
|
|
56
|
+
errorTextFont,
|
|
57
|
+
separatorColor,
|
|
58
|
+
infoIconTint,
|
|
59
|
+
missedCallIconTint,
|
|
60
|
+
outgoingCallIconTint,
|
|
61
|
+
incomingCallIconTint,
|
|
62
|
+
subtitleTextFont,
|
|
63
|
+
subtitleTextColor,
|
|
64
|
+
dateTextFont,
|
|
65
|
+
dateTextColor,
|
|
66
|
+
dateSeparatorTextFont,
|
|
67
|
+
dateSeparatorTextColor
|
|
68
|
+
}: CallLogsStyleInterface) {
|
|
69
|
+
super({
|
|
70
|
+
backgroundColor: backgroundColor,
|
|
71
|
+
border: border,
|
|
72
|
+
borderRadius: borderRadius,
|
|
73
|
+
height: height,
|
|
74
|
+
width: width
|
|
75
|
+
});
|
|
76
|
+
this.titleColor = titleColor;
|
|
77
|
+
this.titleFont = titleFont;
|
|
78
|
+
this.loadingTint = loadingTint;
|
|
79
|
+
this.emptyTextFont = emptyTextFont;
|
|
80
|
+
this.emptyTextColor = emptyTextColor;
|
|
81
|
+
this.errorTextColor = errorTextColor;
|
|
82
|
+
this.errorTextFont = errorTextFont;
|
|
83
|
+
this.separatorColor = separatorColor;
|
|
84
|
+
this.infoIconTint = infoIconTint;
|
|
85
|
+
this.missedCallIconTint = missedCallIconTint;
|
|
86
|
+
this.outgoingCallIconTint = outgoingCallIconTint;
|
|
87
|
+
this.incomingCallIconTint = incomingCallIconTint;
|
|
88
|
+
this.subtitleTextFont = subtitleTextFont;
|
|
89
|
+
this.subtitleTextColor = subtitleTextColor;
|
|
90
|
+
this.dateTextFont = dateTextFont;
|
|
91
|
+
this.dateTextColor = dateTextColor;
|
|
92
|
+
this.dateSeparatorTextFont = dateSeparatorTextFont;
|
|
93
|
+
this.dateSeparatorTextColor = dateSeparatorTextColor;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,482 @@
|
|
|
1
|
+
import { CometChat } from '@cometchat/chat-sdk-react-native'
|
|
2
|
+
import React, { useContext, useEffect, useRef, useState } from 'react'
|
|
3
|
+
import { FlatList, Image, Text, TouchableOpacity, View } from 'react-native'
|
|
4
|
+
import { StyleProp, ViewStyle } from "react-native/types";
|
|
5
|
+
import { AvatarStyleInterface, CometChatContext, CometChatDate, CometChatListItem, CometChatOptions, DatePattern, ImageType, ListItemStyleInterface, localize } from '../../shared'
|
|
6
|
+
import { CallLogsStyle, CallLogsStyleInterface } from './CallLogsStyle'
|
|
7
|
+
import { CometChatUIEventHandler } from '../../shared/events/CometChatUIEventHandler/CometChatUIEventHandler'
|
|
8
|
+
import { LoadingIcon, DetailIcon, BackIcon, IncomingCallIcon, IncomingVideoIcon, MissedCallIcon, MissedVideoIcon, OutgoingCallIcon, OutgoingVideoIcon } from "./resources";
|
|
9
|
+
import { CallTypeConstants } from '../../shared/constants/UIKitConstants'
|
|
10
|
+
import { Style } from './style'
|
|
11
|
+
import { CallingPackage } from '../CallingPackage'
|
|
12
|
+
import { CallUtils } from '../CallUtils'
|
|
13
|
+
import { CallUIEvents } from '../CallEvents'
|
|
14
|
+
import { CometChatOutgoingCall, CometChatOutgoingCallInterface } from '../CometChatOutgoingCall'
|
|
15
|
+
|
|
16
|
+
const listenerId = "callEventListener_" + new Date().getTime();
|
|
17
|
+
const CometChatCalls = CallingPackage.CometChatCalls;
|
|
18
|
+
|
|
19
|
+
export interface CometChatCallLogsConfigurationInterface {
|
|
20
|
+
title?: string,
|
|
21
|
+
SubtitleView?: (param: { call?: CometChat.BaseMessage }) => JSX.Element,
|
|
22
|
+
ListItemView?: (param: { call?: CometChat.BaseMessage }) => JSX.Element,
|
|
23
|
+
TailView?: (param: { call?: CometChat.BaseMessage }) => JSX.Element,
|
|
24
|
+
AppBarOptions?: () => JSX.Element,
|
|
25
|
+
options?: (param: { message: CometChat.BaseMessage }) => CometChatOptions[],
|
|
26
|
+
callRequestBuilder?: any,
|
|
27
|
+
datePattern: DatePattern,
|
|
28
|
+
dateSeparatorPattern: DatePattern,
|
|
29
|
+
hideSeperator?: boolean,
|
|
30
|
+
BackButton?: JSX.Element,
|
|
31
|
+
showBackButton?: boolean,
|
|
32
|
+
EmptyStateView?: () => JSX.Element,
|
|
33
|
+
emptyStateText?: string,
|
|
34
|
+
ErrorStateView?: () => JSX.Element,
|
|
35
|
+
errorStateText?: string,
|
|
36
|
+
loadingIcon?: ImageType,
|
|
37
|
+
LoadingStateView?: () => JSX.Element,
|
|
38
|
+
hideError?: boolean,
|
|
39
|
+
onItemPress?: (item: CometChat.BaseMessage) => void,
|
|
40
|
+
onError?: (e: CometChat.CometChatException) => void,
|
|
41
|
+
onBack?: () => void,
|
|
42
|
+
onInfoIconPress?: (prop: { call: CometChat.BaseMessage }) => void,
|
|
43
|
+
infoIcon?: ImageType,
|
|
44
|
+
avatarStyle?: AvatarStyleInterface,
|
|
45
|
+
listItemStyle?: ListItemStyleInterface,
|
|
46
|
+
callLogsStyle?: CallLogsStyleInterface,
|
|
47
|
+
headViewContainerStyle?: StyleProp<ViewStyle>,
|
|
48
|
+
bodyViewContainerStyle?: StyleProp<ViewStyle>,
|
|
49
|
+
tailViewContainerStyle?: StyleProp<ViewStyle>,
|
|
50
|
+
missedAudioCallIconUrl?: string,
|
|
51
|
+
missedVideoCallIconUrl?: string,
|
|
52
|
+
incomingAudioCallIconUrl?: string,
|
|
53
|
+
incomingVideoCallIconUrl?: string,
|
|
54
|
+
outgoingAudioCallIconUrl?: string,
|
|
55
|
+
outgoingVideoCallIconUrl?: string,
|
|
56
|
+
outgoingCallConfiguration?: CometChatOutgoingCallInterface,
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const CometChatCallLogs = (props: CometChatCallLogsConfigurationInterface) => {
|
|
60
|
+
|
|
61
|
+
const {
|
|
62
|
+
title = localize("CALL_LOGS"),
|
|
63
|
+
SubtitleView,
|
|
64
|
+
ListItemView,
|
|
65
|
+
TailView,
|
|
66
|
+
AppBarOptions,
|
|
67
|
+
options,
|
|
68
|
+
callRequestBuilder,
|
|
69
|
+
datePattern,
|
|
70
|
+
dateSeparatorPattern,
|
|
71
|
+
hideSeperator,
|
|
72
|
+
BackButton,
|
|
73
|
+
showBackButton,
|
|
74
|
+
EmptyStateView,
|
|
75
|
+
emptyStateText,
|
|
76
|
+
ErrorStateView,
|
|
77
|
+
errorStateText,
|
|
78
|
+
loadingIcon,
|
|
79
|
+
LoadingStateView,
|
|
80
|
+
hideError,
|
|
81
|
+
onItemPress,
|
|
82
|
+
onInfoIconPress,
|
|
83
|
+
infoIcon,
|
|
84
|
+
onError,
|
|
85
|
+
onBack,
|
|
86
|
+
avatarStyle,
|
|
87
|
+
listItemStyle,
|
|
88
|
+
callLogsStyle,
|
|
89
|
+
headViewContainerStyle,
|
|
90
|
+
bodyViewContainerStyle,
|
|
91
|
+
tailViewContainerStyle,
|
|
92
|
+
missedAudioCallIconUrl,
|
|
93
|
+
missedVideoCallIconUrl,
|
|
94
|
+
incomingAudioCallIconUrl,
|
|
95
|
+
incomingVideoCallIconUrl,
|
|
96
|
+
outgoingAudioCallIconUrl,
|
|
97
|
+
outgoingVideoCallIconUrl,
|
|
98
|
+
outgoingCallConfiguration,
|
|
99
|
+
} = props;
|
|
100
|
+
|
|
101
|
+
const { theme } = useContext(CometChatContext);
|
|
102
|
+
|
|
103
|
+
const _style = new CallLogsStyle({
|
|
104
|
+
titleFont: theme.typography.heading,
|
|
105
|
+
titleColor: theme.palette.getAccent(),
|
|
106
|
+
backgroundColor: theme.palette.getBackgroundColor(),
|
|
107
|
+
emptyTextColor: theme?.palette?.getAccent400(),
|
|
108
|
+
emptyTextFont: theme?.typography?.subtitle1,
|
|
109
|
+
errorTextColor: theme?.palette?.getError(),
|
|
110
|
+
errorTextFont: theme?.typography?.subtitle1,
|
|
111
|
+
loadingTint: theme?.palette.getAccent700(),
|
|
112
|
+
infoIconTint: theme.palette.getPrimary(),
|
|
113
|
+
subtitleTextColor: theme.palette.getAccent(),
|
|
114
|
+
subtitleTextFont: theme.typography.text2,
|
|
115
|
+
dateSeparatorTextColor: theme.palette.getAccent600(),
|
|
116
|
+
dateSeparatorTextFont: theme.typography.text2,
|
|
117
|
+
dateTextColor: theme.palette.getAccent(),
|
|
118
|
+
dateTextFont: theme.typography.text2,
|
|
119
|
+
...callLogsStyle
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
const {
|
|
123
|
+
backgroundColor,
|
|
124
|
+
height,
|
|
125
|
+
width,
|
|
126
|
+
border,
|
|
127
|
+
borderRadius,
|
|
128
|
+
titleColor,
|
|
129
|
+
titleFont,
|
|
130
|
+
loadingTint,
|
|
131
|
+
dateSeparatorTextColor,
|
|
132
|
+
dateSeparatorTextFont,
|
|
133
|
+
dateTextColor,
|
|
134
|
+
dateTextFont,
|
|
135
|
+
emptyTextColor,
|
|
136
|
+
emptyTextFont,
|
|
137
|
+
errorTextColor,
|
|
138
|
+
errorTextFont,
|
|
139
|
+
incomingCallIconTint,
|
|
140
|
+
infoIconTint,
|
|
141
|
+
missedCallIconTint,
|
|
142
|
+
outgoingCallIconTint,
|
|
143
|
+
separatorColor,
|
|
144
|
+
subtitleTextColor,
|
|
145
|
+
subtitleTextFont
|
|
146
|
+
} = _style;
|
|
147
|
+
|
|
148
|
+
const [list, setList] = useState([]);
|
|
149
|
+
const [listState, setListState] = useState<"loading" | "error" | "done">("loading");
|
|
150
|
+
const [showOutgoingCallScreen, setShowOutgoingCallScreen] = useState(false);
|
|
151
|
+
|
|
152
|
+
const loggedInUser = useRef(null);
|
|
153
|
+
const callRequestBuilderRef = useRef(null);
|
|
154
|
+
const outGoingCall = useRef<CometChat.Call | CometChat.CustomMessage>(null);
|
|
155
|
+
|
|
156
|
+
function setRequestBuilder() {
|
|
157
|
+
callRequestBuilderRef.current = (callRequestBuilder && callRequestBuilder.build()) ??
|
|
158
|
+
new CometChatCalls.CallLogRequestBuilder()
|
|
159
|
+
.setLimit(30)
|
|
160
|
+
.setAuthToken(loggedInUser.current.getAuthToken() || "")
|
|
161
|
+
.setCallCategory("call")
|
|
162
|
+
.build()
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const fetchCallLogs = () => {
|
|
166
|
+
setListState("loading");
|
|
167
|
+
callRequestBuilderRef.current.fetchNext()
|
|
168
|
+
.then(callLogs => {
|
|
169
|
+
console.log(callLogs.length);
|
|
170
|
+
if (callLogs.length > 0) {
|
|
171
|
+
setList([...list, ...callLogs]);
|
|
172
|
+
}
|
|
173
|
+
setListState("done");
|
|
174
|
+
})
|
|
175
|
+
.catch(err => {
|
|
176
|
+
onError && onError(err);
|
|
177
|
+
setListState("error");
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
useEffect(() => {
|
|
182
|
+
CometChat.getLoggedinUser()
|
|
183
|
+
.then(u => {
|
|
184
|
+
loggedInUser.current = u;
|
|
185
|
+
setRequestBuilder();
|
|
186
|
+
fetchCallLogs();
|
|
187
|
+
})
|
|
188
|
+
.catch(e => {
|
|
189
|
+
onError && onError(e);
|
|
190
|
+
});
|
|
191
|
+
CometChat.addCallListener(
|
|
192
|
+
listenerId,
|
|
193
|
+
new CometChat.CallListener({
|
|
194
|
+
onOutgoingCallRejected: (call) => {
|
|
195
|
+
setShowOutgoingCallScreen(false);
|
|
196
|
+
outGoingCall.current = null;
|
|
197
|
+
},
|
|
198
|
+
})
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
CometChatUIEventHandler.addCallListener(
|
|
202
|
+
listenerId,
|
|
203
|
+
{
|
|
204
|
+
ccCallRejected: (call) => {
|
|
205
|
+
outGoingCall.current = null;
|
|
206
|
+
setShowOutgoingCallScreen(false);
|
|
207
|
+
},
|
|
208
|
+
ccCallEnded: () => {
|
|
209
|
+
outGoingCall.current = null;
|
|
210
|
+
setShowOutgoingCallScreen(false);
|
|
211
|
+
},
|
|
212
|
+
}
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
}, []);
|
|
216
|
+
|
|
217
|
+
const DefaultSubtitleView = ({ call }) => {
|
|
218
|
+
function getCallDirectionIcon(call) {
|
|
219
|
+
const missedCall = CallUtils.isMissedCall(call, loggedInUser.current);
|
|
220
|
+
const callType = call.getType();
|
|
221
|
+
let icon, tintColor;
|
|
222
|
+
if (missedCall) {
|
|
223
|
+
tintColor = missedCallIconTint || theme.palette.getAccent700();
|
|
224
|
+
if (callType === CometChat.CALL_TYPE.AUDIO) {
|
|
225
|
+
icon = missedAudioCallIconUrl || MissedCallIcon;
|
|
226
|
+
} else {
|
|
227
|
+
icon = missedVideoCallIconUrl || MissedVideoIcon;
|
|
228
|
+
}
|
|
229
|
+
} else if (call.getInitiator().getUid() === loggedInUser.current?.getUid()) {
|
|
230
|
+
tintColor = outgoingCallIconTint || theme.palette.getAccent700();
|
|
231
|
+
if (callType === CometChat.CALL_TYPE.AUDIO) {
|
|
232
|
+
icon = outgoingAudioCallIconUrl || OutgoingCallIcon;
|
|
233
|
+
} else {
|
|
234
|
+
icon = outgoingVideoCallIconUrl || OutgoingVideoIcon;
|
|
235
|
+
}
|
|
236
|
+
} else {
|
|
237
|
+
tintColor = incomingCallIconTint || theme.palette.getAccent700();
|
|
238
|
+
if (callType === CometChat.CALL_TYPE.AUDIO) {
|
|
239
|
+
icon = incomingAudioCallIconUrl || IncomingCallIcon;
|
|
240
|
+
} else {
|
|
241
|
+
icon = incomingVideoCallIconUrl || IncomingVideoIcon;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return { icon, tintColor };
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (SubtitleView)
|
|
248
|
+
return SubtitleView(call);
|
|
249
|
+
return (
|
|
250
|
+
<View style={[Style.row]}>
|
|
251
|
+
<Image source={getCallDirectionIcon(call).icon} style={{ height: 20, width: 20, alignSelf: "center", tintColor: getCallDirectionIcon(call).tintColor }} />
|
|
252
|
+
<Text style={[{ color: subtitleTextColor, marginStart: 2 }, subtitleTextFont]}>
|
|
253
|
+
{
|
|
254
|
+
CallUtils.getCallStatus(call as CometChat.Call, loggedInUser.current)
|
|
255
|
+
}
|
|
256
|
+
</Text>
|
|
257
|
+
</View>
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
const DeafultTailView = ({ call }) => {
|
|
262
|
+
return (
|
|
263
|
+
<View style={[Style.row, { alignItems: "center" }]}>
|
|
264
|
+
<CometChatDate timeStamp={call['initiatedAt'] * 1000} pattern={datePattern || 'timeFormat'} style={{ textColor: dateTextColor, textFont: dateTextFont }} />
|
|
265
|
+
{onInfoIconPress && <TouchableOpacity onPress={() => onInfoIconPress && onInfoIconPress({ call })} style={{ marginStart: 8 }}>
|
|
266
|
+
<Image source={infoIcon || DetailIcon} style={{ height: 24, width: 24, tintColor: infoIconTint }} />
|
|
267
|
+
</TouchableOpacity>}
|
|
268
|
+
</View>
|
|
269
|
+
)
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
const makeCall = (call, type) => {
|
|
273
|
+
if (type == CallTypeConstants.audio || type == CallTypeConstants.video) {
|
|
274
|
+
let user = call?.getReceiverType() == "user" ? loggedInUser.current?.getUid() === call?.getInitiator()?.getUid() ? call.getReceiver() : call?.getInitiator() : undefined
|
|
275
|
+
let group = call?.getReceiverType() == "group" ? loggedInUser.current?.getUid() === call?.getInitiator()?.getUid() ? call.getReceiver() : call?.getInitiator() : undefined
|
|
276
|
+
|
|
277
|
+
var receiverID = user ? user.getUid() : group ? group.getGuid() : undefined;
|
|
278
|
+
var callType = type;
|
|
279
|
+
console.log({ receiverID, callType })
|
|
280
|
+
var receiverType = user ? CometChat.RECEIVER_TYPE.USER : group ? CometChat.RECEIVER_TYPE.GROUP : undefined
|
|
281
|
+
console.log({ receiverType })
|
|
282
|
+
if (!receiverID || !receiverType)
|
|
283
|
+
return;
|
|
284
|
+
|
|
285
|
+
var call = new CometChat.Call(receiverID, callType, receiverType, CometChat.CATEGORY_CALL);
|
|
286
|
+
|
|
287
|
+
CometChat.initiateCall(call).then(
|
|
288
|
+
initiatedCall => {
|
|
289
|
+
outGoingCall.current = initiatedCall;
|
|
290
|
+
setShowOutgoingCallScreen(true);
|
|
291
|
+
CometChatUIEventHandler.emitCallEvent(CallUIEvents.ccOutgoingCall, { call: outGoingCall.current });
|
|
292
|
+
},
|
|
293
|
+
error => {
|
|
294
|
+
console.log("Call initialization failed with exception:", error);
|
|
295
|
+
CometChatUIEventHandler.emitCallEvent(CallUIEvents.ccCallFailled, { call });
|
|
296
|
+
onError && onError(error);
|
|
297
|
+
}
|
|
298
|
+
);
|
|
299
|
+
} else {
|
|
300
|
+
console.log("Invalid call type.", type, CallTypeConstants.audio, type != CallTypeConstants.audio || type != CallTypeConstants.video);
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
const onPress = (item) => {
|
|
306
|
+
if (onItemPress) {
|
|
307
|
+
onItemPress(item);
|
|
308
|
+
} else {
|
|
309
|
+
if (item?.getReceiverType() == "user") {
|
|
310
|
+
console.log("MAKE A CALL");
|
|
311
|
+
makeCall(item, item.getType());
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
const getCallDetails = (call) => {
|
|
317
|
+
const { mode, initiator, receiver, receiverType } = call;
|
|
318
|
+
|
|
319
|
+
if (mode == "meet") {
|
|
320
|
+
return {
|
|
321
|
+
title: receiver['name'],
|
|
322
|
+
avatarUrl: receiver['icon']
|
|
323
|
+
}
|
|
324
|
+
} else if (mode == "call") {
|
|
325
|
+
|
|
326
|
+
return {
|
|
327
|
+
title: receiverType === 'group' ? receiver['name'] : loggedInUser.current['uid'] == initiator?.getUid() ? receiver['name'] : initiator['name'],
|
|
328
|
+
avatarUrl: receiverType === 'group' ? receiver['avatar'] : loggedInUser.current['uid'] == initiator?.getUid() ? receiver['avatar'] : initiator['avatar'],
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return { title: "", avatarUrl: undefined }
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
const getInitiatedAtTimestamp = (item) => {
|
|
335
|
+
return item['initiatedAt'] * 1000;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
const _render = ({ item, index }) => {
|
|
339
|
+
|
|
340
|
+
if (ListItemView)
|
|
341
|
+
return <ListItemView call={item} />
|
|
342
|
+
|
|
343
|
+
const { title, avatarUrl } = getCallDetails(item);
|
|
344
|
+
|
|
345
|
+
let seperatorView = null;
|
|
346
|
+
const previousMessageDate = list[index - 1] ? new Date(getInitiatedAtTimestamp(list[index - 1])) : null;
|
|
347
|
+
const currentMessageDate = new Date(getInitiatedAtTimestamp(item));
|
|
348
|
+
|
|
349
|
+
const currentDate = isNaN(currentMessageDate.getDate()) ? undefined : `${currentMessageDate.getDate()}-${currentMessageDate.getMonth()}-${currentMessageDate.getFullYear()}`;
|
|
350
|
+
|
|
351
|
+
const previousDate = `${previousMessageDate?.getDate()}-${previousMessageDate?.getMonth()}-${previousMessageDate?.getFullYear()}`;
|
|
352
|
+
|
|
353
|
+
if (currentDate != undefined && previousDate !== currentDate) {
|
|
354
|
+
seperatorView = (
|
|
355
|
+
<View style={{ marginHorizontal: 10, marginVertical: 5 }}>
|
|
356
|
+
<CometChatDate
|
|
357
|
+
timeStamp={getInitiatedAtTimestamp(item)}
|
|
358
|
+
pattern={dateSeparatorPattern || "dayDateFormat"}
|
|
359
|
+
style={{ textColor: dateSeparatorTextColor, textFont: dateSeparatorTextFont }}
|
|
360
|
+
/>
|
|
361
|
+
</View>
|
|
362
|
+
)
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
return <React.Fragment key={index}>
|
|
366
|
+
{seperatorView}
|
|
367
|
+
<CometChatListItem
|
|
368
|
+
id={item.sessionId}
|
|
369
|
+
avatarName={title}
|
|
370
|
+
title={title}
|
|
371
|
+
listItemStyle={listItemStyle ? listItemStyle : { height: 70, titleColor: CallUtils.isMissedCall(item, loggedInUser.current) ? theme.palette.getError() : undefined }}
|
|
372
|
+
headViewContainerStyle={
|
|
373
|
+
headViewContainerStyle
|
|
374
|
+
? headViewContainerStyle
|
|
375
|
+
: { marginHorizontal: 10 }
|
|
376
|
+
}
|
|
377
|
+
bodyViewContainerStyle={
|
|
378
|
+
bodyViewContainerStyle ? bodyViewContainerStyle : {}
|
|
379
|
+
}
|
|
380
|
+
tailViewContainerStyle={
|
|
381
|
+
tailViewContainerStyle ? tailViewContainerStyle : {
|
|
382
|
+
marginHorizontal: 10,
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
avatarURL={avatarUrl}
|
|
386
|
+
SubtitleView={() =>
|
|
387
|
+
SubtitleView ? <SubtitleView {...item} /> : <DefaultSubtitleView call={item} />
|
|
388
|
+
}
|
|
389
|
+
TailView={TailView ? () => <TailView call={item} /> : () => <DeafultTailView call={item} />}
|
|
390
|
+
avatarStyle={avatarStyle}
|
|
391
|
+
options={() => options && options(item)}
|
|
392
|
+
onPress={() => onPress(item)}
|
|
393
|
+
hideSeparator={hideSeperator}
|
|
394
|
+
separatorColor={separatorColor}
|
|
395
|
+
/>
|
|
396
|
+
</React.Fragment>
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
const EmptyView = () => {
|
|
400
|
+
if (EmptyStateView)
|
|
401
|
+
return <EmptyStateView />
|
|
402
|
+
return (
|
|
403
|
+
<View style={[Style.container]}>
|
|
404
|
+
<Text style={[{ color: emptyTextColor }, emptyTextFont]}>{emptyStateText || localize("NO_CALL_HISTORY")}</Text>
|
|
405
|
+
</View>
|
|
406
|
+
)
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
const ErrorView = () => {
|
|
410
|
+
if (hideError) return null;
|
|
411
|
+
if (ErrorStateView)
|
|
412
|
+
return <ErrorStateView />
|
|
413
|
+
return <View style={[Style.container]}>
|
|
414
|
+
<Text style={[{ color: errorTextColor }, errorTextFont]}>{errorStateText || localize("SOMETHING_WRONG")}</Text>
|
|
415
|
+
</View>
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
const LoadingView = () => {
|
|
419
|
+
if (LoadingStateView)
|
|
420
|
+
return <LoadingStateView />
|
|
421
|
+
return <View style={[Style.container]}>
|
|
422
|
+
<Image source={loadingIcon || LoadingIcon} style={[Style.imageStyle, { tintColor: loadingTint }]} />
|
|
423
|
+
</View>
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
return (
|
|
427
|
+
<View style={{ backgroundColor, height, width, borderRadius, ...border }}>
|
|
428
|
+
<>
|
|
429
|
+
<View style={[Style.row, Style.headerStyle, { height: 60 }]}>
|
|
430
|
+
<View style={Style.row}>
|
|
431
|
+
{
|
|
432
|
+
showBackButton ?
|
|
433
|
+
BackButton ??
|
|
434
|
+
<TouchableOpacity style={Style.imageStyle} onPress={onBack}>
|
|
435
|
+
<Image
|
|
436
|
+
source={BackIcon}
|
|
437
|
+
style={[Style.imageStyle, { tintColor: theme.palette.getPrimary() }]}
|
|
438
|
+
/>
|
|
439
|
+
</TouchableOpacity> : null
|
|
440
|
+
}
|
|
441
|
+
<Text style={[{ color: titleColor, ...titleFont }]}>{title}</Text>
|
|
442
|
+
</View>
|
|
443
|
+
<View style={Style.row}>
|
|
444
|
+
{
|
|
445
|
+
AppBarOptions && <AppBarOptions />
|
|
446
|
+
}
|
|
447
|
+
</View>
|
|
448
|
+
</View>
|
|
449
|
+
{
|
|
450
|
+
listState == "loading" && list.length == 0 ?
|
|
451
|
+
<LoadingView /> :
|
|
452
|
+
listState == "error" && list.length == 0 ?
|
|
453
|
+
<ErrorView /> :
|
|
454
|
+
list.length == 0 ?
|
|
455
|
+
<EmptyView /> :
|
|
456
|
+
<FlatList
|
|
457
|
+
data={list}
|
|
458
|
+
keyExtractor={(item) => item.sessionId}
|
|
459
|
+
renderItem={_render}
|
|
460
|
+
onEndReached={fetchCallLogs}
|
|
461
|
+
/>
|
|
462
|
+
}
|
|
463
|
+
</>
|
|
464
|
+
{
|
|
465
|
+
showOutgoingCallScreen && <CometChatOutgoingCall
|
|
466
|
+
call={outGoingCall.current}
|
|
467
|
+
onDeclineButtonPressed={(call) => {
|
|
468
|
+
CometChat.rejectCall(call['sessionId'], CometChat.CALL_STATUS.CANCELLED).then(
|
|
469
|
+
rejectedCall => {
|
|
470
|
+
CometChatUIEventHandler.emitCallEvent(CallUIEvents.ccCallRejected, { call: rejectedCall });
|
|
471
|
+
},
|
|
472
|
+
err => {
|
|
473
|
+
onError && onError(err);
|
|
474
|
+
}
|
|
475
|
+
);
|
|
476
|
+
}}
|
|
477
|
+
{...outgoingCallConfiguration}
|
|
478
|
+
/>
|
|
479
|
+
}
|
|
480
|
+
</View>
|
|
481
|
+
)
|
|
482
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CallLogsConfiguration, CallLogsConfigurationInterface } from "./CallLogsConfiguration";
|
|
2
|
+
import { CallLogsStyle, CallLogsStyleInterface } from "./CallLogsStyle";
|
|
3
|
+
import { CometChatCallLogs, CometChatCallLogsConfigurationInterface } from "./CometChatCallLogs";
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
CallLogsConfiguration,
|
|
7
|
+
CallLogsConfigurationInterface,
|
|
8
|
+
CallLogsStyle,
|
|
9
|
+
CallLogsStyleInterface,
|
|
10
|
+
CometChatCallLogs,
|
|
11
|
+
CometChatCallLogsConfigurationInterface
|
|
12
|
+
}
|