@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.
Files changed (84) hide show
  1. package/ios/CommonUtil.h +4 -0
  2. package/ios/CommonUtil.m +27 -0
  3. package/package.json +1 -1
  4. package/src/AI/AIAssistBot/AIAssistBotDecorator.tsx +0 -3
  5. package/src/CometChatConversations/CometChatConversations.tsx +121 -59
  6. package/src/CometChatConversations/ConversationsConfiguration.ts +25 -4
  7. package/src/CometChatConversationsWithMessages/CometChatConversationsWithMessages.tsx +29 -29
  8. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +554 -52
  9. package/src/CometChatMessageComposer/MessageComposerConfiguration.tsx +12 -1
  10. package/src/CometChatMessageComposer/resources/Info.png +0 -0
  11. package/src/CometChatMessageComposer/resources/index.ts +3 -1
  12. package/src/CometChatMessageHeader/listners.ts +0 -2
  13. package/src/CometChatMessageList/CometChatMessageList.tsx +124 -15
  14. package/src/CometChatMessageList/MessageListConfiguration.ts +14 -1
  15. package/src/CometChatMessages/CometChatMessages.tsx +16 -16
  16. package/src/CometChatThreadedMessages/CometChatThreadedMessages.tsx +6 -1
  17. package/src/calls/CallingExtentionDecorator.tsx +5 -5
  18. package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +3 -3
  19. package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +2 -0
  20. package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +2 -0
  21. package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +3 -3
  22. package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +3 -3
  23. package/src/extensions/LinkPreview/LinkPreviewExtentionDecorator.tsx +4 -4
  24. package/src/extensions/MessageTranslation/MessageTranslationBubble.tsx +31 -9
  25. package/src/extensions/MessageTranslation/MessageTranslationDecorator.tsx +83 -6
  26. package/src/extensions/Polls/Polls.tsx +106 -70
  27. package/src/extensions/Polls/PollsDecorator.tsx +3 -2
  28. package/src/extensions/Stickers/CometChatStickerKeyboard/style.ts +3 -3
  29. package/src/extensions/Stickers/StickersExtensionDecorator.tsx +14 -6
  30. package/src/extensions/TextModeration/TextModerationExtensionDecorator.tsx +3 -3
  31. package/src/index.ts +21 -0
  32. package/src/shared/CometChatUiKit/CometChatUIKit.ts +150 -25
  33. package/src/shared/CometChatUiKit/index.ts +1 -1
  34. package/src/shared/base/vars.ts +13 -0
  35. package/src/shared/constants/UIKitConstants.ts +6 -0
  36. package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +7 -0
  37. package/src/shared/events/CometChatUIEventHandler/Listener.ts +11 -1
  38. package/src/shared/events/CometChatUIEvents.ts +3 -1
  39. package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +380 -0
  40. package/src/shared/formatters/CometChatMentionsFormatter/MentionTextStyle.ts +14 -0
  41. package/src/shared/formatters/CometChatMentionsFormatter/index.ts +7 -0
  42. package/src/shared/formatters/CometChatTextFormatter.ts +253 -0
  43. package/src/shared/formatters/CometChatUrlsFormatter/index.tsx +146 -0
  44. package/src/shared/formatters/index.ts +11 -0
  45. package/src/shared/framework/DataSource.ts +21 -16
  46. package/src/shared/framework/DataSourceDecorator.tsx +29 -13
  47. package/src/shared/framework/MessageDataSource.tsx +215 -49
  48. package/src/shared/helper/useKeyboard.tsx +20 -2
  49. package/src/shared/index.ts +23 -3
  50. package/src/shared/resources/CometChatLocalize/CometChatLocalize.ts +2 -0
  51. package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +11 -1
  52. package/src/shared/resources/CometChatLocalize/resources/de/translation.json +11 -1
  53. package/src/shared/resources/CometChatLocalize/resources/en/translation.json +10 -1
  54. package/src/shared/resources/CometChatLocalize/resources/es/translation.json +11 -1
  55. package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +11 -1
  56. package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +10 -1
  57. package/src/shared/resources/CometChatLocalize/resources/hu/translation.json +315 -0
  58. package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +11 -1
  59. package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +11 -1
  60. package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +12 -1
  61. package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +11 -1
  62. package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +11 -1
  63. package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +11 -1
  64. package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +11 -1
  65. package/src/shared/resources/CometChatTheme/Palette.ts +16 -0
  66. package/src/shared/utils/InteractiveMessageUtils.ts +39 -1
  67. package/src/shared/utils/PermissionUtil.ts +142 -0
  68. package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +8 -6
  69. package/src/shared/views/CometChatAvatar/CometChatAvatar.tsx +5 -1
  70. package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +12 -11
  71. package/src/shared/views/CometChatImageBubble/CometChatImageBubble.tsx +7 -5
  72. package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +3 -2
  73. package/src/shared/views/CometChatReactions/CometChatReactions.tsx +3 -3
  74. package/src/shared/views/CometChatSchedulerBubble/CometChatSchedulerBubble.tsx +12 -0
  75. package/src/shared/views/CometChatSuggestionList/CometChatSuggestionList.tsx +64 -0
  76. package/src/shared/views/CometChatSuggestionList/SuggestionItem.ts +48 -0
  77. package/src/shared/views/CometChatSuggestionList/SuggestionListConfiguration.ts +23 -0
  78. package/src/shared/views/CometChatSuggestionList/index.ts +11 -0
  79. package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +33 -46
  80. package/src/shared/views/CometChatTextBubble/TextBubbleStyle.ts +0 -14
  81. package/src/shared/views/CometChatTextBubble/index.ts +2 -3
  82. package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +5 -3
  83. package/src/shared/views/index.ts +9 -3
  84. package/src/shared/utils/PermissionUtilIOS.ts +0 -104
