@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ImageType } from '../shared';
|
|
2
|
+
import { CometChatMentionsFormatter, CometChatTextFormatter, CometChatUrlsFormatter, ImageType } from '../shared';
|
|
3
3
|
import {
|
|
4
4
|
CometChatMessageComposerInterface,
|
|
5
5
|
MessageComposerStyleInterface,
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
import { CometChat } from '@cometchat/chat-sdk-react-native';
|
|
9
9
|
import { MediaRecorderStyle } from '../shared/views/CometChatMediaRecorder';
|
|
10
10
|
import { AIOptionsStyle } from '../AI/AIOptionsStyle';
|
|
11
|
+
import { KeyboardAvoidingViewProps } from 'react-native';
|
|
11
12
|
export interface MessageComposerConfigurationInterface
|
|
12
13
|
extends Omit<
|
|
13
14
|
CometChatMessageComposerInterface,
|
|
@@ -75,6 +76,16 @@ export class MessageComposerConfiguration {
|
|
|
75
76
|
text?: string;
|
|
76
77
|
AIIconURL?: string;
|
|
77
78
|
AIOptionsStyle?: AIOptionsStyle;
|
|
79
|
+
/**
|
|
80
|
+
* To override keyboardAvoidingViewProps.
|
|
81
|
+
*/
|
|
82
|
+
keyboardAvoidingViewProps?: KeyboardAvoidingViewProps
|
|
83
|
+
/**
|
|
84
|
+
* Collection of text formatter class
|
|
85
|
+
* @type {Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>}
|
|
86
|
+
*/
|
|
87
|
+
textFormatters?: Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>;
|
|
88
|
+
disableMentions?: boolean;
|
|
78
89
|
constructor(props: MessageComposerConfigurationInterface) {
|
|
79
90
|
if (props)
|
|
80
91
|
for (const [key, value] of Object.entries(props)) {
|
|
Binary file
|
|
@@ -7,6 +7,7 @@ import CLOSE from './close.png';
|
|
|
7
7
|
import STICKER from "./stickers.png";
|
|
8
8
|
import MICROPHONE from "./microphone.png";
|
|
9
9
|
import AI from './ai.png'
|
|
10
|
+
import INFO from './Info.png';
|
|
10
11
|
|
|
11
12
|
export const ICONS ={
|
|
12
13
|
HEART,
|
|
@@ -17,5 +18,6 @@ export const ICONS ={
|
|
|
17
18
|
CLOSE,
|
|
18
19
|
STICKER,
|
|
19
20
|
MICROPHONE,
|
|
20
|
-
AI
|
|
21
|
+
AI,
|
|
22
|
+
INFO
|
|
21
23
|
}
|
|
@@ -23,12 +23,10 @@ export const listners = {
|
|
|
23
23
|
msgTypingListenerId,
|
|
24
24
|
{
|
|
25
25
|
onTypingStarted: (typistDetails) => {
|
|
26
|
-
console.log('onTypingStarted', typistDetails);
|
|
27
26
|
|
|
28
27
|
msgTypingIndicator(typistDetails, 'typing');
|
|
29
28
|
},
|
|
30
29
|
onTypingEnded: (typistDetails) => {
|
|
31
|
-
console.log('onTypingEnded', typistDetails);
|
|
32
30
|
msgTypingIndicator(typistDetails, '');
|
|
33
31
|
},
|
|
34
32
|
}
|
|
@@ -3,7 +3,7 @@ import { View, FlatList, Text, Image, TouchableOpacity, ActivityIndicator, Modal
|
|
|
3
3
|
//@ts-ignore
|
|
4
4
|
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
5
5
|
import { LeftArrowCurve, RightArrowCurve } from "./resources";
|
|
6
|
-
import { BaseStyle, BaseStyleInterface, CometChatContext, CometChatLiveReactions, CometChatUIKit, ImageType } from "../shared";
|
|
6
|
+
import { BaseStyle, BaseStyleInterface, CometChatContext, CometChatLiveReactions, CometChatMentionsFormatter, CometChatTextFormatter, CometChatUIKit, CometChatUrlsFormatter, ImageType, SuggestionItem } from "../shared";
|
|
7
7
|
import { MessageBubbleStyle, MessageBubbleStyleInterface } from "../shared/views/CometChatMessageBubble/MessageBubbleStyle";
|
|
8
8
|
import { AvatarStyle, AvatarStyleInterface } from "../shared";
|
|
9
9
|
import { CometChatAvatar, CometChatDate, CometChatReceipt, DateStyle } from "../shared";
|
|
@@ -23,7 +23,6 @@ import { DateStyleInterface } from "../shared/views/CometChatDate/DateStyle";
|
|
|
23
23
|
import { CometChatContextType } from "../shared/base/Types";
|
|
24
24
|
import { CometChatUIEventHandler } from "../shared/events/CometChatUIEventHandler/CometChatUIEventHandler";
|
|
25
25
|
import { ActionSheetStylesInterface } from "../shared/views/CometChatActionSheet/ActionSheetStyle";
|
|
26
|
-
import Clipboard from "@react-native-clipboard/clipboard";
|
|
27
26
|
import { CometChatMessageInformation } from "../CometChatMessageInformation/CometChatMessageInformation";
|
|
28
27
|
// import { CometChatContacts, ForwardMessageConfigurationInterface } from "../CometChatContacts";
|
|
29
28
|
import { MessageInformationConfigurationInterface } from "../CometChatMessageInformation";
|
|
@@ -33,6 +32,7 @@ import { CometChatReactionList, ReactionListConfigurationInterface } from "../sh
|
|
|
33
32
|
import { CometChatQuickReactions, QuickReactionsConfigurationInterface } from "../shared/views/CometChatQuickReactions";
|
|
34
33
|
import { CometChatReactions, ReactionsConfigurationInterface } from "../shared/views/CometChatReactions";
|
|
35
34
|
import { CommonUtils } from "../shared/utils/CommonUtils";
|
|
35
|
+
import Clipboard from "@react-native-clipboard/clipboard";
|
|
36
36
|
|
|
37
37
|
let templatesMap = new Map<string, CometChatMessageTemplate>();
|
|
38
38
|
|
|
@@ -102,6 +102,12 @@ export interface CometChatMessageListProps {
|
|
|
102
102
|
* Disables the reactions functionality
|
|
103
103
|
*/
|
|
104
104
|
disableReactions?: boolean,
|
|
105
|
+
disableMentions?: boolean,
|
|
106
|
+
/**
|
|
107
|
+
* Collection of text formatter class
|
|
108
|
+
* @type {Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>}
|
|
109
|
+
*/
|
|
110
|
+
textFormatters?: Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>;
|
|
105
111
|
}
|
|
106
112
|
|
|
107
113
|
export interface CometChatMessageListActionsInterface {
|
|
@@ -163,6 +169,8 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
163
169
|
reactionListConfiguration,
|
|
164
170
|
quickReactionConfiguration,
|
|
165
171
|
emojiKeyboardStyle,
|
|
172
|
+
disableMentions,
|
|
173
|
+
textFormatters
|
|
166
174
|
} = props;
|
|
167
175
|
|
|
168
176
|
const callListenerId = "call_" + new Date().getTime();
|
|
@@ -477,7 +485,14 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
477
485
|
}
|
|
478
486
|
|
|
479
487
|
const loadTemplates = useCallback(() => {
|
|
480
|
-
|
|
488
|
+
|
|
489
|
+
let _formatters = textFormatters || [];
|
|
490
|
+
|
|
491
|
+
let templates: CometChatMessageTemplate[] = ChatConfigurator.dataSource.getAllMessageTemplates(theme, {
|
|
492
|
+
textFormatters: _formatters,
|
|
493
|
+
disableMentions: disableMentions
|
|
494
|
+
});
|
|
495
|
+
|
|
481
496
|
templates.forEach(template => {
|
|
482
497
|
|
|
483
498
|
if (templatesMap.get(`${template.category}_${template.type}`)) return
|
|
@@ -485,6 +500,79 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
485
500
|
});
|
|
486
501
|
}, [])
|
|
487
502
|
|
|
503
|
+
|
|
504
|
+
const getPlainString = (underlyingText: string, messageObject: CometChat.BaseMessage) => {
|
|
505
|
+
|
|
506
|
+
let _plainString = underlyingText;
|
|
507
|
+
|
|
508
|
+
let regexes: Array<RegExp> = []
|
|
509
|
+
let users: { key: string, value: SuggestionItem } = {};
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
let edits: Array<{
|
|
513
|
+
"endIndex": number,
|
|
514
|
+
"replacement": string,
|
|
515
|
+
"startIndex": number,
|
|
516
|
+
"user": SuggestionItem
|
|
517
|
+
}> = [];
|
|
518
|
+
|
|
519
|
+
let allFormatters = [...(textFormatters || [])];
|
|
520
|
+
let mentionsTextFormatter = ChatConfigurator.getDataSource().getMentionsFormatter(loggedInUser.current);
|
|
521
|
+
allFormatters.push(mentionsTextFormatter);
|
|
522
|
+
|
|
523
|
+
allFormatters.forEach((formatter: CometChatMentionsFormatter, key) => {
|
|
524
|
+
regexes.push(formatter.getRegexPattern());
|
|
525
|
+
let suggestionUsers = formatter.getSuggestionItems();
|
|
526
|
+
if (formatter instanceof CometChatMentionsFormatter) {
|
|
527
|
+
let mentionUsers = (messageObject?.getMentionedUsers && messageObject?.getMentionedUsers()).map(item => new SuggestionItem({
|
|
528
|
+
id: item.getUid(),
|
|
529
|
+
name: item.getName(),
|
|
530
|
+
promptText: "@" + item.getName(),
|
|
531
|
+
trackingCharacter: "@",
|
|
532
|
+
underlyingText: `<@uid:${item.getUid()}>`,
|
|
533
|
+
hideLeadingIcon: false
|
|
534
|
+
|
|
535
|
+
})) || [];
|
|
536
|
+
suggestionUsers = [...suggestionUsers, ...mentionUsers];
|
|
537
|
+
}
|
|
538
|
+
suggestionUsers?.length > 0 && suggestionUsers.forEach(item => users[item.underlyingText] = item);
|
|
539
|
+
})
|
|
540
|
+
|
|
541
|
+
regexes.forEach(regex => {
|
|
542
|
+
let match;
|
|
543
|
+
while ((match = regex.exec(_plainString)) !== null) {
|
|
544
|
+
const user = users[match[0]];
|
|
545
|
+
if (user) {
|
|
546
|
+
edits.push({
|
|
547
|
+
startIndex: match.index,
|
|
548
|
+
endIndex: regex.lastIndex,
|
|
549
|
+
replacement: user.promptText,
|
|
550
|
+
user
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
});
|
|
555
|
+
|
|
556
|
+
// Sort edits by startIndex to apply them in order
|
|
557
|
+
edits.sort((a, b) => a.startIndex - b.startIndex);
|
|
558
|
+
|
|
559
|
+
// Get an array of the entries in the map using the spread operator
|
|
560
|
+
const entries = [...edits].reverse();
|
|
561
|
+
|
|
562
|
+
// Iterate over the array in reverse order
|
|
563
|
+
entries.forEach(({ endIndex, replacement, startIndex, user }) => {
|
|
564
|
+
|
|
565
|
+
let pre = _plainString.substring(0, startIndex);
|
|
566
|
+
let post = _plainString.substring(endIndex);
|
|
567
|
+
|
|
568
|
+
_plainString = pre + replacement + post;
|
|
569
|
+
|
|
570
|
+
});
|
|
571
|
+
|
|
572
|
+
return _plainString;
|
|
573
|
+
|
|
574
|
+
}
|
|
575
|
+
|
|
488
576
|
const playNotificationSound = useCallback((message) => {
|
|
489
577
|
|
|
490
578
|
if (disableSoundForMessages) return;
|
|
@@ -554,6 +642,19 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
554
642
|
return conversationId.current != null && (message.getConversationId() == conversationId.current);
|
|
555
643
|
}
|
|
556
644
|
|
|
645
|
+
function isNearBottom() {
|
|
646
|
+
const { layoutHeight, scrollViewHeight, y } = currentScrollPosition.current;
|
|
647
|
+
|
|
648
|
+
let scrollPos = scrollViewHeight - (layoutHeight + y);
|
|
649
|
+
let scrollPosFromBottomInPercentage = (scrollPos / layoutHeight) * 100;
|
|
650
|
+
|
|
651
|
+
if (scrollPosFromBottomInPercentage <= 30) { // 30% from bottom
|
|
652
|
+
return true;
|
|
653
|
+
}
|
|
654
|
+
return false;
|
|
655
|
+
|
|
656
|
+
}
|
|
657
|
+
|
|
557
658
|
const newMessage = (newMessage, isReceived = true) => {
|
|
558
659
|
let baseMessage = newMessage as CometChat.BaseMessage;
|
|
559
660
|
if (baseMessage.getCategory() === MessageCategoryConstants.interactive) {
|
|
@@ -596,7 +697,9 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
596
697
|
if (baseMessage?.getReceiverType() == ReceiverTypeConstants.user) {
|
|
597
698
|
CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccMessageDelivered, { message: newMessage });
|
|
598
699
|
}
|
|
599
|
-
if ((
|
|
700
|
+
if (isNearBottom()) {
|
|
701
|
+
scrollToBottom();
|
|
702
|
+
} else if ((!parentMessageId && !(newMessage.parentMessageId)) || (parentMessageId && newMessage.parentMessageId == parseInt(parentMessageId))) {
|
|
600
703
|
setUnreadCount(unreadCount + 1);
|
|
601
704
|
}
|
|
602
705
|
} else {
|
|
@@ -719,12 +822,12 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
719
822
|
}
|
|
720
823
|
|
|
721
824
|
const handlePannel = (item) => {
|
|
722
|
-
if(item.alignment === ViewAlignment.messageListBottom && CommonUtils.checkIdBelongsToThisComponent(item.id, user, group,parentMessageId)
|
|
825
|
+
if (item.alignment === ViewAlignment.messageListBottom && CommonUtils.checkIdBelongsToThisComponent(item.id, user, group, parentMessageId)) {
|
|
723
826
|
if (item.child)
|
|
724
827
|
setCustomListHeader(() => item.child)
|
|
725
828
|
else
|
|
726
829
|
setCustomListHeader(null)
|
|
727
|
-
|
|
830
|
+
}
|
|
728
831
|
|
|
729
832
|
}
|
|
730
833
|
|
|
@@ -732,7 +835,10 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
732
835
|
CometChatUIEventHandler.addUIListener(
|
|
733
836
|
uiEventListenerShow,
|
|
734
837
|
{
|
|
735
|
-
showPanel: (item) => handlePannel(item)
|
|
838
|
+
showPanel: (item) => handlePannel(item),
|
|
839
|
+
// ccMentionClick: (item) => {
|
|
840
|
+
// // console.log("item", item)
|
|
841
|
+
// }
|
|
736
842
|
}
|
|
737
843
|
)
|
|
738
844
|
CometChatUIEventHandler.addUIListener(
|
|
@@ -823,7 +929,7 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
823
929
|
if (status == MessageStatusConstants.success) {
|
|
824
930
|
messageEdited(message, true);
|
|
825
931
|
}
|
|
826
|
-
if(
|
|
932
|
+
if (status == MessageStatusConstants.error) {
|
|
827
933
|
messageEdited(message, true);
|
|
828
934
|
}
|
|
829
935
|
},
|
|
@@ -1116,10 +1222,10 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1116
1222
|
|
|
1117
1223
|
return (
|
|
1118
1224
|
<View style={{ flexDirection: "row" }}>
|
|
1119
|
-
<Text style={[Style.nameStyle, {
|
|
1225
|
+
{Boolean(senderName) && <Text style={[Style.nameStyle, {
|
|
1120
1226
|
color: _messageListStyle.nameTextColor,
|
|
1121
1227
|
..._messageListStyle.nameTextFont,
|
|
1122
|
-
}]}>{senderName}</Text>
|
|
1228
|
+
}]}>{senderName}</Text>}
|
|
1123
1229
|
{
|
|
1124
1230
|
timeStampAlignment == "bottom" || item['category'] == "action" ?
|
|
1125
1231
|
null :
|
|
@@ -1147,7 +1253,7 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1147
1253
|
messageState = "DELIVERED";
|
|
1148
1254
|
else if (item.getSentAt())
|
|
1149
1255
|
messageState = "SENT";
|
|
1150
|
-
else if(item?.data?.metaData?.error)
|
|
1256
|
+
else if (item?.data?.metaData?.error)
|
|
1151
1257
|
messageState = "ERROR"
|
|
1152
1258
|
else if (isSender)
|
|
1153
1259
|
messageState = "WAIT";
|
|
@@ -1246,7 +1352,8 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1246
1352
|
}
|
|
1247
1353
|
|
|
1248
1354
|
const copyMessage = (item) => {
|
|
1249
|
-
|
|
1355
|
+
let copyMessage = getPlainString(item['text'], item);
|
|
1356
|
+
Clipboard.setString(copyMessage);
|
|
1250
1357
|
setShowMessageOptions([]);
|
|
1251
1358
|
}
|
|
1252
1359
|
|
|
@@ -1324,7 +1431,9 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1324
1431
|
}
|
|
1325
1432
|
|
|
1326
1433
|
const shareMedia = async (messageObject: CometChat.MediaMessage) => {
|
|
1327
|
-
let
|
|
1434
|
+
let _plainString = getPlainString(messageObject?.data?.text || "", messageObject);
|
|
1435
|
+
|
|
1436
|
+
let textMessage = _plainString;
|
|
1328
1437
|
let fileUrl = messageObject.data.url;
|
|
1329
1438
|
|
|
1330
1439
|
const getFileName = () => {
|
|
@@ -1360,7 +1469,7 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1360
1469
|
if ((item.getSender()?.getUid() || item?.['sender']?.['uid']) == loggedInUser.current?.['uid'])
|
|
1361
1470
|
_style.backgroundColor = (alignment !== "leftAligned" && (item.getType() === MessageTypeConstants.text || item.getType() === MessageTypeConstants.meeting)) ? theme?.palette.getPrimary() : theme?.palette.getAccent50();
|
|
1362
1471
|
|
|
1363
|
-
if(item?.getDeletedBy()) {
|
|
1472
|
+
if (item?.getDeletedBy()) {
|
|
1364
1473
|
_style.backgroundColor = 'transparent';
|
|
1365
1474
|
}
|
|
1366
1475
|
|
|
@@ -1520,7 +1629,7 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1520
1629
|
FooterView={hasTemplate.FooterView ? hasTemplate.FooterView?.bind(this, message, bubbleAlignment) : () => (disableReactions || isThreaded) ? null : getFooterView(message, bubbleAlignment)}
|
|
1521
1630
|
alignment={isThreaded ? "left" : bubbleAlignment}
|
|
1522
1631
|
ContentView={hasTemplate.ContentView?.bind(this, message, bubbleAlignment)}
|
|
1523
|
-
ThreadView={() => !isThreaded && getThreadView(message, bubbleAlignment)}
|
|
1632
|
+
ThreadView={() => !isThreaded && !message.getDeletedBy() && getThreadView(message, bubbleAlignment)}
|
|
1524
1633
|
BottomView={() => ChatConfigurator.dataSource.getBottomView(message, bubbleAlignment)} // Note please rewrite this
|
|
1525
1634
|
StatusInfoView={() => getStatusInfoView(message, bubbleAlignment)}
|
|
1526
1635
|
style={getStyle(message)}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//@ts-ignore
|
|
2
2
|
import { CometChat } from '@cometchat/chat-sdk-react-native';
|
|
3
|
-
import { AvatarStyleInterface, ImageType } from '../shared';
|
|
3
|
+
import { AvatarStyleInterface, CometChatMentionsFormatter, CometChatTextFormatter, CometChatUrlsFormatter, ImageType } from '../shared';
|
|
4
4
|
import { DateStyle } from '../shared';
|
|
5
5
|
import { AvatarStyle } from '../shared';
|
|
6
6
|
import {
|
|
@@ -97,6 +97,12 @@ export interface MessageListConfigurationInterface {
|
|
|
97
97
|
* Disables the reactions functionality
|
|
98
98
|
*/
|
|
99
99
|
disableReactions?: boolean;
|
|
100
|
+
disableMentions?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Collection of text formatter class
|
|
103
|
+
* @type {Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>}
|
|
104
|
+
*/
|
|
105
|
+
textFormatters?: Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>;
|
|
100
106
|
}
|
|
101
107
|
export class MessageListConfiguration
|
|
102
108
|
implements MessageListConfigurationInterface {
|
|
@@ -171,6 +177,13 @@ export class MessageListConfiguration
|
|
|
171
177
|
*/
|
|
172
178
|
disableReactions?: boolean;
|
|
173
179
|
|
|
180
|
+
disableMentions: boolean;
|
|
181
|
+
/**
|
|
182
|
+
* Collection of text formatter class
|
|
183
|
+
* @type {Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>}
|
|
184
|
+
*/
|
|
185
|
+
textFormatters?: Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>;
|
|
186
|
+
|
|
174
187
|
constructor(props: MessageListConfigurationInterface) {
|
|
175
188
|
if (props) {
|
|
176
189
|
for (const [key, value] of Object.entries(props)) {
|
|
@@ -170,24 +170,24 @@ export const CometChatMessages = (props: CometChatMessagesInterface) => {
|
|
|
170
170
|
new CometChat.ConnectionListener({
|
|
171
171
|
onConnected: () => {
|
|
172
172
|
console.log("ConnectionListener => On Connected", user, group);
|
|
173
|
-
if(user?.uid){
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
173
|
+
if (user?.uid) {
|
|
174
|
+
CometChat.getUser(user?.uid)
|
|
175
|
+
.then(user => {
|
|
176
|
+
setUserObject(user);
|
|
177
|
+
console.log("onConnected getUser", { user });
|
|
178
|
+
})
|
|
179
|
+
.catch(e => {
|
|
180
|
+
console.log("ERROR")
|
|
181
|
+
})
|
|
182
182
|
} else {
|
|
183
183
|
CometChat.getGroup(group?.guid)
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
184
|
+
.then(group => {
|
|
185
|
+
setGroupObject(group);
|
|
186
|
+
console.log("onConnected getGroup", { group });
|
|
187
|
+
})
|
|
188
|
+
.catch(e => {
|
|
189
|
+
console.log("ERROR")
|
|
190
|
+
})
|
|
191
191
|
}
|
|
192
192
|
},
|
|
193
193
|
inConnecting: () => {
|
|
@@ -22,6 +22,7 @@ import { messageStatus } from '../shared/utils/CometChatMessageHelper';
|
|
|
22
22
|
import { CometChatContextType } from '../shared/base/Types';
|
|
23
23
|
import { useKeyboard } from '../shared/helper/useKeyboard';
|
|
24
24
|
import { CometChatUIEventHandler } from '../shared/events/CometChatUIEventHandler/CometChatUIEventHandler';
|
|
25
|
+
import { commonVars } from '../shared/base/vars';
|
|
25
26
|
|
|
26
27
|
const uiEventId = 'ccUiEvent' + new Date().getTime();
|
|
27
28
|
export interface CometChatThreadedMessagesInterface {
|
|
@@ -305,7 +306,11 @@ export const CometChatThreadedMessages = (
|
|
|
305
306
|
<View
|
|
306
307
|
style={{
|
|
307
308
|
width: '100%',
|
|
308
|
-
height:
|
|
309
|
+
height:
|
|
310
|
+
keyboardHeight -
|
|
311
|
+
(Number.isInteger(commonVars.safeAreaInsets.bottom)
|
|
312
|
+
? commonVars.safeAreaInsets.bottom
|
|
313
|
+
: 35),
|
|
309
314
|
}}
|
|
310
315
|
/>
|
|
311
316
|
)}
|
|
@@ -6,7 +6,7 @@ import { localize } from "../shared/resources/CometChatLocalize";
|
|
|
6
6
|
import { DataSource, DataSourceDecorator } from "../shared/framework";
|
|
7
7
|
import { CometChatTheme } from "../shared/resources/CometChatTheme";
|
|
8
8
|
import { CallingConfiguration } from "./CallingConfiguration";
|
|
9
|
-
import { CallContstatnts, MessageCategoryConstants, MessageOptionConstants, MessageTypeConstants } from "../shared/constants/UIKitConstants";
|
|
9
|
+
import { AdditionalBubbleStylingParams, CallContstatnts, MessageCategoryConstants, MessageOptionConstants, MessageTypeConstants } from "../shared/constants/UIKitConstants";
|
|
10
10
|
import { CometChatCallBubble } from "./CometChatCallBubble";
|
|
11
11
|
import { AudioIcon } from "./resources";
|
|
12
12
|
import { VideoIcon } from "./resources";
|
|
@@ -16,7 +16,7 @@ import { CallingPackage } from "./CallingPackage";
|
|
|
16
16
|
import { CallUtils } from "./CallUtils";
|
|
17
17
|
import { CometChatUIEventHandler } from "../shared";
|
|
18
18
|
import { CallUIEvents } from "./CallEvents";
|
|
19
|
-
import {
|
|
19
|
+
import { permissionUtil } from "../shared/utils/PermissionUtil";
|
|
20
20
|
|
|
21
21
|
const CometChatCalls = CallingPackage.CometChatCalls;
|
|
22
22
|
|
|
@@ -65,12 +65,14 @@ export class CallingExtensionDecorator extends DataSourceDecorator {
|
|
|
65
65
|
UserCallBubbleView = ({ message, theme }) => {
|
|
66
66
|
if (this.isDeletedMessage(message))
|
|
67
67
|
return null;
|
|
68
|
+
|
|
69
|
+
const callStatus = CallUtils.getCallStatus(message, this.loggedInUser);
|
|
68
70
|
return <View style={{ justifyContent: "space-around", alignItems: "center" }}>
|
|
69
|
-
<View style={{ flexDirection: "row", alignSelf: "center", borderWidth: 1, borderStyle: "dotted", borderRadius: 8, padding: 4 }}>
|
|
70
|
-
<Image source={message['type'] == "audio" ? AudioIcon : VideoIcon} style={{ height: 16, width: 16, alignSelf: "center" }} />
|
|
71
|
-
<Text style={{ color: theme.palette.getAccent(), marginStart: 8 }}>
|
|
71
|
+
<View style={{ flexDirection: "row", alignSelf: "center", borderWidth: 1, borderStyle: "dotted", borderRadius: 8, padding: 4, borderColor: callStatus === localize('MISSED_CALL') ? theme.palette.getError() : undefined }}>
|
|
72
|
+
<Image source={message['type'] == "audio" ? AudioIcon : VideoIcon} style={{ height: 16, width: 16, alignSelf: "center", tintColor: callStatus === localize('MISSED_CALL') ? theme.palette.getError() : undefined }} />
|
|
73
|
+
<Text style={{ color: callStatus === localize('MISSED_CALL') ? theme.palette.getError() : theme.palette.getAccent(), marginStart: 8 }}>
|
|
72
74
|
{
|
|
73
|
-
|
|
75
|
+
callStatus
|
|
74
76
|
}
|
|
75
77
|
</Text>
|
|
76
78
|
</View>
|
|
@@ -129,7 +131,7 @@ export class CallingExtensionDecorator extends DataSourceDecorator {
|
|
|
129
131
|
}
|
|
130
132
|
|
|
131
133
|
async startDirectCall(sessionId: string, theme?: CometChatTheme) {
|
|
132
|
-
if (!(await
|
|
134
|
+
if (!(await permissionUtil.startResourceBasedTask(["mic", "camera"]))) {
|
|
133
135
|
return;
|
|
134
136
|
}
|
|
135
137
|
const callSettingsBuilder = new CometChatCalls.CallSettingsBuilder()
|
|
@@ -195,8 +197,8 @@ export class CallingExtensionDecorator extends DataSourceDecorator {
|
|
|
195
197
|
})
|
|
196
198
|
}
|
|
197
199
|
|
|
198
|
-
getAllMessageTemplates(theme: CometChatTheme): CometChatMessageTemplate[] {
|
|
199
|
-
let templates = super.getAllMessageTemplates(theme);
|
|
200
|
+
getAllMessageTemplates(theme: CometChatTheme, additionalParams?: AdditionalBubbleStylingParams): CometChatMessageTemplate[] {
|
|
201
|
+
let templates = super.getAllMessageTemplates(theme, additionalParams);
|
|
200
202
|
templates.push(
|
|
201
203
|
this.getUserAudioCallTemplate(theme),
|
|
202
204
|
this.getUserVideoCallTemplates(theme),
|
|
@@ -12,7 +12,7 @@ import { Style } from './style'
|
|
|
12
12
|
import { CallUIEvents } from '../CallEvents'
|
|
13
13
|
import { CometChatOutgoingCall } from '../CometChatOutgoingCall'
|
|
14
14
|
import { CometChatUIKit } from '../../shared/CometChatUiKit/CometChatUIKit'
|
|
15
|
-
import {
|
|
15
|
+
import { permissionUtil } from '../../shared/utils/PermissionUtil'
|
|
16
16
|
|
|
17
17
|
const listenerId = "callEventListener_" + new Date().getTime();
|
|
18
18
|
|
|
@@ -206,7 +206,7 @@ export const CometChatCallButtons = (props: CometChatCallButtonsInterface) => {
|
|
|
206
206
|
if (disableButton)
|
|
207
207
|
return;
|
|
208
208
|
|
|
209
|
-
if (!(await
|
|
209
|
+
if (!(await permissionUtil.startResourceBasedTask(["mic"]))) {
|
|
210
210
|
return;
|
|
211
211
|
}
|
|
212
212
|
|
|
@@ -222,7 +222,7 @@ export const CometChatCallButtons = (props: CometChatCallButtonsInterface) => {
|
|
|
222
222
|
if (disableButton)
|
|
223
223
|
return;
|
|
224
224
|
|
|
225
|
-
if (!(await
|
|
225
|
+
if (!(await permissionUtil.startResourceBasedTask(["mic", "camera"]))) {
|
|
226
226
|
return;
|
|
227
227
|
}
|
|
228
228
|
|
|
@@ -126,6 +126,7 @@ export const CometChatCallLogHistory = (props: CometChatCallLogHistoryInterface)
|
|
|
126
126
|
const [list, setList] = useState([]);
|
|
127
127
|
const [listState, setListState] = useState<"loading" | "error" | "done">("loading");
|
|
128
128
|
|
|
129
|
+
const activeSwipeRows = React.useRef({});
|
|
129
130
|
const loggedInUser = useRef(null);
|
|
130
131
|
const callRequestBuilderRef = useRef(null);
|
|
131
132
|
|
|
@@ -262,6 +263,15 @@ export const CometChatCallLogHistory = (props: CometChatCallLogHistoryInterface)
|
|
|
262
263
|
}
|
|
263
264
|
TailView={TailView ? () => <TailView call={item} /> : () => <DefaultTailView call={item} />}
|
|
264
265
|
options={() => options && options(item)}
|
|
266
|
+
activeSwipeRows={activeSwipeRows.current}
|
|
267
|
+
rowOpens={(id) => {
|
|
268
|
+
Object.keys(activeSwipeRows.current).forEach(key => {
|
|
269
|
+
if(id !== key && activeSwipeRows.current[key]) {
|
|
270
|
+
activeSwipeRows.current[key]?.current?.closeRow?.()
|
|
271
|
+
delete activeSwipeRows.current[key]
|
|
272
|
+
}
|
|
273
|
+
})
|
|
274
|
+
}}
|
|
265
275
|
onPress={() => onPress(item)}
|
|
266
276
|
hideSeparator={hideSeperator}
|
|
267
277
|
separatorColor={separatorColor}
|
|
@@ -148,6 +148,7 @@ export const CometChatCallLogs = (props: CometChatCallLogsConfigurationInterface
|
|
|
148
148
|
const [list, setList] = useState([]);
|
|
149
149
|
const [listState, setListState] = useState<"loading" | "error" | "done">("loading");
|
|
150
150
|
const [showOutgoingCallScreen, setShowOutgoingCallScreen] = useState(false);
|
|
151
|
+
const activeSwipeRows = React.useRef({});
|
|
151
152
|
|
|
152
153
|
const loggedInUser = useRef(null);
|
|
153
154
|
const callRequestBuilderRef = useRef(null);
|
|
@@ -389,6 +390,15 @@ export const CometChatCallLogs = (props: CometChatCallLogsConfigurationInterface
|
|
|
389
390
|
TailView={TailView ? () => <TailView call={item} /> : () => <DeafultTailView call={item} />}
|
|
390
391
|
avatarStyle={avatarStyle}
|
|
391
392
|
options={() => options && options(item)}
|
|
393
|
+
activeSwipeRows={activeSwipeRows.current}
|
|
394
|
+
rowOpens={(id) => {
|
|
395
|
+
Object.keys(activeSwipeRows.current).forEach(key => {
|
|
396
|
+
if(id !== key && activeSwipeRows.current[key]) {
|
|
397
|
+
activeSwipeRows.current[key]?.current?.closeRow?.()
|
|
398
|
+
delete activeSwipeRows.current[key]
|
|
399
|
+
}
|
|
400
|
+
})
|
|
401
|
+
}}
|
|
392
402
|
onPress={() => onPress(item)}
|
|
393
403
|
hideSeparator={hideSeperator}
|
|
394
404
|
separatorColor={separatorColor}
|
|
@@ -166,6 +166,8 @@ export const CometChatIncomingCall = (props: CometChatIncomingCallInterface) =>
|
|
|
166
166
|
|
|
167
167
|
callListener.current = new CometChatCalls.OngoingCallListener({
|
|
168
168
|
onCallEnded: () => {
|
|
169
|
+
CometChatCalls.endSession()
|
|
170
|
+
CometChat.clearActiveCall()
|
|
169
171
|
CometChatUIEventHandler.emitCallEvent(CallUIEvents.ccCallEnded,{});
|
|
170
172
|
setShowCallScreen(false);
|
|
171
173
|
acceptedCall.current = null;
|
|
@@ -169,7 +169,9 @@ export const CometChatOutgoingCall = (props: CometChatOutgoingCallInterface) =>
|
|
|
169
169
|
|
|
170
170
|
callListener.current = new CometChatCalls.OngoingCallListener({
|
|
171
171
|
onCallEnded: () => {
|
|
172
|
+
CometChatCalls.endSession()
|
|
172
173
|
if (checkIfDefualtCall(call)) {
|
|
174
|
+
CometChat.clearActiveCall()
|
|
173
175
|
setCallConnected(false);
|
|
174
176
|
call.setStatus("ended");
|
|
175
177
|
CometChatUIEventHandler.emitCallEvent(CallUIEvents.ccCallEnded, { call });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DataSource, DataSourceDecorator } from "../../shared/framework";
|
|
2
2
|
// @ts-ignore
|
|
3
3
|
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
4
|
-
import { MessageBubbleAlignmentType , MetadataConstants, MessageCategoryConstants, ReceiverTypeConstants } from "../../shared/constants/UIKitConstants";
|
|
4
|
+
import { MessageBubbleAlignmentType , MetadataConstants, MessageCategoryConstants, ReceiverTypeConstants, AdditionalBubbleStylingParams } from "../../shared/constants/UIKitConstants";
|
|
5
5
|
import { CometChatTheme } from "../../shared/resources/CometChatTheme";
|
|
6
6
|
import { ExtensionConstants, ExtensionTypeConstants } from "../ExtensionConstants";
|
|
7
7
|
import { getExtentionData } from "../ExtensionModerator";
|
|
@@ -139,8 +139,8 @@ export class CollaborativeDocumentExtensionDecorator extends DataSourceDecorator
|
|
|
139
139
|
|
|
140
140
|
|
|
141
141
|
|
|
142
|
-
getAllMessageTemplates(theme: CometChatTheme): CometChatMessageTemplate[] {
|
|
143
|
-
let templateList : CometChatMessageTemplate[] = super.getAllMessageTemplates(theme );
|
|
142
|
+
getAllMessageTemplates(theme: CometChatTheme, additionalParams?: AdditionalBubbleStylingParams): CometChatMessageTemplate[] {
|
|
143
|
+
let templateList : CometChatMessageTemplate[] = super.getAllMessageTemplates(theme, additionalParams);
|
|
144
144
|
|
|
145
145
|
|
|
146
146
|
|
package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DataSource, DataSourceDecorator } from "../../shared/framework";
|
|
2
2
|
// @ts-ignore
|
|
3
3
|
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
4
|
-
import { MessageBubbleAlignmentType , MetadataConstants, MessageCategoryConstants , MessageTypeConstants,ReceiverTypeConstants } from "../../shared/constants/UIKitConstants";
|
|
4
|
+
import { MessageBubbleAlignmentType , MetadataConstants, MessageCategoryConstants , MessageTypeConstants,ReceiverTypeConstants, AdditionalBubbleStylingParams } from "../../shared/constants/UIKitConstants";
|
|
5
5
|
import { CometChatTheme } from "../../shared/resources/CometChatTheme";
|
|
6
6
|
import { ExtensionConstants } from "../ExtensionConstants";
|
|
7
7
|
import { ExtensionTypeConstants } from "../ExtensionConstants";
|
|
@@ -143,8 +143,8 @@ export class CollaborativeWhiteboardExtensionDecorator extends DataSourceDecorat
|
|
|
143
143
|
|
|
144
144
|
|
|
145
145
|
|
|
146
|
-
getAllMessageTemplates(theme: CometChatTheme): CometChatMessageTemplate[] {
|
|
147
|
-
let templateList : CometChatMessageTemplate[] = super.getAllMessageTemplates(theme );
|
|
146
|
+
getAllMessageTemplates(theme: CometChatTheme, additionalParams?: AdditionalBubbleStylingParams): CometChatMessageTemplate[] {
|
|
147
|
+
let templateList : CometChatMessageTemplate[] = super.getAllMessageTemplates(theme, additionalParams);
|
|
148
148
|
|
|
149
149
|
|
|
150
150
|
|