@cometchat/chat-uikit-react-native 5.0.0-beta.1 → 5.0.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.
Files changed (98) hide show
  1. package/README.md +2 -3
  2. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  3. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  4. package/android/src/main/java/com/reactnativecometchatuikit/CometChatSoundModule.java +29 -44
  5. package/android/src/main/java/com/reactnativecometchatuikit/SoundPlayer.java +12 -0
  6. package/ios/FileManager.m +26 -9
  7. package/package.json +11 -36
  8. package/src/CometChatConversations/CometChatConversations.tsx +287 -147
  9. package/src/CometChatConversations/Skeleton.tsx +116 -73
  10. package/src/CometChatConversations/style.ts +17 -22
  11. package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +439 -227
  12. package/src/CometChatGroupMembers/style.ts +2 -4
  13. package/src/CometChatGroups/CometChatGroups.tsx +239 -135
  14. package/src/CometChatGroups/GroupsStyle.ts +20 -17
  15. package/src/CometChatGroups/Skeleton.tsx +198 -288
  16. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +208 -73
  17. package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +97 -43
  18. package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +4 -2
  19. package/src/CometChatMessageList/CometChatMessageList.tsx +200 -76
  20. package/src/CometChatMessageList/style.ts +4 -4
  21. package/src/CometChatThreadHeader/CometChatThreadHeader.tsx +77 -11
  22. package/src/CometChatThreadHeader/style.ts +2 -2
  23. package/src/CometChatUsers/CometChatUsers.tsx +203 -51
  24. package/src/CometChatUsers/Skeleton.tsx +174 -159
  25. package/src/CometChatUsers/style.ts +21 -18
  26. package/src/calls/CallingConfiguration.ts +4 -3
  27. package/src/calls/CallingExtensionDecorator.tsx +5 -3
  28. package/src/calls/CometChatCallButtons/CometChatCallButtonConfiguration.ts +4 -2
  29. package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +10 -8
  30. package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +240 -97
  31. package/src/calls/CometChatCallLogs/Skeleton.tsx +175 -91
  32. package/src/calls/CometChatCallLogs/index.ts +1 -0
  33. package/src/calls/CometChatCallLogs/style.ts +85 -43
  34. package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +42 -29
  35. package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +36 -10
  36. package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +39 -12
  37. package/src/extensions/MessageTranslation/MessageTranslationDecorator.tsx +5 -4
  38. package/src/extensions/Polls/PollsDecorator.tsx +30 -9
  39. package/src/extensions/Stickers/StickersExtensionDecorator.tsx +34 -16
  40. package/src/index.ts +3 -1
  41. package/src/shared/base/Types.ts +31 -1
  42. package/src/shared/framework/DataSource.ts +64 -20
  43. package/src/shared/framework/DataSourceDecorator.tsx +46 -37
  44. package/src/shared/framework/MessageDataSource.tsx +518 -316
  45. package/src/shared/index.ts +3 -1
  46. package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +3 -2
  47. package/src/shared/resources/CometChatLocalize/resources/de/translation.json +3 -2
  48. package/src/shared/resources/CometChatLocalize/resources/en/translation.json +3 -2
  49. package/src/shared/resources/CometChatLocalize/resources/es/translation.json +3 -2
  50. package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +3 -2
  51. package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +3 -2
  52. package/src/shared/resources/CometChatLocalize/resources/hu/translation.json +3 -2
  53. package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +3 -2
  54. package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +3 -2
  55. package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +3 -2
  56. package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +3 -2
  57. package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +3 -2
  58. package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +3 -2
  59. package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +3 -2
  60. package/src/shared/utils/MessageUtils.tsx +41 -20
  61. package/src/shared/utils/conversationUtils.ts +2 -2
  62. package/src/shared/views/CometChatAvatar/CometChatAvatar.tsx +22 -1
  63. package/src/shared/views/CometChatBadge/CometChatBadge.tsx +20 -8
  64. package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +177 -123
  65. package/src/shared/views/CometChatConfirmDialog/CometChatConfirmDialog.tsx +76 -10
  66. package/src/shared/views/CometChatConfirmDialog/style.ts +2 -2
  67. package/src/shared/views/CometChatDate/CometChatDate.tsx +26 -18
  68. package/src/shared/views/CometChatDateSeperator/CometChatDateSeparator.tsx +22 -16
  69. package/src/shared/views/CometChatDeletedBubble/CometChatDeletedBubble.tsx +17 -5
  70. package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +65 -35
  71. package/src/shared/views/CometChatImageBubble/CometChatImageBubble.tsx +22 -11
  72. package/src/shared/views/CometChatImageBubble/CometChatImageLoader.tsx +47 -18
  73. package/src/shared/views/CometChatList/CometChatList.tsx +70 -46
  74. package/src/shared/views/CometChatList/Header.tsx +122 -37
  75. package/src/shared/views/CometChatList/styles.ts +1 -0
  76. package/src/shared/views/CometChatListItem/CometChatListItem.tsx +116 -30
  77. package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +52 -30
  78. package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +36 -22
  79. package/src/shared/views/CometChatQuickReactions/CometChatQuickReactions.tsx +41 -13
  80. package/src/shared/views/CometChatReactionList/CometChatReactionList.tsx +132 -17
  81. package/src/shared/views/CometChatReactions/CometChatReactions.tsx +30 -2
  82. package/src/shared/views/CometChatReceipt/CometChatReceipt.tsx +10 -6
  83. package/src/shared/views/CometChatStatusIndicator/CometChatStatusIndicator.tsx +20 -13
  84. package/src/shared/views/CometChatStatusIndicator/styles.ts +26 -13
  85. package/src/shared/views/CometChatSuggestionList/CometChatSuggestionList.tsx +25 -2
  86. package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +94 -14
  87. package/src/shared/views/CometChatTooltipMenu/CometChatTooltipMenu.tsx +52 -16
  88. package/src/shared/views/CometChatTooltipMenu/index.ts +2 -1
  89. package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +29 -9
  90. package/src/shared/views/CometChatVideoPlayer/CometChatVideoPlayer.tsx +20 -2
  91. package/src/shared/views/ErrorEmptyView/ErrorEmptyView.tsx +29 -14
  92. package/src/shared/views/index.ts +2 -0
  93. package/src/theme/default/index.ts +5 -5
  94. package/src/theme/type.ts +2 -2
  95. package/src/shared/views/CometChatPanel/CometChatPanel.tsx +0 -57
  96. package/src/shared/views/CometChatPanel/PanelStyle.tsx +0 -43
  97. package/src/shared/views/CometChatPanel/resources/CloseIcon.png +0 -0
  98. package/src/shared/views/CometChatPanel/resources/index.ts +0 -3
