@cometchat/chat-uikit-react-native 4.3.3 → 4.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -21
- package/android/src/main/java/com/reactnativecometchatuikit/FileManager.java +6 -6
- package/ios/CommonUtil.h +4 -0
- package/ios/CommonUtil.m +27 -0
- package/package.json +10 -5
- package/src/AI/AIAssistBot/AIAssistBotDecorator.tsx +0 -3
- package/src/CometChatConversations/CometChatConversations.tsx +143 -72
- package/src/CometChatConversations/ConversationsConfiguration.ts +25 -4
- package/src/CometChatConversationsWithMessages/CometChatConversationsWithMessages.tsx +29 -29
- package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +11 -1
- package/src/CometChatGroups/CometChatGroups.tsx +10 -0
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +554 -52
- package/src/CometChatMessageComposer/MessageComposerConfiguration.tsx +12 -1
- package/src/CometChatMessageComposer/resources/Info.png +0 -0
- package/src/CometChatMessageComposer/resources/index.ts +3 -1
- package/src/CometChatMessageHeader/listners.ts +0 -2
- package/src/CometChatMessageList/CometChatMessageList.tsx +124 -15
- package/src/CometChatMessageList/MessageListConfiguration.ts +14 -1
- package/src/CometChatMessages/CometChatMessages.tsx +16 -16
- package/src/CometChatThreadedMessages/CometChatThreadedMessages.tsx +6 -1
- package/src/calls/CallingExtentionDecorator.tsx +11 -9
- package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +3 -3
- package/src/calls/CometChatCallLogHistory/CometChatCallLogHistory.tsx +10 -0
- package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +10 -0
- package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +2 -0
- package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +2 -0
- package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +3 -3
- package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +3 -3
- package/src/extensions/LinkPreview/LinkPreviewExtentionDecorator.tsx +4 -4
- package/src/extensions/MessageTranslation/MessageTranslationBubble.tsx +31 -9
- package/src/extensions/MessageTranslation/MessageTranslationDecorator.tsx +83 -6
- package/src/extensions/Polls/Polls.tsx +106 -70
- package/src/extensions/Polls/PollsDecorator.tsx +3 -2
- package/src/extensions/Stickers/CometChatStickerKeyboard/style.ts +3 -3
- package/src/extensions/Stickers/StickersExtensionDecorator.tsx +14 -6
- package/src/extensions/TextModeration/TextModerationExtensionDecorator.tsx +3 -3
- package/src/index.ts +21 -0
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +150 -25
- package/src/shared/CometChatUiKit/index.ts +1 -1
- package/src/shared/base/vars.ts +13 -0
- package/src/shared/constants/UIKitConstants.ts +6 -0
- package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +7 -0
- package/src/shared/events/CometChatUIEventHandler/Listener.ts +11 -1
- package/src/shared/events/CometChatUIEvents.ts +3 -1
- package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +380 -0
- package/src/shared/formatters/CometChatMentionsFormatter/MentionTextStyle.ts +14 -0
- package/src/shared/formatters/CometChatMentionsFormatter/index.ts +7 -0
- package/src/shared/formatters/CometChatTextFormatter.ts +253 -0
- package/src/shared/formatters/CometChatUrlsFormatter/index.tsx +146 -0
- package/src/shared/formatters/index.ts +11 -0
- package/src/shared/framework/DataSource.ts +21 -16
- package/src/shared/framework/DataSourceDecorator.tsx +29 -13
- package/src/shared/framework/MessageDataSource.tsx +215 -49
- package/src/shared/helper/useKeyboard.tsx +20 -2
- package/src/shared/index.ts +23 -3
- package/src/shared/resources/CometChatLocalize/CometChatLocalize.ts +2 -0
- package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/de/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/en/translation.json +10 -1
- package/src/shared/resources/CometChatLocalize/resources/es/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +10 -1
- package/src/shared/resources/CometChatLocalize/resources/hu/translation.json +315 -0
- package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +12 -1
- package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +11 -1
- package/src/shared/resources/CometChatTheme/Palette.ts +16 -0
- package/src/shared/utils/InteractiveMessageUtils.ts +39 -1
- package/src/shared/utils/PermissionUtil.ts +142 -0
- package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +8 -6
- package/src/shared/views/CometChatAvatar/CometChatAvatar.tsx +5 -1
- package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +12 -11
- package/src/shared/views/CometChatImageBubble/CometChatImageBubble.tsx +7 -5
- package/src/shared/views/CometChatList/CometChatList.tsx +12 -0
- package/src/shared/views/CometChatListItem/CometChatListItem.tsx +11 -2
- package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +3 -2
- package/src/shared/views/CometChatReactions/CometChatReactions.tsx +3 -3
- package/src/shared/views/CometChatSchedulerBubble/CometChatSchedulerBubble.tsx +12 -0
- package/src/shared/views/CometChatSuggestionList/CometChatSuggestionList.tsx +64 -0
- package/src/shared/views/CometChatSuggestionList/SuggestionItem.ts +48 -0
- package/src/shared/views/CometChatSuggestionList/SuggestionListConfiguration.ts +23 -0
- package/src/shared/views/CometChatSuggestionList/index.ts +11 -0
- package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +33 -46
- package/src/shared/views/CometChatTextBubble/TextBubbleStyle.ts +0 -14
- package/src/shared/views/CometChatTextBubble/index.ts +2 -3
- package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +5 -3
- package/src/shared/views/index.ts +9 -3
- package/src/shared/utils/PermissionUtilIOS.ts +0 -104
|
@@ -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
|
-
|
|
86
|
-
|
|
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
|
-
|
|
97
|
-
|
|
96
|
+
BackHandler.addEventListener('hardwareBackPress', handleBack);
|
|
97
|
+
return () => {
|
|
98
98
|
BackHandler.removeEventListener(
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
'hardwareBackPress',
|
|
100
|
+
handleBack
|
|
101
101
|
);
|
|
102
|
-
|
|
103
|
-
|
|
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
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
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>
|
|
@@ -206,6 +206,7 @@ export const CometChatGroupsMembers = (props: CometChatGroupsMembersInterface) =
|
|
|
206
206
|
...groupScopeStyle
|
|
207
207
|
});
|
|
208
208
|
|
|
209
|
+
const activeSwipeRows = React.useRef({});
|
|
209
210
|
const groupMemberListenerId = 'groupMemberList_' + new Date().getTime();
|
|
210
211
|
const groupRef = React.useRef(null);
|
|
211
212
|
const itemRef = React.useRef(null);
|
|
@@ -281,7 +282,7 @@ export const CometChatGroupsMembers = (props: CometChatGroupsMembersInterface) =
|
|
|
281
282
|
action.setMuid(String(getUnixTimestamp()));
|
|
282
283
|
action.setSender(loggedInUser.current);
|
|
283
284
|
action.setReceiver(group);
|
|
284
|
-
|
|
285
|
+
action.setConversationId(group['conversationId'])
|
|
285
286
|
CometChatUIEventHandler.emitGroupEvent(CometChatGroupsEvents.ccGroupMemberKicked, { message: action, kickedUser: user, kickedBy: loggedInUser.current, kickedFrom: group });
|
|
286
287
|
})
|
|
287
288
|
.catch((err) => {
|
|
@@ -351,6 +352,15 @@ export const CometChatGroupsMembers = (props: CometChatGroupsMembersInterface) =
|
|
|
351
352
|
statusIndicatorStyle={_statusIndicatorStyle}
|
|
352
353
|
TailView={TailView ? () => <TailView {...member} /> : ScopeChangeUI.bind(this, member, groupScopeStyle)} //Note: should return prop to TailView
|
|
353
354
|
options={() => (options && options(member)) || swipeOptions(member, (id) => kickUser(id, member), () => banUser(member))} //Note: should have options
|
|
355
|
+
activeSwipeRows={activeSwipeRows.current}
|
|
356
|
+
rowOpens={(id) => {
|
|
357
|
+
Object.keys(activeSwipeRows.current).forEach(key => {
|
|
358
|
+
if(id !== key && activeSwipeRows.current[key]) {
|
|
359
|
+
activeSwipeRows.current[key]?.current?.closeRow?.()
|
|
360
|
+
delete activeSwipeRows.current[key]
|
|
361
|
+
}
|
|
362
|
+
})
|
|
363
|
+
}}
|
|
354
364
|
/>
|
|
355
365
|
}
|
|
356
366
|
|
|
@@ -200,6 +200,7 @@ export const CometChatGroups = React.forwardRef((props: CometChatGroupsInterface
|
|
|
200
200
|
const {theme} = React.useContext<CometChatContextType>(CometChatContext);
|
|
201
201
|
|
|
202
202
|
const groupListRef = useRef<CometChatListActionsInterface>(null);
|
|
203
|
+
const activeSwipeRows = React.useRef({});
|
|
203
204
|
|
|
204
205
|
const [selecting, setSelecting] = useState(selectionMode != 'none' ? true : false);
|
|
205
206
|
const [selectedGroups, setSelectedGroups] = useState([]);
|
|
@@ -535,6 +536,15 @@ export const CometChatGroups = React.forwardRef((props: CometChatGroupsInterface
|
|
|
535
536
|
onPress={groupClicked.bind(this, item)}
|
|
536
537
|
onLongPress={groupLongPressed.bind(this, item)}
|
|
537
538
|
options={() => options && options(item)}
|
|
539
|
+
activeSwipeRows={activeSwipeRows.current}
|
|
540
|
+
rowOpens={(id) => {
|
|
541
|
+
Object.keys(activeSwipeRows.current).forEach(key => {
|
|
542
|
+
if(id !== key && activeSwipeRows.current[key]) {
|
|
543
|
+
activeSwipeRows.current[key]?.current?.closeRow?.()
|
|
544
|
+
delete activeSwipeRows.current[key]
|
|
545
|
+
}
|
|
546
|
+
})
|
|
547
|
+
}}
|
|
538
548
|
/>
|
|
539
549
|
};
|
|
540
550
|
|