@cometchat/chat-uikit-react-native 5.0.1 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  2. package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
  3. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  4. package/android/.gradle/7.4/gc.properties +0 -0
  5. package/android/.gradle/vcs-1/gc.properties +0 -0
  6. package/android/src/main/java/com/reactnativecometchatuikit/FileManager.java +87 -41
  7. package/android/src/main/java/com/reactnativecometchatuikit/SoundPlayer.java +10 -0
  8. package/ios/SoundPlayer.m +8 -0
  9. package/lib/CometChatMessageList/CometChatMessageList.js +1 -1
  10. package/lib/CometChatMessageList/CometChatMessageList.js.map +1 -1
  11. package/lib/extensions/Stickers/StickersExtensionDecorator.d.ts +1 -2
  12. package/lib/extensions/Stickers/StickersExtensionDecorator.js +1 -2
  13. package/lib/extensions/Stickers/StickersExtensionDecorator.js.map +1 -1
  14. package/lib/shared/CometChatUiKit/CometChatUIKit.d.ts +2 -1
  15. package/lib/shared/CometChatUiKit/CometChatUIKit.js +2 -1
  16. package/lib/shared/CometChatUiKit/CometChatUIKit.js.map +1 -1
  17. package/lib/shared/index.d.ts +15 -13
  18. package/lib/shared/index.js +30 -12
  19. package/lib/shared/index.js.map +1 -1
  20. package/lib/shared/utils/CometChatMessagePreview/CometChatMessagePreview.d.ts +10 -1
  21. package/lib/shared/utils/CometChatMessagePreview/CometChatMessagePreview.js +8 -0
  22. package/lib/shared/utils/CometChatMessagePreview/CometChatMessagePreview.js.map +1 -1
  23. package/lib/shared/utils/CometChatMessagePreview/MessagePreviewStyle.d.ts +29 -0
  24. package/lib/shared/utils/CometChatMessagePreview/MessagePreviewStyle.js +29 -0
  25. package/lib/shared/utils/CometChatMessagePreview/MessagePreviewStyle.js.map +1 -0
  26. package/lib/shared/utils/CometChatMessagePreview/index.d.ts +2 -1
  27. package/lib/shared/utils/CometChatMessagePreview/index.js +3 -1
  28. package/lib/shared/utils/CometChatMessagePreview/index.js.map +1 -1
  29. package/lib/shared/utils/CometChatMessagePreview/style.d.ts +16 -16
  30. package/lib/shared/utils/MessageUtils.js +11 -10
  31. package/lib/shared/utils/MessageUtils.js.map +1 -1
  32. package/lib/shared/utils/index.d.ts +2 -2
  33. package/lib/shared/utils/index.js +2 -2
  34. package/lib/shared/utils/index.js.map +1 -1
  35. package/lib/theme/context.js +1 -1
  36. package/lib/theme/context.js.map +1 -1
  37. package/lib/theme/default/index.d.ts +6 -0
  38. package/lib/theme/default/index.js +178 -0
  39. package/lib/theme/default/index.js.map +1 -1
  40. package/lib/theme/provider.js +1 -1
  41. package/lib/theme/provider.js.map +1 -1
  42. package/package.json +6 -4
  43. package/react-native-cometchat-ui-kit.podspec +1 -1
  44. package/src/CometChatConversations/CometChatConversations.tsx +34 -29
  45. package/src/CometChatConversations/style.ts +5 -2
  46. package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +56 -44
  47. package/src/CometChatGroups/CometChatGroups.tsx +13 -10
  48. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +203 -57
  49. package/src/CometChatMessageComposer/styles.tsx +2 -6
  50. package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +8 -48
  51. package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +8 -14
  52. package/src/CometChatMessageList/CometChatMessageList.tsx +18 -10
  53. package/src/CometChatMessageList/style.ts +0 -16
  54. package/src/CometChatThreadHeader/CometChatThreadHeader.tsx +3 -2
  55. package/src/CometChatUsers/CometChatUsers.tsx +9 -8
  56. package/src/calls/CallUtils.ts +14 -14
  57. package/src/calls/CallingExtensionDecorator.tsx +13 -12
  58. package/src/calls/CometChatCallBubble/CometChatCallBubble.tsx +4 -3
  59. package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +15 -12
  60. package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +8 -6
  61. package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +4 -2
  62. package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +7 -6
  63. package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +7 -6
  64. package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +3 -2
  65. package/src/extensions/MessageTranslation/MessageTranslationBubble.tsx +3 -2
  66. package/src/extensions/MessageTranslation/MessageTranslationDecorator.tsx +26 -17
  67. package/src/extensions/Polls/Polls.tsx +53 -17
  68. package/src/extensions/Polls/PollsDecorator.tsx +5 -3
  69. package/src/extensions/Stickers/CometChatStickerKeyboard/CometChatStickerKeyboard.tsx +5 -4
  70. package/src/extensions/Stickers/CometChatStickerKeyboard/hooks.ts +3 -2
  71. package/src/extensions/Stickers/StickersExtensionDecorator.tsx +5 -2
  72. package/src/index.ts +10 -4
  73. package/src/shared/CometChatUiKit/CometChatUIKit.ts +1 -2
  74. package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +116 -32
  75. package/src/shared/framework/DataSource.ts +5 -2
  76. package/src/shared/framework/DataSourceDecorator.tsx +4 -4
  77. package/src/shared/framework/MessageDataSource.tsx +178 -46
  78. package/src/shared/helper/LocalizedDateHelper.ts +317 -0
  79. package/src/shared/helper/functions.js +69 -1
  80. package/src/shared/helper/useLocalizedDateHook.tsx +16 -0
  81. package/src/shared/index.ts +7 -2
  82. package/src/shared/resources/CometChatLocalizeNew/CometChatI18nProvider.tsx +106 -0
  83. package/src/shared/resources/CometChatLocalizeNew/CometChatLocalizationHelper.ts +99 -0
  84. package/src/shared/resources/CometChatLocalizeNew/CometChatLocalizeContext.tsx +15 -0
  85. package/src/shared/resources/CometChatLocalizeNew/LocalizationManager.ts +65 -0
  86. package/src/shared/resources/CometChatLocalizeNew/index.ts +25 -0
  87. package/src/shared/resources/{CometChatLocalize → CometChatLocalizeNew}/resources/de/translation.json +10 -1
  88. package/src/shared/resources/{CometChatLocalize → CometChatLocalizeNew}/resources/en/translation.json +10 -1
  89. package/src/shared/resources/{CometChatLocalize → CometChatLocalizeNew}/resources/es/translation.json +10 -1
  90. package/src/shared/resources/{CometChatLocalize → CometChatLocalizeNew}/resources/fr/translation.json +10 -1
  91. package/src/shared/resources/{CometChatLocalize → CometChatLocalizeNew}/resources/hi/translation.json +11 -1
  92. package/src/shared/resources/{CometChatLocalize → CometChatLocalizeNew}/resources/hu/translation.json +10 -1
  93. package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +456 -0
  94. package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +456 -0
  95. package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +456 -0
  96. package/src/shared/resources/{CometChatLocalize → CometChatLocalizeNew}/resources/lt/translation.json +10 -1
  97. package/src/shared/resources/{CometChatLocalize → CometChatLocalizeNew}/resources/ms/translation.json +10 -1
  98. package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +456 -0
  99. package/src/shared/resources/{CometChatLocalize → CometChatLocalizeNew}/resources/pt/translation.json +10 -1
  100. package/src/shared/resources/{CometChatLocalize → CometChatLocalizeNew}/resources/ru/translation.json +10 -1
  101. package/src/shared/resources/{CometChatLocalize → CometChatLocalizeNew}/resources/sv/translation.json +11 -1
  102. package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +456 -0
  103. package/src/shared/resources/{CometChatLocalize → CometChatLocalizeNew}/resources/zh/translation.json +11 -1
  104. package/src/shared/resources/{CometChatLocalize → CometChatLocalizeNew}/resources/zh-tw/translation.json +10 -1
  105. package/src/shared/resources/CometChatLocalizeNew/type.ts +7 -0
  106. package/src/shared/resources/CometChatLocalizeNew/useCometChatTranslationHook.ts +24 -0
  107. package/src/shared/resources/index.ts +2 -2
  108. package/src/shared/utils/CommonUtils.ts +2 -1
  109. package/src/shared/utils/PermissionUtil.ts +5 -4
  110. package/src/shared/utils/conversationUtils.ts +11 -9
  111. package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +8 -5
  112. package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +1 -1
  113. package/src/shared/views/CometChatDate/CometChatDate.tsx +17 -14
  114. package/src/shared/views/CometChatDateSeperator/CometChatDateSeparator.tsx +6 -4
  115. package/src/shared/views/CometChatDeletedBubble/CometChatDeletedBubble.tsx +3 -2
  116. package/src/shared/views/CometChatEmojiKeyboard/emojis.ts +11 -8
  117. package/src/shared/views/CometChatList/CometChatList.tsx +5 -4
  118. package/src/shared/views/CometChatMediaRecorder/CometChatAudioPreview/CometChatAudioPreview.tsx +15 -9
  119. package/src/shared/views/CometChatMediaRecorder/CometChatMediaRecorder.tsx +5 -4
  120. package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +3 -2
  121. package/src/shared/views/CometChatReactionList/CometChatReactionList.tsx +7 -6
  122. package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +10 -7
  123. package/src/shared/views/CometChatTooltipMenu/CometChatTooltipMenu.tsx +1 -0
  124. package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +24 -47
  125. package/src/shared/views/CometChatVideoPlayer/CometChatVideoPlayer.tsx +68 -73
  126. package/src/theme/type.ts +0 -2
  127. package/lib/theme/default/default.d.ts +0 -6
  128. package/lib/theme/default/default.js +0 -179
  129. package/lib/theme/default/default.js.map +0 -1
  130. package/src/shared/resources/CometChatLocalize/CometChatLocalize.ts +0 -183
  131. package/src/shared/resources/CometChatLocalize/index.ts +0 -3
  132. package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +0 -447
