@cometchat/chat-uikit-react-native 4.3.8 → 4.3.9
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/package.json +1 -1
- package/src/CometChatAddMembers/CometChatAddMembers.tsx +2 -1
- package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +1 -1
- package/src/CometChatGroupsWithMessages/CometChatGroupsWithMessages.tsx +4 -2
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +6 -2
- package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +1 -1
- package/src/CometChatMessageList/CometChatMessageList.tsx +22 -3
- package/src/CometChatTransferOwnership/CometChatTransferOwnership.tsx +1 -0
- package/src/CometChatUsersWithMessages/CometChatUsersWithMessages.tsx +5 -3
- package/src/calls/CallingExtentionDecorator.tsx +2 -1
- package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +3 -0
- package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +3 -0
- package/src/extensions/Polls/PollsDecorator.tsx +23 -26
- package/src/extensions/Stickers/StickersExtensionDecorator.tsx +3 -0
- package/src/index.ts +10 -1
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +1 -2
- package/src/shared/constants/UIKitConstants.ts +2 -2
- package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +4 -1
- package/src/shared/formatters/CometChatTextFormatter.ts +1 -1
- package/src/shared/framework/DataSource.ts +1 -2
- package/src/shared/framework/DataSourceDecorator.tsx +1 -2
- package/src/shared/framework/MessageDataSource.tsx +28 -6
- package/src/shared/index.ts +11 -3
- package/src/shared/libs/VideoPlayer/Video.js +4 -5
- package/src/shared/modals/CometChatMessageTemplate.ts +15 -0
- package/src/shared/modals/InteractiveData/InteractiveElements/index.ts +1 -0
- package/src/shared/modals/InteractiveData/InteractiveEntities/ElementEntity.ts +1 -2
- package/src/shared/modals/InteractiveData/index.ts +1 -0
- package/src/shared/modals/index.ts +3 -2
- package/src/shared/utils/MessageUtils.tsx +1 -0
- package/src/shared/views/CometChatDateTimePicker/CometChatDateTimePicker.tsx +1 -1
- package/src/shared/views/CometChatFormBubble/CometChatFormBubble.tsx +3 -5
- package/src/shared/views/CometChatList/CometChatList.tsx +42 -15
- package/src/shared/views/CometChatSchedulerBubble/CometChatSchedulerBubble.tsx +3 -5
- package/src/shared/views/index.ts +4 -0
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@ export interface CometChatAddMembersInterface
|
|
|
23
23
|
|
|
24
24
|
export const CometChatAddMembers = (props: CometChatAddMembersInterface) => {
|
|
25
25
|
const userListenerId = 'userlist_' + new Date().getTime();
|
|
26
|
-
const { group, ...newProps } = props;
|
|
26
|
+
const { group, addMembersStyle, ...newProps } = props;
|
|
27
27
|
const userRef = useRef<CometChatUsersActionsInterface>(null);
|
|
28
28
|
const loggedInUser = useRef(null);
|
|
29
29
|
const addMembersToGroup = (res: any) => {
|
|
@@ -93,6 +93,7 @@ export const CometChatAddMembers = (props: CometChatAddMembersInterface) => {
|
|
|
93
93
|
title={localize('ADD_MEMBERS')}
|
|
94
94
|
showBackButton
|
|
95
95
|
selectionMode="multiple"
|
|
96
|
+
usersStyle={addMembersStyle}
|
|
96
97
|
{...newProps}
|
|
97
98
|
/>
|
|
98
99
|
</View>
|
|
@@ -333,7 +333,7 @@ export const CometChatGroupsMembers = (props: CometChatGroupsMembersInterface) =
|
|
|
333
333
|
|
|
334
334
|
const ItemView = ({ item: member, ...props }) => {
|
|
335
335
|
if (ListItemView)
|
|
336
|
-
return
|
|
336
|
+
return ListItemView(member);
|
|
337
337
|
|
|
338
338
|
let image, backgroundColor
|
|
339
339
|
if (selecting) {
|
|
@@ -41,11 +41,13 @@ export const CometChatGroupsWithMessages = (props: CometChatGroupsWithMessagesIn
|
|
|
41
41
|
|
|
42
42
|
const {theme} = useContext(CometChatContext);
|
|
43
43
|
|
|
44
|
-
const [showComponent, setShowComponent] = useState(
|
|
44
|
+
const [showComponent, setShowComponent] = useState(
|
|
45
|
+
group && group instanceof CometChat.Group ? ComponentNames.Messages : ComponentNames.GroupsList
|
|
46
|
+
);
|
|
45
47
|
const [joinProtectedGroup, setJoinProtectedGroup] = useState(false);
|
|
46
48
|
// const [showForwarding, setShowForwarding] = useState(false);
|
|
47
49
|
|
|
48
|
-
const selectedGroup= useRef(group);
|
|
50
|
+
const selectedGroup= useRef(group && group instanceof CometChat.Group ? group : undefined);
|
|
49
51
|
const selectedUser = useRef();
|
|
50
52
|
|
|
51
53
|
const _createGroupConfig = new CreateGroupConfiguration({...createGroupConfiguration});
|
|
@@ -884,7 +884,11 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
884
884
|
setMentionsSearchData([]);
|
|
885
885
|
plainTextInput.current = ""
|
|
886
886
|
|
|
887
|
-
|
|
887
|
+
if (onSendButtonPress) {
|
|
888
|
+
onSendButtonPress(textMessage);
|
|
889
|
+
return;
|
|
890
|
+
}
|
|
891
|
+
|
|
888
892
|
if (finalTextInput.trim().length == 0) {
|
|
889
893
|
return;
|
|
890
894
|
}
|
|
@@ -1788,7 +1792,7 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
1788
1792
|
<KeyboardAvoidingView
|
|
1789
1793
|
key={id}
|
|
1790
1794
|
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
1791
|
-
keyboardVerticalOffset={Platform.select({ios: kbOffset})}
|
|
1795
|
+
keyboardVerticalOffset={Platform.select({ ios: kbOffset })}
|
|
1792
1796
|
{...keyboardAvoidingViewProps}
|
|
1793
1797
|
>
|
|
1794
1798
|
<View
|
|
@@ -414,7 +414,7 @@ export const CometChatMessageHeader = (
|
|
|
414
414
|
{!hideBackIcon && <BackButton />}
|
|
415
415
|
<View style={{ flex: 1 }}>
|
|
416
416
|
{ListItemView ? (
|
|
417
|
-
<ListItemView />
|
|
417
|
+
<ListItemView user={user} group={group}/>
|
|
418
418
|
) : (
|
|
419
419
|
<CometChatListItem
|
|
420
420
|
id={user ? user.getUid() : groupObj ? groupObj.getGuid() : undefined}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef, useEffect, useRef, useState, useImperativeHandle, useContext, useCallback, memo, useLayoutEffect } from "react";
|
|
2
|
-
import { View, FlatList, Text, Image, TouchableOpacity, ActivityIndicator, Modal, SafeAreaView, NativeModules, ScrollView, Dimensions, Platform } from "react-native";
|
|
2
|
+
import { View, FlatList, Text, Image, TouchableOpacity, ActivityIndicator, Modal, SafeAreaView, NativeModules, ScrollView, Dimensions, Platform, Keyboard } from "react-native";
|
|
3
3
|
//@ts-ignore
|
|
4
4
|
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
5
5
|
import { LeftArrowCurve, RightArrowCurve } from "./resources";
|
|
@@ -33,6 +33,7 @@ import { CometChatQuickReactions, QuickReactionsConfigurationInterface } from ".
|
|
|
33
33
|
import { CometChatReactions, ReactionsConfigurationInterface } from "../shared/views/CometChatReactions";
|
|
34
34
|
import { CommonUtils } from "../shared/utils/CommonUtils";
|
|
35
35
|
import Clipboard from "@react-native-clipboard/clipboard";
|
|
36
|
+
import { commonVars } from "../shared/base/vars";
|
|
36
37
|
|
|
37
38
|
let templatesMap = new Map<string, CometChatMessageTemplate>();
|
|
38
39
|
|
|
@@ -229,6 +230,8 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
229
230
|
}, []);
|
|
230
231
|
|
|
231
232
|
const { theme } = useContext<CometChatContextType>(CometChatContext);
|
|
233
|
+
let Keyboard_Height = 0;
|
|
234
|
+
let scrollPos = 0;
|
|
232
235
|
|
|
233
236
|
// creating style based on styles from users
|
|
234
237
|
const _messageListStyle = useRef(new MessageListStyle({
|
|
@@ -808,6 +811,10 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
808
811
|
}
|
|
809
812
|
|
|
810
813
|
useEffect(() => {
|
|
814
|
+
|
|
815
|
+
const showSubscription = Keyboard.addListener('keyboardDidShow', (e) => onKeyboardVisibiltyChange(true, e?.endCoordinates?.height));
|
|
816
|
+
const hideSubscription = Keyboard.addListener('keyboardDidHide', () => onKeyboardVisibiltyChange(false));
|
|
817
|
+
|
|
811
818
|
CometChatUIEventHandler.addUIListener(
|
|
812
819
|
uiEventListenerShow,
|
|
813
820
|
{
|
|
@@ -848,6 +855,8 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
848
855
|
});
|
|
849
856
|
|
|
850
857
|
return () => {
|
|
858
|
+
showSubscription.remove();
|
|
859
|
+
hideSubscription.remove();
|
|
851
860
|
CometChatUIEventHandler.removeUIListener(uiEventListenerShow)
|
|
852
861
|
CometChatUIEventHandler.removeUIListener(uiEventListenerHide)
|
|
853
862
|
CometChatUIEventHandler.removeUIListener(uiEventListener);
|
|
@@ -1113,6 +1122,16 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1113
1122
|
}
|
|
1114
1123
|
});
|
|
1115
1124
|
|
|
1125
|
+
const onKeyboardVisibiltyChange = (isVisible: boolean, keyboardHeight?: number | undefined) => {
|
|
1126
|
+
if (isVisible) {
|
|
1127
|
+
Keyboard_Height = keyboardHeight;
|
|
1128
|
+
scrollPos = (currentScrollPosition.current.y + Keyboard_Height) - (commonVars.safeAreaInsets.top / 2);
|
|
1129
|
+
messageListRef.current.scrollTo({ y: scrollPos, animated: false })
|
|
1130
|
+
} else {
|
|
1131
|
+
messageListRef.current.scrollTo({ y: scrollPos - Keyboard_Height + (commonVars.safeAreaInsets.top / 2), animated: false })
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1116
1135
|
const getMessageById = (messageId: string): CometChat.BaseMessage => {
|
|
1117
1136
|
const message = messagesList.find((message) => message.getId() === messageId);
|
|
1118
1137
|
return message;
|
|
@@ -1603,7 +1622,7 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1603
1622
|
alignment={isThreaded ? "left" : bubbleAlignment}
|
|
1604
1623
|
ContentView={hasTemplate.ContentView?.bind(this, message, bubbleAlignment)}
|
|
1605
1624
|
ThreadView={() => !isThreaded && !message.getDeletedBy() && getThreadView(message, bubbleAlignment)}
|
|
1606
|
-
BottomView={
|
|
1625
|
+
BottomView={hasTemplate.BottomView && hasTemplate.BottomView?.bind(this, message, bubbleAlignment)}
|
|
1607
1626
|
StatusInfoView={() => getStatusInfoView(message, bubbleAlignment)}
|
|
1608
1627
|
style={getStyle(message)}
|
|
1609
1628
|
/>
|
|
@@ -1771,7 +1790,7 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1771
1790
|
|
|
1772
1791
|
const getLoadingStateView = useCallback(() => {
|
|
1773
1792
|
if (LoadingStateView)
|
|
1774
|
-
return LoadingStateView
|
|
1793
|
+
return <LoadingStateView/>;
|
|
1775
1794
|
|
|
1776
1795
|
return (
|
|
1777
1796
|
<View style={Style.msgContainerStyle}>
|
|
@@ -31,9 +31,11 @@ export const CometChatUsersWithMessages = (props: CometChatUsersWithMessagesInte
|
|
|
31
31
|
messagesConfigurations,
|
|
32
32
|
onError
|
|
33
33
|
} = props;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const [selectedUser, setSelectedUser] = useState(
|
|
34
|
+
const [showComponent, setShowComponent] = useState(
|
|
35
|
+
user && user instanceof CometChat.User ? ComponentNames.Messages : ComponentNames.UserList);
|
|
36
|
+
const [selectedUser, setSelectedUser] = useState(
|
|
37
|
+
user && user instanceof CometChat.User ? user : undefined
|
|
38
|
+
);
|
|
37
39
|
// const [showForwarding, setShowForwarding] = useState(false);
|
|
38
40
|
|
|
39
41
|
const loggedInUser = useRef(null);
|
|
@@ -3,7 +3,8 @@ import { Modal, Text, View, Image, Platform } from "react-native";
|
|
|
3
3
|
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
4
4
|
import { CometChatMessageTemplate } from "../shared/modals";
|
|
5
5
|
import { localize } from "../shared/resources/CometChatLocalize";
|
|
6
|
-
import {
|
|
6
|
+
import { DataSourceDecorator } from "../shared/framework/DataSourceDecorator";
|
|
7
|
+
import { DataSource } from "../shared/framework/DataSource";
|
|
7
8
|
import { CometChatTheme } from "../shared/resources/CometChatTheme";
|
|
8
9
|
import { CallingConfiguration } from "./CallingConfiguration";
|
|
9
10
|
import { CallContstatnts, MessageCategoryConstants, MessageOptionConstants, MessageTypeConstants } from "../shared/constants/UIKitConstants";
|
|
@@ -158,6 +158,9 @@ export class CollaborativeDocumentExtensionDecorator extends DataSourceDecorator
|
|
|
158
158
|
options: (loggedInUser: CometChat.User, messageObject: CometChat.BaseMessage, group: CometChat.Group)=>
|
|
159
159
|
|
|
160
160
|
ChatConfigurator.dataSource.getMessageOptions(loggedInUser, messageObject,group),
|
|
161
|
+
BottomView: (message: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) => {
|
|
162
|
+
return ChatConfigurator.dataSource.getBottomView(message, alignment);
|
|
163
|
+
}
|
|
161
164
|
}));
|
|
162
165
|
|
|
163
166
|
return templateList;
|
package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx
CHANGED
|
@@ -162,6 +162,9 @@ export class CollaborativeWhiteboardExtensionDecorator extends DataSourceDecorat
|
|
|
162
162
|
options: (loggedInUser: CometChat.User, messageObject: CometChat.BaseMessage, group: CometChat.Group)=>
|
|
163
163
|
|
|
164
164
|
ChatConfigurator.dataSource.getMessageOptions(loggedInUser, messageObject,group),
|
|
165
|
+
BottomView: (message: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) => {
|
|
166
|
+
return ChatConfigurator.dataSource.getBottomView(message, alignment);
|
|
167
|
+
}
|
|
165
168
|
}));
|
|
166
169
|
|
|
167
170
|
return templateList;
|
|
@@ -21,12 +21,11 @@ import { ICONS as ICONS2 } from './resources';
|
|
|
21
21
|
import { CometChatCreatePoll } from './Polls';
|
|
22
22
|
import { PollsBubble } from './PollsBubble';
|
|
23
23
|
import { AdditionalBubbleStylingParams, MessageBubbleAlignmentType } from '../../shared/base/Types';
|
|
24
|
+
import { CometChatUIKit } from '../../shared';
|
|
24
25
|
|
|
25
26
|
export class PollsExtensionDecorator extends DataSourceDecorator {
|
|
26
27
|
pollsConfiguration?: PollsConfigurationInterface;
|
|
27
28
|
|
|
28
|
-
loggedInUser: CometChat.User;
|
|
29
|
-
|
|
30
29
|
constructor(
|
|
31
30
|
dataSource: DataSource,
|
|
32
31
|
pollsConfiguration?: PollsConfigurationInterface
|
|
@@ -35,12 +34,6 @@ export class PollsExtensionDecorator extends DataSourceDecorator {
|
|
|
35
34
|
if (pollsConfiguration != undefined) {
|
|
36
35
|
this.pollsConfiguration = pollsConfiguration;
|
|
37
36
|
}
|
|
38
|
-
|
|
39
|
-
CometChat.getLoggedinUser()
|
|
40
|
-
.then((u) => {
|
|
41
|
-
this.loggedInUser = u;
|
|
42
|
-
})
|
|
43
|
-
.catch((err) => console.log(err));
|
|
44
37
|
}
|
|
45
38
|
|
|
46
39
|
isDeletedMessage(message: CometChat.BaseMessage): boolean {
|
|
@@ -88,22 +81,22 @@ export class PollsExtensionDecorator extends DataSourceDecorator {
|
|
|
88
81
|
): CometChatMessageComposerActionInterface[] {
|
|
89
82
|
let attachmentOptions: CometChatMessageComposerActionInterface[] =
|
|
90
83
|
super.getAttachmentOptions(user, group, composerId);
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
84
|
+
if (composerId == undefined || (composerId as Map<any, any>).get("parentMessageId") == undefined)
|
|
85
|
+
attachmentOptions.push({
|
|
86
|
+
id: 'polls',
|
|
87
|
+
title: 'Polls',
|
|
88
|
+
iconUrl: ICONS2.DOCUMENT,
|
|
89
|
+
CustomView: (user, group, _id, pollsProps) => {
|
|
90
|
+
return (
|
|
91
|
+
<CometChatCreatePoll
|
|
92
|
+
user={user}
|
|
93
|
+
group={group}
|
|
94
|
+
{...pollsProps}
|
|
95
|
+
{...this.pollsConfiguration}
|
|
96
|
+
/>
|
|
97
|
+
);
|
|
98
|
+
},
|
|
99
|
+
});
|
|
107
100
|
return attachmentOptions;
|
|
108
101
|
}
|
|
109
102
|
|
|
@@ -135,6 +128,9 @@ export class PollsExtensionDecorator extends DataSourceDecorator {
|
|
|
135
128
|
messageObject,
|
|
136
129
|
group
|
|
137
130
|
),
|
|
131
|
+
BottomView: (message: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) => {
|
|
132
|
+
return ChatConfigurator.dataSource.getBottomView(message, alignment);
|
|
133
|
+
}
|
|
138
134
|
})
|
|
139
135
|
);
|
|
140
136
|
|
|
@@ -145,7 +141,8 @@ export class PollsExtensionDecorator extends DataSourceDecorator {
|
|
|
145
141
|
message: CometChat.BaseMessage,
|
|
146
142
|
_alignment: MessageBubbleAlignmentType
|
|
147
143
|
) {
|
|
148
|
-
|
|
144
|
+
let _loggedInUser = CometChatUIKit.loggedInUser;
|
|
145
|
+
if (message && _loggedInUser) {
|
|
149
146
|
const metaData = getExtentionData(
|
|
150
147
|
message,
|
|
151
148
|
MetadataConstants.extensions?.polls
|
|
@@ -156,7 +153,7 @@ export class PollsExtensionDecorator extends DataSourceDecorator {
|
|
|
156
153
|
pollQuestion={message['customData']?.['question']}
|
|
157
154
|
options={message['customData']?.['options']}
|
|
158
155
|
pollId={message['customData']?.['id']}
|
|
159
|
-
loggedInUser={
|
|
156
|
+
loggedInUser={_loggedInUser}
|
|
160
157
|
// choosePoll
|
|
161
158
|
senderUid={message['sender']?.['uid']}
|
|
162
159
|
metadata={metaData}
|
|
@@ -44,6 +44,9 @@ export class StickersExtensionDecorator extends DataSourceDecorator {
|
|
|
44
44
|
},
|
|
45
45
|
options: (loggedInuser, message, group) => {
|
|
46
46
|
return ChatConfigurator.dataSource.getMessageOptions(loggedInuser, message, group);
|
|
47
|
+
},
|
|
48
|
+
BottomView: (message: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) => {
|
|
49
|
+
return ChatConfigurator.dataSource.getBottomView(message, alignment);
|
|
47
50
|
}
|
|
48
51
|
})
|
|
49
52
|
);
|
package/src/index.ts
CHANGED
|
@@ -180,6 +180,10 @@ import {
|
|
|
180
180
|
SuggestionListConfiguration,
|
|
181
181
|
SuggestionListConfigurationInterface,
|
|
182
182
|
SuggestionItem,
|
|
183
|
+
DateTimeElement,
|
|
184
|
+
CometChatDateTimePicker,
|
|
185
|
+
CometChatDateTimePickerInterface,
|
|
186
|
+
DatePickerStyleInterface,
|
|
183
187
|
} from './shared';
|
|
184
188
|
|
|
185
189
|
import {
|
|
@@ -747,8 +751,13 @@ export {
|
|
|
747
751
|
CometChatSuggestionListInterface,
|
|
748
752
|
SuggestionItem,
|
|
749
753
|
SuggestionListConfiguration,
|
|
750
|
-
SuggestionListConfigurationInterface
|
|
754
|
+
SuggestionListConfigurationInterface,
|
|
751
755
|
/* Text Formatters */
|
|
756
|
+
|
|
757
|
+
DateTimeElement,
|
|
758
|
+
CometChatDateTimePicker,
|
|
759
|
+
CometChatDateTimePickerInterface,
|
|
760
|
+
DatePickerStyleInterface,
|
|
752
761
|
|
|
753
762
|
};
|
|
754
763
|
|
|
@@ -18,14 +18,13 @@ import { TextModerationExtension } from "../../extensions/TextModeration";
|
|
|
18
18
|
import { ThumbnailGenerationExtension } from "../../extensions/ThumbnailGeneration";
|
|
19
19
|
import { CometChatSoundManager } from "../utils";
|
|
20
20
|
import { CometChatLocalize } from "../resources";
|
|
21
|
-
import { CardMessage, CustomInteractiveMessage, FormMessage } from "../modals/InteractiveData";
|
|
21
|
+
import { CardMessage, CustomInteractiveMessage, FormMessage, SchedulerMessage } from "../modals/InteractiveData";
|
|
22
22
|
import { ListenerInitializer } from "../events/ListenerInitializer";
|
|
23
23
|
import { AIConversationStarterExtension } from "../../AI/AIConversationStarter/AIConversationStarter";
|
|
24
24
|
import { AIExtensionDataSource } from "../../AI/AIExtensionDataSource";
|
|
25
25
|
import { AISmartRepliesExtension } from "../../AI/AISmartReplies/AISmartReplies";
|
|
26
26
|
import { AIConversationSummaryExtension } from "../../AI/AIConversationSummary/AIConversationSummaryExtension";
|
|
27
27
|
import { AIAssistBotExtension } from "../../AI/AIAssistBot/AIAssistBotExtension";
|
|
28
|
-
import { SchedulerMessage } from "../modals/InteractiveData/InteractiveMessage";
|
|
29
28
|
import { permissionUtil } from "../utils/PermissionUtil";
|
|
30
29
|
import {
|
|
31
30
|
getUnixTimestamp,
|
|
@@ -6,6 +6,7 @@ import { Text } from "react-native";
|
|
|
6
6
|
import { CometChatUIEventHandler, CometChatUIEvents } from '../../events';
|
|
7
7
|
import { localize } from '../../resources';
|
|
8
8
|
import { SuggestionItem } from '../../views/CometChatSuggestionList';
|
|
9
|
+
import { CometChatUIKit } from '../../CometChatUiKit';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Represents the CometChatMentionsFormatter class.
|
|
@@ -334,7 +335,9 @@ export class CometChatMentionsFormatter extends CometChatTextFormatter {
|
|
|
334
335
|
// Check if segment is a UID
|
|
335
336
|
if (userRegistry.hasOwnProperty(segment)) {
|
|
336
337
|
|
|
337
|
-
let
|
|
338
|
+
let _loggedInUser = this.loggedInUser || CometChatUIKit.loggedInUser;
|
|
339
|
+
|
|
340
|
+
let textStyle = (_loggedInUser?.getUid() == segment) ? this.mentionsStyle.loggedInUserTextStyle : this.mentionsStyle.textStyle;
|
|
338
341
|
let onPressProp = this.temp ? { onPress: (event: any) => this.onMentionClick(event, segment) } : {};
|
|
339
342
|
|
|
340
343
|
return (
|
|
@@ -9,10 +9,9 @@ import { ImageBubbleStyleInterface } from "../views/CometChatImageBubble";
|
|
|
9
9
|
import { VideoBubbleStyleInterface } from "../views/CometChatVideoBubble";
|
|
10
10
|
import { CometChatMessageComposerActionInterface } from "../helper/types";
|
|
11
11
|
import { AIOptionsStyle } from "../../AI/AIOptionsStyle";
|
|
12
|
-
import { CardMessage, FormMessage } from "../modals/InteractiveData";
|
|
12
|
+
import { CardMessage, FormMessage, SchedulerMessage } from "../modals/InteractiveData";
|
|
13
13
|
import { FormBubbleStyle } from "../views/CometChatFormBubble/FormBubbleStyle";
|
|
14
14
|
import { CardBubbleStyle } from "../views/CometChatCardBubble/CardBubbleStyle";
|
|
15
|
-
import { SchedulerMessage } from "../modals/InteractiveData/InteractiveMessage";
|
|
16
15
|
import { SchedulerBubbleStyles } from "../views/CometChatSchedulerBubble";
|
|
17
16
|
import { CometChatMentionsFormatter, CometChatTextFormatter, CometChatUrlsFormatter } from "../formatters";
|
|
18
17
|
import { AdditionalBubbleStylingParams, MessageBubbleAlignmentType } from "../base/Types";
|
|
@@ -3,8 +3,7 @@ import { AdditionalBubbleStylingParams, MessageBubbleAlignmentType } from "../ba
|
|
|
3
3
|
import { CometChatMentionsFormatter, CometChatTextFormatter, CometChatUrlsFormatter } from "../formatters";
|
|
4
4
|
import { CometChatMessageComposerActionInterface } from "../helper/types";
|
|
5
5
|
import { CometChatMessageOption, CometChatMessageTemplate } from "../modals";
|
|
6
|
-
import { CardMessage, FormMessage } from "../modals/InteractiveData";
|
|
7
|
-
import { SchedulerMessage } from "../modals/InteractiveData/InteractiveMessage";
|
|
6
|
+
import { CardMessage, FormMessage, SchedulerMessage } from "../modals/InteractiveData";
|
|
8
7
|
import { CometChatTheme } from "../resources/CometChatTheme";
|
|
9
8
|
import { VideoBubbleStyleInterface, ImageBubbleStyleInterface, AudioBubbleStyleInterface, FileBubbleStyleInterface } from "../views";
|
|
10
9
|
import { CardBubbleStyle } from "../views/CometChatCardBubble/CardBubbleStyle";
|
|
@@ -17,16 +17,14 @@ import { CometChatMessageComposerActionInterface } from "../helper/types";
|
|
|
17
17
|
import { ICONS } from "./resources";
|
|
18
18
|
import { CometChatConversationUtils } from "../utils/conversationUtils";
|
|
19
19
|
import { AIOptionsStyle } from "../../AI/AIOptionsStyle";
|
|
20
|
-
import { CometChatFormBubble, CometChatCardBubble } from "../views";
|
|
21
|
-
import { CardMessage, FormMessage } from "../modals/InteractiveData";
|
|
20
|
+
import { CometChatFormBubble, CometChatCardBubble, CometChatSchedulerBubble } from "../views";
|
|
21
|
+
import { CardMessage, FormMessage, SchedulerMessage } from "../modals/InteractiveData";
|
|
22
22
|
import { FormBubbleStyle } from "../views/CometChatFormBubble/FormBubbleStyle";
|
|
23
23
|
import { CardBubbleStyle } from "../views/CometChatCardBubble/CardBubbleStyle";
|
|
24
|
-
import {
|
|
25
|
-
import { CometChatSchedulerBubble, SchedulerBubbleStyles } from "../views/CometChatSchedulerBubble";
|
|
24
|
+
import { SchedulerBubbleStyles } from "../views/CometChatSchedulerBubble";
|
|
26
25
|
import { View } from "react-native";
|
|
27
26
|
import { CommonUtils } from "../utils/CommonUtils";
|
|
28
|
-
import { CometChatUIKit } from "
|
|
29
|
-
import { CometChatMentionsFormatter, CometChatTextFormatter, CometChatUrlsFormatter, MentionTextStyle } from "../formatters";
|
|
27
|
+
import { CometChatUIKit, CometChatMentionsFormatter, CometChatTextFormatter, CometChatUrlsFormatter, MentionTextStyle } from "../..";
|
|
30
28
|
import { AdditionalBubbleStylingParams, MessageBubbleAlignmentType } from "../base/Types";
|
|
31
29
|
|
|
32
30
|
function isAudioMessage(message: CometChat.BaseMessage): message is CometChat.MediaMessage {
|
|
@@ -599,6 +597,9 @@ export class MessageDataSource implements DataSource {
|
|
|
599
597
|
}
|
|
600
598
|
},
|
|
601
599
|
options: (loggedInuser, message, group) => ChatConfigurator.dataSource.getTextMessageOptions(loggedInuser, message, group),
|
|
600
|
+
BottomView: (message: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) => {
|
|
601
|
+
return ChatConfigurator.dataSource.getBottomView(message, alignment);
|
|
602
|
+
}
|
|
602
603
|
});
|
|
603
604
|
}
|
|
604
605
|
|
|
@@ -614,6 +615,9 @@ export class MessageDataSource implements DataSource {
|
|
|
614
615
|
}
|
|
615
616
|
},
|
|
616
617
|
options: (loggedInuser, message, group) => ChatConfigurator.dataSource.getFormMessageOptions(loggedInuser, message, group),
|
|
618
|
+
BottomView: (message: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) => {
|
|
619
|
+
return ChatConfigurator.dataSource.getBottomView(message, alignment);
|
|
620
|
+
}
|
|
617
621
|
});
|
|
618
622
|
}
|
|
619
623
|
|
|
@@ -629,6 +633,9 @@ export class MessageDataSource implements DataSource {
|
|
|
629
633
|
}
|
|
630
634
|
},
|
|
631
635
|
options: (loggedInuser, message, group) => ChatConfigurator.dataSource.getSchedulerMessageOptions(loggedInuser, message, group),
|
|
636
|
+
BottomView: (message: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) => {
|
|
637
|
+
return ChatConfigurator.dataSource.getBottomView(message, alignment);
|
|
638
|
+
}
|
|
632
639
|
});
|
|
633
640
|
}
|
|
634
641
|
|
|
@@ -644,6 +651,9 @@ export class MessageDataSource implements DataSource {
|
|
|
644
651
|
}
|
|
645
652
|
},
|
|
646
653
|
options: (loggedInuser, message, group) => ChatConfigurator.dataSource.getCardMessageOptions(loggedInuser, message, group),
|
|
654
|
+
BottomView: (message: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) => {
|
|
655
|
+
return ChatConfigurator.dataSource.getBottomView(message, alignment);
|
|
656
|
+
}
|
|
647
657
|
});
|
|
648
658
|
}
|
|
649
659
|
|
|
@@ -658,6 +668,9 @@ export class MessageDataSource implements DataSource {
|
|
|
658
668
|
return ChatConfigurator.dataSource.getAudioMessageContentView(message, alignment, theme);
|
|
659
669
|
},
|
|
660
670
|
options: (loggedInuser, message, group) => ChatConfigurator.dataSource.getAudioMessageOptions(loggedInuser, message, group),
|
|
671
|
+
BottomView: (message: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) => {
|
|
672
|
+
return ChatConfigurator.dataSource.getBottomView(message, alignment);
|
|
673
|
+
}
|
|
661
674
|
})
|
|
662
675
|
}
|
|
663
676
|
getVideoMessageTemplate(theme: CometChatTheme): CometChatMessageTemplate {
|
|
@@ -671,6 +684,9 @@ export class MessageDataSource implements DataSource {
|
|
|
671
684
|
return ChatConfigurator.dataSource.getVideoMessageContentView(message, alignment, theme);
|
|
672
685
|
},
|
|
673
686
|
options: (loggedInuser, message, group) => ChatConfigurator.dataSource.getVideoMessageOptions(loggedInuser, message, group),
|
|
687
|
+
BottomView: (message: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) => {
|
|
688
|
+
return ChatConfigurator.dataSource.getBottomView(message, alignment);
|
|
689
|
+
}
|
|
674
690
|
})
|
|
675
691
|
}
|
|
676
692
|
getImageMessageTemplate(theme: CometChatTheme): CometChatMessageTemplate {
|
|
@@ -684,6 +700,9 @@ export class MessageDataSource implements DataSource {
|
|
|
684
700
|
return ChatConfigurator.dataSource.getImageMessageContentView(message, alignment, theme);
|
|
685
701
|
},
|
|
686
702
|
options: (loggedInuser, message, group) => ChatConfigurator.dataSource.getImageMessageOptions(loggedInuser, message, group),
|
|
703
|
+
BottomView: (message: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) => {
|
|
704
|
+
return ChatConfigurator.dataSource.getBottomView(message, alignment);
|
|
705
|
+
}
|
|
687
706
|
})
|
|
688
707
|
}
|
|
689
708
|
getFileMessageTemplate(theme: CometChatTheme): CometChatMessageTemplate {
|
|
@@ -697,6 +716,9 @@ export class MessageDataSource implements DataSource {
|
|
|
697
716
|
return ChatConfigurator.dataSource.getFileMessageContentView(message, alignment, theme);
|
|
698
717
|
},
|
|
699
718
|
options: (loggedInuser, message, group) => ChatConfigurator.dataSource.getFileMessageOptions(loggedInuser, message, group),
|
|
719
|
+
BottomView: (message: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) => {
|
|
720
|
+
return ChatConfigurator.dataSource.getBottomView(message, alignment);
|
|
721
|
+
}
|
|
700
722
|
});
|
|
701
723
|
}
|
|
702
724
|
getGroupActionTemplate(theme: CometChatTheme): CometChatMessageTemplate {
|
package/src/shared/index.ts
CHANGED
|
@@ -49,7 +49,8 @@ import {
|
|
|
49
49
|
RadioButtonElement,
|
|
50
50
|
SingleSelectElement,
|
|
51
51
|
TextInputElement,
|
|
52
|
-
URLNavigationAction
|
|
52
|
+
URLNavigationAction,
|
|
53
|
+
DateTimeElement
|
|
53
54
|
} from './modals';
|
|
54
55
|
import { CometChatLocalize, localize } from './resources/CometChatLocalize';
|
|
55
56
|
import { CometChatTheme, Palette, Typography } from './resources/CometChatTheme';
|
|
@@ -173,7 +174,10 @@ import {
|
|
|
173
174
|
CometChatSuggestionListInterface,
|
|
174
175
|
SuggestionItem,
|
|
175
176
|
SuggestionListConfiguration,
|
|
176
|
-
SuggestionListConfigurationInterface
|
|
177
|
+
SuggestionListConfigurationInterface,
|
|
178
|
+
CometChatDateTimePicker,
|
|
179
|
+
CometChatDateTimePickerInterface,
|
|
180
|
+
DatePickerStyleInterface,
|
|
177
181
|
} from './views';
|
|
178
182
|
|
|
179
183
|
import {
|
|
@@ -390,5 +394,9 @@ export {
|
|
|
390
394
|
CometChatSuggestionListInterface,
|
|
391
395
|
SuggestionItem,
|
|
392
396
|
SuggestionListConfiguration,
|
|
393
|
-
SuggestionListConfigurationInterface
|
|
397
|
+
SuggestionListConfigurationInterface,
|
|
398
|
+
CometChatDateTimePicker,
|
|
399
|
+
CometChatDateTimePickerInterface,
|
|
400
|
+
DatePickerStyleInterface,
|
|
401
|
+
DateTimeElement,
|
|
394
402
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { StyleSheet, requireNativeComponent, NativeModules, View, Image, Platform,
|
|
4
|
-
import { ViewPropTypes, ImagePropTypes } from 'deprecated-react-native-prop-types';
|
|
3
|
+
import { StyleSheet, requireNativeComponent, NativeModules, View, Image, Platform, ViewProps, ImageResizeMode } from 'react-native';
|
|
5
4
|
import resolveAssetSource from 'react-native/Libraries/Image/resolveAssetSource';
|
|
6
5
|
import TextTrackType from './TextTrackType';
|
|
7
6
|
import FilterType from './FilterType';
|
|
@@ -390,9 +389,9 @@ Video.propTypes = {
|
|
|
390
389
|
}),
|
|
391
390
|
minLoadRetryCount: PropTypes.number,
|
|
392
391
|
maxBitRate: PropTypes.number,
|
|
393
|
-
resizeMode:
|
|
392
|
+
resizeMode: ImageResizeMode,
|
|
394
393
|
poster: PropTypes.string,
|
|
395
|
-
posterResizeMode:
|
|
394
|
+
posterResizeMode: ImageResizeMode,
|
|
396
395
|
repeat: PropTypes.bool,
|
|
397
396
|
automaticallyWaitsToMinimizeStalling: PropTypes.bool,
|
|
398
397
|
allowsExternalPlayback: PropTypes.bool,
|
|
@@ -483,7 +482,7 @@ Video.propTypes = {
|
|
|
483
482
|
translateX: PropTypes.number,
|
|
484
483
|
translateY: PropTypes.number,
|
|
485
484
|
rotation: PropTypes.number,
|
|
486
|
-
...
|
|
485
|
+
...ViewProps,
|
|
487
486
|
};
|
|
488
487
|
|
|
489
488
|
const RCTVideo = requireNativeComponent('CCRCTVideo', Video, {
|
|
@@ -31,6 +31,13 @@ interface MessageTemplateInterface {
|
|
|
31
31
|
*/
|
|
32
32
|
BubbleView?: (messageObject: CometChat.BaseMessage) => JSX.Element,
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* The bottom view of the message template.
|
|
36
|
+
* @param messageObject - The message object.
|
|
37
|
+
* @returns The JSX element representing the bottom view.
|
|
38
|
+
*/
|
|
39
|
+
BottomView?: (messageObject: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) => JSX.Element,
|
|
40
|
+
|
|
34
41
|
/**
|
|
35
42
|
* The header view of the message template.
|
|
36
43
|
* @param messageObject - The message object.
|
|
@@ -90,6 +97,12 @@ export class CometChatMessageTemplate implements MessageTemplateInterface {
|
|
|
90
97
|
* @returns The JSX element representing the bubble view.
|
|
91
98
|
*/
|
|
92
99
|
BubbleView?: (messageObject: CometChat.BaseMessage) => JSX.Element;
|
|
100
|
+
/**
|
|
101
|
+
* The bottom view of the message template.
|
|
102
|
+
* @param messageObject - The message object.
|
|
103
|
+
* @returns The JSX element representing the bottom view.
|
|
104
|
+
*/
|
|
105
|
+
BottomView?: (messageObject: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) => JSX.Element;
|
|
93
106
|
/**
|
|
94
107
|
* The header view of the message template.
|
|
95
108
|
* @param messageObject - The message object.
|
|
@@ -128,6 +141,7 @@ export class CometChatMessageTemplate implements MessageTemplateInterface {
|
|
|
128
141
|
category = "MESSAGE",
|
|
129
142
|
type = CometChat.MESSAGE_TYPE.TEXT,
|
|
130
143
|
ContentView,
|
|
144
|
+
BottomView,
|
|
131
145
|
BubbleView,
|
|
132
146
|
HeaderView,
|
|
133
147
|
StatusInfoView,
|
|
@@ -137,6 +151,7 @@ export class CometChatMessageTemplate implements MessageTemplateInterface {
|
|
|
137
151
|
this.category = category;
|
|
138
152
|
this.type = type;
|
|
139
153
|
this.ContentView = ContentView;
|
|
154
|
+
this.BottomView = BottomView;
|
|
140
155
|
this.BubbleView = BubbleView;
|
|
141
156
|
this.HeaderView = HeaderView;
|
|
142
157
|
this.StatusInfoView = StatusInfoView;
|
|
@@ -8,3 +8,4 @@ export { OptionElement } from "./OptionElement";
|
|
|
8
8
|
export { RadioButtonElement } from "./RadioButtonElement";
|
|
9
9
|
export { SingleSelectElement } from "./SingleSelectElement";
|
|
10
10
|
export { TextInputElement } from "./TextInputElement";
|
|
11
|
+
export { DateTimeElement } from './DateTimeElement';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { BaseInputElement, BaseInteractiveElement, LabelElement } from "../InteractiveElements";
|
|
1
|
+
import { BaseInputElement, BaseInteractiveElement, LabelElement, DateTimeElement } from "../InteractiveElements";
|
|
2
2
|
|
|
3
3
|
import { ElementType } from "../../../constants/UIKitConstants";
|
|
4
|
-
import { DateTimeElement } from "../InteractiveElements/DateTimeElement";
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Represents the base input for a dynamic form element.
|
|
@@ -5,7 +5,7 @@ import { CometChatDetailsTemplate } from './CometChatDetailsTemplate';
|
|
|
5
5
|
import { CometChatDetailsOption } from './CometChatDetailsOption';
|
|
6
6
|
import { CometChatCallLogDetailsTemplate } from './CometChatCallLogDetailsTemplate';
|
|
7
7
|
import { CometChatCallLogDetailsOption } from './CometChatCallLogDetailsOptions';
|
|
8
|
-
import { APIAction, ActionEntity, BaseInputElement, BaseInteractiveElement, ButtonElement, CardMessage, CheckboxElement, CustomAction, CustomInteractiveMessage, DropdownElement, ElementEntity, FormMessage, LabelElement, OptionElement, RadioButtonElement, SingleSelectElement, TextInputElement, URLNavigationAction, SchedulerMessage } from './InteractiveData'
|
|
8
|
+
import { APIAction, ActionEntity, BaseInputElement, BaseInteractiveElement, ButtonElement, CardMessage, CheckboxElement, CustomAction, CustomInteractiveMessage, DropdownElement, ElementEntity, FormMessage, LabelElement, OptionElement, RadioButtonElement, SingleSelectElement, TextInputElement, URLNavigationAction, SchedulerMessage, DateTimeElement } from './InteractiveData'
|
|
9
9
|
|
|
10
10
|
export {
|
|
11
11
|
CometChatOptions,
|
|
@@ -33,5 +33,6 @@ export {
|
|
|
33
33
|
URLNavigationAction,
|
|
34
34
|
CometChatCallLogDetailsTemplate,
|
|
35
35
|
CometChatCallLogDetailsOption,
|
|
36
|
-
SchedulerMessage
|
|
36
|
+
SchedulerMessage,
|
|
37
|
+
DateTimeElement
|
|
37
38
|
};
|
|
@@ -52,6 +52,7 @@ export const MessageUtils = {
|
|
|
52
52
|
id={`${message.getId()}`}
|
|
53
53
|
alignment={alignment}
|
|
54
54
|
ContentView={template?.ContentView?.bind(this, message, alignment) || MessageContentView.bind(this, message, alignment, theme)}
|
|
55
|
+
BottomView={template?.BottomView && template?.BottomView?.bind(this, message, alignment)}
|
|
55
56
|
style={{backgroundColor: theme?.palette?.getPrimary()}}
|
|
56
57
|
/>;
|
|
57
58
|
}
|
|
@@ -11,11 +11,11 @@ import DateTimePickerModal from "../../libs/datePickerModal";
|
|
|
11
11
|
import { ICONS } from "../../assets/images";
|
|
12
12
|
import { CometChatContextType } from "../../base";
|
|
13
13
|
import { CometChatContext } from "../../CometChatContext";
|
|
14
|
-
import { DateTimeElement } from "../../modals/InteractiveData/InteractiveElements/DateTimeElement";
|
|
15
14
|
import { DateTime } from "../../libs/luxon/src/luxon";
|
|
16
15
|
import { convertToATimeZone } from "../../utils/SchedulerUtils";
|
|
17
16
|
import DateTimePicker from "@react-native-community/datetimepicker";
|
|
18
17
|
import { styles } from "./DateTimePickerStyle";
|
|
18
|
+
import { DateTimeElement } from "../../modals";
|
|
19
19
|
|
|
20
20
|
export interface CometChatDateTimePickerInterface {
|
|
21
21
|
style: object;
|
|
@@ -10,7 +10,7 @@ import { CometChatContext } from "../../CometChatContext";
|
|
|
10
10
|
// Style Components import
|
|
11
11
|
import { FormBubbleStyle, FormBubbleStyleInterface } from "./FormBubbleStyle";
|
|
12
12
|
|
|
13
|
-
import { APIAction, ButtonElement, CheckboxElement, DropdownElement, ElementEntity, FormMessage, LabelElement, OptionElement, RadioButtonElement, SingleSelectElement, TextInputElement, URLNavigationAction } from '../../modals/InteractiveData';
|
|
13
|
+
import { APIAction, ButtonElement, CheckboxElement, DateTimeElement, DropdownElement, ElementEntity, FormMessage, LabelElement, OptionElement, RadioButtonElement, SingleSelectElement, TextInputElement, URLNavigationAction } from '../../modals/InteractiveData';
|
|
14
14
|
import { ButtonAction, ElementType, HTTPSRequestMethods, goalType } from "../../constants/UIKitConstants";
|
|
15
15
|
import CometChatDropdown from "../CometChatDropDown/CometChatDropDown";
|
|
16
16
|
import { CometChatNetworkUtils } from "../../utils/NetworkUtils";
|
|
@@ -24,10 +24,8 @@ import { localize } from "../../resources";
|
|
|
24
24
|
import { memo } from "react";
|
|
25
25
|
import { ButtonStyle, CometChatButton } from "../CometChatButton";
|
|
26
26
|
import CometChatLabel from "../CometChatLabel/CometChatLabel";
|
|
27
|
-
import {
|
|
28
|
-
import { CometChatDateTimePicker } from
|
|
29
|
-
import { CometChatUIKit } from "../../CometChatUiKit";
|
|
30
|
-
import { CometChatUiKitConstants } from "../..";
|
|
27
|
+
import { CometChatUiKitConstants, CometChatUIKit } from "../..";
|
|
28
|
+
import { CometChatDateTimePicker } from '../CometChatDateTimePicker'
|
|
31
29
|
|
|
32
30
|
const WebView = NativeModules['WebViewManager'];
|
|
33
31
|
const { TimeZoneCodeManager } = NativeModules;
|
|
@@ -2,6 +2,7 @@ import React, {
|
|
|
2
2
|
useContext,
|
|
3
3
|
useEffect,
|
|
4
4
|
useImperativeHandle,
|
|
5
|
+
useRef,
|
|
5
6
|
useState,
|
|
6
7
|
} from 'react';
|
|
7
8
|
|
|
@@ -97,7 +98,7 @@ export interface CometChatListProps {
|
|
|
97
98
|
hideError?: boolean;
|
|
98
99
|
onItemPress?: (user: any) => void;
|
|
99
100
|
onItemLongPress?: (user: any) => void;
|
|
100
|
-
onError?: (error:
|
|
101
|
+
onError?: (error: CometChat.CometChatException) => void;
|
|
101
102
|
onBack?: Function;
|
|
102
103
|
selectionIcon?: ImageType;
|
|
103
104
|
listItemKey: 'uid' | 'guid' | 'conversationId';
|
|
@@ -197,6 +198,22 @@ export const CometChatList = React.forwardRef<
|
|
|
197
198
|
: ''
|
|
198
199
|
: ''
|
|
199
200
|
);
|
|
201
|
+
const searchInputRef = useRef(
|
|
202
|
+
requestBuilder && searchRequestBuilder
|
|
203
|
+
? searchRequestBuilder.searchKeyword
|
|
204
|
+
? searchRequestBuilder.searchKeyword
|
|
205
|
+
: ''
|
|
206
|
+
: requestBuilder
|
|
207
|
+
? requestBuilder.searchKeyword
|
|
208
|
+
? requestBuilder.searchKeyword
|
|
209
|
+
: ''
|
|
210
|
+
: searchRequestBuilder
|
|
211
|
+
? searchRequestBuilder.searchKeyword
|
|
212
|
+
? searchRequestBuilder.searchKeyword
|
|
213
|
+
: ''
|
|
214
|
+
: ''
|
|
215
|
+
);
|
|
216
|
+
|
|
200
217
|
const [shouldSelect, setShouldSelect] = React.useState(
|
|
201
218
|
selectionMode !== 'none' ? true : false
|
|
202
219
|
);
|
|
@@ -211,20 +228,21 @@ export const CometChatList = React.forwardRef<
|
|
|
211
228
|
|
|
212
229
|
const searchHandler = (searchText: string) => {
|
|
213
230
|
setSearchInput(searchText);
|
|
214
|
-
|
|
215
|
-
|
|
231
|
+
let _searchRequestBuilder = searchRequestBuilder || requestBuilder;
|
|
232
|
+
if (searchRequestBuilder && searchText) {
|
|
233
|
+
_searchRequestBuilder = searchRequestBuilder
|
|
216
234
|
.setSearchKeyword(searchText ? searchText : '')
|
|
217
235
|
.build();
|
|
218
236
|
} else if (requestBuilder) {
|
|
219
|
-
|
|
237
|
+
_searchRequestBuilder = requestBuilder
|
|
220
238
|
.setSearchKeyword(searchText ? searchText : '')
|
|
221
239
|
.build();
|
|
222
240
|
}
|
|
223
|
-
getSearch();
|
|
241
|
+
getSearch(_searchRequestBuilder);
|
|
224
242
|
};
|
|
225
243
|
|
|
226
|
-
const getSearch = () => {
|
|
227
|
-
getList(
|
|
244
|
+
const getSearch = (builder) => {
|
|
245
|
+
getList(builder)
|
|
228
246
|
.then((newlist: any) => {
|
|
229
247
|
setDecoratorMessage(NO_DATA_FOUND);
|
|
230
248
|
setList(newlist);
|
|
@@ -252,9 +270,17 @@ export const CometChatList = React.forwardRef<
|
|
|
252
270
|
new CometChat.ConnectionListener({
|
|
253
271
|
onConnected: () => {
|
|
254
272
|
console.log("ConnectionListener => On Connected");
|
|
255
|
-
|
|
273
|
+
if (requestBuilder) {
|
|
274
|
+
if (searchInputRef.current)
|
|
275
|
+
listHandlerRef.current = requestBuilder
|
|
276
|
+
.setSearchKeyword(searchInputRef.current)
|
|
277
|
+
.build();
|
|
278
|
+
else listHandlerRef.current = requestBuilder.build();
|
|
279
|
+
}
|
|
256
280
|
getList(listHandlerRef.current)
|
|
257
281
|
.then((newlist: any) => {
|
|
282
|
+
console.log('new list -->> ',newlist);
|
|
283
|
+
|
|
258
284
|
setDecoratorMessage(NO_DATA_FOUND);
|
|
259
285
|
setList(newlist);
|
|
260
286
|
})
|
|
@@ -279,15 +305,10 @@ export const CometChatList = React.forwardRef<
|
|
|
279
305
|
}
|
|
280
306
|
}, []);
|
|
281
307
|
|
|
308
|
+
|
|
282
309
|
useEffect(() => {
|
|
283
310
|
if (initialRunRef.current === true) {
|
|
284
|
-
if (
|
|
285
|
-
if (searchInput)
|
|
286
|
-
listHandlerRef.current = searchRequestBuilder
|
|
287
|
-
.setSearchKeyword(searchInput)
|
|
288
|
-
.build();
|
|
289
|
-
else listHandlerRef.current = searchRequestBuilder.build();
|
|
290
|
-
} else if (requestBuilder) {
|
|
311
|
+
if (requestBuilder) {
|
|
291
312
|
if (searchInput)
|
|
292
313
|
listHandlerRef.current = requestBuilder
|
|
293
314
|
.setSearchKeyword(searchInput)
|
|
@@ -303,6 +324,10 @@ export const CometChatList = React.forwardRef<
|
|
|
303
324
|
setShouldSelect(selectionMode !== 'none' ? true : false);
|
|
304
325
|
}, [selectionMode]);
|
|
305
326
|
|
|
327
|
+
useEffect(() => {
|
|
328
|
+
searchInputRef.current = searchInput
|
|
329
|
+
}, [searchInput]);
|
|
330
|
+
|
|
306
331
|
/**
|
|
307
332
|
* Updates the list of users to be displayed
|
|
308
333
|
* @param
|
|
@@ -562,6 +587,8 @@ export const CometChatList = React.forwardRef<
|
|
|
562
587
|
lastCall = setTimeout(() => {
|
|
563
588
|
props?.fetchNext().then((listItems: any) => {
|
|
564
589
|
resolve(listItems);
|
|
590
|
+
}).catch((error) => {
|
|
591
|
+
reject(error)
|
|
565
592
|
});
|
|
566
593
|
}, 500);
|
|
567
594
|
lastReject = reject;
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
} from "react-native";
|
|
10
10
|
import { CometChatContextType } from "../../base";
|
|
11
11
|
import { CometChatContext } from "../../CometChatContext";
|
|
12
|
-
import { SchedulerMessage } from "../../modals/InteractiveData/InteractiveMessage";
|
|
13
12
|
import { SchedulerBubbleStyles } from "./styles";
|
|
14
13
|
import { CometChatAvatar } from "../CometChatAvatar";
|
|
15
14
|
import { styles } from "./styles";
|
|
@@ -18,10 +17,9 @@ import {
|
|
|
18
17
|
DefaultTheme,
|
|
19
18
|
} from "../../libs/CometChatCalendar";
|
|
20
19
|
import { ICONS } from "../../assets/images";
|
|
21
|
-
import { CometChatTimeSlotSelector } from "../CometChatTimeSlotSelector/CometChatTimeSlotSelector";
|
|
22
20
|
import { CometChatButton } from "../CometChatButton";
|
|
23
21
|
import icsToJson from "../../utils/icsToJson";
|
|
24
|
-
import { APIAction, ButtonElement } from "../../modals";
|
|
22
|
+
import { APIAction, ButtonElement, SchedulerMessage } from "../../modals";
|
|
25
23
|
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
26
24
|
import { CometChatNetworkUtils } from "../../utils/NetworkUtils";
|
|
27
25
|
import { HTTPSRequestMethods } from "../../constants/UIKitConstants";
|
|
@@ -37,8 +35,8 @@ import {
|
|
|
37
35
|
} from "../../utils/SchedulerUtils";
|
|
38
36
|
import CometChatQuickView from "../CometChatQuickView/CometChatQuickView";
|
|
39
37
|
import { localize } from "../../resources";
|
|
40
|
-
import { CometChatUIKit } from "
|
|
41
|
-
import {
|
|
38
|
+
import { CometChatUiKitConstants, CometChatUIKit } from "../..";
|
|
39
|
+
import { CometChatTimeSlotSelector } from "../CometChatTimeSlotSelector";
|
|
42
40
|
import { InteractiveMessageUtils } from "../../utils/InteractiveMessageUtils";
|
|
43
41
|
|
|
44
42
|
const { TimeZoneCodeManager } = NativeModules;
|
|
@@ -86,6 +86,7 @@ import {
|
|
|
86
86
|
import { CometChatFormBubble, CometChatFormBubbleInterface } from './CometChatFormBubble'
|
|
87
87
|
import { CometChatCardBubble, CometChatCardBubbleInterface } from './CometChatCardBubble'
|
|
88
88
|
import { CometChatSchedulerBubble, CometChatSchedulerBubbleInterface } from './CometChatSchedulerBubble'
|
|
89
|
+
import { CometChatDateTimePicker, CometChatDateTimePickerInterface, DatePickerStyleInterface } from './CometChatDateTimePicker'
|
|
89
90
|
|
|
90
91
|
import { CometChatReactions, CometChatReactionsInterface, ReactionsConfiguration, ReactionsConfigurationInterface, ReactionsStyle, ReactionsStyleInterface } from './CometChatReactions';
|
|
91
92
|
import { CometChatReactionList, CometChatReactionListInterface, ReactionListStyle, ReactionListStyleInterface, ReactionListConfiguration, ReactionListConfigurationInterface } from './CometChatReactionList';
|
|
@@ -205,4 +206,7 @@ export {
|
|
|
205
206
|
SuggestionItem,
|
|
206
207
|
SuggestionListConfiguration,
|
|
207
208
|
SuggestionListConfigurationInterface,
|
|
209
|
+
CometChatDateTimePicker,
|
|
210
|
+
CometChatDateTimePickerInterface,
|
|
211
|
+
DatePickerStyleInterface
|
|
208
212
|
};
|