@cometchat/chat-uikit-react-native 5.0.1 → 5.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/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/android/src/main/java/com/reactnativecometchatuikit/FileManager.java +87 -41
- package/android/src/main/java/com/reactnativecometchatuikit/SoundPlayer.java +10 -0
- package/ios/SoundPlayer.m +8 -0
- package/lib/CometChatMessageList/CometChatMessageList.js +1 -1
- package/lib/CometChatMessageList/CometChatMessageList.js.map +1 -1
- package/lib/extensions/Stickers/StickersExtensionDecorator.d.ts +1 -2
- package/lib/extensions/Stickers/StickersExtensionDecorator.js +1 -2
- package/lib/extensions/Stickers/StickersExtensionDecorator.js.map +1 -1
- package/lib/shared/CometChatUiKit/CometChatUIKit.d.ts +2 -1
- package/lib/shared/CometChatUiKit/CometChatUIKit.js +2 -1
- package/lib/shared/CometChatUiKit/CometChatUIKit.js.map +1 -1
- package/lib/shared/index.d.ts +15 -13
- package/lib/shared/index.js +30 -12
- package/lib/shared/index.js.map +1 -1
- package/lib/shared/utils/CometChatMessagePreview/CometChatMessagePreview.d.ts +10 -1
- package/lib/shared/utils/CometChatMessagePreview/CometChatMessagePreview.js +8 -0
- package/lib/shared/utils/CometChatMessagePreview/CometChatMessagePreview.js.map +1 -1
- package/lib/shared/utils/CometChatMessagePreview/MessagePreviewStyle.d.ts +29 -0
- package/lib/shared/utils/CometChatMessagePreview/MessagePreviewStyle.js +29 -0
- package/lib/shared/utils/CometChatMessagePreview/MessagePreviewStyle.js.map +1 -0
- package/lib/shared/utils/CometChatMessagePreview/index.d.ts +2 -1
- package/lib/shared/utils/CometChatMessagePreview/index.js +3 -1
- package/lib/shared/utils/CometChatMessagePreview/index.js.map +1 -1
- package/lib/shared/utils/CometChatMessagePreview/style.d.ts +16 -16
- package/lib/shared/utils/MessageUtils.js +11 -10
- package/lib/shared/utils/MessageUtils.js.map +1 -1
- package/lib/shared/utils/index.d.ts +2 -2
- package/lib/shared/utils/index.js +2 -2
- package/lib/shared/utils/index.js.map +1 -1
- package/lib/theme/context.js +1 -1
- package/lib/theme/context.js.map +1 -1
- package/lib/theme/default/index.d.ts +6 -0
- package/lib/theme/default/index.js +178 -0
- package/lib/theme/default/index.js.map +1 -1
- package/lib/theme/provider.js +1 -1
- package/lib/theme/provider.js.map +1 -1
- package/package.json +6 -4
- package/react-native-cometchat-ui-kit.podspec +1 -1
- package/src/CometChatConversations/CometChatConversations.tsx +34 -29
- package/src/CometChatConversations/style.ts +5 -2
- package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +56 -44
- package/src/CometChatGroups/CometChatGroups.tsx +13 -10
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +203 -57
- package/src/CometChatMessageComposer/styles.tsx +2 -6
- package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +8 -48
- package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +8 -14
- package/src/CometChatMessageList/CometChatMessageList.tsx +18 -10
- package/src/CometChatMessageList/style.ts +0 -16
- package/src/CometChatThreadHeader/CometChatThreadHeader.tsx +3 -2
- package/src/CometChatUsers/CometChatUsers.tsx +9 -8
- package/src/calls/CallUtils.ts +14 -14
- package/src/calls/CallingExtensionDecorator.tsx +13 -12
- package/src/calls/CometChatCallBubble/CometChatCallBubble.tsx +4 -3
- package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +15 -12
- package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +8 -6
- package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +4 -2
- package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +7 -6
- package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +7 -6
- package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +3 -2
- package/src/extensions/MessageTranslation/MessageTranslationBubble.tsx +3 -2
- package/src/extensions/MessageTranslation/MessageTranslationDecorator.tsx +26 -17
- package/src/extensions/Polls/Polls.tsx +53 -17
- package/src/extensions/Polls/PollsDecorator.tsx +5 -3
- package/src/extensions/Stickers/CometChatStickerKeyboard/CometChatStickerKeyboard.tsx +5 -4
- package/src/extensions/Stickers/CometChatStickerKeyboard/hooks.ts +3 -2
- package/src/extensions/Stickers/StickersExtensionDecorator.tsx +5 -2
- package/src/index.ts +10 -4
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +1 -2
- package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +116 -32
- package/src/shared/framework/DataSource.ts +5 -2
- package/src/shared/framework/DataSourceDecorator.tsx +4 -4
- package/src/shared/framework/MessageDataSource.tsx +178 -46
- package/src/shared/helper/LocalizedDateHelper.ts +317 -0
- package/src/shared/helper/functions.js +69 -1
- package/src/shared/helper/useLocalizedDateHook.tsx +16 -0
- package/src/shared/index.ts +7 -2
- package/src/shared/resources/CometChatLocalizeNew/CometChatI18nProvider.tsx +106 -0
- package/src/shared/resources/CometChatLocalizeNew/CometChatLocalizationHelper.ts +99 -0
- package/src/shared/resources/CometChatLocalizeNew/CometChatLocalizeContext.tsx +15 -0
- package/src/shared/resources/CometChatLocalizeNew/LocalizationManager.ts +65 -0
- package/src/shared/resources/CometChatLocalizeNew/index.ts +25 -0
- package/src/shared/resources/{CometChatLocalize → CometChatLocalizeNew}/resources/de/translation.json +10 -1
- package/src/shared/resources/{CometChatLocalize → CometChatLocalizeNew}/resources/en/translation.json +10 -1
- package/src/shared/resources/{CometChatLocalize → CometChatLocalizeNew}/resources/es/translation.json +10 -1
- package/src/shared/resources/{CometChatLocalize → CometChatLocalizeNew}/resources/fr/translation.json +10 -1
- package/src/shared/resources/{CometChatLocalize → CometChatLocalizeNew}/resources/hi/translation.json +11 -1
- package/src/shared/resources/{CometChatLocalize → CometChatLocalizeNew}/resources/hu/translation.json +10 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +456 -0
- package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +456 -0
- package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +456 -0
- package/src/shared/resources/{CometChatLocalize → CometChatLocalizeNew}/resources/lt/translation.json +10 -1
- package/src/shared/resources/{CometChatLocalize → CometChatLocalizeNew}/resources/ms/translation.json +10 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +456 -0
- package/src/shared/resources/{CometChatLocalize → CometChatLocalizeNew}/resources/pt/translation.json +10 -1
- package/src/shared/resources/{CometChatLocalize → CometChatLocalizeNew}/resources/ru/translation.json +10 -1
- package/src/shared/resources/{CometChatLocalize → CometChatLocalizeNew}/resources/sv/translation.json +11 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +456 -0
- package/src/shared/resources/{CometChatLocalize → CometChatLocalizeNew}/resources/zh/translation.json +11 -1
- package/src/shared/resources/{CometChatLocalize → CometChatLocalizeNew}/resources/zh-tw/translation.json +10 -1
- package/src/shared/resources/CometChatLocalizeNew/type.ts +7 -0
- package/src/shared/resources/CometChatLocalizeNew/useCometChatTranslationHook.ts +24 -0
- package/src/shared/resources/index.ts +2 -2
- package/src/shared/utils/CommonUtils.ts +2 -1
- package/src/shared/utils/PermissionUtil.ts +5 -4
- package/src/shared/utils/conversationUtils.ts +11 -9
- package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +8 -5
- package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +1 -1
- package/src/shared/views/CometChatDate/CometChatDate.tsx +17 -14
- package/src/shared/views/CometChatDateSeperator/CometChatDateSeparator.tsx +6 -4
- package/src/shared/views/CometChatDeletedBubble/CometChatDeletedBubble.tsx +3 -2
- package/src/shared/views/CometChatEmojiKeyboard/emojis.ts +11 -8
- package/src/shared/views/CometChatList/CometChatList.tsx +5 -4
- package/src/shared/views/CometChatMediaRecorder/CometChatAudioPreview/CometChatAudioPreview.tsx +15 -9
- package/src/shared/views/CometChatMediaRecorder/CometChatMediaRecorder.tsx +5 -4
- package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +3 -2
- package/src/shared/views/CometChatReactionList/CometChatReactionList.tsx +7 -6
- package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +10 -7
- package/src/shared/views/CometChatTooltipMenu/CometChatTooltipMenu.tsx +1 -0
- package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +24 -47
- package/src/shared/views/CometChatVideoPlayer/CometChatVideoPlayer.tsx +68 -73
- package/src/theme/type.ts +0 -2
- package/lib/theme/default/default.d.ts +0 -6
- package/lib/theme/default/default.js +0 -179
- package/lib/theme/default/default.js.map +0 -1
- package/src/shared/resources/CometChatLocalize/CometChatLocalize.ts +0 -183
- package/src/shared/resources/CometChatLocalize/index.ts +0 -3
- package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +0 -447
|
@@ -18,7 +18,7 @@ import { AnimatedAudioWaves } from "./AnimatedAudioWaves";
|
|
|
18
18
|
const { SoundPlayer } = NativeModules;
|
|
19
19
|
const eventEmitter = new NativeEventEmitter(SoundPlayer);
|
|
20
20
|
let listener: EmitterSubscription;
|
|
21
|
-
let interval:
|
|
21
|
+
let interval: ReturnType<typeof setTimeout>;;
|
|
22
22
|
|
|
23
23
|
export interface CometChatAudioBubbleInterface {
|
|
24
24
|
/**
|
|
@@ -70,22 +70,24 @@ export const CometChatAudioBubble = ({
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
return () => {
|
|
73
|
-
|
|
73
|
+
SoundPlayer.releaseMediaPlayer();
|
|
74
74
|
};
|
|
75
75
|
}, [audioUrl]);
|
|
76
76
|
|
|
77
77
|
useEffect(() => {
|
|
78
78
|
listener = eventEmitter.addListener("soundPlayStatus", (data) => {
|
|
79
79
|
if (audioUrl === data.url) {
|
|
80
|
-
setStatus("
|
|
80
|
+
setStatus("");
|
|
81
|
+
|
|
81
82
|
clearInterval(interval);
|
|
82
|
-
|
|
83
|
+
|
|
84
|
+
setCurrentTime(0);
|
|
83
85
|
}
|
|
84
86
|
});
|
|
85
87
|
|
|
86
88
|
return () => {
|
|
87
89
|
listener.remove();
|
|
88
|
-
|
|
90
|
+
clearInterval(interval);
|
|
89
91
|
};
|
|
90
92
|
}, [audioUrl]);
|
|
91
93
|
|
|
@@ -231,3 +233,4 @@ export const CometChatAudioBubble = ({
|
|
|
231
233
|
</View>
|
|
232
234
|
);
|
|
233
235
|
};
|
|
236
|
+
// CometChatAudioBubble
|
|
@@ -168,7 +168,7 @@ const CometChatBottomSheet = forwardRef(
|
|
|
168
168
|
flex: 1,
|
|
169
169
|
backgroundColor: overlayAnim.interpolate({
|
|
170
170
|
inputRange: [0, 0.2],
|
|
171
|
-
outputRange: ["rgba(0,0,0,0)", "rgba(0,0,0,0.
|
|
171
|
+
outputRange: ["rgba(0,0,0,0)", "rgba(0,0,0,0.35)"],
|
|
172
172
|
}),
|
|
173
173
|
}}
|
|
174
174
|
onStartShouldSetResponder={() => {
|
|
@@ -2,7 +2,8 @@ import React, { useMemo } from "react";
|
|
|
2
2
|
import { Text, View } from "react-native";
|
|
3
3
|
import { useTheme } from "../../../theme";
|
|
4
4
|
import { useCompTheme } from "../../../theme/hook";
|
|
5
|
-
import {
|
|
5
|
+
import { LocalizedDateHelper } from "./../../helper/LocalizedDateHelper";
|
|
6
|
+
import { useLocalizedDate } from "./../../helper/useLocalizedDateHook";
|
|
6
7
|
import { deepMerge } from "../../helper/helperFunctions";
|
|
7
8
|
import { ValueOf } from "../../helper/types";
|
|
8
9
|
import { DateStyle } from "./styles";
|
|
@@ -12,17 +13,17 @@ import { DateStyle } from "./styles";
|
|
|
12
13
|
*/
|
|
13
14
|
export interface CometChatDateInterface {
|
|
14
15
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
* Unix epoch time to be formatted and displayed.
|
|
17
|
+
*/
|
|
17
18
|
timeStamp?: number;
|
|
18
19
|
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
pattern?: ValueOf<typeof
|
|
20
|
+
* Pattern for formatting the date.
|
|
21
|
+
* One of the following values:
|
|
22
|
+
* - timeFormat: "hh:mm a".
|
|
23
|
+
* - dayDateFormat: Today, Yesterday, week-day or "d MMM, yyyy".
|
|
24
|
+
* - dayWeekDayDateTimeFormat: Today, Yesterday, week-day or "dd/mm/yyyy".
|
|
25
|
+
*/
|
|
26
|
+
pattern?: ValueOf<typeof LocalizedDateHelper.patterns>;
|
|
26
27
|
/**
|
|
27
28
|
* A custom date string to override the formatted date.
|
|
28
29
|
*/
|
|
@@ -46,6 +47,8 @@ export const CometChatDate = (props: CometChatDateInterface) => {
|
|
|
46
47
|
const { timeStamp, pattern, customDateString, style = {} } = props;
|
|
47
48
|
const theme = useTheme();
|
|
48
49
|
const compTheme = useCompTheme();
|
|
50
|
+
const { formatDate } = useLocalizedDate();
|
|
51
|
+
if (!timeStamp) return null;
|
|
49
52
|
|
|
50
53
|
// Merge theme date styles with component date styles and any custom style overrides.
|
|
51
54
|
const dateStyles = useMemo(() => {
|
|
@@ -56,10 +59,10 @@ export const CometChatDate = (props: CometChatDateInterface) => {
|
|
|
56
59
|
<View style={[dateStyles.containerStyle]}>
|
|
57
60
|
<Text style={[dateStyles.textStyle]} numberOfLines={1}>
|
|
58
61
|
{timeStamp
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
? customDateString
|
|
63
|
+
? customDateString
|
|
64
|
+
: pattern && formatDate(timeStamp, pattern)
|
|
65
|
+
: ""}
|
|
63
66
|
</Text>
|
|
64
67
|
</View>
|
|
65
68
|
);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Text, View } from "react-native";
|
|
3
3
|
import { useTheme } from "../../../theme";
|
|
4
|
-
import {
|
|
4
|
+
import { LocalizedDateHelper } from "../../helper/LocalizedDateHelper";
|
|
5
5
|
import { ValueOf } from "../../helper/types";
|
|
6
6
|
import { CometChatTheme } from "../../../theme/type";
|
|
7
|
+
import { useLocalizedDate } from "./../../helper/useLocalizedDateHook";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Props for the CometChatDateSeparator component.
|
|
@@ -20,7 +21,7 @@ export interface CometChatDateSeparatorInterface {
|
|
|
20
21
|
* - dayDateFormat: Today, Yesterday, or "d MMM, yyyy"
|
|
21
22
|
* - dayWeekDayDateTimeFormat: Today (time), weekday, Yesterday, or "dd/mm/yyyy"
|
|
22
23
|
*/
|
|
23
|
-
pattern: ValueOf<typeof
|
|
24
|
+
pattern: ValueOf<typeof LocalizedDateHelper.patterns>;
|
|
24
25
|
/**
|
|
25
26
|
* Custom string to be displayed instead of the formatted date.
|
|
26
27
|
*/
|
|
@@ -34,20 +35,21 @@ export interface CometChatDateSeparatorInterface {
|
|
|
34
35
|
/**
|
|
35
36
|
* CometChatDateSeparator is a component that displays a formatted date/time separator
|
|
36
37
|
* between messages. If a custom date string is provided, it will be displayed instead.
|
|
37
|
-
*
|
|
38
|
+
*
|
|
38
39
|
* - Props for the component.
|
|
39
40
|
* The rendered date separator view.
|
|
40
41
|
*/
|
|
41
42
|
export const CometChatDateSeparator = (props: CometChatDateSeparatorInterface) => {
|
|
42
43
|
const { timeStamp, pattern, customDateString, style } = props;
|
|
43
44
|
const theme = useTheme();
|
|
45
|
+
const { formatDate } = useLocalizedDate();
|
|
44
46
|
|
|
45
47
|
return (
|
|
46
48
|
<View style={[theme.dateSeparatorStyles.containerStyle, style?.containerStyle]}>
|
|
47
49
|
<Text style={[theme.dateSeparatorStyles.textStyle, style?.textStyle]}>
|
|
48
50
|
{customDateString
|
|
49
51
|
? customDateString
|
|
50
|
-
:
|
|
52
|
+
: formatDate(timeStamp, pattern)}
|
|
51
53
|
</Text>
|
|
52
54
|
</View>
|
|
53
55
|
);
|
|
@@ -2,9 +2,9 @@ import React from "react";
|
|
|
2
2
|
import { View } from "react-native";
|
|
3
3
|
import { useTheme } from "../../../theme";
|
|
4
4
|
import { Icon } from "../../icons/Icon";
|
|
5
|
-
import { localize } from "../../resources";
|
|
6
5
|
import { CometChatTextBubbleText } from "../CometChatTextBubble/CometChatTextBubble";
|
|
7
6
|
import { DeletedBubbleStyle } from "./styles";
|
|
7
|
+
import { useCometChatTranslation } from "../../resources/CometChatLocalizeNew";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Props for the CometChatDeletedBubble component.
|
|
@@ -29,7 +29,8 @@ export interface CometChatDeletedBubbleInterface {
|
|
|
29
29
|
*/
|
|
30
30
|
export const CometChatDeletedBubble = (props: CometChatDeletedBubbleInterface) => {
|
|
31
31
|
const theme = useTheme();
|
|
32
|
-
const {
|
|
32
|
+
const {t}=useCometChatTranslation()
|
|
33
|
+
const { text = t("DELETE_MSG_TEXT"), style = {} } = props;
|
|
33
34
|
|
|
34
35
|
return (
|
|
35
36
|
<View
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { getCometChatTranslation } from "../../../shared";
|
|
2
|
+
const t = getCometChatTranslation();
|
|
3
|
+
|
|
1
4
|
export const Emojis = [
|
|
2
5
|
{
|
|
3
6
|
people: {
|
|
4
7
|
id: "people",
|
|
5
|
-
name: "
|
|
8
|
+
name: t("SMILEY_PEOPLE"),
|
|
6
9
|
symbol: "Smileys",
|
|
7
10
|
emojis: {
|
|
8
11
|
grinning: {
|
|
@@ -1701,7 +1704,7 @@ export const Emojis = [
|
|
|
1701
1704
|
{
|
|
1702
1705
|
animals: {
|
|
1703
1706
|
id: "animals_and_nature",
|
|
1704
|
-
name: "
|
|
1707
|
+
name: t("ANIMALES_NATURE"),
|
|
1705
1708
|
symbol: "Animals",
|
|
1706
1709
|
emojis: {
|
|
1707
1710
|
dog: {
|
|
@@ -2464,7 +2467,7 @@ export const Emojis = [
|
|
|
2464
2467
|
{
|
|
2465
2468
|
food: {
|
|
2466
2469
|
id: "food_and_drink",
|
|
2467
|
-
name: "
|
|
2470
|
+
name: t("FOOD_DRINK"),
|
|
2468
2471
|
symbol: "Food",
|
|
2469
2472
|
emojis: {
|
|
2470
2473
|
green_apple: {
|
|
@@ -2947,7 +2950,7 @@ export const Emojis = [
|
|
|
2947
2950
|
{
|
|
2948
2951
|
activity: {
|
|
2949
2952
|
id: "activity",
|
|
2950
|
-
name: "
|
|
2953
|
+
name: t("ACTIVITY"),
|
|
2951
2954
|
symbol: "Activity",
|
|
2952
2955
|
emojis: {
|
|
2953
2956
|
soccer: {
|
|
@@ -3377,7 +3380,7 @@ export const Emojis = [
|
|
|
3377
3380
|
{
|
|
3378
3381
|
travel: {
|
|
3379
3382
|
id: "travel_and_places",
|
|
3380
|
-
name: "
|
|
3383
|
+
name: t("TRAVEL_PLACES"),
|
|
3381
3384
|
symbol: "Travel",
|
|
3382
3385
|
emojis: {
|
|
3383
3386
|
red_car: {
|
|
@@ -3873,7 +3876,7 @@ export const Emojis = [
|
|
|
3873
3876
|
{
|
|
3874
3877
|
objects: {
|
|
3875
3878
|
id: "objects",
|
|
3876
|
-
name: "
|
|
3879
|
+
name: t("OBJECTS"),
|
|
3877
3880
|
symbol: "Objects",
|
|
3878
3881
|
emojis: {
|
|
3879
3882
|
watch: {
|
|
@@ -4768,7 +4771,7 @@ export const Emojis = [
|
|
|
4768
4771
|
{
|
|
4769
4772
|
symbols: {
|
|
4770
4773
|
id: "symbols",
|
|
4771
|
-
name: "
|
|
4774
|
+
name: t("SYMBOLS"),
|
|
4772
4775
|
symbol: "Symbols",
|
|
4773
4776
|
emojis: {
|
|
4774
4777
|
heart: {
|
|
@@ -5928,7 +5931,7 @@ export const Emojis = [
|
|
|
5928
5931
|
{
|
|
5929
5932
|
flags: {
|
|
5930
5933
|
id: "flags",
|
|
5931
|
-
name: "
|
|
5934
|
+
name: t("FLAGS"),
|
|
5932
5935
|
symbol: "Flags",
|
|
5933
5936
|
emojis: {
|
|
5934
5937
|
afghanistan: {
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
ViewStyle,
|
|
14
14
|
} from "react-native";
|
|
15
15
|
import { LOADING, NO_DATA_FOUND, SOMETHING_WRONG } from "../../constants/UIKitConstants";
|
|
16
|
-
import { localize } from "../../resources/CometChatLocalize";
|
|
17
16
|
|
|
18
17
|
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
19
18
|
import { useTheme } from "../../../theme";
|
|
@@ -28,6 +27,7 @@ import {
|
|
|
28
27
|
} from "../CometChatStatusIndicator";
|
|
29
28
|
import Header from "./Header";
|
|
30
29
|
import styles from "./styles";
|
|
30
|
+
import { useCometChatTranslation } from "../../resources/CometChatLocalizeNew";
|
|
31
31
|
|
|
32
32
|
export interface CometChatListActionsInterface {
|
|
33
33
|
updateList: (prop: any) => void;
|
|
@@ -152,6 +152,7 @@ export const CometChatList = React.forwardRef<CometChatListActionsInterface, Com
|
|
|
152
152
|
(props, ref) => {
|
|
153
153
|
const connectionListenerId = "connectionListener_" + new Date().getTime();
|
|
154
154
|
const theme = useTheme();
|
|
155
|
+
const {t}= useCometChatTranslation()
|
|
155
156
|
const [isLoadingMore, setIsLoadingMore] = useState(false);
|
|
156
157
|
const [hasMoreData, setHasMoreData] = useState(true);
|
|
157
158
|
|
|
@@ -171,8 +172,8 @@ export const CometChatList = React.forwardRef<CometChatListActionsInterface, Com
|
|
|
171
172
|
hideSearch = false,
|
|
172
173
|
title = "Title",
|
|
173
174
|
EmptyView,
|
|
174
|
-
emptyStateText =
|
|
175
|
-
errorStateText =
|
|
175
|
+
emptyStateText = t("NO_USERS_FOUND"),
|
|
176
|
+
errorStateText = t("SOMETHING_WRONG"),
|
|
176
177
|
ErrorView,
|
|
177
178
|
LoadingView,
|
|
178
179
|
requestBuilder,
|
|
@@ -560,7 +561,7 @@ export const CometChatList = React.forwardRef<CometChatListActionsInterface, Com
|
|
|
560
561
|
item.value.uid &&
|
|
561
562
|
item.value.uid === CometChatUIKit.loggedInUser!.getUid() &&
|
|
562
563
|
item.value.name === CometChatUIKit.loggedInUser!.getName()
|
|
563
|
-
?
|
|
564
|
+
? t("YOU")
|
|
564
565
|
: item.value.name
|
|
565
566
|
}
|
|
566
567
|
containerStyle={[listStyle?.itemStyle?.containerStyle]}
|
package/src/shared/views/CometChatMediaRecorder/CometChatAudioPreview/CometChatAudioPreview.tsx
CHANGED
|
@@ -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();
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
TouchableOpacity,
|
|
10
10
|
View,
|
|
11
11
|
} from "react-native";
|
|
12
|
-
import { localize } from "../..";
|
|
13
12
|
import { useTheme } from "../../../theme";
|
|
14
13
|
import { Icon } from "../../icons/Icon";
|
|
15
14
|
import { AnimatingMic } from "./AnimatingMic";
|
|
@@ -17,6 +16,7 @@ import { Timer } from "./Timer";
|
|
|
17
16
|
import { CometChatAudioPreview } from "./CometChatAudioPreview/CometChatAudioPreview";
|
|
18
17
|
import { CometChatTheme } from "../../../theme/type";
|
|
19
18
|
import { deepMerge } from "../../helper/helperFunctions";
|
|
19
|
+
import { useCometChatTranslation } from "../../resources/CometChatLocalizeNew";
|
|
20
20
|
|
|
21
21
|
export interface CometChatMediaRecorderInterface {
|
|
22
22
|
onClose?: Function;
|
|
@@ -41,6 +41,7 @@ export const CometChatMediaRecorder = (props: CometChatMediaRecorderInterface) =
|
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
const theme = useTheme();
|
|
44
|
+
const {t}=useCometChatTranslation()
|
|
44
45
|
const mergedStyle = useMemo(() => {
|
|
45
46
|
return deepMerge(theme.mediaRecorderStyle, style ?? {});
|
|
46
47
|
}, [theme, style]);
|
|
@@ -73,14 +74,14 @@ export const CometChatMediaRecorder = (props: CometChatMediaRecorderInterface) =
|
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
function permissionAlert() {
|
|
76
|
-
Alert.alert('',
|
|
77
|
+
Alert.alert('', t("MICROPHONE_PERMISSION"), [
|
|
77
78
|
{
|
|
78
79
|
style: "cancel",
|
|
79
|
-
text:
|
|
80
|
+
text: t("CANCEL"),
|
|
80
81
|
},
|
|
81
82
|
{
|
|
82
83
|
style: "default",
|
|
83
|
-
text:
|
|
84
|
+
text: t("SETTINGS"),
|
|
84
85
|
onPress: () => {
|
|
85
86
|
Linking.openSettings();
|
|
86
87
|
},
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
ViewStyle,
|
|
10
10
|
} from "react-native";
|
|
11
11
|
import { useTheme } from "../../../theme";
|
|
12
|
-
import { localize } from "../../resources/CometChatLocalize";
|
|
13
12
|
import { CometChatTheme } from "../../../theme/type";
|
|
14
13
|
import { CometChatUIEventHandler, CometChatUIEvents } from "../../events";
|
|
15
14
|
import { ViewAlignment } from "../../constants/UIKitConstants";
|
|
15
|
+
import { useCometChatTranslation } from "../../resources/CometChatLocalizeNew";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Props for the CometChatMessageInput component.
|
|
@@ -99,9 +99,10 @@ export interface CometChatMessageInputInterface {
|
|
|
99
99
|
*/
|
|
100
100
|
export const CometChatMessageInput = (props: CometChatMessageInputInterface) => {
|
|
101
101
|
const theme = useTheme();
|
|
102
|
+
const {t}= useCometChatTranslation()
|
|
102
103
|
const {
|
|
103
104
|
text = "",
|
|
104
|
-
placeHolderText =
|
|
105
|
+
placeHolderText = t("ENTER_YOUR_MESSAGE_HERE"),
|
|
105
106
|
onChangeText,
|
|
106
107
|
style,
|
|
107
108
|
SecondaryButtonView,
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
TouchableOpacity,
|
|
10
10
|
View,
|
|
11
11
|
} from "react-native";
|
|
12
|
-
import { localize } from "../../resources";
|
|
13
12
|
import { CommonUtils } from "../../utils/CommonUtils";
|
|
14
13
|
import { CometChatListItem } from "../CometChatListItem";
|
|
15
14
|
import { useTheme } from "../../../theme";
|
|
@@ -18,6 +17,7 @@ import { ErrorEmptyView } from "../ErrorEmptyView/ErrorEmptyView";
|
|
|
18
17
|
import { Icon } from "../../icons/Icon";
|
|
19
18
|
import { CometChatUIEventHandler, MessageEvents } from "../../events";
|
|
20
19
|
import { messageStatus } from "../../utils/CometChatMessageHelper";
|
|
20
|
+
import { useCometChatTranslation } from "../../resources/CometChatLocalizeNew";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Props for the CometChatReactionList component.
|
|
@@ -76,6 +76,7 @@ export const CometChatReactionList = (props: CometChatReactionListInterface) =>
|
|
|
76
76
|
onListEmpty,
|
|
77
77
|
} = props;
|
|
78
78
|
const theme = useTheme();
|
|
79
|
+
const {t} =useCometChatTranslation()
|
|
79
80
|
const reactionListStyleFromTheme = theme.reactionListStyles.reactionListItemStyle;
|
|
80
81
|
const tabStyleFromTheme = theme.reactionListStyles.tabStyle;
|
|
81
82
|
|
|
@@ -333,14 +334,14 @@ export const CometChatReactionList = (props: CometChatReactionListInterface) =>
|
|
|
333
334
|
const subtitleView = useCallback((item: any) => {
|
|
334
335
|
let reactedByMe = loggedInUser.current!.getUid() === item?.reactedBy?.uid;
|
|
335
336
|
return reactedByMe ? (
|
|
336
|
-
<Text style={reactionListStyleFromTheme.subtitleStyle}>{
|
|
337
|
+
<Text style={reactionListStyleFromTheme.subtitleStyle}>{t("TAP_TO_REMOVE")}</Text>
|
|
337
338
|
) : null;
|
|
338
339
|
}, []);
|
|
339
340
|
|
|
340
341
|
const _render = ({ item, index }: { item: any; index: number }) => {
|
|
341
342
|
function getName() {
|
|
342
343
|
let reactedByMe = loggedInUser.current!.getUid() === item?.reactedBy?.uid;
|
|
343
|
-
return reactedByMe ?
|
|
344
|
+
return reactedByMe ? t("YOU") : item?.reactedBy?.name;
|
|
344
345
|
}
|
|
345
346
|
|
|
346
347
|
return (
|
|
@@ -377,8 +378,8 @@ export const CometChatReactionList = (props: CometChatReactionListInterface) =>
|
|
|
377
378
|
return (
|
|
378
379
|
<ErrorEmptyView
|
|
379
380
|
title={errorStateText ?? "Oops!"}
|
|
380
|
-
subTitle={
|
|
381
|
-
tertiaryTitle={
|
|
381
|
+
subTitle={t("SOMETHING_WENT_WRONG")}
|
|
382
|
+
tertiaryTitle={t("WRONG_TEXT_TRY_AGAIN")}
|
|
382
383
|
Icon={
|
|
383
384
|
<Icon
|
|
384
385
|
name='error-state'
|
|
@@ -444,7 +445,7 @@ export const CometChatReactionList = (props: CometChatReactionListInterface) =>
|
|
|
444
445
|
}
|
|
445
446
|
>
|
|
446
447
|
{reactionObject?.getReaction() === "All"
|
|
447
|
-
?
|
|
448
|
+
? t("ALL")
|
|
448
449
|
: reactionObject?.getReaction()}
|
|
449
450
|
</Text>
|
|
450
451
|
<Text
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
CometChatTextFormatter,
|
|
14
14
|
CometChatUrlsFormatter,
|
|
15
15
|
} from "../../formatters";
|
|
16
|
-
import {
|
|
16
|
+
import { useCometChatTranslation } from "../../resources/CometChatLocalizeNew";
|
|
17
17
|
|
|
18
18
|
export interface CometChatTextBubbleInterface {
|
|
19
19
|
/**
|
|
@@ -42,6 +42,7 @@ export const CometChatTextBubble = (props: CometChatTextBubbleInterface) => {
|
|
|
42
42
|
export const CometChatTextBubbleText = (
|
|
43
43
|
props: Omit<CometChatTextBubbleInterface, "textContainerStyle">
|
|
44
44
|
) => {
|
|
45
|
+
const {t}= useCometChatTranslation()
|
|
45
46
|
const { text = "", textFormatters, textStyle } = props;
|
|
46
47
|
const [formattedText, setFormattedText] = useState<string>("");
|
|
47
48
|
// This flag will be set if the text exceeds 4 lines in collapsed mode.
|
|
@@ -60,18 +61,19 @@ export const CometChatTextBubbleText = (
|
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
setFormattedText(finalText);
|
|
63
|
-
//
|
|
64
|
-
|
|
64
|
+
// Don't reset the truncated flag when text is the same, only when text actually changes
|
|
65
|
+
// This preserves the expanded state when messages are updated for reactions, etc.
|
|
65
66
|
}, [text, textFormatters]);
|
|
66
67
|
|
|
67
68
|
// For Android, onTextLayout reliably provides the number of lines.
|
|
68
69
|
const handleTextLayout = (event: any) => {
|
|
69
70
|
const { lines } = event.nativeEvent;
|
|
70
71
|
if (lines.length > 4) {
|
|
72
|
+
// Only set to true, never reset to false when a message is updated
|
|
73
|
+
// This preserves the truncated state when the message is updated (e.g., reactions added)
|
|
71
74
|
setIsTruncated(true);
|
|
72
|
-
} else {
|
|
73
|
-
setIsTruncated(false);
|
|
74
75
|
}
|
|
76
|
+
// We no longer set isTruncated to false here to preserve state during updates
|
|
75
77
|
};
|
|
76
78
|
|
|
77
79
|
// onLayout callback for the collapsed text (iOS)
|
|
@@ -95,7 +97,8 @@ export const CometChatTextBubbleText = (
|
|
|
95
97
|
return (
|
|
96
98
|
<View>
|
|
97
99
|
<Text
|
|
98
|
-
|
|
100
|
+
// Use text content in the key to ensure it only re-renders when text changes
|
|
101
|
+
key={`${expanded ? "expanded" : "collapsed"}-${text}`}
|
|
99
102
|
style={textStyle}
|
|
100
103
|
// Android uses onTextLayout for measuring lines.
|
|
101
104
|
onTextLayout={Platform.OS !== "ios" ? handleTextLayout : undefined}
|
|
@@ -122,7 +125,7 @@ export const CometChatTextBubbleText = (
|
|
|
122
125
|
<View style={{ alignItems: "flex-end", marginTop: 8 }}>
|
|
123
126
|
<TouchableOpacity onPress={() => setExpanded(!expanded)}>
|
|
124
127
|
<Text style={textStyle}>
|
|
125
|
-
{expanded ?
|
|
128
|
+
{expanded ? t("SHOW_LESS") : t("READ_MORE")}
|
|
126
129
|
</Text>
|
|
127
130
|
</TouchableOpacity>
|
|
128
131
|
</View>
|
|
@@ -23,6 +23,7 @@ const { width: screenWidth, height: screenHeight } = Dimensions.get("window");
|
|
|
23
23
|
*/
|
|
24
24
|
export interface MenuItemInterface {
|
|
25
25
|
text: string;
|
|
26
|
+
translationKey?: string; // for localization
|
|
26
27
|
onPress: () => void;
|
|
27
28
|
icon?: ImageSourcePropType | JSX.Element;
|
|
28
29
|
textStyle?: TextStyle;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {JSX, useEffect,
|
|
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
|
+
};
|