@@ -0,0 +1,4 @@
1
+ #import <React/RCTBridgeModule.h>
2
+
3
+ @interface CometChatCommonUtil : NSObject <RCTBridgeModule>
4
+ @end
@@ -0,0 +1,27 @@
1
+ #import "CommonUtil.h"
2
+
3
+ @implementation CometChatCommonUtil
4
+
5
+ RCT_EXPORT_MODULE(CommonUtil);
6
+
7
+ RCT_EXPORT_METHOD(getSafeAreaInsets:(RCTPromiseResolveBlock)resolve
8
+ rejecter:(RCTPromiseRejectBlock)reject)
9
+ {
10
+ dispatch_async(dispatch_get_main_queue(), ^{
11
+ if (@available(iOS 11.0, *)) {
12
+ UIWindow *window = [[UIApplication sharedApplication] keyWindow];
13
+ UIEdgeInsets safeInsets = window.safeAreaInsets;
14
+ resolve(@{
15
+ @"top" : @(safeInsets.top),
16
+ @"bottom" : @(safeInsets.bottom),
17
+ });
18
+ } else {
19
+ resolve(@{
20
+ @"top" : @0,
21
+ @"bottom" : @0,
22
+ });
23
+ }
24
+ });
25
+ }
26
+
27
+ @end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cometchat/chat-uikit-react-native",
3
- "version": "4.3.3",
3
+ "version": "4.3.4",
4
4
  "description": "CometChat React Native UI Kit is a collection of custom UI Components designed to build text , chat and calling features in your application. The UI Kit is developed to keep developers in mind and aims to reduce development efforts significantly",
5
5
  "main": "src/index",
6
6
  "module": "src/index",
