@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
|
@@ -26,11 +26,17 @@ import { AISmartRepliesExtension } from "../../AI/AISmartReplies/AISmartReplies"
|
|
|
26
26
|
import { AIConversationSummaryExtension } from "../../AI/AIConversationSummary/AIConversationSummaryExtension";
|
|
27
27
|
import { AIAssistBotExtension } from "../../AI/AIAssistBot/AIAssistBotExtension";
|
|
28
28
|
import { SchedulerMessage } from "../modals/InteractiveData/InteractiveMessage";
|
|
29
|
-
import {
|
|
29
|
+
import { permissionUtil } from "../utils/PermissionUtil";
|
|
30
|
+
import {
|
|
31
|
+
getUnixTimestamp,
|
|
32
|
+
} from '../../shared/utils/CometChatMessageHelper';
|
|
30
33
|
|
|
31
34
|
export class CometChatUIKit {
|
|
32
35
|
static uiKitSettings: UIKitSettings;
|
|
33
|
-
static aiFeatures:AIExtensionDataSource[]
|
|
36
|
+
static aiFeatures: AIExtensionDataSource[]
|
|
37
|
+
static loggedInUser: null | CometChat.User = null;
|
|
38
|
+
private static loginListenerID: string = ``;
|
|
39
|
+
private static isLoginListenerAttached: boolean = false;
|
|
34
40
|
static init(uiKitSettings: UIKitSettings): Promise<boolean> {
|
|
35
41
|
|
|
36
42
|
//perform sdk init taking values from uiKitSettings
|
|
@@ -47,18 +53,29 @@ export class CometChatUIKit {
|
|
|
47
53
|
|
|
48
54
|
appSetting.subscriptionType = uiKitSettings.subscriptionType;
|
|
49
55
|
|
|
56
|
+
CometChatUIKit.attachListener();
|
|
57
|
+
|
|
50
58
|
return CometChat.init(uiKitSettings.appId, appSetting.build()).then(
|
|
51
59
|
() => {
|
|
52
60
|
CometChat.setSource("uikit-v4", Platform.OS, "react-native")
|
|
53
61
|
ListenerInitializer.attachListeners();
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
62
|
+
|
|
63
|
+
CometChat.getLoggedinUser()
|
|
64
|
+
.then(user => {
|
|
65
|
+
console.log("setting logged in user", user);
|
|
66
|
+
CometChatUIKit.setLoggedInUser(user);
|
|
67
|
+
if (user) {
|
|
68
|
+
this.enableExtensions();
|
|
59
69
|
}
|
|
60
70
|
})
|
|
61
|
-
|
|
71
|
+
.catch(error => {
|
|
72
|
+
// CometChatUIKit.setLoggedInUser(null);
|
|
73
|
+
})
|
|
74
|
+
permissionUtil.init().then(res => {
|
|
75
|
+
if (res !== true) {
|
|
76
|
+
console.warn("[IOS] Permission initialization failed.");
|
|
77
|
+
}
|
|
78
|
+
})
|
|
62
79
|
}, error => {
|
|
63
80
|
// console.log("Initialization failed with error:", error);
|
|
64
81
|
}
|
|
@@ -76,8 +93,8 @@ export class CometChatUIKit {
|
|
|
76
93
|
new LinkPreviewExtention(),
|
|
77
94
|
new PollsExtension(),
|
|
78
95
|
new ImageModerationExtension()
|
|
79
|
-
]
|
|
80
|
-
|
|
96
|
+
]
|
|
97
|
+
|
|
81
98
|
static defaultAIFeatures: AIExtensionDataSource[] = [
|
|
82
99
|
new AISmartRepliesExtension(),
|
|
83
100
|
new AIConversationStarterExtension(),
|
|
@@ -85,6 +102,29 @@ export class CometChatUIKit {
|
|
|
85
102
|
new AIAssistBotExtension()
|
|
86
103
|
]
|
|
87
104
|
|
|
105
|
+
private static attachListener() {
|
|
106
|
+
if (CometChatUIKit.isLoginListenerAttached) {
|
|
107
|
+
CometChatUIKit.removeListener();
|
|
108
|
+
CometChatUIKit.isLoginListenerAttached = false;
|
|
109
|
+
CometChatUIKit.loginListenerID = ``;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
CometChatUIKit.loginListenerID = `__CometChatLoginListener__`;
|
|
113
|
+
CometChat.addLoginListener(
|
|
114
|
+
CometChatUIKit.loginListenerID,
|
|
115
|
+
new CometChat.LoginListener({
|
|
116
|
+
onLoggedIn: (user: CometChat.User) => {
|
|
117
|
+
CometChatUIKit.setLoggedInUser(user);
|
|
118
|
+
},
|
|
119
|
+
onLoggedOut: () => {
|
|
120
|
+
CometChatUIKit.removeLoggedInUser();
|
|
121
|
+
},
|
|
122
|
+
})
|
|
123
|
+
);
|
|
124
|
+
CometChatUIKit.isLoginListenerAttached = true;
|
|
125
|
+
|
|
126
|
+
}
|
|
127
|
+
|
|
88
128
|
private static enableExtensions() {
|
|
89
129
|
ChatConfigurator.init(); //re-initialize data source
|
|
90
130
|
|
|
@@ -95,16 +135,16 @@ export class CometChatUIKit {
|
|
|
95
135
|
let extensionList: ExtensionsDataSource[] = this.uiKitSettings?.extensions || this.defaultExtensions;
|
|
96
136
|
let aiFeaturesList: AIExtensionDataSource[] = this.uiKitSettings?.aiFeatures || this.defaultAIFeatures;
|
|
97
137
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
138
|
+
if (extensionList.length > 0) {
|
|
139
|
+
extensionList.forEach((extension: ExtensionsDataSource) => {
|
|
140
|
+
extension?.enable();
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
if (aiFeaturesList.length > 0) {
|
|
144
|
+
aiFeaturesList.forEach((aiFeatures: AIExtensionDataSource) => {
|
|
145
|
+
aiFeatures.enable();
|
|
146
|
+
})
|
|
147
|
+
}
|
|
108
148
|
|
|
109
149
|
|
|
110
150
|
}
|
|
@@ -113,19 +153,40 @@ export class CometChatUIKit {
|
|
|
113
153
|
if (CometChatUIKit.checkAuthSettings(Promise.reject)) null
|
|
114
154
|
let user = await CometChat.getLoggedinUser().catch((e) => Promise.reject(e))
|
|
115
155
|
if (user == null) {
|
|
116
|
-
|
|
156
|
+
throw(new CometChat.CometChatException({ code: "NOT_FOUND", message: "Login user not found" }));
|
|
157
|
+
} else {
|
|
158
|
+
this.enableExtensions()
|
|
117
159
|
}
|
|
118
160
|
return user;
|
|
119
161
|
}
|
|
120
162
|
|
|
163
|
+
private static setLoggedInUser(user: CometChat.User | null) {
|
|
164
|
+
this.loggedInUser = user;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
private static removeLoggedInUser() {
|
|
168
|
+
this.loggedInUser = null;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
private static removeListener() {
|
|
172
|
+
if (CometChatUIKit.isLoginListenerAttached) {
|
|
173
|
+
CometChat.removeLoginListener(CometChatUIKit.loginListenerID);
|
|
174
|
+
CometChatUIKit.isLoginListenerAttached = false;
|
|
175
|
+
CometChatUIKit.loginListenerID = ``;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
121
179
|
static async login({ uid, authToken }: { uid?: string, authToken?: string }): Promise<CometChat.User> {
|
|
122
180
|
if (CometChatUIKit.checkAuthSettings(Promise.reject)) null
|
|
123
181
|
if (uid) {
|
|
124
182
|
let user = await CometChat.login(uid, CometChatUIKit.uiKitSettings?.authKey).catch(e => Promise.reject(e));
|
|
183
|
+
CometChatUIKit.setLoggedInUser(user)
|
|
184
|
+
this.enableExtensions()
|
|
125
185
|
return user;
|
|
126
186
|
}
|
|
127
187
|
if (authToken) {
|
|
128
188
|
let user = await CometChat.login(authToken).catch(e => Promise.reject(e));
|
|
189
|
+
this.enableExtensions()
|
|
129
190
|
return user;
|
|
130
191
|
}
|
|
131
192
|
return Promise.reject(new CometChat.CometChatException({ code: "INVALID_LOGIN_ATTEMPT", message: "Provide uid or authToken" }));
|
|
@@ -179,6 +240,16 @@ export class CometChatUIKit {
|
|
|
179
240
|
///[sendCustomMessage] used to send a custom message
|
|
180
241
|
static sendCustomMessage(message: CometChat.CustomMessage): Promise<CometChat.CustomMessage | CometChat.BaseMessage> {
|
|
181
242
|
return new Promise((resolve, reject) => {
|
|
243
|
+
|
|
244
|
+
if (!message.getMuid()) {
|
|
245
|
+
message.setMuid(String(getUnixTimestamp()));
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
if(!message.getSender()){
|
|
249
|
+
message.setSender(this.loggedInUser);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
|
|
182
253
|
CometChatUIKitHelper.onMessageSent(message, messageStatus.inprogress);
|
|
183
254
|
CometChat.sendCustomMessage(message)
|
|
184
255
|
.then(customMessage => {
|
|
@@ -186,7 +257,7 @@ export class CometChatUIKit {
|
|
|
186
257
|
resolve(customMessage);
|
|
187
258
|
})
|
|
188
259
|
.catch(err => {
|
|
189
|
-
if(message.data)
|
|
260
|
+
if (message.data)
|
|
190
261
|
message.data.metaData = { ...(message.data.metaData ? message.data.metaData : {}), error: true }
|
|
191
262
|
CometChatUIKitHelper.onMessageSent(message, messageStatus.error);
|
|
192
263
|
reject(err);
|
|
@@ -197,6 +268,16 @@ export class CometChatUIKit {
|
|
|
197
268
|
///[sendMediaMessage] used to send a media message
|
|
198
269
|
static sendMediaMessage(message: CometChat.MediaMessage): Promise<CometChat.MediaMessage | CometChat.BaseMessage> {
|
|
199
270
|
return new Promise((resolve, reject) => {
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
if (!message.getMuid()) {
|
|
274
|
+
message.setMuid(String(getUnixTimestamp()));
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if(!message.getSender()){
|
|
278
|
+
message.setSender(this.loggedInUser);
|
|
279
|
+
}
|
|
280
|
+
|
|
200
281
|
let hasAttachment;
|
|
201
282
|
try {
|
|
202
283
|
hasAttachment = message.getAttachment();
|
|
@@ -228,7 +309,7 @@ export class CometChatUIKit {
|
|
|
228
309
|
resolve(mediaMessage);
|
|
229
310
|
})
|
|
230
311
|
.catch(err => {
|
|
231
|
-
if(message.data)
|
|
312
|
+
if (message.data)
|
|
232
313
|
message.data.metaData = { ...(message.data.metaData ? message.data.metaData : {}), error: true }
|
|
233
314
|
CometChatUIKitHelper.onMessageSent(message, messageStatus.error);
|
|
234
315
|
reject(err);
|
|
@@ -239,6 +320,17 @@ export class CometChatUIKit {
|
|
|
239
320
|
///[sendTextMessage] used to send a text message
|
|
240
321
|
static sendTextMessage(message: CometChat.TextMessage): Promise<CometChat.TextMessage | CometChat.BaseMessage> {
|
|
241
322
|
return new Promise((resolve, reject) => {
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
if (!message?.getMuid()) {
|
|
326
|
+
message.setMuid(String(getUnixTimestamp()));
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
if(!message?.getSender()){
|
|
330
|
+
message.setSender(this.loggedInUser);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
|
|
242
334
|
CometChatUIKitHelper.onMessageSent(message, messageStatus.inprogress);
|
|
243
335
|
CometChat.sendMessage(message)
|
|
244
336
|
.then(textMessage => {
|
|
@@ -246,7 +338,7 @@ export class CometChatUIKit {
|
|
|
246
338
|
resolve(textMessage);
|
|
247
339
|
})
|
|
248
340
|
.catch(err => {
|
|
249
|
-
if(message.data)
|
|
341
|
+
if (message.data)
|
|
250
342
|
message.data.metaData = { ...(message.data.metaData ? message.data.metaData : {}), error: true }
|
|
251
343
|
CometChatUIKitHelper.onMessageSent(message, messageStatus.error);
|
|
252
344
|
reject(err);
|
|
@@ -262,13 +354,20 @@ export class CometChatUIKit {
|
|
|
262
354
|
*/
|
|
263
355
|
static sendSchedulerMessage(message: SchedulerMessage, disableLocalEvents: boolean = false): Promise<CometChat.TextMessage | CometChat.BaseMessage> {
|
|
264
356
|
return new Promise((resolve, reject) => {
|
|
357
|
+
|
|
358
|
+
if (!message.getMuid()) {
|
|
359
|
+
message.setMuid(String(getUnixTimestamp()));
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
if(!message.getSender()){
|
|
363
|
+
message.setSender(this.loggedInUser);
|
|
364
|
+
}
|
|
265
365
|
if (!disableLocalEvents) {
|
|
266
366
|
CometChatUIKitHelper.onMessageSent(message, messageStatus.inprogress);
|
|
267
367
|
}
|
|
268
368
|
|
|
269
369
|
CometChat.sendInteractiveMessage(message)
|
|
270
370
|
.then((message: CometChat.BaseMessage) => {
|
|
271
|
-
console.log("message sent successfully", message.getSentAt())
|
|
272
371
|
if (!disableLocalEvents) {
|
|
273
372
|
CometChatUIKitHelper.onMessageSent(message, messageStatus.success);
|
|
274
373
|
}
|
|
@@ -292,6 +391,15 @@ export class CometChatUIKit {
|
|
|
292
391
|
*/
|
|
293
392
|
static sendFormMessage(message: FormMessage, disableLocalEvents: boolean = false): Promise<CometChat.TextMessage | CometChat.BaseMessage> {
|
|
294
393
|
return new Promise((resolve, reject) => {
|
|
394
|
+
|
|
395
|
+
if (!message.getMuid()) {
|
|
396
|
+
message.setMuid(String(getUnixTimestamp()));
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
if(!message.getSender()){
|
|
400
|
+
message.setSender(this.loggedInUser);
|
|
401
|
+
}
|
|
402
|
+
|
|
295
403
|
if (!disableLocalEvents) {
|
|
296
404
|
CometChatUIKitHelper.onMessageSent(message, messageStatus.inprogress);
|
|
297
405
|
}
|
|
@@ -322,6 +430,14 @@ export class CometChatUIKit {
|
|
|
322
430
|
*/
|
|
323
431
|
static sendCardMessage(message: CardMessage, disableLocalEvents: boolean = false): Promise<CometChat.TextMessage | CometChat.BaseMessage> {
|
|
324
432
|
return new Promise((resolve, reject) => {
|
|
433
|
+
|
|
434
|
+
if (!message.getMuid()) {
|
|
435
|
+
message.setMuid(String(getUnixTimestamp()));
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
if(!message.getSender()){
|
|
439
|
+
message.setSender(this.loggedInUser);
|
|
440
|
+
}
|
|
325
441
|
if (!disableLocalEvents) {
|
|
326
442
|
CometChatUIKitHelper.onMessageSent(message, messageStatus.inprogress);
|
|
327
443
|
}
|
|
@@ -353,6 +469,15 @@ export class CometChatUIKit {
|
|
|
353
469
|
*/
|
|
354
470
|
static sendCustomInteractiveMessage(message: CustomInteractiveMessage, disableLocalEvents: boolean = false): Promise<CometChat.TextMessage | CometChat.BaseMessage> {
|
|
355
471
|
return new Promise((resolve, reject) => {
|
|
472
|
+
|
|
473
|
+
if (!message.getMuid()) {
|
|
474
|
+
message.setMuid(String(getUnixTimestamp()));
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
if(!message.getSender()){
|
|
478
|
+
message.setSender(this.loggedInUser);
|
|
479
|
+
}
|
|
480
|
+
|
|
356
481
|
if (!disableLocalEvents) {
|
|
357
482
|
CometChatUIKitHelper.onMessageSent(message, messageStatus.inprogress);
|
|
358
483
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
//@ts-ignore
|
|
2
2
|
import { CometChat } from '@cometchat/chat-sdk-react-native'
|
|
3
|
+
import { CometChatTextFormatter } from '../views';
|
|
3
4
|
|
|
4
5
|
export const USER_ONLINE_STATUS = 'online'
|
|
5
6
|
export const NO_USERS_FOUND = "no_users_found";
|
|
@@ -383,3 +384,8 @@ export enum goalType {
|
|
|
383
384
|
anyAction = CometChat.GoalType.ANY_ACTION,
|
|
384
385
|
none = CometChat.GoalType.NONE
|
|
385
386
|
}
|
|
387
|
+
|
|
388
|
+
export type AdditionalBubbleStylingParams = {
|
|
389
|
+
textFormatters?: CometChatTextFormatter[],
|
|
390
|
+
disableMentions?: boolean
|
|
391
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SuggestionItem } from "../../views";
|
|
1
2
|
import {
|
|
2
3
|
CallListener,
|
|
3
4
|
CallUIEventListener,
|
|
@@ -360,6 +361,12 @@ export class CometChatUIEventHandler {
|
|
|
360
361
|
case listener._eventListener.ccComposeMessage?.name:
|
|
361
362
|
listener._eventListener.ccComposeMessage(param);
|
|
362
363
|
break;
|
|
364
|
+
// case listener._eventListener.ccMentionClick?.name:
|
|
365
|
+
// listener._eventListener.ccMentionClick(param);
|
|
366
|
+
// break;
|
|
367
|
+
case listener._eventListener.ccSuggestionData?.name:
|
|
368
|
+
listener._eventListener.ccSuggestionData(param as { id: string, data: Array<SuggestionItem> });
|
|
369
|
+
break;
|
|
363
370
|
}
|
|
364
371
|
})
|
|
365
372
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { SuggestionItem } from "../../views";
|
|
2
|
+
|
|
1
3
|
export function isFalsy($false) {
|
|
2
4
|
if ($false != null) {
|
|
3
5
|
if (typeof $false == "string") $false = $false.trim();
|
|
@@ -221,6 +223,8 @@ type UIEvents = {
|
|
|
221
223
|
ccToggleBottomSheet?: (item)=>void,
|
|
222
224
|
openChat?: (item)=>void,
|
|
223
225
|
ccComposeMessage?:(item)=>void,
|
|
226
|
+
// ccMentionClick?:(item)=>void,
|
|
227
|
+
ccSuggestionData?:(item: {id: string | number, data: Array<SuggestionItem>})=>void,
|
|
224
228
|
}
|
|
225
229
|
export class UIEventListener {
|
|
226
230
|
showPanel?: (item)=>void;
|
|
@@ -228,18 +232,24 @@ export class UIEventListener {
|
|
|
228
232
|
ccToggleBottomSheet?: (item)=>void;
|
|
229
233
|
openChat?: (item)=>void;
|
|
230
234
|
ccComposeMessage?:(item)=>void;
|
|
235
|
+
// ccMentionClick?:(item)=>void;
|
|
236
|
+
ccSuggestionData?:(item: {id: string | number, data: Array<SuggestionItem>})=>void;
|
|
231
237
|
constructor({
|
|
232
238
|
showPanel,
|
|
233
239
|
hidePanel,
|
|
234
240
|
ccToggleBottomSheet,
|
|
235
241
|
openChat,
|
|
236
|
-
ccComposeMessage
|
|
242
|
+
ccComposeMessage,
|
|
243
|
+
// ccMentionClick,
|
|
244
|
+
ccSuggestionData,
|
|
237
245
|
}: UIEvents) {
|
|
238
246
|
if (!isFalsy(hidePanel)) this.hidePanel = hidePanel;
|
|
239
247
|
if (!isFalsy(showPanel)) this.showPanel = showPanel;
|
|
240
248
|
if (!isFalsy(openChat)) this.openChat = openChat;
|
|
241
249
|
if (!isFalsy(ccToggleBottomSheet)) this.ccToggleBottomSheet = ccToggleBottomSheet;
|
|
242
250
|
if (!isFalsy(ccComposeMessage)) this.ccComposeMessage = ccComposeMessage;
|
|
251
|
+
// if (!isFalsy(ccMentionClick)) this.ccMentionClick = ccMentionClick;
|
|
252
|
+
if (!isFalsy(ccSuggestionData)) this.ccSuggestionData = ccSuggestionData;
|
|
243
253
|
}
|
|
244
254
|
}
|
|
245
255
|
export class GroupUIEventListener {
|
|
@@ -14,6 +14,8 @@ export enum CometChatUIEvents {
|
|
|
14
14
|
hidePanel = 'hidePanel',
|
|
15
15
|
openChat = 'openChat',
|
|
16
16
|
ccToggleBottomSheet = 'ccToggleBottomSheet',
|
|
17
|
-
ccComposeMessage = "ccComposeMessage"
|
|
17
|
+
ccComposeMessage = "ccComposeMessage",
|
|
18
|
+
// ccMentionClick = "ccMentionClick",
|
|
19
|
+
ccSuggestionData = "ccSuggestionData",
|
|
18
20
|
|
|
19
21
|
}
|