@@ -7,7 +7,13 @@ import {
7
7
  CometChatUrlsFormatter,
8
8
  } from "../..";
9
9
  import { CometChatTheme } from "../../theme/type";
10
- import { AdditionalParams, MessageBubbleAlignmentType } from "../base/Types";
10
+ import {
11
+ AdditionalAttachmentOptionsParams,
12
+ AdditionalAuxiliaryHeaderOptionsParams,
13
+ AdditionalAuxiliaryOptionsParams,
14
+ AdditionalParams,
15
+ MessageBubbleAlignmentType,
16
+ } from "../base/Types";
11
17
  import {
12
18
  CometChatMessageTypes,
13
19
  GroupMemberScope,
@@ -247,28 +253,57 @@ export class MessageDataSource implements DataSource {
247
253
  loggedInUser: CometChat.User,
248
254
  messageObject: CometChat.BaseMessage,
249
255
  theme: CometChatTheme,
250
- group?: CometChat.Group
256
+ group?: CometChat.Group,
257
+ additionalParams?: AdditionalParams
251
258
  ): CometChatMessageOption[] {
252
259
  let messageOptionList: CometChatMessageOption[] = [];
253
260
 
254
261
  if (isDeletedMessage(messageObject)) return messageOptionList;
255
262
 
256
263
  if (
257
- this.validateOption(loggedInUser, messageObject, MessageOptionConstants.replyInThread, group)
264
+ this.validateOption(
265
+ loggedInUser,
266
+ messageObject,
267
+ MessageOptionConstants.replyInThread,
268
+ group,
269
+ additionalParams
270
+ )
258
271
  ) {
259
272
  messageOptionList.push(this.getReplyInThreadOption(theme));
260
273
  }
261
274
 
262
275
  if (
263
- this.validateOption(loggedInUser, messageObject, MessageOptionConstants.shareMessage, group)
276
+ this.validateOption(
277
+ loggedInUser,
278
+ messageObject,
279
+ MessageOptionConstants.shareMessage,
280
+ group,
281
+ additionalParams
282
+ )
264
283
  ) {
265
284
  messageOptionList.push(this.getShareOption(theme));
266
285
  }
267
286
 
268
- messageOptionList.push(this.getCopyOption(theme));
287
+ if (
288
+ this.validateOption(
289
+ loggedInUser,
290
+ messageObject,
291
+ MessageOptionConstants.copyMessage,
292
+ group,
293
+ additionalParams
294
+ )
295
+ ) {
296
+ messageOptionList.push(this.getCopyOption(theme));
297
+ }
269
298
 
270
299
  if (
271
- this.validateOption(loggedInUser, messageObject, MessageOptionConstants.editMessage, group)
300
+ this.validateOption(
301
+ loggedInUser,
302
+ messageObject,
303
+ MessageOptionConstants.editMessage,
304
+ group,
305
+ additionalParams
306
+ )
272
307
  ) {
273
308
  messageOptionList.push(this.getEditOption(theme));
274
309
  }
@@ -278,14 +313,21 @@ export class MessageDataSource implements DataSource {
278
313
  loggedInUser,
279
314
  messageObject,
280
315
  MessageOptionConstants.messageInformation,
281
- group
316
+ group,
317
+ additionalParams
282
318
  )
283
319
  ) {
284
320
  messageOptionList.push(this.getInformationOption(theme));
285
321
  }
286
322
 
287
323
  if (
288
- this.validateOption(loggedInUser, messageObject, MessageOptionConstants.deleteMessage, group)
324
+ this.validateOption(
325
+ loggedInUser,
326
+ messageObject,
327
+ MessageOptionConstants.deleteMessage,
328
+ group,
329
+ additionalParams
330
+ )
289
331
  ) {
290
332
  messageOptionList.push(this.getDeleteOption(theme));
291
333
  }
@@ -295,7 +337,8 @@ export class MessageDataSource implements DataSource {
295
337
  loggedInUser,
296
338
  messageObject,
297
339
  MessageOptionConstants.sendMessagePrivately,
298
- group
340
+ group,
341
+ additionalParams
299
342
  )
300
343
  ) {
301
344
  messageOptionList.push(this.getPrivateMessageOption(theme));
@@ -308,12 +351,19 @@ export class MessageDataSource implements DataSource {
308
351
  loggedInUser: CometChat.User,
309
352
  messageObject: CometChat.BaseMessage,
310
353
  theme: CometChatTheme,
311
- group?: CometChat.Group
354
+ group?: CometChat.Group,
355
+ additionalParams?: AdditionalParams
312
356
  ): CometChatMessageOption[] {
313
357
  let optionsList: Array<CometChatMessageOption> = [];
314
358
  if (!isDeletedMessage(messageObject))
315
359
  optionsList.push(
316
- ...ChatConfigurator.dataSource.getCommonOptions(loggedInUser, messageObject, theme, group)
360
+ ...ChatConfigurator.dataSource.getCommonOptions(
361
+ loggedInUser,
362
+ messageObject,
363
+ theme,
364
+ group,
365
+ additionalParams
366
+ )
317
367
  );
318
368
  return optionsList;
319
369
  }
@@ -321,12 +371,19 @@ export class MessageDataSource implements DataSource {
321
371
  loggedInUser: CometChat.User,
322
372
  messageObject: CometChat.BaseMessage,
323
373
  theme: CometChatTheme,
324
- group?: CometChat.Group
374
+ group?: CometChat.Group,
375
+ additionalParams?: AdditionalParams
325
376
  ): CometChatMessageOption[] {
326
377
  let optionsList: Array<CometChatMessageOption> = [];
327
378
  if (!isDeletedMessage(messageObject))
328
379
  optionsList.push(
329
- ...ChatConfigurator.dataSource.getCommonOptions(loggedInUser, messageObject, theme, group)
380
+ ...ChatConfigurator.dataSource.getCommonOptions(
381
+ loggedInUser,
382
+ messageObject,
383
+ theme,
384
+ group,
385
+ additionalParams
386
+ )
330
387
  );
331
388
  return optionsList;
332
389
  }
@@ -334,12 +391,19 @@ export class MessageDataSource implements DataSource {
334
391
  loggedInUser: CometChat.User,
335
392
  messageObject: CometChat.BaseMessage,
336
393
  theme: CometChatTheme,
337
- group?: CometChat.Group
394
+ group?: CometChat.Group,
395
+ additionalParams?: AdditionalParams
338
396
  ): CometChatMessageOption[] {
339
397
  let optionsList: Array<CometChatMessageOption> = [];
340
398
  if (!isDeletedMessage(messageObject))
341
399
  optionsList.push(
342
- ...ChatConfigurator.dataSource.getCommonOptions(loggedInUser, messageObject, theme, group)
400
+ ...ChatConfigurator.dataSource.getCommonOptions(
401
+ loggedInUser,
402
+ messageObject,
403
+ theme,
404
+ group,
405
+ additionalParams
406
+ )
343
407
  );
344
408
  return optionsList;
345
409
  }
@@ -347,12 +411,19 @@ export class MessageDataSource implements DataSource {
347
411
  loggedInUser: CometChat.User,
348
412
  messageObject: CometChat.BaseMessage,
349
413
  theme: CometChatTheme,
350
- group?: CometChat.Group
414
+ group?: CometChat.Group,
415
+ additionalParams?: AdditionalParams
351
416
  ): CometChatMessageOption[] {
352
417
  let optionsList: Array<CometChatMessageOption> = [];
353
418
  if (!isDeletedMessage(messageObject))
354
419
  optionsList.push(
355
- ...ChatConfigurator.dataSource.getCommonOptions(loggedInUser, messageObject, theme, group)
420
+ ...ChatConfigurator.dataSource.getCommonOptions(
421
+ loggedInUser,
422
+ messageObject,
423
+ theme,
424
+ group,
425
+ additionalParams
426
+ )
356
427
  );
357
428
  return optionsList;
358
429
  }
@@ -360,7 +431,8 @@ export class MessageDataSource implements DataSource {
360
431
  loggedInUser: CometChat.User,
361
432
  messageObject: CometChat.BaseMessage,
362
433
  theme: CometChatTheme,
363
- group?: CometChat.Group
434
+ group?: CometChat.Group,
435
+ additionalParams?: AdditionalParams
364
436
  ): CometChatMessageOption[] {
365
437
  let optionsList: Array<CometChatMessageOption> = [];
366
438
  if (isDeletedMessage(messageObject)) return optionsList;
@@ -373,7 +445,8 @@ export class MessageDataSource implements DataSource {
373
445
  loggedInUser,
374
446
  messageObject,
375
447
  theme,
376
- group
448
+ group,
449
+ additionalParams
377
450
  )
378
451
  );
379
452
  break;
@@ -383,7 +456,8 @@ export class MessageDataSource implements DataSource {
383
456
  loggedInUser,
384
457
  messageObject,
385
458
  theme,
386
- group
459
+ group,
460
+ additionalParams
387
461
  )
388
462
  );