@@ -36,7 +36,6 @@ import {
36
36
  CometChatTextFormatter,
37
37
  CometChatUiKitConstants,
38
38
  CometChatUrlsFormatter,
39
- localize,
40
39
  SuggestionItem,
41
40
  } from "../shared";
42
41
  import {
@@ -82,6 +81,7 @@ import { ExtensionConstants } from "../extensions";
82
81
  import { getExtensionData } from "../shared/helper/functions";
83
82
  import { DeepPartial } from "../shared/helper/types";
84
83
  import { CometChatDateSeparator } from "../shared/views/CometChatDateSeperator";
84
+ import { useCometChatTranslation } from "../shared/resources/CometChatLocalizeNew";
85
85
 
86
86
  let _defaultRequestBuilder: CometChat.MessagesRequestBuilder;
87
87
 
@@ -515,6 +515,7 @@ export const CometChatMessageList = memo(
515
515
  }, [hideGroupActionMessages]);
516
516
 
517
517
  const theme = useTheme();
518
+ const {t}=useCometChatTranslation()
518
519
 
519
520
  const mergedTheme: CometChatTheme = useMemo(() => {
520
521
  const themeClone = deepClone(theme);
@@ -1422,9 +1423,11 @@ export const CometChatMessageList = memo(
1422
1423
  });
1423
1424
  CometChatUIEventHandler.addGroupListener(groupEventListener, {
1424
1425
  ccGroupMemberUnBanned: ({ message }: any) => {
1426
+ message["action"] = "unbanned";
1425
1427
  newMessage(message, false);
1426
1428
  },
1427
1429
  ccGroupMemberBanned: ({ message }: any) => {
1430
+ message["action"] = "banned";
1428
1431
  newMessage(message, false);
1429
1432
  },
1430
1433
  ccGroupMemberAdded: ({ message, usersAdded, userAddedIn }: any) => {
@@ -1433,10 +1436,12 @@ export const CometChatMessageList = memo(
1433
1436
  message["muid"] = String(getUnixTimestamp());
1434
1437
  message["sentAt"] = getUnixTimestamp();
1435
1438
  message["actionOn"] = user;
1439
+ message["action"] = "added";
1436
1440
  newMessage(message, false);
1437
1441
  });
1438
1442
  },
1439
1443
  ccGroupMemberKicked: ({ message }: any) => {
1444
+ message["action"] = "kicked";
1440
1445
  newMessage(message, false);
1441
1446
  },
1442
1447
  ccGroupMemberScopeChanged: ({
@@ -1446,6 +1451,9 @@ export const CometChatMessageList = memo(
1446
1451
  scopeChangedFrom,
1447
1452
  group,
1448
1453
  }: any) => {
1454
+ action["action"] = "scopeChanged";
1455
+ action["newScope"] = scopeChangedTo;
1456
+ action["oldScope"] = scopeChangedFrom;
1449
1457
  newMessage(action, false);
1450
1458
  },
1451
1459
  ccOwnershipChanged: ({ group, message }: any) => {
@@ -1796,7 +1804,7 @@ export const CometChatMessageList = memo(
1796
1804
  },
1797
1805
  ]}
1798
1806
  >
1799
- {localize("EDITED")}
1807
+ {t("EDITED")}
1800
1808
  </Text>
1801
1809
  )}