@@ -34,9 +34,6 @@ export class AIAssistBotDecorator extends DataSourceDecorator {
34
34
  this.usersRequest.fetchNext().then((bots) => {
35
35
  if (bots.length > 0) {
36
36
  this.bots = [...(this.bots || []), ...bots];
37
- if (bots.length > 0) {
38
- this.fetchBots();
39
- }
40
37
  }
41
38
  })
42
39
 
@@ -8,8 +8,13 @@ import {
8
8
  CometChatConfirmDialog,
9
9
  CometChatConfirmDialogStyleInterface,
10
10
  CometChatContext,
11
+ CometChatMentionsFormatter,
12
+ CometChatTextFormatter,
13
+ CometChatUrlsFormatter,
14
+ MentionTextStyle,
11
15
  CometChatListActionsInterface,
12
- localize
16
+ localize,
17
+ CometChatUIKit
13
18
  } from "../shared";
14
19
  import { Style } from "./style";
15
20
  import {
@@ -33,6 +38,7 @@ import { StatusIndicatorStyleInterface } from "../shared/views/CometChatStatusIn
33
38
  import { DateStyleInterface } from "../shared/views/CometChatDate/DateStyle";
34
39
  import { BadgeStyleInterface } from "../shared/views/CometChatBadge";
35
40
  import { InteractiveMessageUtils } from "../shared/utils/InteractiveMessageUtils";
41
+ import { CommonUtils } from "../shared/utils/CommonUtils";
36
42
 
37
43
  const conversationListenerId = "chatlist_" + new Date().getTime();
38
44
  const userListenerId = "chatlist_user_" + new Date().getTime();
@@ -217,7 +223,16 @@ export interface ConversationInterface {
217
223
  /**
218
224
  * style object for confirm dialog
219
225
  */
220
- confirmDialogStyle?: CometChatConfirmDialogStyleInterface
226
+ confirmDialogStyle?: CometChatConfirmDialogStyleInterface,
227
+ /**
228
+ * if true, mentions will be disabled. Default: false
229
+ */
230
+ disableMentions?: boolean,
231
+ /**
232
+ * Collection of text formatter class
233
+ * @type {Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>}
234
+ */
235
+ textFormatters?: Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>;
221
236
  }
222
237
 
223
238
  /**
@@ -263,6 +278,8 @@ export const CometChatConversations = (props: ConversationInterface) => {
263
278
  onError,
264
279
  onBack,
265
280
  conversationsStyle,
281
+ disableMentions,
282
+ textFormatters
266
283
  } = props;
267
284
 
268
285
  //context
@@ -365,16 +382,17 @@ export const CometChatConversations = (props: ConversationInterface) => {
365
382
  }
366
383
 
367
384
 
368
- const getConversationRefFromTypingIndicator = (typingIndicator : CometChat.TypingIndicator)=> {
369
- let list = conversationListRef.current.getAllListItems();
370
- return list.find((item: CometChat.Conversation) => {
371
- return (
372
- (typingIndicator.getReceiverType()== ReceiverTypeConstants.user&&
373
- item.getConversationType() == ReceiverTypeConstants.user
374
- && (item.getConversationWith() as CometChat.User).getUid() == typingIndicator.getSender().getUid() )
375
- || (typingIndicator.getReceiverType() == ReceiverTypeConstants.group && item.getConversationType() == ReceiverTypeConstants.group
376
- && (item.getConversationWith() as CometChat.Group).getGuid() == typingIndicator.getReceiverId() )
377
- )})
385
+ const getConversationRefFromTypingIndicator = (typingIndicator: CometChat.TypingIndicator) => {
386
+ let list = conversationListRef.current.getAllListItems();
387
+ return list.find((item: CometChat.Conversation) => {
388
+ return (
389
+ (typingIndicator.getReceiverType() == ReceiverTypeConstants.user &&
390
+ item.getConversationType() == ReceiverTypeConstants.user
391
+ && (item.getConversationWith() as CometChat.User).getUid() == typingIndicator.getSender().getUid())
392
+ || (typingIndicator.getReceiverType() == ReceiverTypeConstants.group && item.getConversationType() == ReceiverTypeConstants.group
393
+ && (item.getConversationWith() as CometChat.Group).getGuid() == typingIndicator.getReceiverId())
394
+ )
395
+ })
378
396
  }
379
397
 
380
398
  /**
@@ -383,7 +401,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
383
401
  */
384
402
  const typingEventHandler = (...args) => {
385
403
  let conversation: CometChat.Conversation = getConversationRefFromTypingIndicator(args[0]);
386
- if(conversation){
404
+ if (conversation) {
387
405
  let isTyping = args[1];
388
406
  let newConversation = conversation
389
407
  if (isTyping && !newConversation?.['lastMessage']?.["typing"]) {
@@ -398,24 +416,24 @@ export const CometChatConversations = (props: ConversationInterface) => {
398
416
 
399
417
  }
400
418
 
401
- /**
402
- * Find conversation from state , check and udpate its last message object.
403
- * conversation list item remains at the same place
404
- *
405
- * @param newMessage message object
406
- */
407
- const checkAndUpdateLastMessage = (newMessage: CometChat.BaseMessage) => {
419
+ /**
420
+ * Find conversation from state , check and udpate its last message object.
421
+ * conversation list item remains at the same place
422
+ *
423
+ * @param newMessage message object
424
+ */
425
+ const checkAndUpdateLastMessage = (newMessage: CometChat.BaseMessage) => {
408
426
  CometChat.CometChatHelper.getConversationFromMessage(newMessage)
409
- .then(conversation => {
410
- let conver: any = conversationListRef.current.getListItem(conversation.getConversationId())
411
- if (!conver) return;
412
- let lastMessageId = conver['lastMessage']['id']
413
- if (lastMessageId == newMessage['id']) {
414
- conversationListRef.current.updateList(conversation)
415
- }
416
- })
427
+ .then(conversation => {
428
+ let conver: any = conversationListRef.current.getListItem(conversation.getConversationId())
429
+ if (!conver) return;
430
+ let lastMessageId = conver['lastMessage']['id']
431
+ if (lastMessageId == newMessage['id']) {
432
+ conversationListRef.current.updateList(conversation)
433
+ }
434
+ })
417
435
 
418
- }
436
+ }
419
437
 
420
438
  /**
421
439
  * Find conversation from state and udpate its last message object.
@@ -433,7 +451,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
433
451
  if (oldConversation == undefined) {
434
452
  CometChat.CometChatHelper.getConversationFromMessage(newMessage)
435
453
  .then(newConversation => {
436
- if(newConversation?.lastMessage?.sender?.uid !== loggedInUser.current?.['uid'])
454
+ if (newConversation?.lastMessage?.sender?.uid !== loggedInUser.current?.['uid'])
437
455
  newConversation.setUnreadMessageCount(1);
438
456
  conversationListRef.current.updateAndMoveToFirst(newConversation);
439
457
  })
@@ -496,7 +514,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
496
514
 
497
515
  if (conversation) {
498
516
  conversation.setLastMessage(message);
499
- if(action === 'kicked' || action === 'banned')
517
+ if (action === 'kicked' || action === 'banned')
500
518
  conversationListRef.current.removeItemFromList(message.conversationId);
501
519
  else
502
520
  conversationListRef.current.updateList(conversation);
@@ -577,30 +595,72 @@ export const CometChatConversations = (props: ConversationInterface) => {
577
595
 
578
596
  let lastMessage: CometChat.BaseMessage = conversations.getLastMessage();
579
597
  if (!lastMessage) return null;
580
- let messageText: string ;
581
- if(lastMessage.getDeletedAt() !== undefined){
598
+ let messageText: string;
599
+ if (lastMessage.getDeletedAt() !== undefined) {
582
600
  messageText = localize("THIS_MESSAGE_DELETED");
583
- }else{
601
+ } else {
584
602
  messageText = ChatConfigurator.getDataSource().getLastConversationMessage(conversations);
603
+
604
+ if (lastMessage) {
605
+ messageText = getFormattedText(lastMessage, messageText?.trim());
606
+ }
585
607
  }
586
608
  let groupText = "";
587
609
  if (lastMessage.getReceiverType() == ReceiverTypeConstants.group) {
588
610
  if (lastMessage.getSender().getUid() == uid) {
589
- groupText = localize("YOU")+ ": "
611
+ groupText = localize("YOU") + ": "
590
612
  } else {
591
613
  groupText = lastMessage.getSender().getName() + ": "
592
614
  }
593
615
  }
594
616
 
595
- messageText = messageText?.trim();
596
617
  return (
597
- <Text numberOfLines={1} ellipsizeMode={"tail"} style={[Style.subtitleTextStyle, { color: theme.palette.getAccent600(), fontSize : theme.typography.subtitle1.fontSize,
598
- fontWeight : theme.typography.subtitle1.fontWeight }]}>
599
- {groupText + messageText}
618
+ <Text numberOfLines={1} ellipsizeMode={"tail"} style={[Style.subtitleTextStyle, {
619
+ color: theme.palette.getAccent600(), fontSize: theme.typography.subtitle1.fontSize,
620
+ fontWeight: theme.typography.subtitle1.fontWeight
621
+ }]}>
622
+ {groupText}{messageText}
600
623
  </Text>
601
624
  )
602
625
  }
603
626
 
627
+ function getFormattedText(message: CometChat.BaseMessage, subtitle: string) {
628
+ let messageTextTmp = subtitle;
629
+ let allFormatters = [...(textFormatters || [])] || [];
630
+
631
+ if (!disableMentions && message.getMentionedUsers().length) {
632
+ let mentionsFormatter = ChatConfigurator.getDataSource().getMentionsFormatter();
633
+ mentionsFormatter.setLoggedInUser(CometChatUIKit.loggedInUser);
634
+ mentionsFormatter.setMentionsStyle(
635
+ new MentionTextStyle({
636
+ loggedInUserTextStyle: {
637
+ color: theme.palette.getPrimary(),
638
+ ...theme.typography.title2,
639
+ },
640
+ textStyle: {
641
+ color: theme.palette.getPrimary(),
642
+ ...theme.typography.subtitle1,
643
+ }
644
+ })
645
+ );
646
+
647
+ mentionsFormatter.setMessage(message);
648
+ allFormatters.push(mentionsFormatter);
649
+ }
650
+
651
+ if (allFormatters && allFormatters.length) {
652
+ for (let i = 0; i < allFormatters.length; i++) {
653
+ let suggestionUsers = allFormatters[i].getSuggestionItems();
654
+ allFormatters[i].setMessage(message);
655
+ suggestionUsers.length > 0 && allFormatters[i].setSuggestionItems(suggestionUsers);
656
+ let _formatter = CommonUtils.clone(allFormatters[i]);
657
+ (messageTextTmp as string | JSX.Element) = _formatter.getFormattedText(messageTextTmp);
658
+ }
659
+ }
660
+
661
+ return messageTextTmp;
662
+ }
663
+
604
664
  const LastMessageView = (params: {
605
665
  conversations: CometChat.Conversation,
606
666
  typingText: string
@@ -608,35 +668,37 @@ export const CometChatConversations = (props: ConversationInterface) => {
608
668
  const lastMessage = params['conversations']['lastMessage'];
609
669
  if (!lastMessage) return null;
610
670
  let readReceipt;
611
- if ( params.typingText) {
671
+ if (params.typingText) {
612
672
  return <View style={Style.row}>
613
- <Text numberOfLines={1} ellipsizeMode={"tail"} style={[Style.subtitleTextStyle, { color: theme.palette.getPrimary() ,
614
- fontSize : theme.typography.subtitle1.fontSize , fontWeight : theme.typography.subtitle1.fontWeight }]} >{params.typingText}</Text>
673
+ <Text numberOfLines={1} ellipsizeMode={"tail"} style={[Style.subtitleTextStyle, {
674
+ color: theme.palette.getPrimary(),
675
+ fontSize: theme.typography.subtitle1.fontSize, fontWeight: theme.typography.subtitle1.fontWeight
676
+ }]} >{params.typingText}</Text>
615
677
  </View>
616
678
  }
617
679
 
618
680
  if (lastMessage && !disableReadReceipt && lastMessage['sender']['uid'] == loggedInUser.current?.uid && !lastMessage.getDeletedAt()) {
619
- let status: MessageReceipt = "ERROR";
620
- if (lastMessage?.hasOwnProperty('readAt'))
621
- status = "READ";
622
- else if (lastMessage?.hasOwnProperty("deliveredAt"))
623
- status = "DELIVERED";
624
- else if (lastMessage?.hasOwnProperty("sentAt"))
625
- status = "SENT";
626
- readReceipt = disableReceipt ? null : <CometChatReceipt
627
- receipt={status}
628
- deliveredIcon={props.deliveredIcon}
629
- errorIcon={props.errorIcon}
630
- readIcon={props.readIcon}
631
- sentIcon={props.sentIcon}
632
- waitIcon={props.waitingIcon}
633
- />;
681
+ let status: MessageReceipt = "ERROR";
682
+ if (lastMessage?.hasOwnProperty('readAt'))
683
+ status = "READ";
684
+ else if (lastMessage?.hasOwnProperty("deliveredAt"))
685
+ status = "DELIVERED";
686
+ else if (lastMessage?.hasOwnProperty("sentAt"))
687
+ status = "SENT";
688
+ readReceipt = disableReceipt ? null : <CometChatReceipt
689
+ receipt={status}
690
+ deliveredIcon={props.deliveredIcon}
691
+ errorIcon={props.errorIcon}
692
+ readIcon={props.readIcon}
693
+ sentIcon={props.sentIcon}
694
+ waitIcon={props.waitingIcon}
695
+ />;
634
696
  }
635
697
 
636
698
  let threadView;
637
699
 
638
- if(lastMessage?.getParentMessageId()){
639
- threadView = <Text numberOfLines={1} style={[Style.subtitleTextStyle, { color: theme.palette.getAccent600() }]} >{localize("IN_A_THREAD")}</Text>
700
+ if (lastMessage?.getParentMessageId()) {
701
+ threadView = <Text numberOfLines={1} style={[Style.subtitleTextStyle, { color: theme.palette.getAccent600() }]} >{localize("IN_A_THREAD")}</Text>
640
702
  }
641
703
 
642
704
  return (
@@ -1,10 +1,9 @@
1
- import { AvatarStyleInterface, ListItemStyleInterface, localize } from "../shared";
1
+ import { AvatarStyleInterface, CometChatMentionsFormatter, CometChatTextFormatter, CometChatUrlsFormatter, ListItemStyleInterface, localize } from "../shared";
2
2
  import { ImageType } from "../shared";
3
3
  import { DatePattern,SelectionMode } from "../shared/base/Types";
4
- import { AvatarStyle, BadgeStyle, DateStyle, ListItemStyle, StatusIndicatorStyle } from "../shared";
5
4
  import { CometChatOptions } from "../shared";
6
5
  // import { ConversationListConfiguration } from "../CometChatConversationList/ConversationListConfiguration";
7
- import { ConversationsStyle, ConversationsStyleInterface } from "./ConversationsStyle";
6
+ import { ConversationsStyleInterface } from "./ConversationsStyle";
8
7
  //@ts-ignore
9
8
  import { CometChat } from "@cometchat/chat-sdk-react-native";
10
9
  import { StatusIndicatorStyleInterface } from "../shared/views/CometChatStatusIndicator/StatusIndicatorStyle";
@@ -50,7 +49,16 @@ export interface ConversationsConfigurationInterface {
50
49
  dateStyle?: DateStyleInterface,
51
50
  conversationsStyle?: ConversationsStyleInterface,
52
51
  listItemStyle?: ListItemStyleInterface,
53
- badgeStyle?: BadgeStyleInterface
52
+ badgeStyle?: BadgeStyleInterface,
53
+ /**
54
+ * if true, mentions will be disabled. Default: false
55
+ */
56
+ disableMentions?: boolean,
57
+ /**
58
+ * Collection of text formatter class
59
+ * @type {Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>}
60
+ */
61
+ textFormatters?: Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>;
54
62
  }
55
63
 
56
64
  /**
@@ -96,6 +104,15 @@ export class ConversationsConfiguration implements ConversationsConfigurationInt
96
104
  conversationsStyle?: ConversationsStyleInterface;
97
105
  listItemStyle?: ListItemStyleInterface;
98
106
  badgeStyle?: BadgeStyleInterface;
107
+ /**
108
+ * if true, mentions will be disabled. Default: false
109
+ */
110
+ disableMentions?: boolean;
111
+ /**
112
+ * Collection of text formatter class
113
+ * @type {Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>}
114
+ */
115
+ textFormatters?: Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>;
99
116
 
100
117
  constructor({
101
118
  disableUsersPresence = false,
@@ -137,6 +154,8 @@ export class ConversationsConfiguration implements ConversationsConfigurationInt
137
154
  conversationsStyle = undefined,
138
155
  listItemStyle = undefined,
139
156
  badgeStyle = undefined,
157
+ disableMentions,
158
+ textFormatters
140
159
  }: ConversationsConfigurationInterface) {
141
160
  this.disableUsersPresence = disableUsersPresence;
142
161
  this.disableReceipt = disableReceipt;
@@ -177,5 +196,7 @@ export class ConversationsConfiguration implements ConversationsConfigurationInt
177
196
  this.conversationsStyle = conversationsStyle
178
197
  this.listItemStyle = listItemStyle
179
198
  this.badgeStyle = badgeStyle
199
+ this.disableMentions = disableMentions;
200
+ this.textFormatters = textFormatters;
180
201
  }
181
202
  }
@@ -39,7 +39,7 @@ export const CometChatConversationsWithMessages = (props: CometChatConversations
39
39
  onError,
40
40
  } = props;
41
41
 
42
- const {theme} = useContext(CometChatContext);
42
+ const { theme } = useContext(CometChatContext);
43
43
 
44
44
  const [showComponent, setShowComponent] = useState(ComponentNames.ConversationList);
45
45
  // const [showForwarding, setShowForwarding] = useState(false);
@@ -75,15 +75,15 @@ export const CometChatConversationsWithMessages = (props: CometChatConversations
75
75
  const handleBack = () => {
76
76
  if (showComponent == ComponentNames.Messages)
77
77
  setShowComponent(ComponentNames.ConversationList);
78
- else
78
+ else
79
79
  return false;
80
80
  return true;
81
81
  }
82
82
 
83
83
  const NewConversation = () => {
84
84
  return <TouchableOpacity onPress={() => setShowComponent(ComponentNames.NewConversation)} >
85
- <Image source={StartIcon} style={{height: 24, width: 24, tintColor: theme.palette.getPrimary()}} />
86
- </TouchableOpacity>
85
+ <Image source={StartIcon} style={{ height: 24, width: 24, tintColor: theme.palette.getPrimary() }} />
86
+ </TouchableOpacity>
87
87
  }
88
88
 
89
89
  const clearSelected = () => {
@@ -93,14 +93,14 @@ export const CometChatConversationsWithMessages = (props: CometChatConversations
93
93
  }
94
94
 
95
95
  useEffect(() => {
96
- BackHandler.addEventListener('hardwareBackPress', handleBack);
97
- return () => {
96
+ BackHandler.addEventListener('hardwareBackPress', handleBack);
97
+ return () => {
98
98
  BackHandler.removeEventListener(
99
- 'hardwareBackPress',
100
- handleBack
99
+ 'hardwareBackPress',
100
+ handleBack
101
101
  );
102
- };
103
- }, [showComponent]);
102
+ };
103
+ }, [showComponent]);
104
104
 
105
105
  useEffect(() => {
106
106
  if (user) {
@@ -115,14 +115,14 @@ export const CometChatConversationsWithMessages = (props: CometChatConversations
115
115
 
116
116
  useEffect(() => {
117
117
  CometChatUIEventHandler.addUIListener(uiEventListener, {
118
- openChat: ({user, group}) => {
118
+ openChat: ({ user, group }) => {
119
119
  setShowComponent(ComponentNames.ConversationList);
120
120
  clearSelected();
121
- if (user != undefined){
121
+ if (user != undefined) {
122
122
  selectedUser.current = user;
123
123
  setShowComponent(ComponentNames.Messages);
124
124
  }
125
- if(group != undefined){
125
+ if (group != undefined) {
126
126
  selectedGroup.current = group;
127
127
  setShowComponent(ComponentNames.Messages);
128
128
  }
@@ -159,12 +159,12 @@ export const CometChatConversationsWithMessages = (props: CometChatConversations
159
159
  CometChatUIEventHandler.addGroupListener(
160
160
  uiEventListener,
161
161
  {
162
- ccGroupDeleted: ({group}) => {
162
+ ccGroupDeleted: ({ group }) => {
163
163
  if (selectedConversation.current?.getConversationWith()['guid'] == group['guid'] || selectedGroup.current?.getGuid() == group['guid'])
164
164
  setShowComponent(ComponentNames.ConversationList);
165
165
  },
166
- ccGroupLeft: ({leftGroup}) => {
167
- console.log({leftGroup});
166
+ ccGroupLeft: ({ leftGroup }) => {
167
+ console.log({ leftGroup });
168
168
  if (selectedConversation.current?.getConversationId() == leftGroup['conversationId'] || selectedGroup.current?.getGuid() == leftGroup['guid'])
169
169
  setShowComponent(ComponentNames.ConversationList);
170
170
  }
@@ -187,10 +187,10 @@ export const CometChatConversationsWithMessages = (props: CometChatConversations
187
187
  } */}
188
188
  {
189
189
  showComponent == ComponentNames.NewConversation &&
190
- <View style={[Style.stackScreen, {backgroundColor: theme.palette.getBackgroundColor()}]}>
190
+ <View style={[Style.stackScreen, { backgroundColor: theme.palette.getBackgroundColor() }]}>
191
191
  <CometChatContacts
192
192
  hideSubmit={true}
193
- onItemPress={({user, group}) => {
193
+ onItemPress={({ user, group }) => {
194
194
  clearSelected();
195
195
  selectedGroup.current = group;
196
196
  selectedUser.current = user;
@@ -208,18 +208,18 @@ export const CometChatConversationsWithMessages = (props: CometChatConversations
208
208
  }
209
209
  {
210
210
  showComponent == ComponentNames.Messages &&
211
- <View style={[Style.stackScreen, {backgroundColor: theme.palette.getBackgroundColor()}]}>
211
+ <View style={[Style.stackScreen, { backgroundColor: theme.palette.getBackgroundColor() }]}>
212
212
  <CometChatMessages
213
- user={
214
- selectedUser.current || selectedConversation.current?.['conversationType'] == "user" ?
215
- selectedUser.current || selectedConversation.current?.['conversationWith'] as CometChat.User :
216
- undefined
217
- }
218
- group={
219
- selectedGroup.current || selectedConversation.current?.['conversationType'] == "group" ?
220
- selectedGroup.current || selectedConversation.current?.['conversationWith'] as CometChat.Group :
221
- undefined
222
- }
213
+ user={
214
+ selectedUser.current || selectedConversation.current?.['conversationType'] == "user" ?
215
+ selectedUser.current || selectedConversation.current?.['conversationWith'] as CometChat.User :
216
+ undefined
217
+ }
218
+ group={
219
+ selectedGroup.current || selectedConversation.current?.['conversationType'] == "group" ?
220
+ selectedGroup.current || selectedConversation.current?.['conversationWith'] as CometChat.Group :
221
+ undefined
222
+ }
223
223
  {..._messagesConfig}
224
224
  />
225
225
  </View>