@cometchat/chat-uikit-react-native 4.1.0 → 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 +1 -1
- package/src/AI/AIAssistBot/AIAssistBotDecorator.tsx +2 -2
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +1 -1
- package/src/CometChatMessageList/CometChatMessageList.tsx +32 -24
- package/src/calls/CallEvents.ts +1 -0
- package/src/calls/CallingExtentionDecorator.tsx +56 -45
- package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +3 -0
- package/src/shared/events/CometChatUIEventHandler/Listener.ts +5 -1
- package/src/shared/utils/conversationUtils.ts +1 -1
- package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +7 -5
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
[](#)
|
|
13
13
|
[](#)
|
|
14
|
-

|
|
15
15
|

|
|
16
16
|
|
|
17
17
|
## Table of contents
|
package/ios/FileManager.m
CHANGED
|
@@ -95,7 +95,7 @@ RCT_EXPORT_METHOD(checkAndDownload:(NSString *) urlToDownload name:(NSString *)
|
|
|
95
95
|
RCT_EXPORT_METHOD(openFile:(NSString *) url name:(NSString *) fileName myCallback:(RCTResponseSenderBlock)callback) {
|
|
96
96
|
//new way
|
|
97
97
|
@try {
|
|
98
|
-
NSArray *paths = NSSearchPathForDirectoriesInDomains(
|
|
98
|
+
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
|
99
99
|
NSString *documentsDirectory = [paths objectAtIndex:0];
|
|
100
100
|
NSString *filepath = [NSString stringWithFormat:@"%@/%@", documentsDirectory, fileName];
|
|
101
101
|
if ([[NSFileManager defaultManager] fileExistsAtPath: filepath isDirectory:false]) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cometchat/chat-uikit-react-native",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"description": "CometChat React Native UI Kit is a collection of custom UI Components designed to build text , chat and calling features in your application. The UI Kit is developed to keep developers in mind and aims to reduce development efforts significantly",
|
|
5
5
|
"main": "src/index",
|
|
6
6
|
"module": "src/index",
|
|
@@ -49,8 +49,8 @@ export class AIAssistBotDecorator extends DataSourceDecorator {
|
|
|
49
49
|
override getAIOptions(user: CometChat.User | null, group: CometChat.Group | null, theme: CometChatTheme, id?: any, AIOptionsStyle?: AIOptionsStyle): CometChatMessageComposerActionInterface[] {
|
|
50
50
|
this.user = user!;
|
|
51
51
|
this.group = group!;
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
const numberOfBots = this.bots?.length;
|
|
53
|
+
if (!id?.parentMessageId && numberOfBots > 0) {
|
|
54
54
|
const titleName = numberOfBots > 1 ? localize("COMETCHAT_ASK_AI_BOT") : `${localize("COMETCHAT_ASK_BOT")} ${this.bots[0]?.getName()}`;
|
|
55
55
|
const messageComposerActions: CometChatMessageComposerActionInterface[] = super.getAIOptions(user, group, theme, id, AIOptionsStyle);
|
|
56
56
|
let newAction = {
|
|
@@ -1232,7 +1232,7 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
1232
1232
|
|
|
1233
1233
|
return (
|
|
1234
1234
|
<>
|
|
1235
|
-
{!isVisible && CustomView && <CustomView />}
|
|
1235
|
+
{!isVisible && typeof CustomView === "function" && <CustomView />}
|
|
1236
1236
|
<Modal
|
|
1237
1237
|
animationType="slide"
|
|
1238
1238
|
visible={isVisible}
|
|
@@ -133,6 +133,7 @@ export const CometChatMessageList = forwardRef<
|
|
|
133
133
|
const callListenerId = "call_" + new Date().getTime();
|
|
134
134
|
const groupListenerId = "group_" + new Date().getTime();
|
|
135
135
|
const uiEventListener = "uiEvent_" + new Date().getTime();
|
|
136
|
+
const callEventListener = 'callEvent_' + new Date().getTime();
|
|
136
137
|
const uiEventListenerShow = "uiEvent_show_" + new Date().getTime();
|
|
137
138
|
const uiEventListenerHide = "uiEvent_hide_" + new Date().getTime();
|
|
138
139
|
const connectionListenerId = 'connectionListener_' + new Date().getTime();
|
|
@@ -242,6 +243,7 @@ export const CometChatMessageList = forwardRef<
|
|
|
242
243
|
const [ExtensionsComponent, setExtensionsComponent] = useState(null);
|
|
243
244
|
const [CustomListHeader, setCustomListHeader] = useState(null);
|
|
244
245
|
const [messageInfo, setMessageInfo] = useState(false);
|
|
246
|
+
const [ongoingCallView, setOngoingCallView] = useState(null);
|
|
245
247
|
// const [forwarding, setForwarding] = useState(false);
|
|
246
248
|
|
|
247
249
|
const infoObject = useRef<CometChat.BaseMessage>();
|
|
@@ -274,14 +276,12 @@ export const CometChatMessageList = forwardRef<
|
|
|
274
276
|
}
|
|
275
277
|
|
|
276
278
|
const markUnreadMessageAsRead = () => {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
setUnreadCount(0);
|
|
284
|
-
}
|
|
279
|
+
for (let index = 0; index < unreadCount; index++) {
|
|
280
|
+
const message = messagesList[messagesList.length - (index + 1)];
|
|
281
|
+
if (index == 0)
|
|
282
|
+
CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccMessageRead, { message });
|
|
283
|
+
CometChat.markAsRead(message);
|
|
284
|
+
setUnreadCount(0);
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
|
|
@@ -637,6 +637,12 @@ export const CometChatMessageList = forwardRef<
|
|
|
637
637
|
bottomSheetRef.current?.togglePanel()
|
|
638
638
|
},
|
|
639
639
|
});
|
|
640
|
+
CometChatUIEventHandler.addCallListener(callEventListener, {
|
|
641
|
+
ccShowOngoingCall: (CometChatOngoingComponent) => {
|
|
642
|
+
//show ongoing call
|
|
643
|
+
setOngoingCallView(CometChatOngoingComponent?.child);
|
|
644
|
+
},
|
|
645
|
+
});
|
|
640
646
|
CometChat.getLoggedinUser()
|
|
641
647
|
.then(u => {
|
|
642
648
|
loggedInUser.current = u;
|
|
@@ -654,6 +660,7 @@ export const CometChatMessageList = forwardRef<
|
|
|
654
660
|
CometChatUIEventHandler.removeUIListener(uiEventListenerShow)
|
|
655
661
|
CometChatUIEventHandler.removeUIListener(uiEventListenerHide)
|
|
656
662
|
CometChatUIEventHandler.removeUIListener(uiEventListener);
|
|
663
|
+
CometChatUIEventHandler.removeCallListener(callEventListener);
|
|
657
664
|
onBack && onBack();
|
|
658
665
|
}
|
|
659
666
|
}, [])
|
|
@@ -846,15 +853,15 @@ export const CometChatMessageList = forwardRef<
|
|
|
846
853
|
},
|
|
847
854
|
onDisconnected: () => {
|
|
848
855
|
console.log("ConnectionListener => On Disconnected");
|
|
849
|
-
if (!messagesList[
|
|
850
|
-
for (let i =
|
|
856
|
+
if (!messagesList[messagesList.length - 1].id) {
|
|
857
|
+
for (let i = (messagesList.length - 1); i >= 0; i--) {
|
|
851
858
|
if (messagesList[i].id) {
|
|
852
859
|
lastID.current = messagesList[i].id;
|
|
853
860
|
break;
|
|
854
861
|
}
|
|
855
862
|
}
|
|
856
863
|
} else {
|
|
857
|
-
lastID.current = messagesList[
|
|
864
|
+
lastID.current = messagesList[messagesList.length - 1].id;
|
|
858
865
|
}
|
|
859
866
|
}
|
|
860
867
|
})
|
|
@@ -1278,18 +1285,18 @@ export const CometChatMessageList = forwardRef<
|
|
|
1278
1285
|
return <EmptyStateView />
|
|
1279
1286
|
return (
|
|
1280
1287
|
<>
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1288
|
+
<View style={Style.msgContainerStyle}>
|
|
1289
|
+
<Text
|
|
1290
|
+
style={[
|
|
1291
|
+
Style.msgTxtStyle, {
|
|
1292
|
+
...(messageListStyle?.emptyStateTextFont),
|
|
1293
|
+
color: messageListStyle?.emptyStateTextColor
|
|
1294
|
+
}]}
|
|
1295
|
+
>
|
|
1296
|
+
{emptyStateText}
|
|
1297
|
+
</Text>
|
|
1298
|
+
</View >
|
|
1299
|
+
{CustomListHeader && <CustomListHeader />}
|
|
1293
1300
|
</>
|
|
1294
1301
|
)
|
|
1295
1302
|
}, [])
|
|
@@ -1360,7 +1367,7 @@ export const CometChatMessageList = forwardRef<
|
|
|
1360
1367
|
return (
|
|
1361
1368
|
<View style={{
|
|
1362
1369
|
height, width, backgroundColor, borderRadius, ...border,
|
|
1363
|
-
paddingStart: 8, paddingEnd: 8,
|
|
1370
|
+
paddingStart: 8, paddingEnd: 8,
|
|
1364
1371
|
}}>
|
|
1365
1372
|
{
|
|
1366
1373
|
listState == "loading" && messagesList.length == 0 ?
|
|
@@ -1419,6 +1426,7 @@ export const CometChatMessageList = forwardRef<
|
|
|
1419
1426
|
</ScrollView>
|
|
1420
1427
|
</SafeAreaView>
|
|
1421
1428
|
{CustomListHeader && <CustomListHeader />}
|
|
1429
|
+
{ongoingCallView}
|
|
1422
1430
|
{
|
|
1423
1431
|
FooterView && <View style={[Style.stickyHeaderFooterStyle, { bottom: 0 }]}>
|
|
1424
1432
|
<FooterView
|
package/src/calls/CallEvents.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { Modal, Text, View, Image } from "react-native";
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Modal, Text, View, Image, Platform } from "react-native";
|
|
3
3
|
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
4
4
|
import { CometChatMessageTemplate } from "../shared/modals";
|
|
5
5
|
import { localize } from "../shared/resources/CometChatLocalize";
|
|
@@ -14,6 +14,8 @@ import { CometChatCallButtons } from "./CometChatCallButtons";
|
|
|
14
14
|
import { CometChatOngoingCall } from "./CometChatOngoingCall";
|
|
15
15
|
import { CallingPackage } from "./CallingPackage";
|
|
16
16
|
import { CallUtils } from "./CallUtils";
|
|
17
|
+
import { CometChatUIEventHandler } from "../shared";
|
|
18
|
+
import { CallUIEvents } from "./CallEvents";
|
|
17
19
|
|
|
18
20
|
const CometChatCalls = CallingPackage.CometChatCalls;
|
|
19
21
|
|
|
@@ -25,12 +27,12 @@ export class CallingExtensionDecorator extends DataSourceDecorator {
|
|
|
25
27
|
constructor(props: { dataSource: DataSource, configuration: CallingConfiguration }) {
|
|
26
28
|
super(props.dataSource);
|
|
27
29
|
CometChat.getLoggedinUser()
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
.then(user => {
|
|
31
|
+
this.loggedInUser = user;
|
|
32
|
+
})
|
|
33
|
+
.catch(err => {
|
|
34
|
+
console.log("unable to get logged in user.");
|
|
35
|
+
})
|
|
34
36
|
if (props.configuration) {
|
|
35
37
|
this.configuration = props.configuration;
|
|
36
38
|
}
|
|
@@ -63,13 +65,13 @@ export class CallingExtensionDecorator extends DataSourceDecorator {
|
|
|
63
65
|
if (this.isDeletedMessage(message))
|
|
64
66
|
return null;
|
|
65
67
|
return <View style={{ justifyContent: "space-around", alignItems: "center" }}>
|
|
66
|
-
<View style={{flexDirection: "row", alignSelf: "center", borderWidth: 1, borderStyle: "dotted", borderRadius: 8, padding: 4}}>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
<View style={{ flexDirection: "row", alignSelf: "center", borderWidth: 1, borderStyle: "dotted", borderRadius: 8, padding: 4 }}>
|
|
69
|
+
<Image source={message['type'] == "audio" ? AudioIcon : VideoIcon} style={{ height: 16, width: 16, alignSelf: "center" }} />
|
|
70
|
+
<Text style={{ color: theme.palette.getAccent(), marginStart: 8 }}>
|
|
71
|
+
{
|
|
72
|
+
CallUtils.getCallStatus(message, this.loggedInUser)
|
|
73
|
+
}
|
|
74
|
+
</Text>
|
|
73
75
|
</View>
|
|
74
76
|
</View>
|
|
75
77
|
}
|
|
@@ -86,7 +88,7 @@ export class CallingExtensionDecorator extends DataSourceDecorator {
|
|
|
86
88
|
}
|
|
87
89
|
});
|
|
88
90
|
}
|
|
89
|
-
|
|
91
|
+
|
|
90
92
|
getUserVideoCallTemplates = (theme) => {
|
|
91
93
|
return new CometChatMessageTemplate({
|
|
92
94
|
category: MessageCategoryConstants.call,
|
|
@@ -103,28 +105,16 @@ export class CallingExtensionDecorator extends DataSourceDecorator {
|
|
|
103
105
|
GroupCallBubbleView = (props: { message: CometChat.BaseMessage, theme: CometChatTheme, alignment: string }) => {
|
|
104
106
|
const { message, theme, alignment } = props;
|
|
105
107
|
|
|
106
|
-
const [joinCall, setJoinCall] = useState(false);
|
|
107
|
-
const callListener = useRef(undefined);
|
|
108
|
-
|
|
109
108
|
if (this.isDeletedMessage(message))
|
|
110
109
|
return null
|
|
111
|
-
|
|
112
|
-
callListener.current = new CometChatCalls.OngoingCallListener({
|
|
113
|
-
onCallEnded: () => {
|
|
114
|
-
setJoinCall(false);
|
|
115
|
-
},
|
|
116
|
-
onCallEndButtonPressed: () => {
|
|
117
|
-
setJoinCall(false);
|
|
118
|
-
},
|
|
119
|
-
})
|
|
120
|
-
}, []);
|
|
110
|
+
|
|
121
111
|
return (
|
|
122
112
|
<View>
|
|
123
113
|
<CometChatCallBubble
|
|
124
114
|
buttonText={localize("JOIN")}
|
|
125
115
|
title={alignment == "right" ? localize("YOU_INITIATED_GROUP_CALL") : `${message['sender']['name']} ${localize("INITIATED_GROUP_CALL")}`}
|
|
126
116
|
icon={VideoIcon}
|
|
127
|
-
onClick={() =>
|
|
117
|
+
onClick={() => this.startDirectCall(message['customData']['sessionId'], theme)}
|
|
128
118
|
style={{
|
|
129
119
|
backgroundColor: alignment == "left" ? "transparent" : theme.palette.getPrimary(),
|
|
130
120
|
titleColor: alignment == "left" ? theme.palette.getAccent() : theme.palette.getSecondary(),
|
|
@@ -133,25 +123,46 @@ export class CallingExtensionDecorator extends DataSourceDecorator {
|
|
|
133
123
|
buttonTextColor: alignment == "left" ? theme.palette.getPrimary() : theme.palette.getPrimary(),
|
|
134
124
|
}}
|
|
135
125
|
/>
|
|
136
|
-
{
|
|
137
|
-
joinCall &&
|
|
138
|
-
<Modal>
|
|
139
|
-
<CometChatOngoingCall
|
|
140
|
-
sessionID={message['customData']['sessionId']}
|
|
141
|
-
callSettingsBuilder={
|
|
142
|
-
new CometChatCalls.CallSettingsBuilder()
|
|
143
|
-
.setCallEventListener(callListener.current)
|
|
144
|
-
}
|
|
145
|
-
onError={(e) => {
|
|
146
|
-
setJoinCall(false);
|
|
147
|
-
}}
|
|
148
|
-
/>
|
|
149
|
-
</Modal>
|
|
150
|
-
}
|
|
151
126
|
</View>
|
|
152
127
|
)
|
|
153
128
|
}
|
|
154
129
|
|
|
130
|
+
startDirectCall(sessionId: string, theme?: CometChatTheme) {
|
|
131
|
+
|
|
132
|
+
const callSettingsBuilder = new CometChatCalls.CallSettingsBuilder()
|
|
133
|
+
.setCallEventListener(
|
|
134
|
+
new CometChatCalls.OngoingCallListener({
|
|
135
|
+
onCallEndButtonPressed: () => {
|
|
136
|
+
CometChatUIEventHandler.emitCallEvent(CallUIEvents.ccShowOngoingCall, {
|
|
137
|
+
child: null,
|
|
138
|
+
})
|
|
139
|
+
},
|
|
140
|
+
onError: (error) => {
|
|
141
|
+
CometChatUIEventHandler.emitCallEvent(CallUIEvents.ccShowOngoingCall, {
|
|
142
|
+
child: null,
|
|
143
|
+
})
|
|
144
|
+
}
|
|
145
|
+
})
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
const ongoingCallScreen = (
|
|
149
|
+
<Modal>
|
|
150
|
+
<CometChatOngoingCall
|
|
151
|
+
sessionID={sessionId}
|
|
152
|
+
callSettingsBuilder={callSettingsBuilder}
|
|
153
|
+
onError={(e) => {
|
|
154
|
+
CometChatUIEventHandler.emitCallEvent(CallUIEvents.ccShowOngoingCall, {
|
|
155
|
+
child: null,
|
|
156
|
+
});
|
|
157
|
+
}}
|
|
158
|
+
/>
|
|
159
|
+
</Modal>
|
|
160
|
+
);
|
|
161
|
+
CometChatUIEventHandler.emitCallEvent(CallUIEvents.ccShowOngoingCall, {
|
|
162
|
+
child: ongoingCallScreen,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
155
166
|
getAuxiliaryHeaderAppbarOptions(user, group, theme: CometChatTheme) {
|
|
156
167
|
return <View>
|
|
157
168
|
<CometChatCallButtons
|
|
@@ -72,6 +72,9 @@ export class CometChatUIEventHandler {
|
|
|
72
72
|
case listener._eventListener.ccCallInitiated?.name:
|
|
73
73
|
listener._eventListener.ccCallInitiated(param);
|
|
74
74
|
break;
|
|
75
|
+
case listener._eventListener.ccShowOngoingCall?.name:
|
|
76
|
+
listener._eventListener.ccShowOngoingCall(param);
|
|
77
|
+
break;
|
|
75
78
|
}
|
|
76
79
|
});
|
|
77
80
|
}
|
|
@@ -122,6 +122,7 @@ type CallUIEvents = {
|
|
|
122
122
|
ccCallEnded?: Function,
|
|
123
123
|
ccCallInitiated?: Function,
|
|
124
124
|
ccCallFailled?: Function,
|
|
125
|
+
ccShowOngoingCall?: (CometChatOngoingComponent) => void,
|
|
125
126
|
}
|
|
126
127
|
|
|
127
128
|
type PanelUIEvents = {
|
|
@@ -153,6 +154,7 @@ export class CallUIEventListener {
|
|
|
153
154
|
ccOutgoingCallCancelled?: Function = undefined;
|
|
154
155
|
ccCallFailled?: Function = undefined;
|
|
155
156
|
ccCallInitiated?: Function = undefined;
|
|
157
|
+
ccShowOngoingCall?: (CometChatOngoingComponent) => void;
|
|
156
158
|
|
|
157
159
|
constructor({
|
|
158
160
|
ccIncomingCallReceived,
|
|
@@ -165,7 +167,8 @@ export class CallUIEventListener {
|
|
|
165
167
|
ccCallEnded,
|
|
166
168
|
ccOutgoingCallCancelled,
|
|
167
169
|
ccCallFailled,
|
|
168
|
-
ccCallInitiated
|
|
170
|
+
ccCallInitiated,
|
|
171
|
+
ccShowOngoingCall,
|
|
169
172
|
}: CallUIEvents) {
|
|
170
173
|
if (!isFalsy(ccCallFailled)) this.ccCallFailled = ccCallFailled;
|
|
171
174
|
if (!isFalsy(ccCallInitiated)) this.ccCallInitiated = ccCallInitiated;
|
|
@@ -178,6 +181,7 @@ export class CallUIEventListener {
|
|
|
178
181
|
if (!isFalsy(ccOutgoingCallAccepted)) this.ccOutgoingCallAccepted = ccOutgoingCallAccepted;
|
|
179
182
|
if (!isFalsy(ccOutgoingCallRejected)) this.ccOutgoingCallRejected = ccOutgoingCallRejected;
|
|
180
183
|
if (!isFalsy(ccIncomingCallCancelled)) this.ccIncomingCallCancelled = ccIncomingCallCancelled;
|
|
184
|
+
if (!isFalsy(ccShowOngoingCall)) this.ccShowOngoingCall = ccShowOngoingCall;
|
|
181
185
|
}
|
|
182
186
|
}
|
|
183
187
|
|
|
@@ -15,7 +15,7 @@ export class CometChatConversationUtils {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
static getLastMessage(conversation: CometChat.Conversation): CometChat.BaseMessage {
|
|
18
|
-
let msg = conversation
|
|
18
|
+
let msg = conversation?.getLastMessage && conversation?.getLastMessage();
|
|
19
19
|
if (!msg) {
|
|
20
20
|
return undefined;
|
|
21
21
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {useContext, useEffect, useState} from "react";
|
|
1
|
+
import React, { useContext, useEffect, useState } from "react";
|
|
2
2
|
import { View, Image, ImageBackground, NativeModules, Platform, NativeEventEmitter, EmitterSubscription } from "react-native";
|
|
3
3
|
import { CometChatContext } from "../../CometChatContext";
|
|
4
4
|
import { ImageType } from "../../base/Types";
|
|
@@ -48,7 +48,7 @@ export const CometChatVideoBubble = (props: CometChatVideoBubbleInterface) => {
|
|
|
48
48
|
onPress,
|
|
49
49
|
} = props;
|
|
50
50
|
|
|
51
|
-
const {theme} = useContext<CometChatContextType>(CometChatContext);
|
|
51
|
+
const { theme } = useContext<CometChatContextType>(CometChatContext);
|
|
52
52
|
const [isOpening, setOpening] = useState(false);
|
|
53
53
|
|
|
54
54
|
const _style = new VideoBubbleStyle({
|
|
@@ -69,7 +69,7 @@ export const CometChatVideoBubble = (props: CometChatVideoBubbleInterface) => {
|
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
const getFileName = (url) => {
|
|
72
|
-
return (url.substring(url.lastIndexOf("/") + 1, url.length)).replace(" ","_");
|
|
72
|
+
return (url.substring(url.lastIndexOf("/") + 1, url.length)).replace(" ", "_");
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
const playVideo = () => {
|
|
@@ -82,9 +82,11 @@ export const CometChatVideoBubble = (props: CometChatVideoBubbleInterface) => {
|
|
|
82
82
|
return;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
if (!videoUrl) return;
|
|
86
|
+
|
|
85
87
|
Platform.OS == 'ios' ?
|
|
86
|
-
FileManager.openFile(videoUrl, getFileName(videoUrl), (s) => {}) :
|
|
87
|
-
VideoManager.openVideo(videoUrl, (s) => {});
|
|
88
|
+
FileManager.openFile(videoUrl, getFileName(videoUrl), (s) => { }) :
|
|
89
|
+
VideoManager.openVideo(videoUrl, (s) => { });
|
|
88
90
|
|
|
89
91
|
}
|
|
90
92
|
|