@cometchat/chat-uikit-react-native 4.3.2 → 4.3.3
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/android/src/main/AndroidManifest.xml +3 -4
- package/android/src/main/java/com/reactnativecometchatuikit/CometchatUiKitPackage.java +0 -1
- package/android/src/main/java/com/reactnativecometchatuikit/FileManager.java +125 -7
- package/android/src/main/java/com/reactnativecometchatuikit/ImageManager.java +1 -1
- package/package.json +1 -1
- package/src/CometChatConversations/CometChatConversations.tsx +51 -28
- package/src/CometChatConversations/style.ts +5 -1
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +53 -20
- package/src/CometChatMessageList/CometChatMessageList.tsx +15 -15
- package/src/CometChatMessageList/MessageListConfiguration.ts +5 -5
- package/src/CometChatThreadedMessages/CometChatThreadedMessages.tsx +35 -2
- package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +51 -15
- package/src/index.ts +8 -8
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +1 -4
- package/src/shared/index.ts +8 -8
- package/src/shared/libs/ImageZoom/ReactNativeZoomableView.tsx +1040 -0
- package/src/shared/libs/ImageZoom/ReactNativeZoomableViewWithGestures.tsx +223 -0
- package/src/shared/libs/ImageZoom/helper.ts +144 -0
- package/src/shared/libs/ImageZoom/index.tsx +13 -0
- package/src/shared/libs/ImageZoom/types/index.ts +186 -0
- package/src/shared/libs/VideoPlayer/Video.js +0 -24
- package/src/shared/libs/VideoPlayerControls/assets/img/back.png +0 -0
- package/src/shared/libs/VideoPlayerControls/components/Back/Back.tsx +1 -1
- package/src/shared/utils/NetworkUtils.tsx +5 -0
- package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +1 -0
- package/src/shared/views/CometChatImageBubble/CometChatImageBubble.tsx +64 -18
- package/src/shared/views/CometChatImageBubble/assets/index.ts +5 -0
- package/src/shared/views/CometChatImageBubble/assets/spineer.png +0 -0
- package/src/shared/views/CometChatImageViewerModal/ImageViewerModal.tsx +106 -0
- package/src/shared/views/CometChatImageViewerModal/index.tsx +1 -0
- package/src/shared/views/CometChatImageViewerModal/resources/Back.png +0 -0
- package/src/shared/views/CometChatImageViewerModal/resources/index.ts +5 -0
- package/src/shared/views/CometChatList/CometChatList.tsx +10 -1
- package/src/shared/views/{CometChatReactionsList/CometChatReactionsList.tsx → CometChatReactionList/CometChatReactionList.tsx} +17 -17
- package/src/shared/views/CometChatReactionList/ReactionListConfiguration.tsx +14 -0
- package/src/shared/views/CometChatReactionList/index.ts +12 -0
- package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +1 -1
- package/src/shared/views/index.ts +5 -5
- package/android/src/main/java/com/reactnativecometchatuikit/VideoManager.java +0 -40
- package/src/shared/libs/VideoPlayerControls/assets/img/back@2x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/back@3x.png +0 -0
- package/src/shared/views/CometChatReactionsList/ReactionsListConfiguration.tsx +0 -14
- package/src/shared/views/CometChatReactionsList/index.ts +0 -12
- /package/src/shared/views/{CometChatReactionsList/ReactionsListStyle.tsx → CometChatReactionList/ReactionListStyle.tsx} +0 -0
- /package/src/shared/views/{CometChatReactionsList → CometChatReactionList}/resources/Spineer.png +0 -0
- /package/src/shared/views/{CometChatReactionsList → CometChatReactionList}/resources/index.ts +0 -0
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
import { DateStyleInterface } from '../shared/views/CometChatDate/DateStyle';
|
|
23
23
|
import { ActionSheetStylesInterface } from '../shared/views/CometChatActionSheet/ActionSheetStyle';
|
|
24
24
|
import { ReactionsConfigurationInterface } from '../shared/views/CometChatReactions';
|
|
25
|
-
import {
|
|
25
|
+
import { ReactionListConfigurationInterface } from '../shared/views/CometChatReactionList';
|
|
26
26
|
import { QuickReactionsConfigurationInterface } from '../shared/views/CometChatQuickReactions';
|
|
27
27
|
import { EmojiKeyboardStyle } from '../shared/views/CometChatEmojiKeyboard';
|
|
28
28
|
|
|
@@ -82,9 +82,9 @@ export interface MessageListConfigurationInterface {
|
|
|
82
82
|
*/
|
|
83
83
|
reactionsConfiguration?: ReactionsConfigurationInterface;
|
|
84
84
|
/**
|
|
85
|
-
* Message Reaction List Configuration @
|
|
85
|
+
* Message Reaction List Configuration @ReactionListConfigurationInterface
|
|
86
86
|
*/
|
|
87
|
-
|
|
87
|
+
reactionListConfiguration?: ReactionListConfigurationInterface;
|
|
88
88
|
/**
|
|
89
89
|
* Quick Reaction Configuration @QuickReactionsConfigurationInterface
|
|
90
90
|
*/
|
|
@@ -155,9 +155,9 @@ export class MessageListConfiguration
|
|
|
155
155
|
*/
|
|
156
156
|
reactionsConfiguration?: ReactionsConfigurationInterface;
|
|
157
157
|
/**
|
|
158
|
-
* Message Reaction List Configuration @
|
|
158
|
+
* Message Reaction List Configuration @ReactionListConfigurationInterface
|
|
159
159
|
*/
|
|
160
|
-
|
|
160
|
+
reactionListConfiguration?: ReactionListConfigurationInterface;
|
|
161
161
|
/**
|
|
162
162
|
* Quick Reaction Configuration @QuickReactionsConfigurationInterface
|
|
163
163
|
*/
|
|
@@ -132,10 +132,20 @@ export const CometChatThreadedMessages = (
|
|
|
132
132
|
|
|
133
133
|
let limit: number = 30;
|
|
134
134
|
|
|
135
|
+
const checkMessageBelongsToSameThread = (updatedMessage : CometChat.BaseMessage)=>{
|
|
136
|
+
|
|
137
|
+
return (updatedMessage.getParentMessageId() == message.getId() );
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const checkAndUpdateRepliesCount = ( updatedMessage : CometChat.BaseMessage)=>{
|
|
141
|
+
if(checkMessageBelongsToSameThread(updatedMessage)){
|
|
142
|
+
setReplyCount((prev) => prev + 1);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
135
146
|
const ccMessageSentFunc = ({ message: msg, status }) => {
|
|
136
147
|
if (status === messageStatus.success) {
|
|
137
|
-
|
|
138
|
-
setReplyCount((prev) => prev + 1);
|
|
148
|
+
checkAndUpdateRepliesCount(msg)
|
|
139
149
|
if (message.getId() == msg.id) setMessage(message);
|
|
140
150
|
}
|
|
141
151
|
};
|
|
@@ -150,12 +160,35 @@ export const CometChatThreadedMessages = (
|
|
|
150
160
|
if (message.getId() == msg.id) setMessage(message);
|
|
151
161
|
};
|
|
152
162
|
|
|
163
|
+
|
|
164
|
+
|
|
153
165
|
useEffect(() => {
|
|
154
166
|
CometChatUIEventHandler.addMessageListener(uiEventId, {
|
|
155
167
|
ccMessageSent: (item) => ccMessageSentFunc(item),
|
|
156
168
|
ccMessageEdited: (item) => ccMessageEditedFunc(item),
|
|
157
169
|
ccMessageDeleted: (item) => ccMessageDeletedFunc(item),
|
|
158
170
|
ccMessageRead: (item) => ccMessageReadFunc(item),
|
|
171
|
+
onTextMessageReceived: (textMessage) => {
|
|
172
|
+
checkAndUpdateRepliesCount(textMessage)
|
|
173
|
+
},
|
|
174
|
+
onMediaMessageReceived: (mediaMessage) => {
|
|
175
|
+
checkAndUpdateRepliesCount(mediaMessage)
|
|
176
|
+
},
|
|
177
|
+
onCustomMessageReceived: (customMessage) => {
|
|
178
|
+
checkAndUpdateRepliesCount(customMessage)
|
|
179
|
+
},
|
|
180
|
+
onFormMessageReceived: (formMessage) => {
|
|
181
|
+
checkAndUpdateRepliesCount(formMessage)
|
|
182
|
+
},
|
|
183
|
+
onCardMessageReceived: (cardMessage) => {
|
|
184
|
+
checkAndUpdateRepliesCount(cardMessage)
|
|
185
|
+
},
|
|
186
|
+
onSchedulerMessageReceived: (schedulerMessage) => {
|
|
187
|
+
checkAndUpdateRepliesCount(schedulerMessage)
|
|
188
|
+
},
|
|
189
|
+
onCustomInteractiveMessageReceived: (customInteractiveMessage) => {
|
|
190
|
+
checkAndUpdateRepliesCount(customInteractiveMessage)
|
|
191
|
+
}
|
|
159
192
|
});
|
|
160
193
|
|
|
161
194
|
return () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import { View, Text, TouchableOpacity, Linking, Image, Alert } from 'react-native'
|
|
1
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { View, Text, TouchableOpacity, Linking, Image, Alert, Platform } from 'react-native'
|
|
3
3
|
import { LinkPreviewBubbleStyle, LinkPreviewBubbleStyleInterface } from './LInkPreviewBubbleStyle';
|
|
4
4
|
import { localize } from '../../shared/resources/CometChatLocalize';
|
|
5
5
|
import { DefaultLinkPreview } from "./resources";
|
|
@@ -30,20 +30,53 @@ export const LinkPreviewBubble = (props: LinkPreviewBubbleInterface) => {
|
|
|
30
30
|
|
|
31
31
|
const [imageSource, setImageSource] = useState({ uri: image.startsWith("https:") ? image : `https:${image.split("http:")[1]}` });
|
|
32
32
|
|
|
33
|
+
|
|
34
|
+
const pressTime = useRef(0);
|
|
35
|
+
|
|
36
|
+
const handleTouchStart = () => {
|
|
37
|
+
pressTime.current = Date.now();
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const handleTouchEnd = () => {
|
|
41
|
+
if (pressTime.current === null && Platform.OS === "ios") return;
|
|
42
|
+
const endTime = Date.now();
|
|
43
|
+
const pressDuration = endTime - pressTime.current;
|
|
44
|
+
if (pressDuration < 500) {
|
|
45
|
+
onPress ? onPress() : (Linking.canOpenURL(link) && Linking.openURL(link)) || Alert.alert(localize("SOMETHING_WRONG"))
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const onTouchMove = () => {
|
|
50
|
+
if (Platform.OS === "ios") {
|
|
51
|
+
pressTime.current = null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
33
56
|
return (
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<Image
|
|
41
|
-
source={imageSource }
|
|
42
|
-
style={{ height: 100, width: "100%", alignSelf: "center" }}
|
|
43
|
-
onError={(err) => {
|
|
44
|
-
setImageSource(DefaultLinkPreview)
|
|
57
|
+
<View>
|
|
58
|
+
|
|
59
|
+
<View
|
|
60
|
+
style={{
|
|
61
|
+
backgroundColor: _style.backgroundColor,
|
|
62
|
+
borderRadius: 8,
|
|
45
63
|
}}
|
|
46
|
-
|
|
64
|
+
onTouchStart={handleTouchStart}
|
|
65
|
+
onTouchEnd={handleTouchEnd}
|
|
66
|
+
onTouchMove={onTouchMove}
|
|
67
|
+
>
|
|
68
|
+
|
|
69
|
+
<Image
|
|
70
|
+
source={imageSource}
|
|
71
|
+
style={{ height: 100, width: "100%", alignSelf: "center" }}
|
|
72
|
+
onError={(err) => {
|
|
73
|
+
setImageSource(DefaultLinkPreview)
|
|
74
|
+
}}
|
|
75
|
+
/>
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
</View>
|
|
79
|
+
|
|
47
80
|
<View style={{ margin: 8 }}>
|
|
48
81
|
<Text
|
|
49
82
|
style={{
|
|
@@ -68,6 +101,9 @@ export const LinkPreviewBubble = (props: LinkPreviewBubbleInterface) => {
|
|
|
68
101
|
ChildView && <ChildView />
|
|
69
102
|
}
|
|
70
103
|
</View>
|
|
71
|
-
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
</View>
|
|
107
|
+
|
|
72
108
|
)
|
|
73
109
|
}
|
package/src/index.ts
CHANGED
|
@@ -149,10 +149,10 @@ import {
|
|
|
149
149
|
ReactionsConfigurationInterface,
|
|
150
150
|
ReactionsStyle,
|
|
151
151
|
ReactionsStyleInterface,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
152
|
+
CometChatReactionList,
|
|
153
|
+
CometChatReactionListInterface,
|
|
154
|
+
ReactionListConfiguration,
|
|
155
|
+
ReactionListConfigurationInterface,
|
|
156
156
|
ReactionListStyle,
|
|
157
157
|
ReactionListStyleInterface,
|
|
158
158
|
CometChatQuickReactions,
|
|
@@ -699,10 +699,10 @@ export {
|
|
|
699
699
|
ReactionsConfigurationInterface,
|
|
700
700
|
ReactionsStyle,
|
|
701
701
|
ReactionsStyleInterface,
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
702
|
+
CometChatReactionList,
|
|
703
|
+
CometChatReactionListInterface,
|
|
704
|
+
ReactionListConfiguration,
|
|
705
|
+
ReactionListConfigurationInterface,
|
|
706
706
|
ReactionListStyle,
|
|
707
707
|
ReactionListStyleInterface,
|
|
708
708
|
CometChatQuickReactions,
|
|
@@ -51,6 +51,7 @@ export class CometChatUIKit {
|
|
|
51
51
|
() => {
|
|
52
52
|
CometChat.setSource("uikit-v4", Platform.OS, "react-native")
|
|
53
53
|
ListenerInitializer.attachListeners();
|
|
54
|
+
this.enableExtensions();
|
|
54
55
|
if (Platform.OS === "ios") {
|
|
55
56
|
permissionUtilIOS.init().then(res => {
|
|
56
57
|
if (res !== true) {
|
|
@@ -113,8 +114,6 @@ export class CometChatUIKit {
|
|
|
113
114
|
let user = await CometChat.getLoggedinUser().catch((e) => Promise.reject(e))
|
|
114
115
|
if (user == null) {
|
|
115
116
|
Promise.reject(new CometChat.CometChatException({ code: "NOT_FOUND", message: "Login user not found" }));
|
|
116
|
-
} else {
|
|
117
|
-
this.enableExtensions()
|
|
118
117
|
}
|
|
119
118
|
return user;
|
|
120
119
|
}
|
|
@@ -123,12 +122,10 @@ export class CometChatUIKit {
|
|
|
123
122
|
if (CometChatUIKit.checkAuthSettings(Promise.reject)) null
|
|
124
123
|
if (uid) {
|
|
125
124
|
let user = await CometChat.login(uid, CometChatUIKit.uiKitSettings?.authKey).catch(e => Promise.reject(e));
|
|
126
|
-
this.enableExtensions()
|
|
127
125
|
return user;
|
|
128
126
|
}
|
|
129
127
|
if (authToken) {
|
|
130
128
|
let user = await CometChat.login(authToken).catch(e => Promise.reject(e));
|
|
131
|
-
this.enableExtensions()
|
|
132
129
|
return user;
|
|
133
130
|
}
|
|
134
131
|
return Promise.reject(new CometChat.CometChatException({ code: "INVALID_LOGIN_ATTEMPT", message: "Provide uid or authToken" }));
|
package/src/shared/index.ts
CHANGED
|
@@ -145,10 +145,10 @@ import {
|
|
|
145
145
|
ReactionsConfigurationInterface,
|
|
146
146
|
ReactionsStyle,
|
|
147
147
|
ReactionsStyleInterface,
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
148
|
+
CometChatReactionList,
|
|
149
|
+
CometChatReactionListInterface,
|
|
150
|
+
ReactionListConfiguration,
|
|
151
|
+
ReactionListConfigurationInterface,
|
|
152
152
|
ReactionListStyle,
|
|
153
153
|
ReactionListStyleInterface,
|
|
154
154
|
CometChatQuickReactions,
|
|
@@ -344,10 +344,10 @@ export {
|
|
|
344
344
|
ReactionsConfigurationInterface,
|
|
345
345
|
ReactionsStyle,
|
|
346
346
|
ReactionsStyleInterface,
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
347
|
+
CometChatReactionList,
|
|
348
|
+
CometChatReactionListInterface,
|
|
349
|
+
ReactionListConfiguration,
|
|
350
|
+
ReactionListConfigurationInterface,
|
|
351
351
|
ReactionListStyle,
|
|
352
352
|
ReactionListStyleInterface,
|
|
353
353
|
CometChatQuickReactions,
|