@cometchat/chat-uikit-react-native 5.0.0 → 5.0.2
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/android/src/main/java/com/reactnativecometchatuikit/FileManager.java +87 -49
- package/android/src/main/java/com/reactnativecometchatuikit/SoundPlayer.java +10 -0
- package/ios/SoundPlayer.m +8 -0
- package/package.json +8 -9
- package/src/CometChatConversations/CometChatConversations.tsx +19 -14
- package/src/CometChatConversations/style.ts +6 -2
- package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +1 -0
- package/src/CometChatGroupMembers/style.ts +1 -0
- package/src/CometChatGroups/CometChatGroups.tsx +1 -0
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +227 -57
- package/src/CometChatMessageComposer/styles.tsx +3 -6
- package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +2 -2
- package/src/CometChatMessageHeader/styles.ts +1 -0
- package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +1 -1
- package/src/CometChatMessageList/CometChatMessageList.tsx +188 -111
- package/src/CometChatMessageList/style.ts +0 -16
- package/src/CometChatThreadHeader/CometChatThreadHeader.tsx +1 -1
- package/src/CometChatUsers/CometChatUsers.tsx +1 -1
- package/src/calls/CallUtils.ts +18 -10
- package/src/calls/CallingExtensionDecorator.tsx +1 -1
- package/src/calls/CometChatCallBubble/CometChatCallBubble.tsx +8 -7
- package/src/calls/CometChatCallBubble/styles.ts +1 -0
- package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +6 -4
- package/src/calls/CometChatCallButtons/style.ts +2 -1
- package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +4 -3
- package/src/calls/CometChatCallLogs/style.ts +1 -0
- package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +4 -3
- package/src/calls/CometChatOngoingCall/CometChatOngoingCall.tsx +1 -0
- package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +3 -3
- package/src/calls/CometChatOutgoingCall/OutgoingCallConfiguration.ts +1 -0
- package/src/extensions/CollaborativeBubble/CometChatCollaborativeBubble.tsx +1 -1
- package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +1 -1
- package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +1 -1
- package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +15 -18
- package/src/extensions/LinkPreview/LinkPreviewExtensionDecorator.tsx +1 -1
- package/src/extensions/LinkPreview/style.ts +2 -2
- package/src/extensions/MessageTranslation/MessageTranslationDecorator.tsx +20 -17
- package/src/extensions/Polls/Polls.tsx +45 -8
- package/src/extensions/Polls/PollsDecorator.tsx +1 -1
- package/src/extensions/Stickers/StickersExtensionDecorator.tsx +2 -4
- package/src/extensions/Stickers/style.ts +3 -3
- package/src/extensions/ThumbnailGeneration/ThumbnailGenerationDecorator.tsx +1 -1
- package/src/imageresolver.d.ts +4 -0
- package/src/index.ts +2 -0
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +1 -2
- package/src/shared/base/Types.ts +1 -0
- package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +114 -32
- package/src/shared/formatters/CometChatTextFormatter.ts +1 -0
- package/src/shared/formatters/CometChatUrlsFormatter/index.tsx +4 -4
- package/src/shared/framework/DataSource.ts +6 -2
- package/src/shared/framework/DataSourceDecorator.tsx +5 -4
- package/src/shared/framework/MessageDataSource.tsx +26 -28
- package/src/shared/helper/types/index.ts +1 -0
- package/src/shared/icons/Icon.tsx +1 -1
- package/src/shared/index.ts +41 -126
- package/src/shared/libs/ImageZoom/ReactNativeZoomableView.tsx +1 -1
- package/src/shared/libs/ImageZoom/ReactNativeZoomableViewWithGestures.tsx +4 -2
- package/src/shared/modals/CometChatMessageOption.ts +1 -0
- package/src/shared/modals/CometChatMessageTemplate.ts +1 -0
- package/src/shared/resources/CometChatSoundManager/index.ts +1 -0
- package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +0 -8
- package/src/shared/utils/CometChatMessagePreview/index.ts +1 -2
- package/src/shared/utils/CommonUtils.ts +2 -1
- package/src/shared/utils/MessageUtils.tsx +54 -62
- package/src/shared/utils/conversationUtils.ts +1 -0
- package/src/shared/utils/index.ts +1 -2
- package/src/shared/views/CometChatActionSheet/ActionItem.ts +1 -0
- package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +1 -1
- package/src/shared/views/CometChatAudioBubble/AnimatedAudioWaves.tsx +1 -1
- package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +9 -6
- package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +1 -1
- package/src/shared/views/CometChatConfirmDialog/CometChatConfirmDialog.tsx +1 -1
- package/src/shared/views/CometChatConfirmDialog/style.ts +1 -0
- package/src/shared/views/CometChatDeletedBubble/styles.ts +1 -0
- package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +1 -1
- package/src/shared/views/CometChatList/CometChatList.tsx +2 -2
- package/src/shared/views/CometChatList/Header.tsx +1 -1
- package/src/shared/views/CometChatMediaRecorder/AnimatingMic.tsx +2 -2
- package/src/shared/views/CometChatMediaRecorder/CometChatAudioPreview/CometChatAudioPreview.tsx +16 -10
- package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +7 -8
- package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +1 -1
- package/src/shared/views/CometChatReactionList/CometChatReactionList.tsx +84 -70
- package/src/shared/views/CometChatReactions/CometChatReactions.tsx +1 -1
- package/src/shared/views/CometChatReactions/style.ts +5 -4
- package/src/shared/views/CometChatReceipt/style.ts +1 -0
- package/src/shared/views/CometChatStatusIndicator/CometChatStatusIndicator.tsx +1 -1
- package/src/shared/views/CometChatSuggestionList/style.ts +3 -2
- package/src/shared/views/CometChatTooltipMenu/CometChatTooltipMenu.tsx +1 -1
- package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +24 -47
- package/src/shared/views/CometChatVideoPlayer/CometChatVideoPlayer.tsx +68 -73
- package/src/shared/views/ErrorEmptyView/ErrorEmptyView.tsx +1 -0
- package/src/theme/CometChatThemeHelper.ts +69 -58
- package/src/theme/context.ts +2 -2
- package/src/theme/default/default.ts +204 -0
- package/src/theme/default/index.ts +0 -238
- package/src/theme/provider.tsx +7 -7
- package/src/theme/type.ts +5 -7
- package/android/.gradle/7.4/checksums/checksums.lock +0 -0
- package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.4/gc.properties +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/src/shared/utils/CometChatMessagePreview/MessagePreviewStyle.js +0 -42
package/src/shared/views/CometChatMediaRecorder/CometChatAudioPreview/CometChatAudioPreview.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
1
|
+
import React, { JSX, useCallback, useEffect, useRef, useState } from "react";
|
|
2
2
|
import {
|
|
3
3
|
EmitterSubscription,
|
|
4
4
|
ImageSourcePropType,
|
|
@@ -17,8 +17,8 @@ import { AnimatedAudioWaves } from "../../CometChatAudioBubble/AnimatedAudioWave
|
|
|
17
17
|
|
|
18
18
|
const { SoundPlayer } = NativeModules;
|
|
19
19
|
const eventEmitter = new NativeEventEmitter(SoundPlayer);
|
|
20
|
-
let listener: EmitterSubscription;
|
|
21
|
-
let interval:
|
|
20
|
+
let listener: EmitterSubscription | undefined;
|
|
21
|
+
let interval: ReturnType<typeof setTimeout>;
|
|
22
22
|
|
|
23
23
|
export interface CometChatAudioBubbleInterface {
|
|
24
24
|
/**
|
|
@@ -65,26 +65,32 @@ export const CometChatAudioPreview = ({
|
|
|
65
65
|
useEffect(() => {
|
|
66
66
|
if (audioUrl) {
|
|
67
67
|
SoundPlayer.prepareMediaPlayer(audioUrl, (s: string) => {
|
|
68
|
-
|
|
68
|
+
try {
|
|
69
|
+
setDuration(JSON.parse(s).duration);
|
|
70
|
+
} catch (e) {
|
|
71
|
+
console.log("prepareMediaPlayer parse error", e);
|
|
72
|
+
}
|
|
69
73
|
});
|
|
70
74
|
}
|
|
71
75
|
|
|
76
|
+
// release player on unmount (all platforms) — keeps behaviour consistent with AudioBubble
|
|
72
77
|
return () => {
|
|
73
|
-
|
|
78
|
+
SoundPlayer.releaseMediaPlayer();
|
|
74
79
|
};
|
|
75
80
|
}, [audioUrl]);
|
|
76
81
|
|
|
77
82
|
useEffect(() => {
|
|
78
83
|
listener = eventEmitter.addListener("soundPlayStatus", (data) => {
|
|
79
84
|
if (audioUrl === data.url) {
|
|
80
|
-
|
|
85
|
+
// playback ended for this url — reset to idle, clear interval and reset time
|
|
86
|
+
setStatus("");
|
|
81
87
|
clearInterval(interval);
|
|
82
|
-
setCurrentTime(
|
|
88
|
+
setCurrentTime(0);
|
|
83
89
|
}
|
|
84
90
|
});
|
|
85
91
|
|
|
86
92
|
return () => {
|
|
87
|
-
listener
|
|
93
|
+
listener?.remove();
|
|
88
94
|
clearInterval(interval);
|
|
89
95
|
};
|
|
90
96
|
}, [audioUrl]);
|
|
@@ -114,7 +120,7 @@ export const CometChatAudioPreview = ({
|
|
|
114
120
|
if (Platform.OS == "ios") {
|
|
115
121
|
setStatus("playing");
|
|
116
122
|
}
|
|
117
|
-
// Get total duration when
|
|
123
|
+
// Get total duration/position when resume
|
|
118
124
|
SoundPlayer.getPosition((info: string) => {
|
|
119
125
|
if (info) {
|
|
120
126
|
if (Platform.OS == "android") {
|
|
@@ -166,7 +172,7 @@ export const CometChatAudioPreview = ({
|
|
|
166
172
|
}
|
|
167
173
|
};
|
|
168
174
|
|
|
169
|
-
const pressTime = useRef<number|null>(0);
|
|
175
|
+
const pressTime = useRef<number | null>(0);
|
|
170
176
|
|
|
171
177
|
const handleTouchStart = () => {
|
|
172
178
|
pressTime.current = Date.now();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { memo, useState, useCallback } from "react";
|
|
1
|
+
import React, { memo, useState, useCallback, useMemo, JSX } from "react";
|
|
2
2
|
import { View, ViewProps } from "react-native";
|
|
3
3
|
import { BubbleStyles } from "../../../theme/type";
|
|
4
4
|
import { MessageBubbleAlignmentType } from "../../base/Types";
|
|
@@ -115,16 +115,15 @@ export const CometChatMessageBubble = memo(
|
|
|
115
115
|
[_width]
|
|
116
116
|
);
|
|
117
117
|
|
|
118
|
+
const alignItems = useMemo(() => {
|
|
119
|
+
return alignment === "right" ? "flex-end" : alignment === "left" ? "flex-start" : alignment;
|
|
120
|
+
}, [alignment]);
|
|
121
|
+
|
|
118
122
|
return (
|
|
119
123
|
<View
|
|
120
124
|
style={{
|
|
121
125
|
width: "100%",
|
|
122
|
-
alignItems:
|
|
123
|
-
alignment === "right"
|
|
124
|
-
? "flex-end"
|
|
125
|
-
: alignment === "left"
|
|
126
|
-
? "flex-start"
|
|
127
|
-
: alignment,
|
|
126
|
+
alignItems: alignItems,
|
|
128
127
|
}}
|
|
129
128
|
>
|
|
130
129
|
<View style={{ flexDirection: "row" } as ViewProps}>
|
|
@@ -152,4 +151,4 @@ export const CometChatMessageBubble = memo(
|
|
|
152
151
|
</View>
|
|
153
152
|
);
|
|
154
153
|
}
|
|
155
|
-
);
|
|
154
|
+
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
2
|
-
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
+
import React, { JSX, useCallback, useEffect, useRef, useState } from "react";
|
|
3
3
|
import {
|
|
4
4
|
ActivityIndicator,
|
|
5
5
|
FlatList,
|
|
@@ -58,6 +58,10 @@ export interface CometChatReactionListInterface {
|
|
|
58
58
|
* @returns A JSX element representing the loading state.
|
|
59
59
|
*/
|
|
60
60
|
LoadingStateView?: () => JSX.Element;
|
|
61
|
+
/**
|
|
62
|
+
* Callback if reaction list becomes empty.
|
|
63
|
+
*/
|
|
64
|
+
onListEmpty?: () => void;
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
export const CometChatReactionList = (props: CometChatReactionListInterface) => {
|
|
@@ -69,6 +73,7 @@ export const CometChatReactionList = (props: CometChatReactionListInterface) =>
|
|
|
69
73
|
ErrorStateView,
|
|
70
74
|
errorStateText,
|
|
71
75
|
LoadingStateView,
|
|
76
|
+
onListEmpty,
|
|
72
77
|
} = props;
|
|
73
78
|
const theme = useTheme();
|
|
74
79
|
const reactionListStyleFromTheme = theme.reactionListStyles.reactionListItemStyle;
|
|
@@ -78,7 +83,7 @@ export const CometChatReactionList = (props: CometChatReactionListInterface) =>
|
|
|
78
83
|
const [currentSelectedReaction, setCurrentSelectedReaction] = useState(selectedReaction || "All");
|
|
79
84
|
const [reactionList, setReactionList] = useState<CometChat.Reaction[]>();
|
|
80
85
|
const [state, setState] = useState<"loading" | "error" | "done" | "fetchNextOnScroll">("loading");
|
|
81
|
-
const loggedInUser = useRef<CometChat.User | null>();
|
|
86
|
+
const loggedInUser = useRef<CometChat.User | null>(undefined);
|
|
82
87
|
const newMessageObj = useRef<CometChat.BaseMessage>(CommonUtils.clone(message));
|
|
83
88
|
|
|
84
89
|
const requestBuilderMap = useRef<Record<string, CometChat.ReactionsRequest>>({});
|
|
@@ -123,7 +128,8 @@ export const CometChatReactionList = (props: CometChatReactionListInterface) =>
|
|
|
123
128
|
return requestBuilderMap.current[reaction];
|
|
124
129
|
}
|
|
125
130
|
|
|
126
|
-
requestBuilder =
|
|
131
|
+
requestBuilder =
|
|
132
|
+
reactionsRequestBuilder || new CometChat.ReactionsRequestBuilder().setLimit(10);
|
|
127
133
|
requestBuilder.setMessageId(messageObject?.getId());
|
|
128
134
|
|
|
129
135
|
if (reaction !== "All") {
|
|
@@ -178,85 +184,88 @@ export const CometChatReactionList = (props: CometChatReactionListInterface) =>
|
|
|
178
184
|
}
|
|
179
185
|
};
|
|
180
186
|
|
|
181
|
-
const reactToMessage = useCallback(
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
if (reaction?.
|
|
194
|
-
|
|
187
|
+
const reactToMessage = useCallback(
|
|
188
|
+
(emoji: string) => {
|
|
189
|
+
const msgObj = CommonUtils.clone(messageObject);
|
|
190
|
+
|
|
191
|
+
const messageId = msgObj?.getId();
|
|
192
|
+
const reactions = msgObj?.getReactions() || [];
|
|
193
|
+
const emojiObject = reactions?.find((reaction: any) => {
|
|
194
|
+
return reaction?.reaction == emoji;
|
|
195
|
+
});
|
|
196
|
+
if (emojiObject && emojiObject?.getReactedByMe()) {
|
|
197
|
+
const updatedReactions: any[] = [];
|
|
198
|
+
reactions.forEach((reaction: any) => {
|
|
199
|
+
if (reaction?.getReaction() == emoji) {
|
|
200
|
+
if (reaction?.getCount() === 1) {
|
|
201
|
+
return;
|
|
202
|
+
} else {
|
|
203
|
+
reaction.setCount(reaction?.getCount() - 1);
|
|
204
|
+
reaction.setReactedByMe(false);
|
|
205
|
+
updatedReactions.push(reaction);
|
|
206
|
+
}
|
|
195
207
|
} else {
|
|
196
|
-
reaction.setCount(reaction?.getCount() - 1);
|
|
197
|
-
reaction.setReactedByMe(false);
|
|
198
208
|
updatedReactions.push(reaction);
|
|
199
209
|
}
|
|
200
|
-
}
|
|
201
|
-
updatedReactions.push(reaction);
|
|
202
|
-
}
|
|
203
|
-
});
|
|
210
|
+
});
|
|
204
211
|
|
|
205
|
-
|
|
206
|
-
|
|
212
|
+
const newMessageObj = CommonUtils.clone(msgObj);
|
|
213
|
+
newMessageObj.setReactions(updatedReactions);
|
|
207
214
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
215
|
+
CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccMessageEdited, {
|
|
216
|
+
message: newMessageObj,
|
|
217
|
+
status: messageStatus.success,
|
|
218
|
+
});
|
|
219
|
+
CometChat.removeReaction(messageId, emoji)
|
|
220
|
+
.then((message: any) => {})
|
|
221
|
+
.catch((error: any) => {
|
|
222
|
+
CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccMessageEdited, {
|
|
223
|
+
message: msgObj,
|
|
224
|
+
status: messageStatus.success,
|
|
225
|
+
});
|
|
226
|
+
//console.log(error);
|
|
218
227
|
});
|
|
219
|
-
|
|
228
|
+
} else {
|
|
229
|
+
const updatedReactions: any[] = [];
|
|
230
|
+
const reactionAvailable = reactions.find((reaction: any) => {
|
|
231
|
+
return reaction?.getReaction() == emoji;
|
|
220
232
|
});
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
updatedReactions.push(
|
|
233
|
+
reactions.forEach((reaction: any) => {
|
|
234
|
+
if (reaction?.getReaction() == emoji) {
|
|
235
|
+
reaction.setCount(reaction?.getCount() + 1);
|
|
236
|
+
reaction.setReactedByMe(true);
|
|
237
|
+
updatedReactions.push(reaction);
|
|
238
|
+
} else {
|
|
239
|
+
updatedReactions.push(reaction);
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
if (!reactionAvailable) {
|
|
243
|
+
const react: CometChat.ReactionCount = new CometChat.ReactionCount(emoji, 1, true);
|
|
244
|
+
updatedReactions.push(react);
|
|
233
245
|
}
|
|
234
|
-
});
|
|
235
|
-
if (!reactionAvailable) {
|
|
236
|
-
const react: CometChat.ReactionCount = new CometChat.ReactionCount(emoji, 1, true);
|
|
237
|
-
updatedReactions.push(react);
|
|
238
|
-
}
|
|
239
246
|
|
|
240
|
-
|
|
247
|
+
const newMessageObj = CommonUtils.clone(msgObj);
|
|
241
248
|
|
|
242
|
-
|
|
249
|
+
newMessageObj.setReactions(updatedReactions);
|
|
243
250
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
251
|
+
CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccMessageEdited, {
|
|
252
|
+
message: newMessageObj,
|
|
253
|
+
status: messageStatus.success,
|
|
254
|
+
});
|
|
248
255
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
+
CometChat.addReaction(messageId, emoji)
|
|
257
|
+
.then((response: any) => {})
|
|
258
|
+
.catch((error: any) => {
|
|
259
|
+
//console.log(error);
|
|
260
|
+
CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccMessageEdited, {
|
|
261
|
+
message: msgObj,
|
|
262
|
+
status: messageStatus.success,
|
|
263
|
+
});
|
|
256
264
|
});
|
|
257
|
-
|
|
258
|
-
}
|
|
259
|
-
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
[messageObject]
|
|
268
|
+
);
|
|
260
269
|
|
|
261
270
|
const removeReaction = (reactionObj: CometChat.Reaction) => {
|
|
262
271
|
let reactedByMe = loggedInUser.current!.getUid() === reactionObj?.getReactedBy()?.getUid();
|
|
@@ -308,6 +317,11 @@ export const CometChatReactionList = (props: CometChatReactionListInterface) =>
|
|
|
308
317
|
newMessageReactions.shift();
|
|
309
318
|
_setAllReactions(newMessageReactions);
|
|
310
319
|
setCurrentSelectedReaction("All");
|
|
320
|
+
|
|
321
|
+
// Check if all reactions are gone and call onListEmpty
|
|
322
|
+
if (newMessageReactions.length === 0 && onListEmpty) {
|
|
323
|
+
onListEmpty();
|
|
324
|
+
}
|
|
311
325
|
}
|
|
312
326
|
}
|
|
313
327
|
|
|
@@ -363,7 +377,7 @@ export const CometChatReactionList = (props: CometChatReactionListInterface) =>
|
|
|
363
377
|
return (
|
|
364
378
|
<ErrorEmptyView
|
|
365
379
|
title={errorStateText ?? "Oops!"}
|
|
366
|
-
|
|
380
|
+
subTitle={localize("SOMETHING_WENT_WRONG")}
|
|
367
381
|
tertiaryTitle={localize("WRONG_TEXT_TRY_AGAIN")}
|
|
368
382
|
Icon={
|
|
369
383
|
<Icon
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useLayoutEffect } from "react";
|
|
1
|
+
import React, { JSX, useLayoutEffect } from "react";
|
|
2
2
|
import { Text, TouchableOpacity, View } from "react-native";
|
|
3
3
|
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
4
4
|
import { MessageBubbleAlignmentType } from "../../base/Types";
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { CometChatTheme } from "../../../theme/type";
|
|
2
2
|
import { deepMerge } from "../../helper/helperFunctions";
|
|
3
|
+
import { DeepPartial } from "../../helper/types";
|
|
3
4
|
|
|
4
5
|
export const getReactionsStyleLight = (
|
|
5
6
|
color: CometChatTheme["color"],
|
|
6
7
|
spacing: CometChatTheme["spacing"],
|
|
7
8
|
typography: CometChatTheme["typography"]
|
|
8
9
|
): {
|
|
9
|
-
incomingBubbleStyle: CometChatTheme["messageBubbleReactionStyles"]
|
|
10
|
-
outgoingBubbleStyle: CometChatTheme["messageBubbleReactionStyles"]
|
|
10
|
+
incomingBubbleStyle: DeepPartial<CometChatTheme["messageBubbleReactionStyles"]>;
|
|
11
|
+
outgoingBubbleStyle: DeepPartial<CometChatTheme["messageBubbleReactionStyles"]>;
|
|
11
12
|
} => {
|
|
12
13
|
return {
|
|
13
14
|
incomingBubbleStyle: {
|
|
@@ -146,8 +147,8 @@ export const getReactionsStyleDark = (
|
|
|
146
147
|
spacing: CometChatTheme["spacing"],
|
|
147
148
|
typography: CometChatTheme["typography"]
|
|
148
149
|
): {
|
|
149
|
-
incomingBubbleStyle: CometChatTheme["messageBubbleReactionStyles"]
|
|
150
|
-
outgoingBubbleStyle: CometChatTheme["messageBubbleReactionStyles"]
|
|
150
|
+
incomingBubbleStyle: DeepPartial<CometChatTheme["messageBubbleReactionStyles"]>;
|
|
151
|
+
outgoingBubbleStyle: DeepPartial<CometChatTheme["messageBubbleReactionStyles"]>;
|
|
151
152
|
} => {
|
|
152
153
|
return deepMerge(getReactionsStyleLight(color, spacing, typography)!, {
|
|
153
154
|
incomingBubbleStyle: {
|
|
@@ -14,7 +14,7 @@ export interface CometChatStatusIndicatorInterface {
|
|
|
14
14
|
* The status type to be displayed. Can be one of:
|
|
15
15
|
* "online", "offline", "private", "protected", or "public".
|
|
16
16
|
*/
|
|
17
|
-
type?: "online" | "offline" | "private" | "protected" | "public" | null;
|
|
17
|
+
type?: "online" | "offline" | "private" | "protected" | "public" | "password" | null;
|
|
18
18
|
/**
|
|
19
19
|
* Custom styles for the status indicator.
|
|
20
20
|
*/
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Dimensions } from "react-native";
|
|
2
2
|
import { CometChatTheme } from "../../../theme/type";
|
|
3
3
|
import { deepMerge } from "../../helper/helperFunctions";
|
|
4
|
+
import { DeepPartial } from "../../helper/types";
|
|
4
5
|
|
|
5
6
|
export const getMentionsListStyleLight = (
|
|
6
7
|
color: CometChatTheme["color"],
|
|
7
8
|
spacing: CometChatTheme["spacing"],
|
|
8
9
|
typography: CometChatTheme["typography"]
|
|
9
|
-
): CometChatTheme["mentionsListStyle"] => {
|
|
10
|
+
): DeepPartial<CometChatTheme["mentionsListStyle"]> => {
|
|
10
11
|
return {
|
|
11
12
|
containerStyle: {
|
|
12
13
|
borderRadius: spacing.radius.r4,
|
|
@@ -57,7 +58,7 @@ export const getMentionsListStyleDark = (
|
|
|
57
58
|
color: CometChatTheme["color"],
|
|
58
59
|
spacing: CometChatTheme["spacing"],
|
|
59
60
|
typography: CometChatTheme["typography"]
|
|
60
|
-
): CometChatTheme["mentionsListStyle"] => {
|
|
61
|
+
): DeepPartial<CometChatTheme["mentionsListStyle"]> => {
|
|
61
62
|
return deepMerge(getMentionsListStyleLight(color, spacing, typography), {
|
|
62
63
|
skeletonStyle: {
|
|
63
64
|
linearGradientColors: ["#383838", "#272727"] as [string, string],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { JSX, useEffect, useState } from "react";
|
|
2
2
|
import {
|
|
3
3
|
ActivityIndicator,
|
|
4
4
|
EmitterSubscription,
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
ImageStyle,
|
|
8
8
|
NativeEventEmitter,
|
|
9
9
|
NativeModules,
|
|
10
|
-
Platform,
|
|
11
10
|
Pressable,
|
|
12
11
|
View,
|
|
13
12
|
ViewStyle,
|
|
@@ -76,7 +75,7 @@ export const CometChatVideoBubble = (props: CometChatVideoBubbleInterface) => {
|
|
|
76
75
|
playIcon,
|
|
77
76
|
playIconStyle,
|
|
78
77
|
onPress,
|
|
79
|
-
playIconContainerStyle,
|
|
78
|
+
playIconContainerStyle = {},
|
|
80
79
|
imageStyle,
|
|
81
80
|
} = props;
|
|
82
81
|
|
|
@@ -130,27 +129,6 @@ export const CometChatVideoBubble = (props: CometChatVideoBubbleInterface) => {
|
|
|
130
129
|
};
|
|
131
130
|
}, []);
|
|
132
131
|
|
|
133
|
-
const pressTime = useRef<number | null>(0);
|
|
134
|
-
|
|
135
|
-
// const handleTouchStart = () => {
|
|
136
|
-
// pressTime.current = Date.now();
|
|
137
|
-
// };
|
|
138
|
-
|
|
139
|
-
// const handleTouchEnd = () => {
|
|
140
|
-
// if (pressTime.current === null && Platform.OS === "ios") return;
|
|
141
|
-
// const endTime = Date.now();
|
|
142
|
-
// const pressDuration = endTime - pressTime.current!;
|
|
143
|
-
// if (pressDuration < 500) {
|
|
144
|
-
// playVideo();
|
|
145
|
-
// }
|
|
146
|
-
// };
|
|
147
|
-
|
|
148
|
-
// const onTouchMove = () => {
|
|
149
|
-
// if (Platform.OS === "ios") {
|
|
150
|
-
// pressTime.current = null;
|
|
151
|
-
// }
|
|
152
|
-
// };
|
|
153
|
-
|
|
154
132
|
return (
|
|
155
133
|
<>
|
|
156
134
|
<CometChatVideoPlayer
|
|
@@ -163,29 +141,28 @@ export const CometChatVideoBubble = (props: CometChatVideoBubbleInterface) => {
|
|
|
163
141
|
onLoad={() => setIsLoading(false)}
|
|
164
142
|
/>
|
|
165
143
|
<ImageBackground source={imageSource} resizeMode={"cover"} style={imageStyle}>
|
|
166
|
-
<
|
|
167
|
-
onPress={() => playVideo()}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
</Pressable>
|
|
144
|
+
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
|
|
145
|
+
<Pressable onPress={() => playVideo()} style={playIconContainerStyle} hitSlop={12}>
|
|
146
|
+
<View>
|
|
147
|
+
{isLoading ? (
|
|
148
|
+
<ActivityIndicator
|
|
149
|
+
size={typeof playIconStyle?.height === "number" ? playIconStyle.height : "large"}
|
|
150
|
+
color={playIconStyle?.tintColor}
|
|
151
|
+
/>
|
|
152
|
+
) : (
|
|
153
|
+
<Icon
|
|
154
|
+
name='play-arrow-fill'
|
|
155
|
+
height={playIconStyle?.height}
|
|
156
|
+
width={playIconStyle?.width}
|
|
157
|
+
icon={playIcon}
|
|
158
|
+
imageStyle={playIconStyle}
|
|
159
|
+
color={playIconStyle?.tintColor}
|
|
160
|
+
></Icon>
|
|
161
|
+
)}
|
|
162
|
+
</View>
|
|
163
|
+
</Pressable>
|
|
164
|
+
</View>
|
|
188
165
|
</ImageBackground>
|
|
189
166
|
</>
|
|
190
167
|
);
|
|
191
|
-
};
|
|
168
|
+
};
|