389
463
  break;
@@ -393,7 +467,8 @@ export class MessageDataSource implements DataSource {
393
467
  loggedInUser,
394
468
  messageObject,
395
469
  theme,
396
- group
470
+ group,
471
+ additionalParams
397
472
  )
398
473
  );
399
474
  break;
@@ -403,7 +478,8 @@ export class MessageDataSource implements DataSource {
403
478
  loggedInUser,
404
479
  messageObject,
405
480
  theme,
406
- group
481
+ group,
482
+ additionalParams
407
483
  )
408
484
  );
409
485
  break;
@@ -413,14 +489,21 @@ export class MessageDataSource implements DataSource {
413
489
  loggedInUser,
414
490
  messageObject,
415
491
  theme,
416
- group
492
+ group,
493
+ additionalParams
417
494
  )
418
495
  );
419
496
  break;
420
497
  }
421
498
  } else if (messageObject.getCategory() == MessageCategoryConstants.custom) {
422
499
  optionsList.push(
423
- ...ChatConfigurator.dataSource.getCommonOptions(loggedInUser, messageObject, theme, group)
500
+ ...ChatConfigurator.dataSource.getCommonOptions(
501
+ loggedInUser,
502
+ messageObject,
503
+ theme,
504
+ group,
505
+ additionalParams
506
+ )
424
507
  );
425
508
  } else if (messageObject.getCategory() == MessageCategoryConstants.interactive) {
426
509
  let type: string = messageObject.getType();
@@ -433,11 +516,13 @@ export class MessageDataSource implements DataSource {
433
516
  loggedInUser: CometChat.User,
434
517
  messageObject: CometChat.BaseMessage,
435
518
  optionId: string,
436
- group?: CometChat.Group | null
519
+ group?: CometChat.Group | null,
520
+ additionalParams?: AdditionalParams
437
521
  ): boolean {
438
522
  if (
439
523
  MessageOptionConstants.replyInThread === optionId &&
440
- (!messageObject.getParentMessageId() || messageObject.getParentMessageId() === 0)
524
+ (!messageObject.getParentMessageId() || messageObject.getParentMessageId() === 0) &&
525
+ !additionalParams?.hideReplyInThreadOption
441
526
  ) {
442
527
  return true;
443
528
  }
@@ -445,21 +530,27 @@ export class MessageDataSource implements DataSource {
445
530
  if (
446
531
  MessageOptionConstants.shareMessage === optionId &&
447
532
  (messageObject instanceof CometChat.TextMessage ||
448
- messageObject instanceof CometChat.MediaMessage)
533
+ messageObject instanceof CometChat.MediaMessage) &&
534
+ !additionalParams?.hideShareMessageOption
449
535
  ) {
450
536
  return true;
451
537
  }
452
538
 
453
539
  if (
454
540
  MessageOptionConstants.copyMessage === optionId &&
455
- messageObject instanceof CometChat.TextMessage
541
+ messageObject instanceof CometChat.TextMessage &&
542
+ !additionalParams?.hideCopyMessageOption
456
543
  ) {
457
544
  return true;
458
545
  }
459
546
 
460
547
  let isSentByMe: boolean = this.isSentByMe(loggedInUser, messageObject);
461
548
 
462
- if (MessageOptionConstants.messageInformation === optionId && isSentByMe) {
549
+ if (
550
+ MessageOptionConstants.messageInformation === optionId &&
551
+ isSentByMe &&
552
+ !additionalParams?.hideMessageInfoOption
553
+ ) {
463
554
  return true;
464
555
  }
465
556
 
@@ -471,18 +562,16 @@ export class MessageDataSource implements DataSource {
471
562
 
472
563
  if (
473
564
  MessageOptionConstants.deleteMessage === optionId &&
474
- (isSentByMe || memberIsNotParticipant)
565
+ (isSentByMe || memberIsNotParticipant) &&
566
+ !additionalParams?.hideDeleteMessageOption
475
567
  ) {
476
568
  return true;
477
569
  }
478
570
 
479
- if (MessageOptionConstants.editMessage === optionId && (isSentByMe || memberIsNotParticipant)) {
480
- return true;
481
- }
482
-
483
571
  if (
484
- MessageOptionConstants.copyMessage === optionId &&
485
- messageObject instanceof CometChat.TextMessage
572
+ MessageOptionConstants.editMessage === optionId &&
573
+ (isSentByMe || memberIsNotParticipant) &&
574
+ !additionalParams?.hideEditMessageOption
486
575
  ) {
487
576
  return true;
488
577
  }
@@ -490,7 +579,8 @@ export class MessageDataSource implements DataSource {
490
579
  if (
491
580
  MessageOptionConstants.sendMessagePrivately === optionId &&
492
581
  group &&
493
- loggedInUser.getUid() != messageObject.getSender()?.getUid()
582
+ loggedInUser.getUid() != messageObject.getSender()?.getUid() &&
583
+ !additionalParams?.hideMessagePrivatelyOption
494
584
  ) {
495
585
  return true;
496
586
  }
@@ -502,20 +592,33 @@ export class MessageDataSource implements DataSource {
502
592
  loggedInUser: CometChat.User,
503
593
  messageObject: CometChat.BaseMessage,
504
594
  theme: CometChatTheme,
505
- group?: CometChat.Group
595
+ group?: CometChat.Group,
596
+ additionalParams?: AdditionalParams
506
597
  ): CometChatMessageOption[] {
507
598
  let messageOptionList: CometChatMessageOption[] = [];
508
599
 
509
600
  if (isDeletedMessage(messageObject)) return messageOptionList;
510
601
 
511
602
  if (
512
- this.validateOption(loggedInUser, messageObject, MessageOptionConstants.replyInThread, group)
603
+ this.validateOption(
604
+ loggedInUser,
605
+ messageObject,
606
+ MessageOptionConstants.replyInThread,
607
+ group,
608
+ additionalParams
609
+ )
513
610
  ) {
514
611
  messageOptionList.push(this.getReplyInThreadOption(theme));
515
612
  }
516
613
 
517
614
  if (
518
- this.validateOption(loggedInUser, messageObject, MessageOptionConstants.shareMessage, group)
615
+ this.validateOption(
616
+ loggedInUser,
617
+ messageObject,
618
+ MessageOptionConstants.shareMessage,
619
+ group,
620
+ additionalParams
621
+ )
519
622
  ) {
520
623
  messageOptionList.push(this.getShareOption(theme));
521
624
  }
@@ -525,14 +628,21 @@ export class MessageDataSource implements DataSource {
525
628
  loggedInUser,
526
629
  messageObject,
527
630
  MessageOptionConstants.messageInformation,
528
- group
631
+ group,
632
+ additionalParams
529
633
  )
530
634
  ) {
531
635
  messageOptionList.push(this.getInformationOption(theme));
532
636
  }
533
637
 
534
638
  if (
535
- this.validateOption(loggedInUser, messageObject, MessageOptionConstants.deleteMessage, group)
639
+ this.validateOption(
640
+ loggedInUser,
641
+ messageObject,
642
+ MessageOptionConstants.deleteMessage,
643
+ group,
644
+ additionalParams
645
+ )
536
646
  ) {
537
647
  messageOptionList.push(this.getDeleteOption(theme));
538
648
  }
@@ -542,7 +652,8 @@ export class MessageDataSource implements DataSource {
542
652
  loggedInUser,
543
653
  messageObject,
544
654
  MessageOptionConstants.sendMessagePrivately,
545
- group
655
+ group,
656
+ additionalParams
546
657
  )
547
658
  ) {
548
659
  messageOptionList.push(this.getPrivateMessageOption(theme));
@@ -663,11 +774,8 @@ export class MessageDataSource implements DataSource {
663
774
  mentionsFormatterExists = true;
664
775
  formatter.setMessage(message);
665
776
  formatter.setTargetElement(MentionsTargetElement.textbubble);
666
- formatter.setMentionsStyle();
667
777
  formatter.setLoggedInUser(CometChatUIKit.loggedInUser!);
668
778
  }
669
- if (formatter instanceof CometChatUrlsFormatter) {
670
- }
671
779
  formatter.setMessage(message);
672
780
  finalFormatters.push(CommonUtils.clone(formatter));
673
781
  if (urlFormatterExists && mentionsFormatterExists) {
@@ -893,14 +1001,23 @@ export class MessageDataSource implements DataSource {
893
1001
  }
894
1002
  },
895
1003
  options: (loggedInuser, message, theme, group) =>
896
- ChatConfigurator.dataSource.getTextMessageOptions(loggedInuser, message, theme, group),
1004
+ ChatConfigurator.dataSource.getTextMessageOptions(
1005
+ loggedInuser,
1006
+ message,
1007
+ theme,
1008
+ group,
1009
+ additionalParams
1010
+ ),
897
1011
  BottomView: (message: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) => {
898
1012
  return ChatConfigurator.dataSource.getBottomView(message, alignment);
899
1013
  },
900
1014
  });
901
1015
  }
902
1016
 
903
- getAudioMessageTemplate(theme: CometChatTheme): CometChatMessageTemplate {
1017
+ getAudioMessageTemplate(
1018
+ theme: CometChatTheme,
1019
+ additionalParams?: AdditionalParams
1020
+ ): CometChatMessageTemplate {
904
1021
  return new CometChatMessageTemplate({
905
1022
  type: MessageTypeConstants.audio,
906
1023
  category: MessageCategoryConstants.message,
@@ -911,13 +1028,22 @@ export class MessageDataSource implements DataSource {
911
1028
  return ChatConfigurator.dataSource.getAudioMessageContentView(message, alignment, theme);
912
1029
  },
913
1030
  options: (loggedInuser, message, theme, group) =>
914
- ChatConfigurator.dataSource.getAudioMessageOptions(loggedInuser, message, theme, group),
1031
+ ChatConfigurator.dataSource.getAudioMessageOptions(
1032
+ loggedInuser,
1033
+ message,
1034
+ theme,
1035
+ group,
1036
+ additionalParams
1037
+ ),
915
1038
  BottomView: (message: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) => {
916
1039
  return ChatConfigurator.dataSource.getBottomView(message, alignment);
917
1040
  },
918
1041
  });
919
1042
  }
920
- getVideoMessageTemplate(theme: CometChatTheme): CometChatMessageTemplate {
1043
+ getVideoMessageTemplate(
1044
+ theme: CometChatTheme,
1045
+ additionalParams?: AdditionalParams
1046
+ ): CometChatMessageTemplate {
921
1047
  return new CometChatMessageTemplate({
922
1048
  type: MessageTypeConstants.video,
923
1049
  category: MessageCategoryConstants.message,
@@ -928,13 +1054,22 @@ export class MessageDataSource implements DataSource {
928
1054
  return ChatConfigurator.dataSource.getVideoMessageContentView(message, alignment, theme);
929
1055
  },
930
1056
  options: (loggedInuser, message, theme, group) =>
931
- ChatConfigurator.dataSource.getVideoMessageOptions(loggedInuser, message, theme, group),
1057
+ ChatConfigurator.dataSource.getVideoMessageOptions(
1058
+ loggedInuser,
1059
+ message,
1060
+ theme,
1061
+ group,
1062
+ additionalParams
1063
+ ),
932
1064
  BottomView: (message: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) => {
933
1065
  return ChatConfigurator.dataSource.getBottomView(message, alignment);
934
1066
  },
935
1067
  });
936
1068
  }
937
- getImageMessageTemplate(theme: CometChatTheme): CometChatMessageTemplate {
1069
+ getImageMessageTemplate(
1070
+ theme: CometChatTheme,
1071
+ additionalParams?: AdditionalParams
1072
+ ): CometChatMessageTemplate {
938
1073
  return new CometChatMessageTemplate({
939
1074
  type: MessageTypeConstants.image,
940
1075
  category: MessageCategoryConstants.message,
@@ -945,13 +1080,22 @@ export class MessageDataSource implements DataSource {
945
1080
  return ChatConfigurator.dataSource.getImageMessageContentView(message, alignment, theme);
946
1081
  },
947
1082
  options: (loggedInuser, message, theme, group) =>
948
- ChatConfigurator.dataSource.getImageMessageOptions(loggedInuser, message, theme, group),
1083
+ ChatConfigurator.dataSource.getImageMessageOptions(
1084
+ loggedInuser,
1085
+ message,
1086
+ theme,
1087
+ group,
1088
+ additionalParams
1089
+ ),
949
1090
  BottomView: (message: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) => {
950
1091
  return ChatConfigurator.dataSource.getBottomView(message, alignment);
951
1092
  },
952
1093
  });
953
1094
  }
954
- getFileMessageTemplate(theme: CometChatTheme): CometChatMessageTemplate {
1095
+ getFileMessageTemplate(
1096
+ theme: CometChatTheme,
1097
+ additionalParams?: AdditionalParams
1098
+ ): CometChatMessageTemplate {
955
1099
  return new CometChatMessageTemplate({
956
1100
  type: MessageTypeConstants.file,
957
1101
  category: MessageCategoryConstants.message,
@@ -962,14 +1106,23 @@ export class MessageDataSource implements DataSource {
962
1106
  return ChatConfigurator.dataSource.getFileMessageContentView(message, alignment, theme);
963
1107
  },
964
1108
  options: (loggedInuser, message, theme, group) =>
965
- ChatConfigurator.dataSource.getFileMessageOptions(loggedInuser, message, theme, group),
1109
+ ChatConfigurator.dataSource.getFileMessageOptions(
1110
+ loggedInuser,
1111
+ message,
1112
+ theme,
1113
+ group,
1114
+ additionalParams
1115
+ ),
966
1116
  BottomView: (message: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) => {
967
1117
  return ChatConfigurator.dataSource.getBottomView(message, alignment);
968
1118
  },
969
1119
  });
970
1120
  }
971
1121
 
972
- getFormMessageTemplate(theme: CometChatTheme): CometChatMessageTemplate {
1122
+ getFormMessageTemplate(
1123
+ theme: CometChatTheme,
1124
+ additionalParams?: AdditionalParams
1125
+ ): CometChatMessageTemplate {
973
1126
  return new CometChatMessageTemplate({
974
1127
  type: MessageTypeConstants.form,
975
1128
  category: MessageCategoryConstants.interactive,
@@ -993,7 +1146,10 @@ export class MessageDataSource implements DataSource {
993
1146
  });
994
1147
  }
995
1148
 
996
- getSchedulerMessageTemplate(theme: CometChatTheme): CometChatMessageTemplate {
1149
+ getSchedulerMessageTemplate(
1150
+ theme: CometChatTheme,
1151
+ additionalParams?: AdditionalParams
1152
+ ): CometChatMessageTemplate {
997
1153
  return new CometChatMessageTemplate({
998
1154
  type: MessageTypeConstants.scheduler,
999
1155
  category: MessageCategoryConstants.interactive,
@@ -1017,7 +1173,10 @@ export class MessageDataSource implements DataSource {
1017
1173
  });
1018
1174
  }
1019
1175
 
1020
- getCardMessageTemplate(theme: CometChatTheme): CometChatMessageTemplate {
1176
+ getCardMessageTemplate(
1177
+ theme: CometChatTheme,
1178
+ additionalParams?: AdditionalParams
1179
+ ): CometChatMessageTemplate {
1021
1180
  return new CometChatMessageTemplate({
1022
1181
  type: MessageTypeConstants.card,
1023
1182
  category: MessageCategoryConstants.interactive,
@@ -1041,7 +1200,10 @@ export class MessageDataSource implements DataSource {
1041
1200
  });
1042
1201
  }
1043
1202
 
1044
- getGroupActionTemplate(theme: CometChatTheme): CometChatMessageTemplate {
1203
+ getGroupActionTemplate(
1204
+ theme: CometChatTheme,
1205
+ additionalParams?: AdditionalParams
1206
+ ): CometChatMessageTemplate {
1045
1207
  return new CometChatMessageTemplate({
1046
1208
  type: MessageTypeConstants.groupMember,
1047
1209
  category: MessageCategoryConstants.action,
@@ -1057,22 +1219,23 @@ export class MessageDataSource implements DataSource {
1057
1219
  ): CometChatMessageTemplate[] {
1058
1220
  return [
1059
1221
  ChatConfigurator.dataSource.getTextMessageTemplate(theme, additionalParams),
1060
- ChatConfigurator.dataSource.getAudioMessageTemplate(theme),
1061
- ChatConfigurator.dataSource.getVideoMessageTemplate(theme),
1062
- ChatConfigurator.dataSource.getFileMessageTemplate(theme),
1063
- ChatConfigurator.dataSource.getImageMessageTemplate(theme),
1064
- ChatConfigurator.dataSource.getGroupActionTemplate(theme),
1065
- ChatConfigurator.dataSource.getGroupActionTemplate(theme),
1066
- ChatConfigurator.dataSource.getFormMessageTemplate(theme),
1067
- ChatConfigurator.dataSource.getSchedulerMessageTemplate(theme),
1068
- ChatConfigurator.dataSource.getCardMessageTemplate(theme),
1222
+ ChatConfigurator.dataSource.getAudioMessageTemplate(theme, additionalParams),
1223
+ ChatConfigurator.dataSource.getVideoMessageTemplate(theme, additionalParams),
1224
+ ChatConfigurator.dataSource.getFileMessageTemplate(theme, additionalParams),
1225
+ ChatConfigurator.dataSource.getImageMessageTemplate(theme, additionalParams),
1226
+ ChatConfigurator.dataSource.getGroupActionTemplate(theme, additionalParams),
1227
+ ChatConfigurator.dataSource.getGroupActionTemplate(theme, additionalParams),
1228
+ ChatConfigurator.dataSource.getFormMessageTemplate(theme, additionalParams),
1229
+ ChatConfigurator.dataSource.getSchedulerMessageTemplate(theme, additionalParams),
1230
+ ChatConfigurator.dataSource.getCardMessageTemplate(theme, additionalParams),
1069
1231
  ];
1070
1232
  }
1071
1233
 
1072
1234
  getMessageTemplate(
1073
1235
  messageType: string,
1074
1236
  MessageCategory: string,
1075
- theme: CometChatTheme
1237
+ theme: CometChatTheme,
1238
+ additionalParams?: AdditionalParams
1076
1239
  ): CometChatMessageTemplate | null {
1077
1240
  // let _theme: CometChatTheme = useContext("theme") ???
1078
1241
  let template: CometChatMessageTemplate;
@@ -1082,29 +1245,29 @@ export class MessageDataSource implements DataSource {
1082
1245
 
1083
1246
  switch (messageType) {
1084
1247
  case MessageTypeConstants.text:
1085
- template = ChatConfigurator.dataSource.getTextMessageTemplate(theme);
1248
+ template = ChatConfigurator.dataSource.getTextMessageTemplate(theme, additionalParams);
1086
1249
  break;
1087
1250
  case MessageTypeConstants.audio:
1088
- template = ChatConfigurator.dataSource.getAudioMessageTemplate(theme);
1251
+ template = ChatConfigurator.dataSource.getAudioMessageTemplate(theme, additionalParams);
1089
1252
  break;
1090
1253
  case MessageTypeConstants.video:
1091
- template = ChatConfigurator.dataSource.getVideoMessageTemplate(theme);
1254
+ template = ChatConfigurator.dataSource.getVideoMessageTemplate(theme, additionalParams);
1092
1255
  break;
1093
1256
  case MessageTypeConstants.groupActions:
1094
1257
  case MessageTypeConstants.groupMember:
1095
- template = ChatConfigurator.dataSource.getGroupActionTemplate(theme);
1258
+ template = ChatConfigurator.dataSource.getGroupActionTemplate(theme, additionalParams);
1096
1259
  break;
1097
1260
  case MessageTypeConstants.file:
1098
- template = ChatConfigurator.dataSource.getFileMessageTemplate(theme);
1261
+ template = ChatConfigurator.dataSource.getFileMessageTemplate(theme, additionalParams);
1099
1262
  break;
1100
1263
  case MessageTypeConstants.form:
1101
- template = ChatConfigurator.dataSource.getFormMessageTemplate(theme);
1264
+ template = ChatConfigurator.dataSource.getFormMessageTemplate(theme, additionalParams);
1102
1265
  break;
1103
1266
  case MessageTypeConstants.scheduler:
1104
- template = ChatConfigurator.dataSource.getSchedulerMessageTemplate(theme);
1267
+ template = ChatConfigurator.dataSource.getSchedulerMessageTemplate(theme, additionalParams);
1105
1268
  break;
1106
1269
  case MessageTypeConstants.card:
1107
- template = ChatConfigurator.dataSource.getCardMessageTemplate(theme);
1270
+ template = ChatConfigurator.dataSource.getCardMessageTemplate(theme, additionalParams);
1108
1271
  break;
1109
1272
  }
1110
1273
  return null;
@@ -1135,14 +1298,14 @@ export class MessageDataSource implements DataSource {
1135
1298
  user: CometChat.User,
1136
1299
  group: CometChat.Group,
1137
1300
  id: Map<string, any>,
1138
- additionalParams?: AdditionalParams
1301
+ additionalAuxiliaryParams?: AdditionalAuxiliaryOptionsParams
1139
1302
  ): JSX.Element[] {
1140
1303
  return [];
1141
1304
  }
1142
1305
  getAuxiliaryHeaderAppbarOptions(
1143
1306
  user?: CometChat.User,
1144
1307
  group?: CometChat.Group,
1145
- additionalParams?: AdditionalParams
1308
+ additionalAuxiliaryHeaderOptionsParams?: AdditionalAuxiliaryHeaderOptionsParams
1146
1309
  ): JSX.Element | null {
1147
1310
  return null;
1148
1311
  }
@@ -1173,247 +1336,289 @@ export class MessageDataSource implements DataSource {
1173
1336
  }
1174
1337
  return subtitle;
1175
1338
  }
1176
- usersActionList = (theme: CometChatTheme) => [
1177
- {
1178
- id: MessageTypeConstants.takePhoto,
1179
- title: localize("CAMERA"),
1180
- icon: (
1181
- <Icon
1182
- name='photo-camera-fill'
1183
- color={theme.color.primary}
1184
- height={
1185
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1186
- ?.height as DimensionValue
1187
- }
1188
- width={
1189
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1190
- ?.width as DimensionValue
1191
- }
1192
- containerStyle={
1193
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle
1194
- ?.iconContainerStyle as ViewStyle
1195
- }
1196
- />
1197
- ),
1198
- onClick: null,
1199
- },
1200
- {
1201
- id: MessageTypeConstants.image,
1202
- title: localize("ATTACH_IMAGE"),
1203
- icon: (
1204
- <Icon
1205
- name='photo-fill'
1206
- color={theme.color.primary}
1207
- height={
1208
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1209
- ?.height as DimensionValue
1210
- }
1211
- width={
1212
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1213
- ?.width as DimensionValue
1214
- }
1215
- containerStyle={
1216
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle
1217
- ?.iconContainerStyle as ViewStyle
1218
- }
1219
- />
1220
- ),
1221
- onClick: null,
1222
- },
1223
- {
1224
- id: MessageTypeConstants.video,
1225
- title: localize("ATTACH_VIDEO"),
1226
- icon: (
1227
- <Icon
1228
- name='videocam-fill'
1229
- color={theme.color.primary}
1230
- height={
1231
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1232
- ?.height as DimensionValue
1233
- }
1234
- width={
1235
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1236
- ?.width as DimensionValue
1237
- }
1238
- containerStyle={
1239
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle
1240
- ?.iconContainerStyle as ViewStyle
1241
- }
1242
- />
1243
- ),
1244
- onClick: null,
1245
- },
1246
- {
1247
- id: MessageTypeConstants.audio,
1248
- title: localize("ATTACH_AUDIO"),
1249
- icon: (
1250
- <Icon
1251
- name='play-circle-fill'
1252
- color={theme.color.primary}
1253
- height={
1254
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1255
- ?.height as DimensionValue
1256
- }
1257
- width={
1258
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1259
- ?.width as DimensionValue
1260
- }
1261
- containerStyle={
1262
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle
1263
- ?.iconContainerStyle as ViewStyle
1264
- }
1265
- />
1266
- ),
1267
- onClick: null,
1268
- },
1269
- {
1270
- id: MessageTypeConstants.file,
1271
- title: localize("ATTACH_DOCUMENT"),
1272
- icon: (
1273
- <Icon
1274
- name='description-fill'
1275
- color={theme.color.primary}
1276
- height={
1277
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1278
- ?.height as DimensionValue
1279
- }
1280
- width={
1281
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1282
- ?.width as DimensionValue
1283
- }
1284
- containerStyle={
1285
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle
1286
- ?.iconContainerStyle as ViewStyle
1287
- }
1288
- />
1289
- ),
1290
- onClick: null,
1291
- },
1292
- ];
1293
- groupActionList = (theme: CometChatTheme) => [
1294
- {
1295
- id: MessageTypeConstants.takePhoto,
1296
- title: localize("CAMERA"),
1297
- icon: (
1298
- <Icon
1299
- name='photo-camera-fill'
1300
- color={theme.color.primary}
1301
- height={
1302
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1303
- ?.height
1304
- }
1305
- width={
1306
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle?.width
1307
- }
1308
- containerStyle={
1309
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle
1310
- ?.iconContainerStyle
1311
- }
1312
- />
1313
- ),
1314
- onClick: null,
1315
- },
1316
- {
1317
- id: MessageTypeConstants.image,
1318
- title: localize("ATTACH_IMAGE"),
1319
- icon: (
1320
- <Icon
1321
- name='photo-fill'
1322
- color={theme.color.primary}
1323
- height={
1324
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1325
- ?.height
1326
- }
1327
- width={
1328
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle?.width
1329
- }
1330
- containerStyle={
1331
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle
1332
- ?.iconContainerStyle
1333
- }
1334
- />
1335
- ),
1336
- onClick: null,
1337
- },
1338
- {
1339
- id: MessageTypeConstants.audio,
1340
- title: localize("ATTACH_AUDIO"),
1341
- icon: (
1342
- <Icon
1343
- name='play-circle-fill'
1344
- color={theme.color.primary}
1345
- height={
1346
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1347
- ?.height
1348
- }
1349
- width={
1350
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle?.width
1351
- }
1352
- containerStyle={
1353
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle
1354
- ?.iconContainerStyle
1355
- }
1356
- />
1357
- ),
1358
- onClick: null,
1359
- },
1360
- {
1361
- id: MessageTypeConstants.video,
1362
- title: localize("ATTACH_VIDEO"),
1363
- icon: (
1364
- <Icon
1365
- name='videocam-fill'
1366
- color={theme.color.primary}
1367
- height={
1368
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1369
- ?.height
1370
- }
1371
- width={
1372
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle?.width
1373
- }
1374
- containerStyle={
1375
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle
1376
- ?.iconContainerStyle
1377
- }
1378
- />
1379
- ),
1380
- onClick: null,
1381
- },
1382
- {
1383
- id: MessageTypeConstants.file,
1384
- title: localize("ATTACH_DOCUMENT"),
1385
- icon: (
1386
- <Icon
1387
- name='description-fill'
1388
- color={theme.color.primary}
1389
- height={
1390
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1391
- ?.height
1392
- }
1393
- width={
1394
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle?.width
1395
- }
1396
- containerStyle={
1397
- theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle
1398
- ?.iconContainerStyle
1399
- }
1400
- />
1401
- ),
1402
- onClick: null,
1403
- },
1404
- ];
1339
+ usersActionList = (
1340
+ theme: CometChatTheme,
1341
+ additionalAttachmentOptionsParams?: AdditionalAttachmentOptionsParams
1342
+ ) => {
1343
+ const attachmentOptions = [];
1344
+ if (!additionalAttachmentOptionsParams?.hideCameraOption) {
1345
+ attachmentOptions.push({
1346
+ id: MessageTypeConstants.takePhoto,
1347
+ title: localize("CAMERA"),
1348
+ icon: (
1349
+ <Icon
1350
+ name='photo-camera-fill'
1351
+ color={theme.color.primary}
1352
+ height={
1353
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1354
+ ?.height as DimensionValue
1355
+ }
1356
+ width={
1357
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1358
+ ?.width as DimensionValue
1359
+ }
1360
+ containerStyle={
1361
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle
1362
+ ?.iconContainerStyle as ViewStyle
1363
+ }
1364
+ />
1365
+ ),
1366
+ onClick: null,
1367
+ });
1368
+ }
1369
+ if (!additionalAttachmentOptionsParams?.hideImageAttachmentOption) {
1370
+ attachmentOptions.push({
1371
+ id: MessageTypeConstants.image,
1372
+ title: localize("ATTACH_IMAGE"),
1373
+ icon: (
1374
+ <Icon
1375
+ name='photo-fill'
1376
+ color={theme.color.primary}
1377
+ height={
1378
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1379
+ ?.height as DimensionValue
1380
+ }
1381
+ width={
1382
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1383
+ ?.width as DimensionValue
1384
+ }
1385
+ containerStyle={
1386
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle
1387
+ ?.iconContainerStyle as ViewStyle
1388
+ }
1389
+ />
1390
+ ),
1391
+ onClick: null,
1392
+ });
1393
+ }
1394
+
1395
+ if (!additionalAttachmentOptionsParams?.hideVideoAttachmentOption) {
1396
+ attachmentOptions.push({
1397
+ id: MessageTypeConstants.video,
1398
+ title: localize("ATTACH_VIDEO"),
1399
+ icon: (
1400
+ <Icon
1401
+ name='videocam-fill'
1402
+ color={theme.color.primary}
1403
+ height={
1404
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1405
+ ?.height as DimensionValue
1406
+ }
1407
+ width={
1408
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1409
+ ?.width as DimensionValue
1410
+ }
1411
+ containerStyle={
1412
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle
1413
+ ?.iconContainerStyle as ViewStyle
1414
+ }
1415
+ />
1416
+ ),
1417
+ onClick: null,
1418
+ });
1419
+ }
1420
+
1421
+ if (!additionalAttachmentOptionsParams?.hideAudioAttachmentOption) {
1422
+ attachmentOptions.push({
1423
+ id: MessageTypeConstants.audio,
1424
+ title: localize("ATTACH_AUDIO"),
1425
+ icon: (
1426
+ <Icon
1427
+ name='play-circle-fill'
1428
+ color={theme.color.primary}
1429
+ height={
1430
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1431
+ ?.height as DimensionValue
1432
+ }
1433
+ width={
1434
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1435
+ ?.width as DimensionValue
1436
+ }
1437
+ containerStyle={
1438
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle
1439
+ ?.iconContainerStyle as ViewStyle
1440
+ }
1441
+ />
1442
+ ),
1443
+ onClick: null,
1444
+ });
1445
+ }
1446
+ if (!additionalAttachmentOptionsParams?.hideFileAttachmentOption) {
1447
+ attachmentOptions.push({
1448
+ id: MessageTypeConstants.file,
1449
+ title: localize("ATTACH_DOCUMENT"),
1450
+ icon: (
1451
+ <Icon
1452
+ name='description-fill'
1453
+ color={theme.color.primary}
1454
+ height={
1455
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1456
+ ?.height as DimensionValue
1457
+ }
1458
+ width={
1459
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1460
+ ?.width as DimensionValue
1461
+ }
1462
+ containerStyle={
1463
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle
1464
+ ?.iconContainerStyle as ViewStyle
1465
+ }
1466
+ />
1467
+ ),
1468
+ onClick: null,
1469
+ });
1470
+ }
1471
+ return attachmentOptions;
1472
+ };
1473
+ groupActionList = (
1474
+ theme: CometChatTheme,
1475
+ additionalAttachmentOptionsParams?: AdditionalAttachmentOptionsParams
1476
+ ) => {
1477
+ const attachmentOptions = [];
1478
+ if (!additionalAttachmentOptionsParams?.hideCameraOption) {
1479
+ attachmentOptions.push({
1480
+ id: MessageTypeConstants.takePhoto,
1481
+ title: localize("CAMERA"),
1482
+ icon: (
1483
+ <Icon
1484
+ name='photo-camera-fill'
1485
+ color={theme.color.primary}
1486
+ height={
1487
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1488
+ ?.height
1489
+ }
1490
+ width={
1491
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1492
+ ?.width
1493
+ }
1494
+ containerStyle={
1495
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle
1496
+ ?.iconContainerStyle
1497
+ }
1498
+ />
1499
+ ),
1500
+ onClick: null,
1501
+ });
1502
+ }
1503
+ if (!additionalAttachmentOptionsParams?.hideImageAttachmentOption) {
1504
+ attachmentOptions.push({
1505
+ id: MessageTypeConstants.image,
1506
+ title: localize("ATTACH_IMAGE"),
1507
+ icon: (
1508
+ <Icon
1509
+ name='photo-fill'
1510
+ color={theme.color.primary}
1511
+ height={
1512
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1513
+ ?.height
1514
+ }
1515
+ width={
1516
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1517
+ ?.width
1518
+ }
1519
+ containerStyle={
1520
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle
1521
+ ?.iconContainerStyle
1522
+ }
1523
+ />
1524
+ ),
1525
+ onClick: null,
1526
+ });
1527
+ }
1528
+
1529
+ if (!additionalAttachmentOptionsParams?.hideVideoAttachmentOption) {
1530
+ attachmentOptions.push({
1531
+ id: MessageTypeConstants.video,
1532
+ title: localize("ATTACH_VIDEO"),
1533
+ icon: (
1534
+ <Icon
1535
+ name='videocam-fill'
1536
+ color={theme.color.primary}
1537
+ height={
1538
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1539
+ ?.height
1540
+ }
1541
+ width={
1542
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1543
+ ?.width
1544
+ }
1545
+ containerStyle={
1546
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle
1547
+ ?.iconContainerStyle
1548
+ }
1549
+ />
1550
+ ),
1551
+ onClick: null,
1552
+ });
1553
+ }
1554
+
1555
+ if (!additionalAttachmentOptionsParams?.hideAudioAttachmentOption) {
1556
+ attachmentOptions.push({
1557
+ id: MessageTypeConstants.audio,
1558
+ title: localize("ATTACH_AUDIO"),
1559
+ icon: (
1560
+ <Icon
1561
+ name='play-circle-fill'
1562
+ color={theme.color.primary}
1563
+ height={
1564
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1565
+ ?.height
1566
+ }
1567
+ width={
1568
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1569
+ ?.width
1570
+ }
1571
+ containerStyle={
1572
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle
1573
+ ?.iconContainerStyle
1574
+ }
1575
+ />
1576
+ ),
1577
+ onClick: null,
1578
+ });
1579
+ }
1580
+ if (!additionalAttachmentOptionsParams?.hideFileAttachmentOption) {
1581
+ attachmentOptions.push({
1582
+ id: MessageTypeConstants.file,
1583
+ title: localize("ATTACH_DOCUMENT"),
1584
+ icon: (
1585
+ <Icon
1586
+ name='description-fill'
1587
+ color={theme.color.primary}
1588
+ height={
1589
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1590
+ ?.height
1591
+ }
1592
+ width={
1593
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
1594
+ ?.width
1595
+ }
1596
+ containerStyle={
1597
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle
1598
+ ?.iconContainerStyle
1599
+ }
1600
+ />
1601
+ ),
1602
+ onClick: null,
1603
+ });
1604
+ }
1605
+
1606
+ return attachmentOptions;
1607
+ };
1608
+
1405
1609
  getAttachmentOptions(
1406
1610
  theme: CometChatTheme,
1407
1611
  user?: any,
1408
1612
  group?: any,
1409
- composerId?: any
1613
+ composerId?: any,
1614
+ additionalAttachmentOptionsParams?: AdditionalAttachmentOptionsParams
1410
1615
  ): CometChatMessageComposerAction[] {
1411
1616
  if (user) {
1412
- return this.usersActionList(theme);
1617
+ return this.usersActionList(theme, additionalAttachmentOptionsParams);
1413
1618
  } else if (group) {
1414
- return this.groupActionList(theme);
1619
+ return this.groupActionList(theme, additionalAttachmentOptionsParams);
1415
1620
  } else {
1416
- return this.usersActionList(theme);
1621
+ return this.usersActionList(theme, additionalAttachmentOptionsParams);
1417
1622
  }
1418
1623
  }
1419
1624
  getAuxiliaryButtonOptions() {
@@ -1424,10 +1629,7 @@ export class MessageDataSource implements DataSource {
1424
1629
  conversation: CometChat.Conversation,
1425
1630
  theme?: CometChatTheme
1426
1631
  ): string | JSX.Element {
1427
- return CometChatConversationUtils.getMessagePreview(
1428
- conversation.getLastMessage(),
1429
- theme
1430
- );
1632
+ return CometChatConversationUtils.getMessagePreview(conversation.getLastMessage(), theme);
1431
1633
  }
1432
1634
 
1433
1635
  getAllTextFormatters(loggedInUser?: CometChat.User): CometChatTextFormatter[] {