1802
1810
  {
@@ -1953,7 +1961,7 @@ export const CometChatMessageList = memo(
1953
1961
  <Text
1954
1962
  style={_style.threadedMessageStyles?.indicatorTextStyle}
1955
1963
  >{`${item.getReplyCount()} ${
1956
- item.getReplyCount() > 1 ? localize("REPLIES") : localize("REPLY")
1964
+ item.getReplyCount() > 1 ? t("REPLIES") : t("REPLY")
1957
1965
  }`}</Text>
1958
1966
  <CometChatBadge
1959
1967
  style={{
@@ -2350,9 +2358,9 @@ export const CometChatMessageList = memo(
2350
2358
  if (ErrorView) return ErrorView();
2351
2359
  return (
2352
2360
  <ErrorEmptyView
2353
- title={"Oops!"}
2354
- subTitle={localize("SOMETHING_WENT_WRONG")}
2355
- tertiaryTitle={localize("WRONG_TEXT_TRY_AGAIN")}
2361
+ title={t("OOPS")}
2362
+ subTitle={t("SOMETHING_WENT_WRONG")}
2363
+ tertiaryTitle={t("WRONG_TEXT_TRY_AGAIN")}
2356
2364
  Icon={
2357
2365
  <Icon
2358
2366
  name='error-state'
@@ -2548,11 +2556,11 @@ export const CometChatMessageList = memo(
2548
2556
  )}
2549
2557
 
2550
2558
  <CometChatConfirmDialog
2551
- titleText={localize("DELETE_THIS_MESSAGE")}
2559
+ titleText={t("DELETE_THIS_MESSAGE")}
2552
2560
  icon={<Icon name='delete' size={theme.spacing.spacing.s12} color={theme.color.error} />}
2553
- cancelButtonText={localize("CANCEL")}
2554
- confirmButtonText={localize("DELETE")}
2555
- messageText={localize("DELETE_MESSAGE_CONFIRM")}
2561
+ cancelButtonText={t("CANCEL")}
2562
+ confirmButtonText={t("DELETE")}
2563
+ messageText={t("DELETE_MESSAGE_CONFIRM")}
2556
2564
  isOpen={showDeleteModal}
2557
2565
  // onDismiss={()=>console.log(deleteItem.current, "CometChatConfirmDialog onDismiss")}
2558
2566
  onCancel={() => {
@@ -245,14 +245,10 @@ export const getMessageListStylesLight = (
245
245
  textStyle: {
246
246
  ...typography.body.bold,
247
247
  color: color.receiveBubbleTextHighlight,
248
- //backgroundColor: '#6852D633',
249
- //paddingHorizontal: spacing.padding.p0_5
250
248
  },
251
249
  selfTextStyle: {
252
250
  ...typography.body.bold,
253
251
  color: color.warning,
254
- //backgroundColor: '#FFAB0033',
255
- //paddingHorizontal: spacing.padding.p0_5
256
252
  },
257
253
  },
258
254
  },
@@ -425,14 +421,10 @@ export const getMessageListStylesLight = (
425
421
  textStyle: {
426
422
  ...typography.body.bold,
427
423
  color: color.sendBubbleTextHighlight,
428
- //backgroundColor: '#F9F8FD33',
429
- //paddingHorizontal: spacing.padding.p0_5,
430
424
  },
431
425
  selfTextStyle: {
432
426
  ...typography.body.bold,
433
427
  color: color.warning,
434
- //backgroundColor: '#FFAB0033',
435
- //paddingHorizontal: spacing.padding.p0_5
436
428
  },
437
429
  },
438
430
  },
@@ -699,14 +691,10 @@ export const getMessageListStylesDark = (
699
691
  textStyle: {
700
692
  ...typography.body.bold,
701
693
  color: color.receiveBubbleTextHighlight,
702
- //backgroundColor: '#6852D633',
703
- //paddingHorizontal: spacing.padding.p0_5
704
694
  },
705
695
  selfTextStyle: {
706
696
  ...typography.body.bold,
707
697
  color: color.warning,
708
- //backgroundColor: '#FFAB0033',
709
- //paddingHorizontal: spacing.padding.p0_5
710
698
  },
711
699
  },
712
700
  },
@@ -879,14 +867,10 @@ export const getMessageListStylesDark = (
879
867
  textStyle: {
880
868
  ...typography.body.bold,
881
869
  color: color.sendBubbleTextHighlight,
882
- //backgroundColor: '#F9F8FD33',
883
- //paddingHorizontal: spacing.padding.p0_5
884
870
  },
885
871
  selfTextStyle: {
886
872
  ...typography.body.bold,
887
873
  color: color.warning,
888
- //backgroundColor: '#FFAB0033',
889
- //paddingHorizontal: spacing.padding.p0_5
890
874
  },
891
875
  },
892
876
  },
@@ -7,7 +7,6 @@ import {
7
7
  CometChatTextFormatter,
8
8
  CometChatUIKit,
9
9
  CometChatUrlsFormatter,
10
- localize,
11
10
  MessageBubbleAlignmentType,
12
11
  } from "../shared";
13
12
  import { CometChat } from "@cometchat/chat-sdk-react-native";
@@ -19,6 +18,7 @@ import { CometChatTheme } from "../theme/type";
19
18
  import { deepMerge } from "../shared/helper/helperFunctions";
20
19
  import { CommonUtils } from "../shared/utils/CommonUtils";
21
20
  import { DeepPartial } from "../shared/helper/types";
21
+ import { useCometChatTranslation } from "../shared/resources/CometChatLocalizeNew";
22
22
 
23
23
  /**
24
24
  * Unique UI event identifier for CometChatUIEventHandler.
@@ -117,6 +117,7 @@ export const CometChatThreadHeader = (props: CometChatThreadHeaderInterface): JS
117
117
  const [replyCount, setReplyCount] = useState<number>(parentMessage.getReplyCount() || 0);
118
118
 
119
119
  const theme = useTheme();
120
+ const { t } = useCometChatTranslation();
120
121
  const style = deepMerge(theme.threadHeaderStyles, props.style ?? {});
121
122
 
122
123
  /**
@@ -264,7 +265,7 @@ export const CometChatThreadHeader = (props: CometChatThreadHeaderInterface): JS
264
265
  {replyCountVisibility
265
266
  ? replyCount.toString() +
266
267
  " " +
267
- (replyCount == 1 ? localize("REPLY") : localize("REPLIES"))
268
+ (replyCount == 1 ? t("REPLY") : t("REPLIES"))
268
269
  : ""}
269
270
  </Text>
270
271
  </View>
@@ -5,7 +5,6 @@ import {
5
5
  CometChatList,
6
6
  CometChatListActionsInterface,
7
7
  CometChatListProps,
8
- localize,
9
8
  } from "../shared";
10
9
  import { CometChatUIEventHandler } from "../shared/events/CometChatUIEventHandler/CometChatUIEventHandler";
11
10
  import { deepMerge } from "../shared/helper/helperFunctions";
@@ -18,6 +17,7 @@ import { Skeleton } from "./Skeleton";
18
17
  import { UserStyle } from "./style";
19
18
  import { CommonUtils } from "../shared/utils/CommonUtils";
20
19
  import { CometChatTooltipMenu } from "../shared/views/CometChatTooltipMenu";
20
+ import { useCometChatTranslation } from "../shared/resources/CometChatLocalizeNew";
21
21
 
22
22
  /**
23
23
  * Interface for the menu items (tooltip actions).
@@ -228,6 +228,7 @@ export const CometChatUsers = React.forwardRef<
228
228
  >((props, ref) => {
229
229
  const userListenerId = "userStatus_" + new Date().getTime();
230
230
  const theme = useTheme();
231
+ const {t}= useCometChatTranslation()
231
232
  const [hideSearchError, setHideSearchError] = useState(false);
232
233
 
233
234
  const {
@@ -257,7 +258,7 @@ export const CometChatUsers = React.forwardRef<
257
258
  hideHeader,
258
259
  onSelection,
259
260
  onSubmit,
260
- searchPlaceholderText = localize("SEARCH"),
261
+ searchPlaceholderText = t("SEARCH"),
261
262
  ...newProps
262
263
  } = props;
263
264
  const userRef = useRef<CometChatUsersActionsInterface>(null);
@@ -367,8 +368,8 @@ export const CometChatUsers = React.forwardRef<
367
368
  style={{ flex: 1 }}
368
369
  >
369
370
  <ErrorEmptyView
370
- title={localize("NO_USERS_AVAILABLE")}
371
- subTitle={localize("ADD_CONTACTS")}
371
+ title={t("NO_USERS_AVAILABLE")}
372
+ subTitle={t("ADD_CONTACTS")}
372
373
  Icon={
373
374
  <Icon
374
375
  name='user-empty-icon'
@@ -406,9 +407,9 @@ export const CometChatUsers = React.forwardRef<
406
407
  return (
407
408
  <View style={{ flex: 1 }}>
408
409
  <ErrorEmptyView
409
- title={localize("OOPS")}
410
- subTitle={localize("SOMETHING_WENT_WRONG")}
411
- tertiaryTitle={localize("WRONG_TEXT_TRY_AGAIN")}
410
+ title={t("OOPS")}
411
+ subTitle={t("SOMETHING_WENT_WRONG")}
412
+ tertiaryTitle={t("WRONG_TEXT_TRY_AGAIN")}
412
413
  Icon={
413
414
  <Icon
414
415
  name='error-state'
@@ -442,7 +443,7 @@ export const CometChatUsers = React.forwardRef<
442
443
  hideError={hideError}
443
444
  hideSubmitButton={props.hideSubmitButton}
444
445
  AppBarOptions={AppBarOptions}
445
- title={title ? title : localize("USERS")}
446
+ title={title ? title : t("USERS")}
446
447
  onError={onError}
447
448
  TrailingView={TrailingView}
448
449
  selectionMode={selectionMode}
@@ -8,9 +8,9 @@ import {
8
8
  CALL_REJECTED,
9
9
  CALL_UNANSWERED,
10
10
  } from "../shared/constants/UIKitConstants";
11
- import { localize } from "../shared/resources/CometChatLocalize";
11
+ import { getCometChatTranslation} from "../shared";
12
12
  import { IconName } from "../shared/icons/Icon";
13
-
13
+ const t = getCometChatTranslation()
14
14
  export class CallUtils {
15
15
  /**
16
16
  * Checks if the given initiator is the same as the logged in user.
@@ -47,54 +47,54 @@ export class CallUtils {
47
47
  switch (call.getStatus()) {
48
48
  case CALL_INITIATED:
49
49
  if (this.isInitiator(initiator, loggedInUser)) {
50
- callMessageText = `${localize(`OUTGOING_CALL`)}`;
50
+ callMessageText = `${t(`OUTGOING_CALL`)}`;
51
51
  selectedIcon = call["type"] === "audio" ? "outgoing-audio" : "outgoing-video";
52
52
  } else {
53
- callMessageText = `${localize(`INCOMING_CALL`)}`;
53
+ callMessageText = `${t(`INCOMING_CALL`)}`;
54
54
  selectedIcon = call["type"] === "audio" ? "incoming-audio" : "incoming-video";
55
55
  }
56
56
  break;
57
57
  case CALL_ONGOING:
58
- callMessageText = `${localize(`CALL_ACCEPTED`)}`;
58
+ callMessageText = `${t(`CALL_ACCEPTED`)}`;
59
59
  selectedIcon = call["type"] === "audio" ? "call" : "video-call";
60
60
  break;
61
61
  case CALL_ENDED:
62
- callMessageText = `${localize(`CALL_ENDED`)}`;
62
+ callMessageText = `${t(`CALL_ENDED`)}`;
63
63
  selectedIcon = call["type"] === "audio" ? "call" : "video-call";
64
64
  break;
65
65
  case CALL_UNANSWERED:
66
66
  if (this.isInitiator(initiator, loggedInUser)) {
67
- callMessageText = `${localize("UNANSWERED_CALL")}`;
67
+ callMessageText = `${t("UNANSWERED_CALL")}`;
68
68
  selectedIcon = call["type"] === "audio" ? "call" : "video-call";
69
69
  } else {
70
- callMessageText = `${localize("MISSED_CALL")}`;
70
+ callMessageText = `${t("MISSED_CALL")}`;
71
71
  selectedIcon = call["type"] === "audio" ? "phone-missed" : "missed-video-call";
72
72
  }
73
73
  break;
74
74
  case CALL_CANCELLED:
75
75
  if (this.isInitiator(initiator, loggedInUser)) {
76
- callMessageText = `${localize("CANCELLED_CALL")}`;
76
+ callMessageText = `${t("CANCELLED_CALL")}`;
77
77
  selectedIcon = call["type"] === "audio" ? "call" : "video-call";
78
78
  } else {
79
- callMessageText = `${localize("MISSED_CALL")}`;
79
+ callMessageText = `${t("MISSED_CALL")}`;
80
80
  selectedIcon = call["type"] === "audio" ? "phone-missed" : "missed-video-call";
81
81
  }
82
82
  break;
83
83
  case CALL_REJECTED:
84
84
  if (this.isInitiator(initiator, loggedInUser)) {
85
- callMessageText = `${localize("CALL_REJECTED")}`;
85
+ callMessageText = `${t("CALL_REJECTED")}`;
86
86
  selectedIcon = call["type"] === "audio" ? "call" : "video-call";
87
87
  } else {
88
- callMessageText = `${localize("INCOMING_CALL")}`;
88
+ callMessageText = `${t("INCOMING_CALL")}`;
89
89
  selectedIcon = call["type"] === "audio" ? "incoming-audio" : "incoming-video";
90
90
  }
91
91
  break;
92
92
  case CALL_BUSY:
93
93
  if (this.isInitiator(initiator, loggedInUser)) {
94
- callMessageText = `${localize("CALL_BUSY")}`;
94
+ callMessageText = `${t("CALL_BUSY")}`;
95
95
  selectedIcon = call["type"] === "audio" ? "call" : "video-call";
96
96
  } else {
97
- callMessageText = `${localize("MISSED_CALL")}`;
97
+ callMessageText = `${t("MISSED_CALL")}`;
98
98
  selectedIcon = call["type"] === "audio" ? "phone-missed" : "missed-video-call";
99
99
  }
100
100
  break;
@@ -11,7 +11,7 @@ import {
11
11
  import { DataSource } from "../shared/framework/DataSource";
12
12
  import { DataSourceDecorator } from "../shared/framework/DataSourceDecorator";
13
13
  import { CometChatMessageTemplate } from "../shared/modals";
14
- import { localize } from "../shared/resources/CometChatLocalize";
14
+ import { getCometChatTranslation, getCurrentLanguage } from "../shared";
15
15
  import { permissionUtil } from "../shared/utils/PermissionUtil";
16
16
  import { CallUIEvents } from "./CallEvents";
17
17
  import { CallingConfiguration } from "./CallingConfiguration";
@@ -20,12 +20,13 @@ import { CallUtils } from "./CallUtils";
20
20
  import { CometChatMeetCallBubble } from "./CometChatCallBubble";
21
21
  import { CometChatCallButtons } from "./CometChatCallButtons";
22
22
  import { CometChatOngoingCall } from "./CometChatOngoingCall";
23
- import { DateHelper, dateHelperInstance } from "../shared/helper/dateHelper";
24
23
  import { Icon } from "../shared/icons/Icon";
25
24
  import { CometChatCallActionBubble } from "./CometChatCallBubble/CometChatCallBubble";
26
25
  import { CometChatTheme } from "../theme/type";
26
+ import { LocalizedDateHelper, localizedDateHelperInstance } from "../shared/helper/LocalizedDateHelper";
27
27
 
28
28
  const CometChatCalls = CallingPackage.CometChatCalls;
29
+ const t = getCometChatTranslation();
29
30
 
30
31
  /**
31
32
  * CallingExtensionDecorator extends the DataSourceDecorator to add calling-specific
@@ -129,27 +130,27 @@ export class CallingExtensionDecorator extends DataSourceDecorator {
129
130
  <Icon
130
131
  name={callStatus.selectedIcon}
131
132
  height={
132
- callStatus.callMessageText === localize("MISSED_CALL")
133
+ callStatus.callMessageText === t("MISSED_CALL")
133
134
  ? theme.messageListStyles?.callActionBubbleStyles?.missedCallIconStyle?.height ?? 16
134
135
  : theme.messageListStyles?.callActionBubbleStyles?.iconStyle?.height ?? 16
135
136
  }
136
137
  width={
137
- callStatus.callMessageText === localize("MISSED_CALL")
138
+ callStatus.callMessageText === t("MISSED_CALL")
138
139
  ? theme.messageListStyles?.callActionBubbleStyles?.missedCallIconStyle?.width ?? 16
139
140
  : theme.messageListStyles?.callActionBubbleStyles?.iconStyle?.width ?? 16
140
141
  }
141
142
  color={
142
- callStatus.callMessageText === localize("MISSED_CALL")
143
+ callStatus.callMessageText === t("MISSED_CALL")
143
144
  ? theme.messageListStyles?.callActionBubbleStyles?.missedCallIconStyle?.tintColor
144
145
  : theme.messageListStyles?.callActionBubbleStyles?.iconStyle?.tintColor
145
146
  }
146
147
  imageStyle={
147
- callStatus.callMessageText === localize("MISSED_CALL")
148
+ callStatus.callMessageText === t("MISSED_CALL")
148
149
  ? theme.messageListStyles?.callActionBubbleStyles?.missedCallIconStyle
149
150
  : theme.messageListStyles?.callActionBubbleStyles?.iconStyle
150
151
  }
151
152
  containerStyle={
152
- callStatus.callMessageText === localize("MISSED_CALL")
153
+ callStatus.callMessageText === t("MISSED_CALL")
153
154
  ? theme.messageListStyles?.callActionBubbleStyles?.missedCallIconContainerStyle
154
155
  : theme.messageListStyles?.callActionBubbleStyles?.iconContainerStyle
155
156
  }
@@ -243,8 +244,8 @@ export class CallingExtensionDecorator extends DataSourceDecorator {
243
244
  return (
244
245
  <View>
245
246
  <CometChatMeetCallBubble
246
- buttonText={localize("JOIN")}
247
- titleText={callType === "audio" ? localize("AUDIO_CALL") : localize("VIDEO_CALL")}
247
+ buttonText={t("JOIN")}
248
+ titleText={callType === "audio" ? t("AUDIO_CALL") : t("VIDEO_CALL")}
248
249
  icon={BubbleIcon}
249
250
  onClick={() =>
250
251
  this.startDirectCall(
@@ -256,7 +257,7 @@ export class CallingExtensionDecorator extends DataSourceDecorator {
256
257
  }
257
258
  style={_style ?? {}}
258
259
  subTitleText={
259
- dateHelperInstance.getFormattedDate(sentAt, DateHelper.patterns.callBubble)!
260
+ localizedDateHelperInstance.getFormattedDate(sentAt, LocalizedDateHelper.patterns.callBubble, getCurrentLanguage())
260
261
  }
261
262
  />
262
263
  </View>
@@ -410,9 +411,9 @@ export class CallingExtensionDecorator extends DataSourceDecorator {
410
411
  return super.getLastConversationMessage(conversation, theme);
411
412
  let lastMesssageString = "";
412
413
  if (conversation.getLastMessage()["type"] == "audio")
413
- lastMesssageString = localize("AUDIO_CALL");
414
+ lastMesssageString = t("AUDIO_CALL");
414
415
  if (conversation.getLastMessage()["type"] == "video")
415
- lastMesssageString = localize("VIDEO_CALL");
416
+ lastMesssageString = t("VIDEO_CALL");
416
417
  return lastMesssageString;
417
418
  }
418
419
  }
@@ -2,10 +2,10 @@ import React, { useMemo } from "react";
2
2
  import { StyleSheet, Text, TouchableOpacity, View } from "react-native";
3
3
  import { CometChatTheme } from "../../theme/type";
4
4
  import { useTheme } from "../../theme";
5
- import { localize } from "../../shared";
6
5
  import { deepMerge } from "../../shared/helper/helperFunctions";
7
6
  import { DeepPartial } from "../../shared/helper/types";
8
7
  import { JSX } from "react";
8
+ import { useCometChatTranslation } from "../../shared/resources/CometChatLocalizeNew";
9
9
 
10
10
  /**
11
11
  * Props for the CometChatMeetCallBubble component.
@@ -82,6 +82,7 @@ export interface CometChatUserCallBubbleInterface {
82
82
  export const CometChatCallActionBubble = (props: CometChatUserCallBubbleInterface) => {
83
83
  const { titleText, icon, style } = props;
84
84
  const theme = useTheme();
85
+ const {t} = useCometChatTranslation()
85
86
 
86
87
  // Merge default theme styles with optional style overrides
87
88
  const callActionBubbleStyles = useMemo(() => {
@@ -92,7 +93,7 @@ export const CometChatCallActionBubble = (props: CometChatUserCallBubbleInterfac
92
93
  <View style={{ justifyContent: "center", alignItems: "center" }}>
93
94
  <View
94
95
  style={
95
- titleText === localize("MISSED_CALL")
96
+ titleText === t("MISSED_CALL")
96
97
  ? callActionBubbleStyles.missedCallContainerStyle
97
98
  : callActionBubbleStyles.containerStyle
98
99
  }
@@ -100,7 +101,7 @@ export const CometChatCallActionBubble = (props: CometChatUserCallBubbleInterfac
100
101
  {icon}
101
102
  <Text
102
103
  style={
103
- titleText === localize("MISSED_CALL")
104
+ titleText === t("MISSED_CALL")
104
105
  ? callActionBubbleStyles.missedCallTextStyle
105
106
  : callActionBubbleStyles.textStyle
106
107
  }
@@ -9,7 +9,7 @@ import {
9
9
  GestureResponderEvent,
10
10
  ActivityIndicator,
11
11
  } from "react-native";
12
- import { CometChatAvatar, localize } from "../../shared";
12
+ import { CometChatAvatar} from "../../shared";
13
13
  import { CallTypeConstants } from "../../shared/constants/UIKitConstants";
14
14
  import { CometChatUIEventHandler } from "../../shared/events/CometChatUIEventHandler/CometChatUIEventHandler";
15
15
  import { CallUIEvents } from "../CallEvents";
@@ -28,6 +28,7 @@ import { deepMerge } from "../../shared/helper/helperFunctions";
28
28
  import { DeepPartial, ValueOf } from "../../shared/helper/types";
29
29
  import { CometChatTooltipMenu, MenuItemInterface } from "../../shared/views/CometChatTooltipMenu";
30
30
  import { JSX } from "react";
31
+ import { useCometChatTranslation, useLocalizedDate, LocalizedDateHelper } from "../../shared";
31
32
 
32
33
  const listenerId = "callEventListener_" + new Date().getTime();
33
34
  const CometChatCalls = CallingPackage.CometChatCalls;
@@ -143,6 +144,8 @@ export const CometChatCallLogs = (props: CometChatCallLogsConfigurationInterface
143
144
  const [showOutgoingCallScreen, setShowOutgoingCallScreen] = useState(false);
144
145
 
145
146
  const theme = useTheme();
147
+ const {t} = useCometChatTranslation()
148
+ const { formatDate } = useLocalizedDate();
146
149
  const mergedCallLogsStyle = useMemo(() => {
147
150
  return deepMerge(theme.callLogsStyles, style ?? {});
148
151
  }, [theme, style]);
@@ -451,10 +454,10 @@ export const CometChatCallLogs = (props: CometChatCallLogsConfigurationInterface
451
454
  SubtitleView(item)
452
455
  ) : (
453
456
  <Text style={mergedCallLogsStyle.itemStyle.subTitleTextStyle}>
454
- {dateHelperInstance.getFormattedDate(
455
- item["initiatedAt"] * 1000,
456
- datePattern ?? DateHelper.patterns.callBubble
457
- )}
457
+ {formatDate(
458
+ item["initiatedAt"] * 1000,
459
+ datePattern ?? LocalizedDateHelper.patterns.callLogs
460
+ )}
458
461
  </Text>
459
462
  )}
460
463
  </View>
@@ -489,9 +492,9 @@ export const CometChatCallLogs = (props: CometChatCallLogsConfigurationInterface
489
492
  if (ErrorView) return <ErrorView />;
490
493
  return (
491
494
  <ErrorEmptyView
492
- title='Oops!'
493
- subTitle={localize("SOMETHING_WENT_WRONG")}
494
- tertiaryTitle={localize("WRONG_TEXT_TRY_AGAIN")}
495
+ title={t("OOPS")}
496
+ subTitle={t("SOMETHING_WENT_WRONG")}
497
+ tertiaryTitle={t("WRONG_TEXT_TRY_AGAIN")}
495
498
  Icon={
496
499
  <Icon
497
500
  name='error-state'
@@ -521,7 +524,7 @@ export const CometChatCallLogs = (props: CometChatCallLogsConfigurationInterface
521
524
  ...theme.typography.button.medium,
522
525
  }}
523
526
  >
524
- {localize("RETRY")}
527
+ {t("RETRY")}
525
528
  </Text>
526
529
  </TouchableOpacity>
527
530
  }
@@ -536,8 +539,8 @@ export const CometChatCallLogs = (props: CometChatCallLogsConfigurationInterface
536
539
  if (EmptyView) return <EmptyView />;
537
540
  return (
538
541
  <ErrorEmptyView
539
- title='No Call Logs Yet'
540
- subTitle='Make or receive calls to see your call history listed here'
542
+ title={t("NO_CALL_LOGS")}
543
+ subTitle={t("CALL_LOGS_EMPTY_MESSAGE")}
541
544
  Icon={
542
545
  <Icon
543
546
  name='call-fill'
@@ -603,7 +606,7 @@ export const CometChatCallLogs = (props: CometChatCallLogsConfigurationInterface
603
606
  />
604
607
  </TouchableOpacity>
605
608
  ) : null}
606
- <Text style={mergedCallLogsStyle.titleTextStyle}>{localize("CALLS")}</Text>
609
+ <Text style={mergedCallLogsStyle.titleTextStyle}>{t("CALLS")}</Text>
607
610
  </View>
608
611
  <View style={Style.row}>{AppBarOptions && <AppBarOptions />}</View>
609
612
  </View>
@@ -7,7 +7,7 @@ import {
7
7
  SafeAreaView,
8
8
  StyleSheet,
9
9
  } from "react-native";
10
- import { CometChatAvatar, CometChatSoundManager, localize } from "../../shared";
10
+ import { CometChatAvatar, CometChatSoundManager } from "../../shared";
11
11
  import {
12
12
  CallTypeConstants,
13
13
  MessageCategoryConstants,
@@ -23,6 +23,7 @@ import { IncomingCallStyle } from "./style";
23
23
  import { deepMerge } from "../../shared/helper/helperFunctions";
24
24
  import { DeepPartial } from "../../shared/helper/types";
25
25
  import { JSX } from "react";
26
+ import { useCometChatTranslation } from "../../shared/resources/CometChatLocalizeNew";
26
27
 
27
28
  const listnerID = "CALL_LISTENER_" + new Date().getTime();
28
29
  const CometChatCalls = CallingPackage.CometChatCalls;
@@ -89,6 +90,7 @@ export const CometChatIncomingCall = (props: CometChatIncomingCallInterface): JS
89
90
  } = props;
90
91
 
91
92
  const theme = useTheme();
93
+ const {t}= useCometChatTranslation()
92
94
  const [showCallScreen, setShowCallScreen] = useState(false);
93
95
  const acceptedCall = useRef<CometChat.Call>(undefined);
94
96
 
@@ -272,7 +274,7 @@ export const CometChatIncomingCall = (props: CometChatIncomingCallInterface): JS
272
274
  TitleView(call)
273
275
  ) : (
274
276
  <Text style={incomingCallStyle.titleTextStyle}>
275
- {call["sender"]?.["name"] ?? localize("INCOMING_CALL")}
277
+ {call["sender"]?.["name"] ?? t("INCOMING_CALL")}
276
278
  </Text>
277
279
  )}
278
280
 
@@ -283,8 +285,8 @@ export const CometChatIncomingCall = (props: CometChatIncomingCallInterface): JS
283
285
  <Icon name="call-fill" size={16} containerStyle={{ marginTop: 4, marginRight: 4 }} />
284
286
  <Text style={incomingCallStyle.subtitleTextStyle}>
285
287
  {call?.["type"] === CallTypeConstants.audio
286
- ? localize("INCOMING_AUDIO_CALL")
287
- : localize("INCOMING_VIDEO_CALL")}
288
+ ? t("INCOMING_AUDIO_CALL")
289
+ : t("INCOMING_VIDEO_CALL")}
288
290
  </Text>
289
291
  </View>
290
292
  )}
@@ -308,7 +310,7 @@ export const CometChatIncomingCall = (props: CometChatIncomingCallInterface): JS
308
310
  style={incomingCallStyle.declineCallButtonStyle}
309
311
  >
310
312
  <Text style={incomingCallStyle.declineCallTextStyle}>
311
- {localize("DECLINE")}
313
+ {t("DECLINE")}
312
314
  </Text>
313
315
  </TouchableOpacity>
314
316
 
@@ -317,7 +319,7 @@ export const CometChatIncomingCall = (props: CometChatIncomingCallInterface): JS
317
319
  style={incomingCallStyle.acceptCallButtonStyle}
318
320
  >
319
321
  <Text style={incomingCallStyle.acceptCallTextStyle}>
320
- {localize("ACCEPT")}
322
+ {t("ACCEPT")}
321
323
  </Text>
322
324
  </TouchableOpacity>
323
325
  </View>
@@ -6,7 +6,7 @@ import {
6
6
  MessageTypeConstants,
7
7
  } from "../../shared/constants/UIKitConstants";
8
8
  import { CometChatUIEventHandler } from "../../shared/events/CometChatUIEventHandler/CometChatUIEventHandler";
9
- import { CometChatSoundManager, localize } from "../../shared/resources";
9
+ import { CometChatSoundManager } from "../../shared/resources";
10
10
  import { CometChatAvatar } from "../../shared/views";
11
11
  import { CallUIEvents } from "../CallEvents";
12
12
  import { CallingPackage } from "../CallingPackage";
@@ -16,6 +16,7 @@ import { Icon } from "../../shared/icons/Icon";
16
16
  import { deepMerge } from "../../shared/helper/helperFunctions";
17
17
  import { OutgoingCallStyle } from "./styles";
18
18
  import { DeepPartial } from "../../shared/helper/types";
19
+ import { useCometChatTranslation } from "../../shared/resources/CometChatLocalizeNew";
19
20
 
20
21
  const listenerId = "callListener_" + new Date().getTime();
21
22
  const CometChatCalls = CallingPackage.CometChatCalls;
@@ -112,6 +113,7 @@ export const CometChatOutgoingCall = (props: CometChatOutgoingCallInterface): JS
112
113
  const isCallEnded = useRef<null | boolean>(undefined);
113
114
 
114
115
  const theme = useTheme();
116
+ const {t}= useCometChatTranslation()
115
117
 
116
118
  // Merge default and custom styles for the outgoing call.
117
119
  const outgoingCallStyle = useMemo(() => {
@@ -291,7 +293,7 @@ export const CometChatOutgoingCall = (props: CometChatOutgoingCallInterface): JS
291
293
  {SubtitleView ? (
292
294
  SubtitleView(call)
293
295
  ) : (
294
- <Text style={outgoingCallStyle.subtitleTextStyle}>{localize("CALLING")}</Text>
296
+ <Text style={outgoingCallStyle.subtitleTextStyle}>{t("CALLING")}</Text>
295
297
  )}
296
298
  {AvatarView ? (
297
299
  AvatarView(call)