@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
|
@@ -26,7 +26,6 @@ import { CometChatMessageComposerAction } from "../helper/types";
|
|
|
26
26
|
import { Icon } from "../icons/Icon";
|
|
27
27
|
import { CometChatMessageOption } from "../modals/CometChatMessageOption";
|
|
28
28
|
import { CometChatMessageTemplate } from "../modals/CometChatMessageTemplate";
|
|
29
|
-
import { localize } from "../resources/CometChatLocalize";
|
|
30
29
|
import { CometChatConversationUtils } from "../utils/conversationUtils";
|
|
31
30
|
import { CometChatAudioBubble } from "../views/CometChatAudioBubble";
|
|
32
31
|
import { CometChatDeletedBubble } from "../views/CometChatDeletedBubble";
|
|
@@ -38,6 +37,14 @@ import { ChatConfigurator } from "./ChatConfigurator";
|
|
|
38
37
|
import { DataSource } from "./DataSource";
|
|
39
38
|
import { CommonUtils } from "../utils/CommonUtils";
|
|
40
39
|
import { DimensionValue, ViewStyle } from "react-native";
|
|
40
|
+
import { getCometChatTranslation } from "../../shared";
|
|
41
|
+
|
|
42
|
+
const t = getCometChatTranslation();
|
|
43
|
+
|
|
44
|
+
export enum MentionContext {
|
|
45
|
+
Incoming = 'incoming',
|
|
46
|
+
Outgoing = 'outgoing',
|
|
47
|
+
}
|
|
41
48
|
|
|
42
49
|
function isAudioMessage(message: CometChat.BaseMessage): message is CometChat.MediaMessage {
|
|
43
50
|
return (
|
|
@@ -86,7 +93,7 @@ export class MessageDataSource implements DataSource {
|
|
|
86
93
|
getEditOption(theme: CometChatTheme): CometChatMessageOption {
|
|
87
94
|
return {
|
|
88
95
|
id: MessageOptionConstants.editMessage,
|
|
89
|
-
title:
|
|
96
|
+
title: t("EDIT"),
|
|
90
97
|
icon: (
|
|
91
98
|
<Icon
|
|
92
99
|
name='edit'
|
|
@@ -106,7 +113,7 @@ export class MessageDataSource implements DataSource {
|
|
|
106
113
|
getDeleteOption(theme: CometChatTheme): CometChatMessageOption {
|
|
107
114
|
return {
|
|
108
115
|
id: MessageOptionConstants.deleteMessage,
|
|
109
|
-
title:
|
|
116
|
+
title: t("DELETE"),
|
|
110
117
|
icon: (
|
|
111
118
|
<Icon
|
|
112
119
|
name='delete'
|
|
@@ -128,7 +135,7 @@ export class MessageDataSource implements DataSource {
|
|
|
128
135
|
getReplyOption(theme: CometChatTheme): CometChatMessageOption {
|
|
129
136
|
return {
|
|
130
137
|
id: MessageOptionConstants.replyMessage,
|
|
131
|
-
title:
|
|
138
|
+
title: t("REPLY"),
|
|
132
139
|
icon: (
|
|
133
140
|
<Icon
|
|
134
141
|
name='reply'
|
|
@@ -147,7 +154,7 @@ export class MessageDataSource implements DataSource {
|
|
|
147
154
|
getReplyInThreadOption(theme: CometChatTheme): CometChatMessageOption {
|
|
148
155
|
return {
|
|
149
156
|
id: MessageOptionConstants.replyInThread,
|
|
150
|
-
title:
|
|
157
|
+
title: t("REPLY_IN_THREAD"),
|
|
151
158
|
icon: (
|
|
152
159
|
<Icon
|
|
153
160
|
name='subdirectory-arrow-right'
|
|
@@ -166,7 +173,7 @@ export class MessageDataSource implements DataSource {
|
|
|
166
173
|
getShareOption(theme: CometChatTheme): CometChatMessageOption {
|
|
167
174
|
return {
|
|
168
175
|
id: MessageOptionConstants.shareMessage,
|
|
169
|
-
title:
|
|
176
|
+
title: t("SHARE"),
|
|
170
177
|
icon: (
|
|
171
178
|
<Icon
|
|
172
179
|
name='share'
|
|
@@ -185,7 +192,7 @@ export class MessageDataSource implements DataSource {
|
|
|
185
192
|
getCopyOption(theme: CometChatTheme): CometChatMessageOption {
|
|
186
193
|
return {
|
|
187
194
|
id: MessageOptionConstants.copyMessage,
|
|
188
|
-
title:
|
|
195
|
+
title: t("COPY"),
|
|
189
196
|
icon: (
|
|
190
197
|
<Icon
|
|
191
198
|
name='content-copy'
|
|
@@ -204,14 +211,14 @@ export class MessageDataSource implements DataSource {
|
|
|
204
211
|
// getForwardOption(): CometChatMessageOption {
|
|
205
212
|
// return {
|
|
206
213
|
// id: MessageOptionConstants.forwardMessage,
|
|
207
|
-
// title:
|
|
214
|
+
// title: t("FORWARD"),
|
|
208
215
|
// icon: ICONS.FORWARD
|
|
209
216
|
// }
|
|
210
217
|
// }
|
|
211
218
|
getInformationOption(theme: CometChatTheme): CometChatMessageOption {
|
|
212
219
|
return {
|
|
213
220
|
id: MessageOptionConstants.messageInformation,
|
|
214
|
-
title:
|
|
221
|
+
title: t("INFO"),
|
|
215
222
|
icon: (
|
|
216
223
|
<Icon
|
|
217
224
|
name='info'
|
|
@@ -231,7 +238,7 @@ export class MessageDataSource implements DataSource {
|
|
|
231
238
|
getPrivateMessageOption(theme: CometChatTheme): CometChatMessageOption {
|
|
232
239
|
return {
|
|
233
240
|
id: MessageOptionConstants.sendMessagePrivately,
|
|
234
|
-
title:
|
|
241
|
+
title: t("MESSAGE_PRIVATELY"),
|
|
235
242
|
icon: (
|
|
236
243
|
<Icon
|
|
237
244
|
name='reply'
|
|
@@ -662,11 +669,128 @@ export class MessageDataSource implements DataSource {
|
|
|
662
669
|
return messageOptionList;
|
|
663
670
|
}
|
|
664
671
|
|
|
672
|
+
/**
|
|
673
|
+
* Returns a localized group action message string for group events (added, kicked, banned, etc.)
|
|
674
|
+
*/
|
|
675
|
+
getActionMessage(message: any): string {
|
|
676
|
+
|
|
677
|
+
let actionMessage = "";
|
|
678
|
+
|
|
679
|
+
if (!message || typeof message !== "object") {
|
|
680
|
+
return "";
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
const action =
|
|
684
|
+
message.action ||
|
|
685
|
+
message.data?.action ||
|
|
686
|
+
message.rawMessage?.action;
|
|
687
|
+
|
|
688
|
+
const actionBy = message.actionBy || message.rawMessage?.actionBy;
|
|
689
|
+
const actionOn = message.actionOn || message.rawMessage?.actionOn;
|
|
690
|
+
|
|
691
|
+
// Do NOT require actionOn for JOINED/LEFT.
|
|
692
|
+
const requiresActionOn = action !== "joined" && action !== "left";
|
|
693
|
+
|
|
694
|
+
if (!actionBy || (requiresActionOn && !actionOn)) {
|
|
695
|
+
return message.message || "";
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
// Names (JOINED/LEFT only need byName)
|
|
699
|
+
const byName = actionBy?.name || "User";
|
|
700
|
+
const onName = requiresActionOn ? (actionOn?.name || "User") : "";
|
|
701
|
+
|
|
702
|
+
const GroupMemberAction = {
|
|
703
|
+
ADDED: "added",
|
|
704
|
+
JOINED: "joined",
|
|
705
|
+
LEFT: "left",
|
|
706
|
+
KICKED: "kicked",
|
|
707
|
+
BANNED: "banned",
|
|
708
|
+
UNBANNED: "unbanned",
|
|
709
|
+
SCOPE_CHANGE: "scopeChanged",
|
|
710
|
+
} as const;
|
|
711
|
+
|
|
712
|
+
switch (action) {
|
|
713
|
+
case GroupMemberAction.ADDED:
|
|
714
|
+
// Use template string with placeholders for names
|
|
715
|
+
actionMessage = t("MESSAGE_LIST_ACTION_ADDED").replace("${byName}", byName).replace("${onName}", onName);
|
|
716
|
+
// Fallback to simpler format if template is missing
|
|
717
|
+
if (actionMessage === "MESSAGE_LIST_ACTION_ADDED") {
|
|
718
|
+
actionMessage = `${byName} ${t("ADDED")} ${onName}`;
|
|
719
|
+
}
|
|
720
|
+
break;
|
|
721
|
+
|
|
722
|
+
case GroupMemberAction.JOINED:
|
|
723
|
+
// No onName needed
|
|
724
|
+
actionMessage = t("MESSAGE_LIST_ACTION_JOINED").replace("${byName}", byName);
|
|
725
|
+
if (actionMessage === "MESSAGE_LIST_ACTION_JOINED") {
|
|
726
|
+
actionMessage = `${byName} ${t("JOINED")}`;
|
|
727
|
+
}
|
|
728
|
+
break;
|
|
729
|
+
|
|
730
|
+
case GroupMemberAction.LEFT:
|
|
731
|
+
// No onName needed
|
|
732
|
+
actionMessage = t("MESSAGE_LIST_ACTION_LEFT").replace("${byName}", byName);
|
|
733
|
+
if (actionMessage === "MESSAGE_LIST_ACTION_LEFT") {
|
|
734
|
+
actionMessage = `${byName} ${t("LEFT")}`;
|
|
735
|
+
}
|
|
736
|
+
break;
|
|
737
|
+
|
|
738
|
+
case GroupMemberAction.KICKED:
|
|
739
|
+
actionMessage = t("MESSAGE_LIST_ACTION_KICKED").replace("${byName}", byName).replace("${onName}", onName);
|
|
740
|
+
if (actionMessage === "MESSAGE_LIST_ACTION_KICKED") {
|
|
741
|
+
actionMessage = `${byName} ${t("KICKED")} ${onName}`;
|
|
742
|
+
}
|
|
743
|
+
break;
|
|
744
|
+
|
|
745
|
+
case GroupMemberAction.BANNED:
|
|
746
|
+
actionMessage = t("MESSAGE_LIST_ACTION_BANNED").replace("${byName}", byName).replace("${onName}", onName);
|
|
747
|
+
if (actionMessage === "MESSAGE_LIST_ACTION_BANNED") {
|
|
748
|
+
actionMessage = `${byName} ${t("BANNED")} ${onName}`;
|
|
749
|
+
}
|
|
750
|
+
break;
|
|
751
|
+
|
|
752
|
+
case GroupMemberAction.UNBANNED:
|
|
753
|
+
actionMessage = t("MESSAGE_LIST_ACTION_UNBANNED").replace("${byName}", byName).replace("${onName}", onName);
|
|
754
|
+
if (actionMessage === "MESSAGE_LIST_ACTION_UNBANNED") {
|
|
755
|
+
actionMessage = `${byName} ${t("UNBANNED")} ${onName}`;
|
|
756
|
+
}
|
|
757
|
+
break;
|
|
758
|
+
|
|
759
|
+
case GroupMemberAction.SCOPE_CHANGE: {
|
|
760
|
+
const newScope =
|
|
761
|
+
message.newScope ||
|
|
762
|
+
message.data?.extras?.scope?.new ||
|
|
763
|
+
message.rawMessage?.data?.extras?.scope?.new ||
|
|
764
|
+
"";
|
|
765
|
+
|
|
766
|
+
const translatedRole = newScope ? t(newScope.toUpperCase()) : "";
|
|
767
|
+
|
|
768
|
+
// Template with three placeholders
|
|
769
|
+
actionMessage = t("MESSAGE_LIST_ACTION_SCOPE_CHANGED")
|
|
770
|
+
.replace("${byName}", byName)
|
|
771
|
+
.replace("${onName}", onName)
|
|
772
|
+
.replace("${role}", translatedRole);
|
|
773
|
+
|
|
774
|
+
if (actionMessage === "MESSAGE_LIST_ACTION_SCOPE_CHANGED") {
|
|
775
|
+
actionMessage = `${byName} ${t("MADE")} ${onName} ${translatedRole}`.trim();
|
|
776
|
+
}
|
|
777
|
+
break;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
default:
|
|
781
|
+
actionMessage = message.message || "";
|
|
782
|
+
break;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
return actionMessage;
|
|
786
|
+
}
|
|
787
|
+
|
|
665
788
|
getGroupActionBubble(message: CometChat.BaseMessage, theme: CometChatTheme): JSX.Element | null {
|
|
666
789
|
if (isActionMessage(message)) {
|
|
790
|
+
const messageText = this.getActionMessage(message)
|
|
667
791
|
return (
|
|
668
792
|
<CometChatTextBubble
|
|
669
|
-
text={
|
|
793
|
+
text={messageText}
|
|
670
794
|
textContainerStyle={theme.messageListStyles?.groupActionBubbleStyles?.textContainerStyle}
|
|
671
795
|
textStyle={theme?.messageListStyles?.groupActionBubbleStyles?.textStyle}
|
|
672
796
|
/>
|
|
@@ -738,8 +862,10 @@ export class MessageDataSource implements DataSource {
|
|
|
738
862
|
|
|
739
863
|
let linksTextFormatter = ChatConfigurator.getDataSource().getUrlsFormatter(loggedInUser!);
|
|
740
864
|
let mentionsTextFormatter = ChatConfigurator.getDataSource().getMentionsFormatter(
|
|
741
|
-
loggedInUser
|
|
865
|
+
loggedInUser!,
|
|
866
|
+
theme
|
|
742
867
|
);
|
|
868
|
+
mentionsTextFormatter.setContext(isMessageSentByLoggedInUser ? MentionContext.Outgoing : MentionContext.Incoming);
|
|
743
869
|
linksTextFormatter.setMessage(message);
|
|
744
870
|
linksTextFormatter.setId("ccDefaultUrlsFormatterId");
|
|
745
871
|
linksTextFormatter.setStyle({ linkTextColor: theme.color.receiveBubbleLink });
|
|
@@ -751,13 +877,6 @@ export class MessageDataSource implements DataSource {
|
|
|
751
877
|
mentionsTextFormatter.setLoggedInUser(loggedInUser!);
|
|
752
878
|
mentionsTextFormatter.setMessage(message);
|
|
753
879
|
mentionsTextFormatter.setId("ccDefaultMentionFormatterId");
|
|
754
|
-
let isUserSentMessage = message.getSender().getUid() == loggedInUser!.getUid();
|
|
755
|
-
if (isUserSentMessage) {
|
|
756
|
-
mentionsTextFormatter.setMentionsStyle(_style?.mentionsStyle);
|
|
757
|
-
} else {
|
|
758
|
-
mentionsTextFormatter.setMentionsStyle(_style?.mentionsStyle);
|
|
759
|
-
}
|
|
760
|
-
mentionsTextFormatter.setTextStyle(_style?.textStyle);
|
|
761
880
|
}
|
|
762
881
|
|
|
763
882
|
let finalFormatters: CometChatTextFormatter[] = [];
|
|
@@ -775,7 +894,9 @@ export class MessageDataSource implements DataSource {
|
|
|
775
894
|
formatter.setMessage(message);
|
|
776
895
|
formatter.setTargetElement(MentionsTargetElement.textbubble);
|
|
777
896
|
formatter.setLoggedInUser(CometChatUIKit.loggedInUser!);
|
|
897
|
+
formatter.setContext(isMessageSentByLoggedInUser ? "outgoing" : "incoming");
|
|
778
898
|
}
|
|
899
|
+
|
|
779
900
|
formatter.setMessage(message);
|
|
780
901
|
finalFormatters.push(CommonUtils.clone(formatter));
|
|
781
902
|
if (urlFormatterExists && mentionsFormatterExists) {
|
|
@@ -1134,7 +1255,7 @@ export class MessageDataSource implements DataSource {
|
|
|
1134
1255
|
: theme.messageListStyles.incomingMessageBubbleStyles;
|
|
1135
1256
|
return (
|
|
1136
1257
|
<CometChatDeletedBubble
|
|
1137
|
-
text={
|
|
1258
|
+
text={t("NOT_SUPPORTED") ?? "This message type is not supported"}
|
|
1138
1259
|
style={_style?.deletedBubbleStyles}
|
|
1139
1260
|
/>
|
|
1140
1261
|
);
|
|
@@ -1161,7 +1282,7 @@ export class MessageDataSource implements DataSource {
|
|
|
1161
1282
|
: theme.messageListStyles.incomingMessageBubbleStyles;
|
|
1162
1283
|
return (
|
|
1163
1284
|
<CometChatDeletedBubble
|
|
1164
|
-
text={
|
|
1285
|
+
text={t("NOT_SUPPORTED") ?? "This message type is not supported"}
|
|
1165
1286
|
style={_style?.deletedBubbleStyles}
|
|
1166
1287
|
/>
|
|
1167
1288
|
);
|
|
@@ -1188,7 +1309,7 @@ export class MessageDataSource implements DataSource {
|
|
|
1188
1309
|
: theme.messageListStyles.incomingMessageBubbleStyles;
|
|
1189
1310
|
return (
|
|
1190
1311
|
<CometChatDeletedBubble
|
|
1191
|
-
text={
|
|
1312
|
+
text={t("NOT_SUPPORTED") ?? "This message type is not supported"}
|
|
1192
1313
|
style={_style?.deletedBubbleStyles}
|
|
1193
1314
|
/>
|
|
1194
1315
|
);
|
|
@@ -1316,19 +1437,19 @@ export class MessageDataSource implements DataSource {
|
|
|
1316
1437
|
let subtitle: string = messageType;
|
|
1317
1438
|
switch (messageType) {
|
|
1318
1439
|
case MessageTypeConstants.text:
|
|
1319
|
-
subtitle =
|
|
1440
|
+
subtitle = t("TEXT");
|
|
1320
1441
|
break;
|
|
1321
1442
|
case MessageTypeConstants.image:
|
|
1322
|
-
subtitle =
|
|
1443
|
+
subtitle = t("MESSAGE_IMAGE");
|
|
1323
1444
|
break;
|
|
1324
1445
|
case MessageTypeConstants.video:
|
|
1325
|
-
subtitle =
|
|
1446
|
+
subtitle = t("MESSAGE_VIDEO");
|
|
1326
1447
|
break;
|
|
1327
1448
|
case MessageTypeConstants.file:
|
|
1328
|
-
subtitle =
|
|
1449
|
+
subtitle = t("MESSAGE_FILE");
|
|
1329
1450
|
break;
|
|
1330
1451
|
case MessageTypeConstants.audio:
|
|
1331
|
-
subtitle =
|
|
1452
|
+
subtitle = t("MESSAGE_AUDIO");
|
|
1332
1453
|
break;
|
|
1333
1454
|
default:
|
|
1334
1455
|
subtitle = messageType;
|
|
@@ -1340,11 +1461,11 @@ export class MessageDataSource implements DataSource {
|
|
|
1340
1461
|
theme: CometChatTheme,
|
|
1341
1462
|
additionalAttachmentOptionsParams?: AdditionalAttachmentOptionsParams
|
|
1342
1463
|
) => {
|
|
1343
|
-
const attachmentOptions
|
|
1464
|
+
const attachmentOptions: CometChatMessageComposerAction[] = [];
|
|
1344
1465
|
if (!additionalAttachmentOptionsParams?.hideCameraOption) {
|
|
1345
1466
|
attachmentOptions.push({
|
|
1346
1467
|
id: MessageTypeConstants.takePhoto,
|
|
1347
|
-
title:
|
|
1468
|
+
title: t("CAMERA"),
|
|
1348
1469
|
icon: (
|
|
1349
1470
|
<Icon
|
|
1350
1471
|
name='photo-camera-fill'
|
|
@@ -1368,7 +1489,7 @@ export class MessageDataSource implements DataSource {
|
|
|
1368
1489
|
if (!additionalAttachmentOptionsParams?.hideImageAttachmentOption) {
|
|
1369
1490
|
attachmentOptions.push({
|
|
1370
1491
|
id: MessageTypeConstants.image,
|
|
1371
|
-
title:
|
|
1492
|
+
title: t("ATTACH_IMAGE"),
|
|
1372
1493
|
icon: (
|
|
1373
1494
|
<Icon
|
|
1374
1495
|
name='photo-fill'
|
|
@@ -1393,7 +1514,7 @@ export class MessageDataSource implements DataSource {
|
|
|
1393
1514
|
if (!additionalAttachmentOptionsParams?.hideVideoAttachmentOption) {
|
|
1394
1515
|
attachmentOptions.push({
|
|
1395
1516
|
id: MessageTypeConstants.video,
|
|
1396
|
-
title:
|
|
1517
|
+
title: t("ATTACH_VIDEO"),
|
|
1397
1518
|
icon: (
|
|
1398
1519
|
<Icon
|
|
1399
1520
|
name='videocam-fill'
|
|
@@ -1418,7 +1539,7 @@ export class MessageDataSource implements DataSource {
|
|
|
1418
1539
|
if (!additionalAttachmentOptionsParams?.hideAudioAttachmentOption) {
|
|
1419
1540
|
attachmentOptions.push({
|
|
1420
1541
|
id: MessageTypeConstants.audio,
|
|
1421
|
-
title:
|
|
1542
|
+
title: t("ATTACH_AUDIO"),
|
|
1422
1543
|
icon: (
|
|
1423
1544
|
<Icon
|
|
1424
1545
|
name='play-circle-fill'
|
|
@@ -1442,7 +1563,7 @@ export class MessageDataSource implements DataSource {
|
|
|
1442
1563
|
if (!additionalAttachmentOptionsParams?.hideFileAttachmentOption) {
|
|
1443
1564
|
attachmentOptions.push({
|
|
1444
1565
|
id: MessageTypeConstants.file,
|
|
1445
|
-
title:
|
|
1566
|
+
title: t("ATTACH_DOCUMENT"),
|
|
1446
1567
|
icon: (
|
|
1447
1568
|
<Icon
|
|
1448
1569
|
name='description-fill'
|
|
@@ -1469,11 +1590,11 @@ export class MessageDataSource implements DataSource {
|
|
|
1469
1590
|
theme: CometChatTheme,
|
|
1470
1591
|
additionalAttachmentOptionsParams?: AdditionalAttachmentOptionsParams
|
|
1471
1592
|
) => {
|
|
1472
|
-
const attachmentOptions
|
|
1593
|
+
const attachmentOptions: CometChatMessageComposerAction[] = [];
|
|
1473
1594
|
if (!additionalAttachmentOptionsParams?.hideCameraOption) {
|
|
1474
1595
|
attachmentOptions.push({
|
|
1475
1596
|
id: MessageTypeConstants.takePhoto,
|
|
1476
|
-
title:
|
|
1597
|
+
title: t("CAMERA"),
|
|
1477
1598
|
icon: (
|
|
1478
1599
|
<Icon
|
|
1479
1600
|
name='photo-camera-fill'
|
|
@@ -1497,7 +1618,7 @@ export class MessageDataSource implements DataSource {
|
|
|
1497
1618
|
if (!additionalAttachmentOptionsParams?.hideImageAttachmentOption) {
|
|
1498
1619
|
attachmentOptions.push({
|
|
1499
1620
|
id: MessageTypeConstants.image,
|
|
1500
|
-
title:
|
|
1621
|
+
title: t("ATTACH_IMAGE"),
|
|
1501
1622
|
icon: (
|
|
1502
1623
|
<Icon
|
|
1503
1624
|
name='photo-fill'
|
|
@@ -1522,7 +1643,7 @@ export class MessageDataSource implements DataSource {
|
|
|
1522
1643
|
if (!additionalAttachmentOptionsParams?.hideVideoAttachmentOption) {
|
|
1523
1644
|
attachmentOptions.push({
|
|
1524
1645
|
id: MessageTypeConstants.video,
|
|
1525
|
-
title:
|
|
1646
|
+
title: t("ATTACH_VIDEO"),
|
|
1526
1647
|
icon: (
|
|
1527
1648
|
<Icon
|
|
1528
1649
|
name='videocam-fill'
|
|
@@ -1540,14 +1661,14 @@ export class MessageDataSource implements DataSource {
|
|
|
1540
1661
|
?.iconContainerStyle
|
|
1541
1662
|
}
|
|
1542
1663
|
/>
|
|
1543
|
-
)
|
|
1664
|
+
),
|
|
1544
1665
|
});
|
|
1545
1666
|
}
|
|
1546
1667
|
|
|
1547
1668
|
if (!additionalAttachmentOptionsParams?.hideAudioAttachmentOption) {
|
|
1548
1669
|
attachmentOptions.push({
|
|
1549
1670
|
id: MessageTypeConstants.audio,
|
|
1550
|
-
title:
|
|
1671
|
+
title: t("ATTACH_AUDIO"),
|
|
1551
1672
|
icon: (
|
|
1552
1673
|
<Icon
|
|
1553
1674
|
name='play-circle-fill'
|
|
@@ -1571,7 +1692,7 @@ export class MessageDataSource implements DataSource {
|
|
|
1571
1692
|
if (!additionalAttachmentOptionsParams?.hideFileAttachmentOption) {
|
|
1572
1693
|
attachmentOptions.push({
|
|
1573
1694
|
id: MessageTypeConstants.file,
|
|
1574
|
-
title:
|
|
1695
|
+
title: t("ATTACH_DOCUMENT"),
|
|
1575
1696
|
icon: (
|
|
1576
1697
|
<Icon
|
|
1577
1698
|
name='description-fill'
|
|
@@ -1595,7 +1716,7 @@ export class MessageDataSource implements DataSource {
|
|
|
1595
1716
|
|
|
1596
1717
|
return attachmentOptions;
|
|
1597
1718
|
};
|
|
1598
|
-
|
|
1719
|
+
|
|
1599
1720
|
getAttachmentOptions(
|
|
1600
1721
|
theme: CometChatTheme,
|
|
1601
1722
|
user?: any,
|
|
@@ -1619,18 +1740,29 @@ export class MessageDataSource implements DataSource {
|
|
|
1619
1740
|
conversation: CometChat.Conversation,
|
|
1620
1741
|
theme?: CometChatTheme
|
|
1621
1742
|
): string | JSX.Element {
|
|
1622
|
-
|
|
1743
|
+
const lastMessage = conversation.getLastMessage();
|
|
1744
|
+
if (lastMessage && lastMessage.category === 'action') {
|
|
1745
|
+
const actionMsg = this.getActionMessage(lastMessage);
|
|
1746
|
+
if (actionMsg) return actionMsg;
|
|
1747
|
+
}
|
|
1748
|
+
return CometChatConversationUtils.getMessagePreview(lastMessage, theme);
|
|
1623
1749
|
}
|
|
1624
1750
|
|
|
1625
|
-
getAllTextFormatters(
|
|
1751
|
+
getAllTextFormatters(
|
|
1752
|
+
loggedInUser?: CometChat.User,
|
|
1753
|
+
theme?: CometChatTheme
|
|
1754
|
+
): CometChatTextFormatter[] {
|
|
1626
1755
|
return [
|
|
1627
|
-
ChatConfigurator.getDataSource().getMentionsFormatter(loggedInUser),
|
|
1756
|
+
ChatConfigurator.getDataSource().getMentionsFormatter(loggedInUser, theme),
|
|
1628
1757
|
ChatConfigurator.getDataSource().getUrlsFormatter(loggedInUser),
|
|
1629
1758
|
];
|
|
1630
1759
|
}
|
|
1631
1760
|
|
|
1632
|
-
getMentionsFormatter(
|
|
1633
|
-
|
|
1761
|
+
getMentionsFormatter(
|
|
1762
|
+
loggedInUser?: CometChat.User,
|
|
1763
|
+
theme?: CometChatTheme
|
|
1764
|
+
): CometChatMentionsFormatter {
|
|
1765
|
+
return new CometChatMentionsFormatter(theme!, loggedInUser);
|
|
1634
1766
|
}
|
|
1635
1767
|
|
|
1636
1768
|
getUrlsFormatter(loggedInUser?: CometChat.User): CometChatUrlsFormatter {
|