@cometchat/chat-uikit-react-native 4.3.2 → 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 (118) hide show
  1. package/android/src/main/AndroidManifest.xml +3 -4
  2. package/android/src/main/java/com/reactnativecometchatuikit/CometchatUiKitPackage.java +0 -1
  3. package/android/src/main/java/com/reactnativecometchatuikit/FileManager.java +125 -7
  4. package/android/src/main/java/com/reactnativecometchatuikit/ImageManager.java +1 -1
  5. package/ios/CommonUtil.h +4 -0
  6. package/ios/CommonUtil.m +27 -0
  7. package/package.json +1 -1
  8. package/src/AI/AIAssistBot/AIAssistBotDecorator.tsx +0 -3
  9. package/src/CometChatConversations/CometChatConversations.tsx +151 -66
  10. package/src/CometChatConversations/ConversationsConfiguration.ts +25 -4
  11. package/src/CometChatConversations/style.ts +5 -1
  12. package/src/CometChatConversationsWithMessages/CometChatConversationsWithMessages.tsx +29 -29
  13. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +598 -63
  14. package/src/CometChatMessageComposer/MessageComposerConfiguration.tsx +12 -1
  15. package/src/CometChatMessageComposer/resources/Info.png +0 -0
  16. package/src/CometChatMessageComposer/resources/index.ts +3 -1
  17. package/src/CometChatMessageHeader/listners.ts +0 -2
  18. package/src/CometChatMessageList/CometChatMessageList.tsx +139 -30
  19. package/src/CometChatMessageList/MessageListConfiguration.ts +19 -6
  20. package/src/CometChatMessages/CometChatMessages.tsx +16 -16
  21. package/src/CometChatThreadedMessages/CometChatThreadedMessages.tsx +41 -3
  22. package/src/calls/CallingExtentionDecorator.tsx +5 -5
  23. package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +3 -3
  24. package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +2 -0
  25. package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +2 -0
  26. package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +3 -3
  27. package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +3 -3
  28. package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +51 -15
  29. package/src/extensions/LinkPreview/LinkPreviewExtentionDecorator.tsx +4 -4
  30. package/src/extensions/MessageTranslation/MessageTranslationBubble.tsx +31 -9
  31. package/src/extensions/MessageTranslation/MessageTranslationDecorator.tsx +83 -6
  32. package/src/extensions/Polls/Polls.tsx +106 -70
  33. package/src/extensions/Polls/PollsDecorator.tsx +3 -2
  34. package/src/extensions/Stickers/CometChatStickerKeyboard/style.ts +3 -3
  35. package/src/extensions/Stickers/StickersExtensionDecorator.tsx +14 -6
  36. package/src/extensions/TextModeration/TextModerationExtensionDecorator.tsx +3 -3
  37. package/src/index.ts +29 -8
  38. package/src/shared/CometChatUiKit/CometChatUIKit.ts +146 -24
  39. package/src/shared/CometChatUiKit/index.ts +1 -1
  40. package/src/shared/base/vars.ts +13 -0
  41. package/src/shared/constants/UIKitConstants.ts +6 -0
  42. package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +7 -0
  43. package/src/shared/events/CometChatUIEventHandler/Listener.ts +11 -1
  44. package/src/shared/events/CometChatUIEvents.ts +3 -1
  45. package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +380 -0
  46. package/src/shared/formatters/CometChatMentionsFormatter/MentionTextStyle.ts +14 -0
  47. package/src/shared/formatters/CometChatMentionsFormatter/index.ts +7 -0
  48. package/src/shared/formatters/CometChatTextFormatter.ts +253 -0
  49. package/src/shared/formatters/CometChatUrlsFormatter/index.tsx +146 -0
  50. package/src/shared/formatters/index.ts +11 -0
  51. package/src/shared/framework/DataSource.ts +21 -16
  52. package/src/shared/framework/DataSourceDecorator.tsx +29 -13
  53. package/src/shared/framework/MessageDataSource.tsx +215 -49
  54. package/src/shared/helper/useKeyboard.tsx +20 -2
  55. package/src/shared/index.ts +31 -11
  56. package/src/shared/libs/ImageZoom/ReactNativeZoomableView.tsx +1040 -0
  57. package/src/shared/libs/ImageZoom/ReactNativeZoomableViewWithGestures.tsx +223 -0
  58. package/src/shared/libs/ImageZoom/helper.ts +144 -0
  59. package/src/shared/libs/ImageZoom/index.tsx +13 -0
  60. package/src/shared/libs/ImageZoom/types/index.ts +186 -0
  61. package/src/shared/libs/VideoPlayer/Video.js +0 -24
  62. package/src/shared/libs/VideoPlayerControls/assets/img/back.png +0 -0
  63. package/src/shared/libs/VideoPlayerControls/components/Back/Back.tsx +1 -1
  64. package/src/shared/resources/CometChatLocalize/CometChatLocalize.ts +2 -0
  65. package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +11 -1
  66. package/src/shared/resources/CometChatLocalize/resources/de/translation.json +11 -1
  67. package/src/shared/resources/CometChatLocalize/resources/en/translation.json +10 -1
  68. package/src/shared/resources/CometChatLocalize/resources/es/translation.json +11 -1
  69. package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +11 -1
  70. package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +10 -1
  71. package/src/shared/resources/CometChatLocalize/resources/hu/translation.json +315 -0
  72. package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +11 -1
  73. package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +11 -1
  74. package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +12 -1
  75. package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +11 -1
  76. package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +11 -1
  77. package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +11 -1
  78. package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +11 -1
  79. package/src/shared/resources/CometChatTheme/Palette.ts +16 -0
  80. package/src/shared/utils/InteractiveMessageUtils.ts +39 -1
  81. package/src/shared/utils/NetworkUtils.tsx +5 -0
  82. package/src/shared/utils/PermissionUtil.ts +142 -0
  83. package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +1 -0
  84. package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +8 -6
  85. package/src/shared/views/CometChatAvatar/CometChatAvatar.tsx +5 -1
  86. package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +12 -11
  87. package/src/shared/views/CometChatImageBubble/CometChatImageBubble.tsx +70 -22
  88. package/src/shared/views/CometChatImageBubble/assets/index.ts +5 -0
  89. package/src/shared/views/CometChatImageBubble/assets/spineer.png +0 -0
  90. package/src/shared/views/CometChatImageViewerModal/ImageViewerModal.tsx +106 -0
  91. package/src/shared/views/CometChatImageViewerModal/index.tsx +1 -0
  92. package/src/shared/views/CometChatImageViewerModal/resources/Back.png +0 -0
  93. package/src/shared/views/CometChatImageViewerModal/resources/index.ts +5 -0
  94. package/src/shared/views/CometChatList/CometChatList.tsx +10 -1
  95. package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +3 -2
  96. package/src/shared/views/{CometChatReactionsList/CometChatReactionsList.tsx → CometChatReactionList/CometChatReactionList.tsx} +17 -17
  97. package/src/shared/views/CometChatReactionList/ReactionListConfiguration.tsx +14 -0
  98. package/src/shared/views/CometChatReactionList/index.ts +12 -0
  99. package/src/shared/views/CometChatReactions/CometChatReactions.tsx +3 -3
  100. package/src/shared/views/CometChatSchedulerBubble/CometChatSchedulerBubble.tsx +12 -0
  101. package/src/shared/views/CometChatSuggestionList/CometChatSuggestionList.tsx +64 -0
  102. package/src/shared/views/CometChatSuggestionList/SuggestionItem.ts +48 -0
  103. package/src/shared/views/CometChatSuggestionList/SuggestionListConfiguration.ts +23 -0
  104. package/src/shared/views/CometChatSuggestionList/index.ts +11 -0
  105. package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +33 -46
  106. package/src/shared/views/CometChatTextBubble/TextBubbleStyle.ts +0 -14
  107. package/src/shared/views/CometChatTextBubble/index.ts +2 -3
  108. package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +6 -4
  109. package/src/shared/views/index.ts +14 -8
  110. package/android/src/main/java/com/reactnativecometchatuikit/VideoManager.java +0 -40
  111. package/src/shared/libs/VideoPlayerControls/assets/img/back@2x.png +0 -0
  112. package/src/shared/libs/VideoPlayerControls/assets/img/back@3x.png +0 -0
  113. package/src/shared/utils/PermissionUtilIOS.ts +0 -104
  114. package/src/shared/views/CometChatReactionsList/ReactionsListConfiguration.tsx +0 -14
  115. package/src/shared/views/CometChatReactionsList/index.ts +0 -12
  116. /package/src/shared/views/{CometChatReactionsList/ReactionsListStyle.tsx → CometChatReactionList/ReactionListStyle.tsx} +0 -0
  117. /package/src/shared/views/{CometChatReactionsList → CometChatReactionList}/resources/Spineer.png +0 -0
  118. /package/src/shared/views/{CometChatReactionsList → CometChatReactionList}/resources/index.ts +0 -0
@@ -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
  }
@@ -29,6 +29,10 @@ export const Style = StyleSheet.create({
29
29
  justifyContent: "center",
30
30
  alignItems: "center"
31
31
  },
32
+ column: {
33
+ width: "100%",
34
+ flexDirection: 'column'
35
+ },
32
36
  row: {
33
37
  flexDirection: 'row'
34
38
  },
@@ -36,7 +40,7 @@ export const Style = StyleSheet.create({
36
40
  fontWeight: 'bold'
37
41
  },
38
42
  subtitleTextStyle: {
39
- maxWidth: "80%",
43
+ width: "95%",
40
44
  color: "rgba(20, 20, 20, 0.58)",
41
45
  },
42
46
  startNewConversationBtnStyle: {
@@ -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>