@cometchat/chat-uikit-react-native 4.3.3 → 4.3.4
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/ios/CommonUtil.h +4 -0
- package/ios/CommonUtil.m +27 -0
- package/package.json +1 -1
- package/src/AI/AIAssistBot/AIAssistBotDecorator.tsx +0 -3
- package/src/CometChatConversations/CometChatConversations.tsx +121 -59
- package/src/CometChatConversations/ConversationsConfiguration.ts +25 -4
- package/src/CometChatConversationsWithMessages/CometChatConversationsWithMessages.tsx +29 -29
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +554 -52
- package/src/CometChatMessageComposer/MessageComposerConfiguration.tsx +12 -1
- package/src/CometChatMessageComposer/resources/Info.png +0 -0
- package/src/CometChatMessageComposer/resources/index.ts +3 -1
- package/src/CometChatMessageHeader/listners.ts +0 -2
- package/src/CometChatMessageList/CometChatMessageList.tsx +124 -15
- package/src/CometChatMessageList/MessageListConfiguration.ts +14 -1
- package/src/CometChatMessages/CometChatMessages.tsx +16 -16
- package/src/CometChatThreadedMessages/CometChatThreadedMessages.tsx +6 -1
- package/src/calls/CallingExtentionDecorator.tsx +5 -5
- package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +3 -3
- package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +2 -0
- package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +2 -0
- package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +3 -3
- package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +3 -3
- package/src/extensions/LinkPreview/LinkPreviewExtentionDecorator.tsx +4 -4
- package/src/extensions/MessageTranslation/MessageTranslationBubble.tsx +31 -9
- package/src/extensions/MessageTranslation/MessageTranslationDecorator.tsx +83 -6
- package/src/extensions/Polls/Polls.tsx +106 -70
- package/src/extensions/Polls/PollsDecorator.tsx +3 -2
- package/src/extensions/Stickers/CometChatStickerKeyboard/style.ts +3 -3
- package/src/extensions/Stickers/StickersExtensionDecorator.tsx +14 -6
- package/src/extensions/TextModeration/TextModerationExtensionDecorator.tsx +3 -3
- package/src/index.ts +21 -0
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +150 -25
- package/src/shared/CometChatUiKit/index.ts +1 -1
- package/src/shared/base/vars.ts +13 -0
- package/src/shared/constants/UIKitConstants.ts +6 -0
- package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +7 -0
- package/src/shared/events/CometChatUIEventHandler/Listener.ts +11 -1
- package/src/shared/events/CometChatUIEvents.ts +3 -1
- package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +380 -0
- package/src/shared/formatters/CometChatMentionsFormatter/MentionTextStyle.ts +14 -0
- package/src/shared/formatters/CometChatMentionsFormatter/index.ts +7 -0
- package/src/shared/formatters/CometChatTextFormatter.ts +253 -0
- package/src/shared/formatters/CometChatUrlsFormatter/index.tsx +146 -0
- package/src/shared/formatters/index.ts +11 -0
- package/src/shared/framework/DataSource.ts +21 -16
- package/src/shared/framework/DataSourceDecorator.tsx +29 -13
- package/src/shared/framework/MessageDataSource.tsx +215 -49
- package/src/shared/helper/useKeyboard.tsx +20 -2
- package/src/shared/index.ts +23 -3
- package/src/shared/resources/CometChatLocalize/CometChatLocalize.ts +2 -0
- package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/de/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/en/translation.json +10 -1
- package/src/shared/resources/CometChatLocalize/resources/es/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +10 -1
- package/src/shared/resources/CometChatLocalize/resources/hu/translation.json +315 -0
- package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +12 -1
- package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +11 -1
- package/src/shared/resources/CometChatTheme/Palette.ts +16 -0
- package/src/shared/utils/InteractiveMessageUtils.ts +39 -1
- package/src/shared/utils/PermissionUtil.ts +142 -0
- package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +8 -6
- package/src/shared/views/CometChatAvatar/CometChatAvatar.tsx +5 -1
- package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +12 -11
- package/src/shared/views/CometChatImageBubble/CometChatImageBubble.tsx +7 -5
- package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +3 -2
- package/src/shared/views/CometChatReactions/CometChatReactions.tsx +3 -3
- package/src/shared/views/CometChatSchedulerBubble/CometChatSchedulerBubble.tsx +12 -0
- package/src/shared/views/CometChatSuggestionList/CometChatSuggestionList.tsx +64 -0
- package/src/shared/views/CometChatSuggestionList/SuggestionItem.ts +48 -0
- package/src/shared/views/CometChatSuggestionList/SuggestionListConfiguration.ts +23 -0
- package/src/shared/views/CometChatSuggestionList/index.ts +11 -0
- package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +33 -46
- package/src/shared/views/CometChatTextBubble/TextBubbleStyle.ts +0 -14
- package/src/shared/views/CometChatTextBubble/index.ts +2 -3
- package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +5 -3
- package/src/shared/views/index.ts +9 -3
- package/src/shared/utils/PermissionUtilIOS.ts +0 -104
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
//@ts-ignore
|
|
3
3
|
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
4
|
-
import { CometChatMessageTypes, GroupMemberScope, MessageBubbleAlignmentType, MessageCategoryConstants, MessageOptionConstants, MessageTypeConstants } from "../constants/UIKitConstants";
|
|
4
|
+
import { AdditionalBubbleStylingParams, CometChatMessageTypes, GroupMemberScope, MessageBubbleAlignmentType, MessageCategoryConstants, MessageOptionConstants, MessageTypeConstants } from "../constants/UIKitConstants";
|
|
5
5
|
import { CometChatMessageOption } from "../modals/CometChatMessageOption";
|
|
6
6
|
import { CometChatMessageTemplate } from "../modals/CometChatMessageTemplate";
|
|
7
7
|
import { DataSource } from "./DataSource";
|
|
@@ -24,6 +24,9 @@ import { CardBubbleStyle } from "../views/CometChatCardBubble/CardBubbleStyle";
|
|
|
24
24
|
import { SchedulerMessage } from "../modals/InteractiveData/InteractiveMessage";
|
|
25
25
|
import { CometChatSchedulerBubble, SchedulerBubbleStyles } from "../views/CometChatSchedulerBubble";
|
|
26
26
|
import { View } from "react-native";
|
|
27
|
+
import { CommonUtils } from "../utils/CommonUtils";
|
|
28
|
+
import { CometChatUIKit } from "../CometChatUiKit";
|
|
29
|
+
import { CometChatMentionsFormatter, CometChatTextFormatter, CometChatUrlsFormatter, MentionTextStyle } from "../formatters";
|
|
27
30
|
|
|
28
31
|
function isAudioMessage(message: CometChat.BaseMessage): message is CometChat.MediaMessage {
|
|
29
32
|
return message.getCategory() == CometChat.CATEGORY_MESSAGE &&
|
|
@@ -63,7 +66,7 @@ export class MessageDataSource implements DataSource {
|
|
|
63
66
|
getEditOption(): CometChatMessageOption {
|
|
64
67
|
return {
|
|
65
68
|
id: MessageOptionConstants.editMessage,
|
|
66
|
-
title: localize("
|
|
69
|
+
title: localize("EDIT"),
|
|
67
70
|
icon: ICONS.EDIT
|
|
68
71
|
}
|
|
69
72
|
}
|
|
@@ -99,7 +102,7 @@ export class MessageDataSource implements DataSource {
|
|
|
99
102
|
getCopyOption(): CometChatMessageOption {
|
|
100
103
|
return {
|
|
101
104
|
id: MessageOptionConstants.copyMessage,
|
|
102
|
-
title: localize("
|
|
105
|
+
title: localize("COPY"),
|
|
103
106
|
icon: ICONS.COPY
|
|
104
107
|
}
|
|
105
108
|
}
|
|
@@ -113,7 +116,7 @@ export class MessageDataSource implements DataSource {
|
|
|
113
116
|
getInformationOption(): CometChatMessageOption {
|
|
114
117
|
return {
|
|
115
118
|
id: MessageOptionConstants.messageInformation,
|
|
116
|
-
title: localize("
|
|
119
|
+
title: localize("INFO"),
|
|
117
120
|
icon: ICONS.INFO
|
|
118
121
|
}
|
|
119
122
|
}
|
|
@@ -121,31 +124,52 @@ export class MessageDataSource implements DataSource {
|
|
|
121
124
|
getPrivateMessageOption(): CometChatMessageOption {
|
|
122
125
|
return {
|
|
123
126
|
id: MessageOptionConstants.sendMessagePrivately,
|
|
124
|
-
title: localize('
|
|
127
|
+
title: localize('MESSAGE_PRIVATELY'),
|
|
125
128
|
icon: ICONS.PRIVATE_MESSAGE
|
|
126
129
|
}
|
|
127
130
|
}
|
|
128
131
|
|
|
129
132
|
isSentByMe(loggedInUser: CometChat.User, message: CometChat.BaseMessage) {
|
|
133
|
+
if (!loggedInUser) return false;
|
|
130
134
|
return loggedInUser.getUid() == message?.getSender()?.getUid();
|
|
131
135
|
}
|
|
132
136
|
|
|
133
137
|
getTextMessageOptions(loggedInUser: CometChat.User, messageObject: CometChat.BaseMessage, group: CometChat.Group): CometChatMessageOption[] {
|
|
134
|
-
let msgOptions = [];
|
|
135
|
-
msgOptions.push(this.getCopyOption());
|
|
136
|
-
let _isSentByMe = this.isSentByMe(loggedInUser, messageObject);
|
|
137
|
-
let canEdit = false;
|
|
138
|
-
if (group) {
|
|
139
|
-
canEdit = group['scope'] != GroupMemberScope.participant; //need clarification on why only moderator can edit and not participant or admin.
|
|
140
|
-
}
|
|
141
|
-
if (_isSentByMe || canEdit)
|
|
142
|
-
msgOptions.push(this.getEditOption())
|
|
143
138
|
|
|
144
|
-
let
|
|
139
|
+
let messageOptionList: CometChatMessageOption[] = [];
|
|
140
|
+
|
|
141
|
+
|
|
145
142
|
if (isDeletedMessage(messageObject))
|
|
146
|
-
return
|
|
143
|
+
return messageOptionList;
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
if (this.validateOption(loggedInUser, messageObject, group, MessageOptionConstants.replyInThread)) {
|
|
147
|
+
messageOptionList.push(this.getReplyInThreadOption());
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (this.validateOption(loggedInUser, messageObject, group, MessageOptionConstants.shareMessage)) {
|
|
151
|
+
messageOptionList.push(this.getShareOption());
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
messageOptionList.push(this.getCopyOption());
|
|
147
155
|
|
|
148
|
-
|
|
156
|
+
if (this.validateOption(loggedInUser, messageObject, group, MessageOptionConstants.editMessage)) {
|
|
157
|
+
messageOptionList.push(this.getEditOption());
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (this.validateOption(loggedInUser, messageObject, group, MessageOptionConstants.messageInformation)) {
|
|
161
|
+
messageOptionList.push(this.getInformationOption());
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (this.validateOption(loggedInUser, messageObject, group, MessageOptionConstants.deleteMessage)) {
|
|
165
|
+
messageOptionList.push(this.getDeleteOption());
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (this.validateOption(loggedInUser, messageObject, group, MessageOptionConstants.sendMessagePrivately)) {
|
|
169
|
+
messageOptionList.push(this.getPrivateMessageOption());
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return messageOptionList;
|
|
149
173
|
}
|
|
150
174
|
|
|
151
175
|
getFormMessageOptions(loggedInUser: CometChat.User, messageObject: CometChat.BaseMessage, group: CometChat.Group): CometChatMessageOption[] {
|
|
@@ -194,7 +218,7 @@ export class MessageDataSource implements DataSource {
|
|
|
194
218
|
return optionsList;
|
|
195
219
|
}
|
|
196
220
|
getMessageOptions(loggedInUser: CometChat.User, messageObject: CometChat.BaseMessage, group: CometChat.Group): CometChatMessageOption[] {
|
|
197
|
-
let optionsList: Array<CometChatMessageOption> = [
|
|
221
|
+
let optionsList: Array<CometChatMessageOption> = [];
|
|
198
222
|
if (isDeletedMessage(messageObject))
|
|
199
223
|
return optionsList;
|
|
200
224
|
if (messageObject.getCategory() == MessageCategoryConstants.message) {
|
|
@@ -218,41 +242,94 @@ export class MessageDataSource implements DataSource {
|
|
|
218
242
|
}
|
|
219
243
|
|
|
220
244
|
}
|
|
245
|
+
else if(messageObject.getCategory() == MessageCategoryConstants.custom){
|
|
246
|
+
optionsList.push(...ChatConfigurator.dataSource.getCommonOptions(loggedInUser, messageObject, group));
|
|
247
|
+
}else if(messageObject.getCategory() == MessageCategoryConstants.interactive){
|
|
248
|
+
let type: string = messageObject.getType();
|
|
249
|
+
switch (type) {
|
|
250
|
+
case MessageTypeConstants.form:
|
|
251
|
+
optionsList.push(...ChatConfigurator.dataSource.getFormMessageOptions(loggedInUser, messageObject, group));
|
|
252
|
+
break;
|
|
253
|
+
case MessageTypeConstants.card:
|
|
254
|
+
optionsList.push(...ChatConfigurator.dataSource.getCardMessageOptions(loggedInUser, messageObject, group));
|
|
255
|
+
break;
|
|
256
|
+
case MessageTypeConstants.scheduler:
|
|
257
|
+
optionsList.push(...ChatConfigurator.dataSource.getSchedulerMessageOptions(loggedInUser, messageObject, group));
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
221
261
|
return optionsList;
|
|
222
262
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
if (
|
|
228
|
-
|
|
229
|
-
canDelete = true;
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
private validateOption(loggedInUser: CometChat.User, messageObject: CometChat.BaseMessage, group: CometChat.Group | null, optionId: string): boolean {
|
|
266
|
+
|
|
267
|
+
if (MessageOptionConstants.replyInThread === optionId &&(!messageObject.parentMessageId|| messageObject.parentMessageId === 0)) {
|
|
268
|
+
return true;
|
|
230
269
|
}
|
|
231
|
-
|
|
232
|
-
|
|
270
|
+
|
|
271
|
+
if (MessageOptionConstants.shareMessage === optionId && (messageObject instanceof CometChat.TextMessage || messageObject instanceof CometChat.MediaMessage)) {
|
|
272
|
+
return true;
|
|
233
273
|
}
|
|
234
|
-
|
|
235
|
-
|
|
274
|
+
|
|
275
|
+
if (MessageOptionConstants.copyMessage === optionId && messageObject instanceof CometChat.TextMessage) {
|
|
276
|
+
return true;
|
|
236
277
|
}
|
|
237
278
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
// }
|
|
279
|
+
let isSentByMe: boolean = this.isSentByMe(loggedInUser, messageObject);
|
|
280
|
+
|
|
281
|
+
if (MessageOptionConstants.messageInformation === optionId && isSentByMe) {
|
|
282
|
+
return true;
|
|
243
283
|
}
|
|
244
284
|
|
|
245
|
-
|
|
246
|
-
|
|
285
|
+
let memberIsNotParticipant: boolean = group && (group.owner === loggedInUser.uid || group.scope !== GroupMemberScope.participant);
|
|
286
|
+
|
|
287
|
+
if (MessageOptionConstants.deleteMessage === optionId && (isSentByMe || memberIsNotParticipant)) {
|
|
288
|
+
return true;
|
|
247
289
|
}
|
|
248
290
|
|
|
249
|
-
if (
|
|
250
|
-
|
|
251
|
-
optionsList.push(this.getDeleteOption());
|
|
252
|
-
}
|
|
291
|
+
if (MessageOptionConstants.editMessage === optionId && (isSentByMe || memberIsNotParticipant)) {
|
|
292
|
+
return true;
|
|
253
293
|
}
|
|
254
294
|
|
|
255
|
-
|
|
295
|
+
if (MessageOptionConstants.copyMessage === optionId && messageObject instanceof CometChat.TextMessage) {
|
|
296
|
+
return true;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
if (MessageOptionConstants.sendMessagePrivately === optionId && group
|
|
300
|
+
&& loggedInUser.getUid() != messageObject.getSender()?.getUid()) {
|
|
301
|
+
return true;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
getCommonOptions(loggedInUser: CometChat.User, messageObject: CometChat.BaseMessage, group: CometChat.Group): CometChatMessageOption[] {
|
|
308
|
+
let messageOptionList: CometChatMessageOption[] = [];
|
|
309
|
+
|
|
310
|
+
if (isDeletedMessage(messageObject)) return messageOptionList;
|
|
311
|
+
|
|
312
|
+
if( this.validateOption(loggedInUser, messageObject, group, MessageOptionConstants.replyInThread) ) {
|
|
313
|
+
messageOptionList.push(this.getReplyInThreadOption());
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if (this.validateOption(loggedInUser, messageObject,group, MessageOptionConstants.shareMessage)) {
|
|
317
|
+
messageOptionList.push(this.getShareOption());
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
if(this.validateOption(loggedInUser, messageObject, group, MessageOptionConstants.messageInformation)) {
|
|
321
|
+
messageOptionList.push(this.getInformationOption());
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
if (this.validateOption(loggedInUser, messageObject, group, MessageOptionConstants.deleteMessage)) {
|
|
325
|
+
messageOptionList.push(this.getDeleteOption());
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
if (this.validateOption(loggedInUser, messageObject, group, MessageOptionConstants.sendMessagePrivately)) {
|
|
329
|
+
messageOptionList.push(this.getPrivateMessageOption());
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
return messageOptionList;
|
|
256
333
|
}
|
|
257
334
|
|
|
258
335
|
getGroupActionBubble(message: CometChat.BaseMessage, theme: CometChatTheme): JSX.Element {
|
|
@@ -305,7 +382,82 @@ export class MessageDataSource implements DataSource {
|
|
|
305
382
|
return null;
|
|
306
383
|
}
|
|
307
384
|
|
|
308
|
-
getTextMessageBubble(messageText: string, message: CometChat.TextMessage, alignment: MessageBubbleAlignmentType, theme: CometChatTheme): JSX.Element {
|
|
385
|
+
getTextMessageBubble(messageText: string, message: CometChat.TextMessage, alignment: MessageBubbleAlignmentType, theme: CometChatTheme, additionalParams?: AdditionalBubbleStylingParams): JSX.Element {
|
|
386
|
+
let loggedInUser = CometChatUIKit.loggedInUser;
|
|
387
|
+
let mentionedUsers = message.getMentionedUsers();
|
|
388
|
+
let textFormatters = [...(additionalParams?.textFormatters || [])] || [];
|
|
389
|
+
|
|
390
|
+
let linksTextFormatter = ChatConfigurator.getDataSource().getUrlsFormatter(loggedInUser);
|
|
391
|
+
linksTextFormatter.setMessage(message);
|
|
392
|
+
linksTextFormatter.setId("ccDefaultUrlsFormatterId")
|
|
393
|
+
textFormatters.push(linksTextFormatter);
|
|
394
|
+
|
|
395
|
+
if (!additionalParams?.disableMentions && mentionedUsers && mentionedUsers.length) {
|
|
396
|
+
|
|
397
|
+
let mentionsTextFormatter = ChatConfigurator.getDataSource().getMentionsFormatter(loggedInUser);
|
|
398
|
+
mentionsTextFormatter.setLoggedInUser(loggedInUser);
|
|
399
|
+
mentionsTextFormatter.setId("ccDefaultMentionFormatterId")
|
|
400
|
+
let isUserSentMessage = alignment === "right";
|
|
401
|
+
if (isUserSentMessage) {
|
|
402
|
+
mentionsTextFormatter.setMentionsStyle(
|
|
403
|
+
new MentionTextStyle({
|
|
404
|
+
loggedInUserTextStyle: {
|
|
405
|
+
color: theme.palette.getTertiary(),
|
|
406
|
+
...theme.typography.title2,
|
|
407
|
+
fontSize: 16
|
|
408
|
+
},
|
|
409
|
+
textStyle: {
|
|
410
|
+
color: theme.palette.getTertiary(),
|
|
411
|
+
...theme.typography.subtitle1,
|
|
412
|
+
fontSize: 16
|
|
413
|
+
},
|
|
414
|
+
})
|
|
415
|
+
);
|
|
416
|
+
} else {
|
|
417
|
+
mentionsTextFormatter.setMentionsStyle(
|
|
418
|
+
new MentionTextStyle({
|
|
419
|
+
loggedInUserTextStyle: {
|
|
420
|
+
color: theme.palette.getPrimary(),
|
|
421
|
+
...theme.typography.title2,
|
|
422
|
+
fontSize: 16
|
|
423
|
+
},
|
|
424
|
+
textStyle: {
|
|
425
|
+
color: theme.palette.getPrimary(),
|
|
426
|
+
...theme.typography.subtitle1,
|
|
427
|
+
fontSize: 16
|
|
428
|
+
},
|
|
429
|
+
})
|
|
430
|
+
);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
textFormatters.push(mentionsTextFormatter);
|
|
434
|
+
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
let finalFormatters = [];
|
|
438
|
+
|
|
439
|
+
let customerHasPassedUrlsFormatter;
|
|
440
|
+
|
|
441
|
+
textFormatters.forEach(formatter => {
|
|
442
|
+
if (formatter instanceof CometChatUrlsFormatter) {
|
|
443
|
+
if (formatter.getId() !== "ccDefaultUrlsFormatterId") {
|
|
444
|
+
customerHasPassedUrlsFormatter = true
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
formatter.setMessage(message);
|
|
448
|
+
let suggestionUsers = formatter.getSuggestionItems();
|
|
449
|
+
suggestionUsers.length > 0 && formatter.setSuggestionItems(suggestionUsers);
|
|
450
|
+
let _formatter = CommonUtils.clone(formatter);
|
|
451
|
+
finalFormatters.push(_formatter);
|
|
452
|
+
})
|
|
453
|
+
|
|
454
|
+
if (customerHasPassedUrlsFormatter) {
|
|
455
|
+
let customUrlsIndex = finalFormatters.findIndex((formatter: CometChatTextFormatter[]) => (formatter instanceof CometChatUrlsFormatter && formatter.getId() === "ccDefaultUrlsFormatterId"));
|
|
456
|
+
if (customUrlsIndex > -1) {
|
|
457
|
+
finalFormatters.splice(customUrlsIndex, 1);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
309
461
|
return <CometChatTextBubble
|
|
310
462
|
text={messageText}
|
|
311
463
|
style={{
|
|
@@ -314,6 +466,7 @@ export class MessageDataSource implements DataSource {
|
|
|
314
466
|
textColor: alignment == "right" ? theme?.palette.getSecondary() : theme?.palette?.getAccent(),
|
|
315
467
|
borderRadius: 8
|
|
316
468
|
}}
|
|
469
|
+
textFormatters={finalFormatters}
|
|
317
470
|
/>
|
|
318
471
|
}
|
|
319
472
|
|
|
@@ -326,7 +479,7 @@ export class MessageDataSource implements DataSource {
|
|
|
326
479
|
}
|
|
327
480
|
|
|
328
481
|
getSchedulerMessageBubble(message: SchedulerMessage, theme: CometChatTheme, style?: SchedulerBubbleStyles, onScheduleClick?: (data: any) => void): JSX.Element {
|
|
329
|
-
return <CometChatSchedulerBubble
|
|
482
|
+
return <CometChatSchedulerBubble
|
|
330
483
|
schedulerMessage={message}
|
|
331
484
|
onScheduleClick={onScheduleClick}
|
|
332
485
|
style={style}
|
|
@@ -372,8 +525,8 @@ export class MessageDataSource implements DataSource {
|
|
|
372
525
|
}
|
|
373
526
|
return null;
|
|
374
527
|
}
|
|
375
|
-
getTextMessageContentView(message: CometChat.TextMessage, alignment: MessageBubbleAlignmentType, theme: CometChatTheme): JSX.Element {
|
|
376
|
-
return ChatConfigurator.dataSource.getTextMessageBubble(message.getText(), message, alignment, theme);
|
|
528
|
+
getTextMessageContentView(message: CometChat.TextMessage, alignment: MessageBubbleAlignmentType, theme: CometChatTheme, additionalParams?: AdditionalBubbleStylingParams): JSX.Element {
|
|
529
|
+
return ChatConfigurator.dataSource.getTextMessageBubble(message.getText(), message, alignment, theme, additionalParams);
|
|
377
530
|
}
|
|
378
531
|
getFormMessageContentView(message: FormMessage, alignment: MessageBubbleAlignmentType, theme: CometChatTheme): JSX.Element {
|
|
379
532
|
return ChatConfigurator.dataSource.getFormMessageBubble(message, theme);
|
|
@@ -433,7 +586,7 @@ export class MessageDataSource implements DataSource {
|
|
|
433
586
|
, message, theme);
|
|
434
587
|
}
|
|
435
588
|
|
|
436
|
-
getTextMessageTemplate(theme: CometChatTheme): CometChatMessageTemplate {
|
|
589
|
+
getTextMessageTemplate(theme: CometChatTheme, additionalParams?: AdditionalBubbleStylingParams): CometChatMessageTemplate {
|
|
437
590
|
return new CometChatMessageTemplate({
|
|
438
591
|
type: MessageTypeConstants.text,
|
|
439
592
|
category: MessageCategoryConstants.message,
|
|
@@ -441,7 +594,7 @@ export class MessageDataSource implements DataSource {
|
|
|
441
594
|
if (isDeletedMessage(message)) {
|
|
442
595
|
return ChatConfigurator.dataSource.getDeleteMessageBubble(message, theme);
|
|
443
596
|
} else {
|
|
444
|
-
return ChatConfigurator.dataSource.getTextMessageContentView(message, _alignment, theme);
|
|
597
|
+
return ChatConfigurator.dataSource.getTextMessageContentView(message, _alignment, theme, additionalParams);
|
|
445
598
|
}
|
|
446
599
|
},
|
|
447
600
|
options: (loggedInuser, message, group) => ChatConfigurator.dataSource.getTextMessageOptions(loggedInuser, message, group),
|
|
@@ -556,9 +709,9 @@ export class MessageDataSource implements DataSource {
|
|
|
556
709
|
});
|
|
557
710
|
}
|
|
558
711
|
|
|
559
|
-
getAllMessageTemplates(theme: CometChatTheme): CometChatMessageTemplate[] {
|
|
712
|
+
getAllMessageTemplates(theme: CometChatTheme, additionalParams?: AdditionalBubbleStylingParams): CometChatMessageTemplate[] {
|
|
560
713
|
return [
|
|
561
|
-
ChatConfigurator.dataSource.getTextMessageTemplate(theme),
|
|
714
|
+
ChatConfigurator.dataSource.getTextMessageTemplate(theme, additionalParams),
|
|
562
715
|
ChatConfigurator.dataSource.getFormMessageTemplate(theme),
|
|
563
716
|
ChatConfigurator.dataSource.getSchedulerMessageTemplate(theme),
|
|
564
717
|
ChatConfigurator.dataSource.getCardMessageTemplate(theme),
|
|
@@ -746,4 +899,17 @@ export class MessageDataSource implements DataSource {
|
|
|
746
899
|
return CometChatConversationUtils.getMessagePreview(conversation.getLastMessage());
|
|
747
900
|
};
|
|
748
901
|
|
|
902
|
+
getAllTextFormatters(loggedInUser?: CometChat.User): CometChatTextFormatter[] {
|
|
903
|
+
return [ChatConfigurator.getDataSource().getMentionsFormatter(loggedInUser),
|
|
904
|
+
ChatConfigurator.getDataSource().getUrlsFormatter(loggedInUser)];
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
getMentionsFormatter(loggedInUser?: CometChat.User): CometChatMentionsFormatter {
|
|
908
|
+
return new CometChatMentionsFormatter(loggedInUser);
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
getUrlsFormatter(loggedInUser?: CometChat.User): CometChatUrlsFormatter {
|
|
912
|
+
return new CometChatUrlsFormatter(loggedInUser);
|
|
913
|
+
}
|
|
914
|
+
|
|
749
915
|
}
|
|
@@ -6,17 +6,35 @@ import {
|
|
|
6
6
|
Platform,
|
|
7
7
|
} from 'react-native';
|
|
8
8
|
|
|
9
|
+
export let isKeyboardVisible = false;
|
|
10
|
+
|
|
9
11
|
export const useKeyboard = () => {
|
|
10
12
|
const [keyboardHeight, setKeyboardHeight] = useState(0);
|
|
11
13
|
|
|
12
14
|
useEffect(() => {
|
|
13
15
|
function onKeyboardDidShow(e: KeyboardEvent) {
|
|
14
|
-
|
|
16
|
+
isKeyboardVisible = true;
|
|
17
|
+
if (Platform.OS === 'ios') {
|
|
18
|
+
LayoutAnimation.configureNext({
|
|
19
|
+
duration: 200,
|
|
20
|
+
create: {type: 'linear', property: 'opacity'},
|
|
21
|
+
update: {type: 'linear', property: 'opacity'},
|
|
22
|
+
delete: {type: 'linear', property: 'opacity'},
|
|
23
|
+
});
|
|
24
|
+
}
|
|
15
25
|
setKeyboardHeight(e.endCoordinates.height);
|
|
16
26
|
}
|
|
17
27
|
|
|
18
28
|
function onKeyboardDidHide() {
|
|
19
|
-
|
|
29
|
+
isKeyboardVisible = false;
|
|
30
|
+
if (Platform.OS === 'ios') {
|
|
31
|
+
LayoutAnimation.configureNext({
|
|
32
|
+
duration: 200,
|
|
33
|
+
create: {type: 'linear', property: 'opacity'},
|
|
34
|
+
update: {type: 'linear', property: 'opacity'},
|
|
35
|
+
delete: {type: 'linear', property: 'opacity'},
|
|
36
|
+
});
|
|
37
|
+
}
|
|
20
38
|
setKeyboardHeight(0);
|
|
21
39
|
}
|
|
22
40
|
|
package/src/shared/index.ts
CHANGED
|
@@ -130,7 +130,6 @@ import {
|
|
|
130
130
|
CometChatStatusIndicatorInterface,
|
|
131
131
|
DateConfigurationInterface,
|
|
132
132
|
DateStyleInterface,
|
|
133
|
-
FormatTextForLinks,
|
|
134
133
|
ReceiptConfigurationInterface,
|
|
135
134
|
StatusIndicatorConfigurationInterface,
|
|
136
135
|
StatusIndicatorStyleInterface,
|
|
@@ -163,9 +162,22 @@ import {
|
|
|
163
162
|
EmojiKeyboardStyle,
|
|
164
163
|
|
|
165
164
|
CometChatSchedulerBubble,
|
|
166
|
-
CometChatSchedulerBubbleInterface
|
|
165
|
+
CometChatSchedulerBubbleInterface,
|
|
166
|
+
|
|
167
|
+
CometChatSuggestionList,
|
|
168
|
+
CometChatSuggestionListInterface,
|
|
169
|
+
SuggestionItem,
|
|
170
|
+
SuggestionListConfiguration,
|
|
171
|
+
SuggestionListConfigurationInterface
|
|
167
172
|
} from './views';
|
|
168
173
|
|
|
174
|
+
import {
|
|
175
|
+
CometChatMentionsFormatter,
|
|
176
|
+
CometChatTextFormatter,
|
|
177
|
+
CometChatUrlsFormatter,
|
|
178
|
+
MentionTextStyle
|
|
179
|
+
} from './formatters';
|
|
180
|
+
|
|
169
181
|
import {
|
|
170
182
|
CometChatUIKit,
|
|
171
183
|
CometChatUIKitHelper,
|
|
@@ -205,7 +217,6 @@ export {
|
|
|
205
217
|
CometChatStatusIndicatorInterface,
|
|
206
218
|
DateConfigurationInterface,
|
|
207
219
|
DateStyleInterface,
|
|
208
|
-
FormatTextForLinks,
|
|
209
220
|
ReceiptConfigurationInterface,
|
|
210
221
|
StatusIndicatorConfigurationInterface,
|
|
211
222
|
StatusIndicatorStyleInterface,
|
|
@@ -361,4 +372,13 @@ export {
|
|
|
361
372
|
EmojiKeyboardConfiguration,
|
|
362
373
|
EmojiKeyboardStyle,
|
|
363
374
|
|
|
375
|
+
CometChatMentionsFormatter,
|
|
376
|
+
CometChatTextFormatter,
|
|
377
|
+
CometChatUrlsFormatter,
|
|
378
|
+
MentionTextStyle,
|
|
379
|
+
CometChatSuggestionList,
|
|
380
|
+
CometChatSuggestionListInterface,
|
|
381
|
+
SuggestionItem,
|
|
382
|
+
SuggestionListConfiguration,
|
|
383
|
+
SuggestionListConfigurationInterface
|
|
364
384
|
};
|
|
@@ -11,6 +11,7 @@ import translationZH from "./resources/zh/translation.json";
|
|
|
11
11
|
import translationZHTW from "./resources/zh-tw/translation.json";
|
|
12
12
|
import translationSV from "./resources/sv/translation.json";
|
|
13
13
|
import translationLT from "./resources/lt/translation.json";
|
|
14
|
+
import translationHU from "./resources/hu/translation.json";
|
|
14
15
|
import { Platform, NativeModules } from 'react-native';
|
|
15
16
|
|
|
16
17
|
/**
|
|
@@ -45,6 +46,7 @@ class CometChatLocalize {
|
|
|
45
46
|
"zh-tw": translationZHTW,
|
|
46
47
|
sv: translationSV,
|
|
47
48
|
lt: translationLT,
|
|
49
|
+
hu: translationHU,
|
|
48
50
|
};
|
|
49
51
|
|
|
50
52
|
/**
|
|
@@ -301,5 +301,15 @@
|
|
|
301
301
|
"MIN": "ميل",
|
|
302
302
|
"TAP_TO_REMOVE":"انقر للإزالة",
|
|
303
303
|
"ALL":"جميع",
|
|
304
|
-
"
|
|
304
|
+
"MENTION_UPTO":"يمكنك ذكر ما يصل إلى",
|
|
305
|
+
"TIME":"وقت",
|
|
306
|
+
"TIMES":"مرات",
|
|
307
|
+
"AT_A_TIME":"في كل مرة",
|
|
308
|
+
"RESOURCE_PERMISSION_REQUIRED": "تتطلب هذه الميزة إذنًا (أذونات) موارد محددة. يرجى تمكين الأذونات اللازمة في إعدادات جهازك",
|
|
309
|
+
"COPY":"نسخة",
|
|
310
|
+
"INFO":"معلومات",
|
|
311
|
+
"MESSAGE_PRIVATELY":"أرسل رسالة بشكل خاص",
|
|
312
|
+
"TRANSLATE":"ترجم",
|
|
313
|
+
"EDIT":"تحرير"
|
|
314
|
+
|
|
305
315
|
}
|
|
@@ -301,5 +301,15 @@
|
|
|
301
301
|
"MIN": "mi",
|
|
302
302
|
"TAP_TO_REMOVE":"Zum Entfernen antippen",
|
|
303
303
|
"ALL":"Alle",
|
|
304
|
-
"
|
|
304
|
+
"MENTION_UPTO":"Sie können bis zu erwähnen",
|
|
305
|
+
"TIME":"Zeit",
|
|
306
|
+
"TIMES":"mal",
|
|
307
|
+
"AT_A_TIME":"zu einer Zeit",
|
|
308
|
+
"RESOURCE_PERMISSION_REQUIRED": "Für diese Funktion sind spezielle Ressourcenberechtigungen erforderlich. Bitte aktivieren Sie die erforderlichen Berechtigungen in Ihren Geräteeinstellungen",
|
|
309
|
+
"COPY":"Kopieren",
|
|
310
|
+
"INFO":"Informationen",
|
|
311
|
+
"CHAT_PRIVATELY":"Privat chatten",
|
|
312
|
+
"MESSAGE_PRIVATELY":"Private Nachricht",
|
|
313
|
+
"TRANSLATE":"Übersetzen",
|
|
314
|
+
"EDIT":"Bearbeiten"
|
|
305
315
|
}
|
|
@@ -301,5 +301,14 @@
|
|
|
301
301
|
"MIN": "min",
|
|
302
302
|
"TAP_TO_REMOVE":"Tap to remove",
|
|
303
303
|
"ALL": "All",
|
|
304
|
-
"
|
|
304
|
+
"MENTION_UPTO":"You can mention up to",
|
|
305
|
+
"TIME":"time",
|
|
306
|
+
"TIMES":"times",
|
|
307
|
+
"AT_A_TIME":"at a time",
|
|
308
|
+
"RESOURCE_PERMISSION_REQUIRED": "This feature requires specific resource permission(s). Please enable the necessary permissions in your device settings.",
|
|
309
|
+
"COPY":"Copy",
|
|
310
|
+
"INFO":"Info",
|
|
311
|
+
"MESSAGE_PRIVATELY":"Message Privately",
|
|
312
|
+
"TRANSLATE":"Translate",
|
|
313
|
+
"EDIT":"Edit"
|
|
305
314
|
}
|
|
@@ -301,5 +301,15 @@
|
|
|
301
301
|
"MIN": "mi",
|
|
302
302
|
"TAP_TO_REMOVE":"Pulsa para eliminar",
|
|
303
303
|
"ALL":"Todas",
|
|
304
|
-
"
|
|
304
|
+
"MENTION_UPTO":"Puedes mencionar hasta",
|
|
305
|
+
"TIME":"tiempo",
|
|
306
|
+
"TIMES":"veces",
|
|
307
|
+
"AT_A_TIME":"a la vez",
|
|
308
|
+
"RESOURCE_PERMISSION_REQUIRED": "Esta función requiere permisos de recursos específicos. Habilite los permisos necesarios en la configuración de su dispositivo",
|
|
309
|
+
"COPY":"Copiar",
|
|
310
|
+
"INFO":"Información",
|
|
311
|
+
"CHAT_PRIVATELY":"Chatea en privado",
|
|
312
|
+
"MESSAGE_PRIVATELY":"Mensaje privado",
|
|
313
|
+
"TRANSLATE":"Traducir",
|
|
314
|
+
"EDIT":"Editar"
|
|
305
315
|
}
|
|
@@ -301,5 +301,15 @@
|
|
|
301
301
|
"MIN": "mi",
|
|
302
302
|
"TAP_TO_REMOVE":"Touchez pour supprimer",
|
|
303
303
|
"ALL":"Tous",
|
|
304
|
-
"
|
|
304
|
+
"MENTION_UPTO":"Vous pouvez citer jusqu'à",
|
|
305
|
+
"TIME":"temps",
|
|
306
|
+
"TIMES":"temps",
|
|
307
|
+
"AT_A_TIME":"à la fois",
|
|
308
|
+
"RESOURCE_PERMISSION_REQUIRED": "Cette fonctionnalité nécessite des autorisations de ressources spécifiques. Veuillez activer les autorisations nécessaires dans les paramètres de votre appareil",
|
|
309
|
+
"COPY":"Copier",
|
|
310
|
+
"INFO":"Infos",
|
|
311
|
+
"CHAT_PRIVATELY":"Discutez en privé",
|
|
312
|
+
"MESSAGE_PRIVATELY":"Message privé",
|
|
313
|
+
"TRANSLATE":"Traduire",
|
|
314
|
+
"EDIT":"Modifier"
|
|
305
315
|
}
|
|
@@ -301,5 +301,14 @@
|
|
|
301
301
|
"MIN": "मील",
|
|
302
302
|
"TAP_TO_REMOVE":"हटाने के लिए टैप करें",
|
|
303
303
|
"ALL":"सभी",
|
|
304
|
-
"
|
|
304
|
+
"MENTION_UPTO":"आप निम्नलिखित का उल्लेख कर सकते हैं",
|
|
305
|
+
"TIME":"पहर",
|
|
306
|
+
"TIMES":"समय",
|
|
307
|
+
"AT_A_TIME":"एक समय में",
|
|
308
|
+
"RESOURCE_PERMISSION_REQUIRED": "इस सुविधा के लिए विशिष्ट संसाधन अनुमति (ओं) की आवश्यकता होती है। कृपया अपनी डिवाइस सेटिंग में आवश्यक अनुमतियां सक्षम करें।",
|
|
309
|
+
"COPY":"कॉपी करें",
|
|
310
|
+
"INFO":"जानकारी",
|
|
311
|
+
"MESSAGE_PRIVATELY":"निजी तौर पर संदेश",
|
|
312
|
+
"TRANSLATE":"ट्रांसलेट करें",
|
|
313
|
+
"EDIT":"संपादित करें"
|
|
305
314
|
}
|