@messenger-box/platform-mobile 10.0.2-alpha.5 → 10.0.3-alpha.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/CHANGELOG.md +8 -0
- package/lib/compute.js +14 -14
- package/lib/compute.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/module.js +1 -2
- package/lib/module.js.map +1 -1
- package/lib/screens/inbox/DialogMessages.js +44 -20
- package/lib/screens/inbox/DialogMessages.js.map +1 -1
- package/lib/screens/inbox/DialogThreadMessages.js +13 -48
- package/lib/screens/inbox/DialogThreadMessages.js.map +1 -1
- package/lib/screens/inbox/DialogThreads.js +13 -70
- package/lib/screens/inbox/DialogThreads.js.map +1 -1
- package/lib/screens/inbox/Inbox.js +18 -9
- package/lib/screens/inbox/Inbox.js.map +1 -1
- package/lib/screens/inbox/components/CachedImage/consts.js.map +1 -1
- package/lib/screens/inbox/components/CachedImage/index.js +41 -27
- package/lib/screens/inbox/components/CachedImage/index.js.map +1 -1
- package/lib/screens/inbox/components/DialogsListItem.js +96 -146
- package/lib/screens/inbox/components/DialogsListItem.js.map +1 -1
- package/lib/screens/inbox/components/ServiceDialogsListItem.js +95 -148
- package/lib/screens/inbox/components/ServiceDialogsListItem.js.map +1 -1
- package/lib/screens/inbox/components/SlackMessageContainer/ImageViewerModal.js +37 -51
- package/lib/screens/inbox/components/SlackMessageContainer/ImageViewerModal.js.map +1 -1
- package/lib/screens/inbox/components/SlackMessageContainer/SlackBubble.js +113 -97
- package/lib/screens/inbox/components/SlackMessageContainer/SlackBubble.js.map +1 -1
- package/lib/screens/inbox/components/SlackMessageContainer/SlackMessage.js +50 -42
- package/lib/screens/inbox/components/SlackMessageContainer/SlackMessage.js.map +1 -1
- package/lib/screens/inbox/components/ThreadsViewItem.js +41 -149
- package/lib/screens/inbox/components/ThreadsViewItem.js.map +1 -1
- package/lib/screens/inbox/config/config.js +8 -10
- package/lib/screens/inbox/config/config.js.map +1 -1
- package/lib/screens/inbox/containers/ConversationView.js +357 -501
- package/lib/screens/inbox/containers/ConversationView.js.map +1 -1
- package/lib/screens/inbox/containers/Dialogs.js +49 -140
- package/lib/screens/inbox/containers/Dialogs.js.map +1 -1
- package/lib/screens/inbox/containers/ThreadConversationView.js +297 -400
- package/lib/screens/inbox/containers/ThreadConversationView.js.map +1 -1
- package/lib/screens/inbox/containers/ThreadsView.js +83 -190
- package/lib/screens/inbox/containers/ThreadsView.js.map +1 -1
- package/package.json +4 -4
- package/rollup.config.mjs +5 -1
- package/lib/compute.d.ts +0 -5
- package/lib/index.d.ts +0 -4
- package/lib/module.d.ts +0 -3
- package/lib/navigation/InboxNavigation.d.ts +0 -2
- package/lib/navigation/index.d.ts +0 -1
- package/lib/screens/inbox/DialogMessages.d.ts +0 -8
- package/lib/screens/inbox/DialogThreadMessages.d.ts +0 -8
- package/lib/screens/inbox/DialogThreads.d.ts +0 -7
- package/lib/screens/inbox/Inbox.d.ts +0 -2
- package/lib/screens/inbox/components/CachedImage/consts.d.ts +0 -2
- package/lib/screens/inbox/components/CachedImage/index.d.ts +0 -8
- package/lib/screens/inbox/components/DialogsHeader.d.ts +0 -8
- package/lib/screens/inbox/components/DialogsListItem.d.ts +0 -19
- package/lib/screens/inbox/components/ServiceDialogsListItem.d.ts +0 -21
- package/lib/screens/inbox/components/SlackMessageContainer/ImageViewerModal.d.ts +0 -3
- package/lib/screens/inbox/components/SlackMessageContainer/SlackBubble.d.ts +0 -34
- package/lib/screens/inbox/components/SlackMessageContainer/SlackMessage.d.ts +0 -25
- package/lib/screens/inbox/components/SlackMessageContainer/index.d.ts +0 -3
- package/lib/screens/inbox/components/SupportServiceDialogsListItem.d.ts +0 -21
- package/lib/screens/inbox/components/ThreadsViewItem.d.ts +0 -20
- package/lib/screens/inbox/config/config.d.ts +0 -11
- package/lib/screens/inbox/config/index.d.ts +0 -1
- package/lib/screens/inbox/containers/ConversationView.d.ts +0 -11
- package/lib/screens/inbox/containers/Dialogs.d.ts +0 -7
- package/lib/screens/inbox/containers/SupportServiceDialogs.d.ts +0 -6
- package/lib/screens/inbox/containers/ThreadConversationView.d.ts +0 -11
- package/lib/screens/inbox/containers/ThreadsView.d.ts +0 -13
- package/lib/screens/index.d.ts +0 -4
|
@@ -1,36 +1,74 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default,{useState,useRef,useEffect,useCallback,useMemo}from'react';import {Spinner,Box,HStack,Image,Button,ButtonText,Avatar,AvatarFallbackText,AvatarImage,Text}from'@admin-layout/gluestack-ui-mobile';import {Platform,TouchableHighlight}from'react-native';import {useNavigation,useIsFocused,useFocusEffect}from'@react-navigation/native';import {navigationRef}from'@common-stack/client-react';import {useSelector}from'react-redux';import {uniqBy,orderBy,startCase}from'lodash-es';import*as ImagePicker from'expo-image-picker';import {encode}from'base-64';import {Ionicons,MaterialCommunityIcons}from'@expo/vector-icons';import {GiftedChat,Actions,MessageText,Send}from'react-native-gifted-chat';import {RoomType,PreDefinedRole}from'common';import {useAddDirectChannelMutation,useSendMessagesMutation,useSendExpoNotificationOnPostMutation,useMessagesQuery,OnChatMessageAddedDocument}from'common/lib/generated/generated.js';import {useUploadFilesNative}from'@messenger-box/platform-client';import {objectId}from'@messenger-box/core';import {userSelector}from'@adminide-stack/user-auth0-client';import {isToday,isYesterday,format}from'date-fns';import Message from'../components/SlackMessageContainer/SlackMessage.js';import ImageViewerModal from'../components/SlackMessageContainer/ImageViewerModal.js';import CachedImage from'../components/CachedImage/index.js';import {config}from'../config/config.js';var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
const {
|
|
2
33
|
MESSAGES_PER_PAGE,
|
|
3
34
|
CALL_TO_ACTION_BOX_BGCOLOR,
|
|
4
35
|
CALL_TO_ACTION_PATH,
|
|
5
36
|
CALL_TO_ACTION_BUTTON_BORDERCOLOR,
|
|
6
37
|
CALL_TO_ACTION_TEXT_COLOR
|
|
7
38
|
} = config;
|
|
8
|
-
const createdAtText = value => {
|
|
9
|
-
if (!value)
|
|
39
|
+
const createdAtText = (value) => {
|
|
40
|
+
if (!value)
|
|
41
|
+
return "";
|
|
10
42
|
let date = new Date(value);
|
|
11
|
-
if (isToday(date))
|
|
12
|
-
|
|
13
|
-
|
|
43
|
+
if (isToday(date))
|
|
44
|
+
return "Today";
|
|
45
|
+
if (isYesterday(date))
|
|
46
|
+
return "Yesterday";
|
|
47
|
+
return format(new Date(value), "MMM dd, yyyy");
|
|
14
48
|
};
|
|
15
|
-
const ConversationViewComponent = _a => {
|
|
16
|
-
var {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
49
|
+
const ConversationViewComponent = (_a) => {
|
|
50
|
+
var _b = _a, {
|
|
51
|
+
channelId: ChannelId,
|
|
52
|
+
role,
|
|
53
|
+
isShowThreadMessage
|
|
54
|
+
} = _b, rest = __objRest(_b, [
|
|
55
|
+
"channelId",
|
|
56
|
+
"role",
|
|
57
|
+
"isShowThreadMessage"
|
|
58
|
+
]);
|
|
59
|
+
var _a2;
|
|
22
60
|
const [channelToTop, setChannelToTop] = useState(0);
|
|
23
61
|
const [channelMessages, setChannelMessages] = useState([]);
|
|
24
62
|
const auth = useSelector(userSelector);
|
|
25
63
|
const [totalCount, setTotalCount] = useState(0);
|
|
26
|
-
const [selectedImage, setImage] = useState(
|
|
27
|
-
const currentRoute = navigationRef.isReady() ?
|
|
28
|
-
const [channelId, setChannelId] = useState((rest
|
|
64
|
+
const [selectedImage, setImage] = useState("");
|
|
65
|
+
const currentRoute = navigationRef.isReady() ? (_a2 = navigationRef) == null ? void 0 : _a2.getCurrentRoute() : null;
|
|
66
|
+
const [channelId, setChannelId] = useState((rest == null ? void 0 : rest.isCreateNewChannel) ? null : ChannelId);
|
|
29
67
|
const [loadingOldMessages, setLoadingOldMessages] = useState(false);
|
|
30
68
|
const navigation = useNavigation();
|
|
31
69
|
const [files, setFiles] = useState([]);
|
|
32
70
|
const [images, setImages] = useState([]);
|
|
33
|
-
const [msg, setMsg] = useState(
|
|
71
|
+
const [msg, setMsg] = useState("");
|
|
34
72
|
const [loading, setLoading] = useState(false);
|
|
35
73
|
const [loadEarlierMsg, setLoadEarlierMsg] = useState(false);
|
|
36
74
|
const [imageLoading, setImageLoading] = useState(false);
|
|
@@ -47,7 +85,7 @@ const ConversationViewComponent = _a => {
|
|
|
47
85
|
startUpload
|
|
48
86
|
} = useUploadFilesNative();
|
|
49
87
|
const [sendMsg] = useSendMessagesMutation();
|
|
50
|
-
useSendExpoNotificationOnPostMutation();
|
|
88
|
+
const [sendExpoNotificationOnPostMutation] = useSendExpoNotificationOnPostMutation();
|
|
51
89
|
const {
|
|
52
90
|
data,
|
|
53
91
|
loading: messageLoading,
|
|
@@ -56,100 +94,88 @@ const ConversationViewComponent = _a => {
|
|
|
56
94
|
subscribeToMore
|
|
57
95
|
} = useMessagesQuery({
|
|
58
96
|
variables: {
|
|
59
|
-
channelId: channelId
|
|
97
|
+
channelId: channelId == null ? void 0 : channelId.toString(),
|
|
60
98
|
parentId: null,
|
|
61
99
|
limit: MESSAGES_PER_PAGE,
|
|
62
|
-
skip
|
|
100
|
+
skip
|
|
63
101
|
},
|
|
64
102
|
skip: !channelId,
|
|
65
|
-
fetchPolicy:
|
|
66
|
-
nextFetchPolicy:
|
|
67
|
-
refetchWritePolicy:
|
|
103
|
+
fetchPolicy: "cache-and-network",
|
|
104
|
+
nextFetchPolicy: "cache-first",
|
|
105
|
+
refetchWritePolicy: "merge"
|
|
68
106
|
});
|
|
69
|
-
// const {
|
|
70
|
-
// data: channelsDetail,
|
|
71
|
-
// loading: channelLoading,
|
|
72
|
-
// refetch: refetchChannelDetail,
|
|
73
|
-
// } = useViewChannelDetailQuery({
|
|
74
|
-
// variables: {
|
|
75
|
-
// id: channelId?.toString(),
|
|
76
|
-
// },
|
|
77
|
-
// });
|
|
78
|
-
// const { data: users } = useGetAllUsersQuery();
|
|
79
107
|
React__default.useEffect(() => {
|
|
80
108
|
return () => {
|
|
81
109
|
setChannelMessages([]);
|
|
82
110
|
};
|
|
83
111
|
}, []);
|
|
84
112
|
useFocusEffect(React__default.useCallback(() => {
|
|
85
|
-
// Do something when the screen is focused
|
|
86
113
|
setSkip(0);
|
|
87
|
-
// refetchChannelDetail({ id: channelId?.toString() });
|
|
88
114
|
if (channelId) {
|
|
89
115
|
refetch({
|
|
90
|
-
channelId: channelId
|
|
116
|
+
channelId: channelId == null ? void 0 : channelId.toString(),
|
|
91
117
|
parentId: null,
|
|
92
118
|
limit: MESSAGES_PER_PAGE,
|
|
93
119
|
skip: 0
|
|
94
120
|
}).then(({
|
|
95
|
-
data
|
|
121
|
+
data: data2
|
|
96
122
|
}) => {
|
|
97
|
-
if (!(
|
|
123
|
+
if (!(data2 == null ? void 0 : data2.messages)) {
|
|
98
124
|
return;
|
|
99
125
|
}
|
|
100
126
|
const {
|
|
101
127
|
data: messages,
|
|
102
|
-
totalCount
|
|
103
|
-
} =
|
|
104
|
-
setTotalCount(
|
|
128
|
+
totalCount: totalCount2
|
|
129
|
+
} = data2.messages;
|
|
130
|
+
setTotalCount(totalCount2);
|
|
105
131
|
setChannelMessages(messages);
|
|
106
132
|
});
|
|
107
133
|
}
|
|
108
134
|
return () => {
|
|
109
|
-
// Do something when the screen is unfocused
|
|
110
|
-
// Useful for cleanup functions
|
|
111
135
|
setChannelId(null);
|
|
112
136
|
setTotalCount(0);
|
|
113
137
|
setSkip(0);
|
|
114
138
|
};
|
|
115
139
|
}, [channelId, isFocused]));
|
|
116
140
|
React__default.useEffect(() => {
|
|
117
|
-
var
|
|
118
|
-
const currentChannelId = ChannelId || ((
|
|
141
|
+
var _a3;
|
|
142
|
+
const currentChannelId = ChannelId || ((_a3 = currentRoute == null ? void 0 : currentRoute.params) == null ? void 0 : _a3.channelId);
|
|
119
143
|
setChannelId(currentChannelId);
|
|
120
144
|
}, [ChannelId, currentRoute]);
|
|
121
145
|
React__default.useEffect(() => {
|
|
122
|
-
if (selectedImage)
|
|
146
|
+
if (selectedImage)
|
|
147
|
+
setImageLoading(false);
|
|
123
148
|
}, [selectedImage]);
|
|
124
149
|
useEffect(() => {
|
|
125
|
-
var
|
|
126
|
-
if ((
|
|
150
|
+
var _a3;
|
|
151
|
+
if ((_a3 = data == null ? void 0 : data.messages) == null ? void 0 : _a3.data) {
|
|
127
152
|
const {
|
|
128
153
|
data: messages,
|
|
129
154
|
totalCount: messeageTotalCount
|
|
130
155
|
} = data.messages;
|
|
131
|
-
console.log(
|
|
156
|
+
console.log("messeageTotalCount", messeageTotalCount, " totalCount=", totalCount);
|
|
132
157
|
if (messages && messages.length > 0 && messeageTotalCount > totalCount || messages && messages.length > 0 && (loadingOldMessages || channelMessages.length === 0)) {
|
|
133
|
-
setChannelMessages(oldMessages => uniqBy([...messages, ...oldMessages], ({
|
|
158
|
+
setChannelMessages((oldMessages) => uniqBy([...messages, ...oldMessages], ({
|
|
134
159
|
id
|
|
135
160
|
}) => id));
|
|
136
161
|
setTotalCount(messeageTotalCount);
|
|
137
162
|
}
|
|
138
|
-
if (loadingOldMessages && channelMessages)
|
|
163
|
+
if (loadingOldMessages && channelMessages)
|
|
164
|
+
setLoadingOldMessages(false);
|
|
139
165
|
}
|
|
140
166
|
}, [data, loadingOldMessages, channelMessages, totalCount]);
|
|
141
|
-
const onFetchOld = useCallback(() =>
|
|
167
|
+
const onFetchOld = useCallback(async () => {
|
|
142
168
|
if (totalCount > channelMessages.length && !loadingOldMessages) {
|
|
143
169
|
setLoadEarlierMsg(true);
|
|
144
170
|
try {
|
|
145
|
-
const response =
|
|
171
|
+
const response = await fetchMoreMessages({
|
|
146
172
|
variables: {
|
|
147
|
-
channelId: channelId
|
|
173
|
+
channelId: channelId == null ? void 0 : channelId.toString(),
|
|
148
174
|
parentId: null,
|
|
149
175
|
skip: channelMessages.length
|
|
150
176
|
}
|
|
151
177
|
});
|
|
152
|
-
if (response
|
|
178
|
+
if (response == null ? void 0 : response.data) {
|
|
153
179
|
setSkip(channelMessages.length);
|
|
154
180
|
setLoadEarlierMsg(false);
|
|
155
181
|
setLoadingOldMessages(true);
|
|
@@ -157,14 +183,8 @@ const ConversationViewComponent = _a => {
|
|
|
157
183
|
} catch (error) {
|
|
158
184
|
setLoadEarlierMsg(false);
|
|
159
185
|
}
|
|
160
|
-
// ?.then((res: any) => {
|
|
161
|
-
// setLoadingOldMessages(true);
|
|
162
|
-
// });
|
|
163
186
|
}
|
|
164
|
-
}
|
|
165
|
-
// const isCloseToTop = ({ layoutMeasurement, contentOffset, contentSize }) => {
|
|
166
|
-
// return contentOffset.y <= 100; // 100px from top
|
|
167
|
-
// };
|
|
187
|
+
}, [totalCount, channelMessages]);
|
|
168
188
|
const isCloseToTop = ({
|
|
169
189
|
layoutMeasurement,
|
|
170
190
|
contentOffset,
|
|
@@ -174,11 +194,7 @@ const ConversationViewComponent = _a => {
|
|
|
174
194
|
return contentSize.height - layoutMeasurement.height - paddingToTop <= contentOffset.y;
|
|
175
195
|
};
|
|
176
196
|
const dataURLtoFile = (dataurl, filename) => {
|
|
177
|
-
var arr = dataurl.split(
|
|
178
|
-
mime = arr[0].match(/:(.*?);/)[1],
|
|
179
|
-
bstr = encode(arr[1]),
|
|
180
|
-
n = bstr.length,
|
|
181
|
-
u8arr = new Uint8Array(n);
|
|
197
|
+
var arr = dataurl.split(","), mime = arr[0].match(/:(.*?);/)[1], bstr = encode(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
|
|
182
198
|
while (n--) {
|
|
183
199
|
u8arr[n] = bstr.charCodeAt(n);
|
|
184
200
|
}
|
|
@@ -186,99 +202,94 @@ const ConversationViewComponent = _a => {
|
|
|
186
202
|
type: mime
|
|
187
203
|
});
|
|
188
204
|
};
|
|
189
|
-
const onSelectImages = () =>
|
|
190
|
-
var
|
|
205
|
+
const onSelectImages = async () => {
|
|
206
|
+
var _a3;
|
|
191
207
|
setImageLoading(true);
|
|
192
|
-
let imageSource =
|
|
208
|
+
let imageSource = await ImagePicker.launchImageLibraryAsync({
|
|
193
209
|
mediaTypes: ImagePicker.MediaTypeOptions.Images,
|
|
194
210
|
allowsEditing: true,
|
|
195
211
|
aspect: [4, 3],
|
|
196
212
|
quality: 1,
|
|
197
213
|
base64: true
|
|
198
214
|
});
|
|
199
|
-
// if (!imageSource.cancelled) {
|
|
200
|
-
// const image = 'data:image/jpeg;base64,' + imageSource?.base64;
|
|
201
|
-
// setImage(image);
|
|
202
|
-
// const file = dataURLtoFile(image, 'inputImage.jpg');
|
|
203
|
-
// setFiles((files) => files.concat(file));
|
|
204
|
-
// setImages((images) => images.concat(imageSource as ImagePicker.ImageInfo));
|
|
205
|
-
// }
|
|
206
|
-
// if (imageSource.cancelled) setLoading(false);
|
|
207
215
|
if (!imageSource.canceled) {
|
|
208
|
-
const image =
|
|
216
|
+
const image = "data:image/jpeg;base64," + ((_a3 = imageSource == null ? void 0 : imageSource.assets[0]) == null ? void 0 : _a3.base64);
|
|
209
217
|
setImage(image);
|
|
210
|
-
const file = dataURLtoFile(image,
|
|
211
|
-
setFiles(
|
|
212
|
-
setImages(
|
|
218
|
+
const file = dataURLtoFile(image, "inputImage.jpg");
|
|
219
|
+
setFiles((files2) => files2.concat(file));
|
|
220
|
+
setImages((images2) => images2.concat(imageSource == null ? void 0 : imageSource.assets[0]));
|
|
213
221
|
}
|
|
214
|
-
if (imageSource.canceled)
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
222
|
+
if (imageSource.canceled)
|
|
223
|
+
setLoading(false);
|
|
224
|
+
};
|
|
225
|
+
const createDirectChannel = useCallback((msg2) => {
|
|
226
|
+
var _a3, _b2, _c, _d, _e, _f, _g, _h;
|
|
227
|
+
if ((rest == null ? void 0 : rest.isCreateNewChannel) && ((_a3 = rest == null ? void 0 : rest.newChannelData) == null ? void 0 : _a3.type) === ((_b2 = RoomType) == null ? void 0 : _b2.Direct) && ((_d = (_c = rest == null ? void 0 : rest.newChannelData) == null ? void 0 : _c.userIds) == null ? void 0 : _d.length) > 0) {
|
|
228
|
+
(_h = (_g = addDirectChannel({
|
|
220
229
|
variables: {
|
|
221
|
-
receiver: [...(
|
|
222
|
-
displayName:
|
|
230
|
+
receiver: [...(_f = (_e = rest == null ? void 0 : rest.newChannelData) == null ? void 0 : _e.userIds) != null ? _f : []],
|
|
231
|
+
displayName: "DIRECT CHANNEL"
|
|
223
232
|
}
|
|
224
|
-
}))
|
|
225
|
-
var
|
|
226
|
-
if ((
|
|
227
|
-
setChannelId((
|
|
233
|
+
})) == null ? void 0 : _g.then(async (res) => {
|
|
234
|
+
var _a4, _b3, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
235
|
+
if ((_b3 = (_a4 = res == null ? void 0 : res.data) == null ? void 0 : _a4.createDirectChannel) == null ? void 0 : _b3.id) {
|
|
236
|
+
setChannelId((_d2 = (_c2 = res == null ? void 0 : res.data) == null ? void 0 : _c2.createDirectChannel) == null ? void 0 : _d2.id);
|
|
228
237
|
const notificationData = {
|
|
229
238
|
url: config.INBOX_MESSEGE_PATH,
|
|
230
239
|
params: {
|
|
231
|
-
channelId: (
|
|
240
|
+
channelId: (_f2 = (_e2 = res == null ? void 0 : res.data) == null ? void 0 : _e2.createDirectChannel) == null ? void 0 : _f2.id,
|
|
232
241
|
hideTabBar: true
|
|
233
242
|
},
|
|
234
|
-
screen:
|
|
243
|
+
screen: "DialogMessages",
|
|
235
244
|
other: {
|
|
236
|
-
sound: Platform.OS ===
|
|
245
|
+
sound: Platform.OS === "android" ? void 0 : "default"
|
|
237
246
|
}
|
|
238
247
|
};
|
|
239
248
|
setLoading(true);
|
|
240
|
-
|
|
249
|
+
await sendMsg({
|
|
241
250
|
variables: {
|
|
242
|
-
channelId: (
|
|
243
|
-
content:
|
|
251
|
+
channelId: (_h2 = (_g2 = res == null ? void 0 : res.data) == null ? void 0 : _g2.createDirectChannel) == null ? void 0 : _h2.id,
|
|
252
|
+
content: msg2,
|
|
244
253
|
notificationParams: notificationData
|
|
245
254
|
},
|
|
246
255
|
update: (cache, {
|
|
247
|
-
data,
|
|
256
|
+
data: data2,
|
|
248
257
|
errors
|
|
249
258
|
}) => {
|
|
250
|
-
if (!
|
|
259
|
+
if (!data2 || errors) {
|
|
251
260
|
setLoading(false);
|
|
252
261
|
return;
|
|
253
262
|
}
|
|
254
263
|
setChannelToTop(channelToTop + 1);
|
|
255
264
|
setLoading(false);
|
|
256
|
-
setMsg(
|
|
265
|
+
setMsg("");
|
|
257
266
|
}
|
|
258
267
|
});
|
|
259
268
|
}
|
|
260
|
-
}))
|
|
269
|
+
})) == null ? void 0 : _h.catch((e) => console.log("error", JSON.stringify(e)));
|
|
261
270
|
}
|
|
262
271
|
}, [rest]);
|
|
263
|
-
const handleSend = useCallback(message =>
|
|
264
|
-
var
|
|
265
|
-
if (!channelId)
|
|
266
|
-
|
|
272
|
+
const handleSend = useCallback(async (message) => {
|
|
273
|
+
var _a3;
|
|
274
|
+
if (!channelId)
|
|
275
|
+
return;
|
|
276
|
+
if (!message && message != " " && images.length == 0)
|
|
277
|
+
return;
|
|
267
278
|
const notificationData = {
|
|
268
279
|
url: config.INBOX_MESSEGE_PATH,
|
|
269
280
|
params: {
|
|
270
281
|
channelId,
|
|
271
282
|
hideTabBar: true
|
|
272
283
|
},
|
|
273
|
-
screen:
|
|
284
|
+
screen: "DialogMessages",
|
|
274
285
|
other: {
|
|
275
|
-
sound: Platform.OS ===
|
|
286
|
+
sound: Platform.OS === "android" ? void 0 : "default"
|
|
276
287
|
}
|
|
277
288
|
};
|
|
278
289
|
if (images && images.length > 0) {
|
|
279
290
|
const postId = objectId();
|
|
280
291
|
setLoading(true);
|
|
281
|
-
const uploadResponse =
|
|
292
|
+
const uploadResponse = await startUpload({
|
|
282
293
|
file: images,
|
|
283
294
|
saveUploadedFile: {
|
|
284
295
|
variables: {
|
|
@@ -291,526 +302,371 @@ const ConversationViewComponent = _a => {
|
|
|
291
302
|
}
|
|
292
303
|
}
|
|
293
304
|
});
|
|
294
|
-
if (uploadResponse
|
|
305
|
+
if (uploadResponse == null ? void 0 : uploadResponse.error)
|
|
306
|
+
setLoading(false);
|
|
295
307
|
const uploadedFiles = uploadResponse.data;
|
|
296
308
|
if (uploadResponse.data) {
|
|
297
|
-
setImage(
|
|
309
|
+
setImage("");
|
|
298
310
|
setFiles([]);
|
|
299
311
|
setImages([]);
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
yield sendMsg({
|
|
312
|
+
const files2 = (_a3 = uploadedFiles == null ? void 0 : uploadedFiles.map((f) => f.id)) != null ? _a3 : null;
|
|
313
|
+
await sendMsg({
|
|
303
314
|
variables: {
|
|
304
315
|
postId,
|
|
305
316
|
channelId,
|
|
306
317
|
content: message,
|
|
307
|
-
files,
|
|
318
|
+
files: files2,
|
|
308
319
|
notificationParams: notificationData
|
|
309
320
|
},
|
|
310
321
|
update: (cache, {
|
|
311
|
-
data,
|
|
322
|
+
data: data2,
|
|
312
323
|
errors
|
|
313
324
|
}) => {
|
|
314
|
-
if (!
|
|
325
|
+
if (!data2 || errors) {
|
|
315
326
|
setLoading(false);
|
|
316
327
|
return;
|
|
317
328
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
setChannelMessages(oldMessages => uniqBy([...oldMessages, newMessage], ({
|
|
329
|
+
const newMessage = data2 == null ? void 0 : data2.sendMessage;
|
|
330
|
+
setChannelMessages((oldMessages) => uniqBy([...oldMessages, newMessage], ({
|
|
321
331
|
id
|
|
322
332
|
}) => id));
|
|
323
|
-
setTotalCount(t => t + 1);
|
|
324
|
-
//Temporary fix.....//
|
|
333
|
+
setTotalCount((t) => t + 1);
|
|
325
334
|
setChannelToTop(channelToTop + 1);
|
|
326
335
|
setLoading(false);
|
|
327
|
-
setMsg(
|
|
336
|
+
setMsg("");
|
|
328
337
|
}
|
|
329
338
|
});
|
|
330
339
|
}
|
|
331
340
|
} else {
|
|
332
341
|
setLoading(true);
|
|
333
|
-
|
|
342
|
+
await sendMsg({
|
|
334
343
|
variables: {
|
|
335
344
|
channelId,
|
|
336
345
|
content: message,
|
|
337
346
|
notificationParams: notificationData
|
|
338
347
|
},
|
|
339
348
|
update: (cache, {
|
|
340
|
-
data,
|
|
349
|
+
data: data2,
|
|
341
350
|
errors
|
|
342
351
|
}) => {
|
|
343
|
-
if (!
|
|
352
|
+
if (!data2 || errors) {
|
|
344
353
|
setLoading(false);
|
|
345
354
|
return;
|
|
346
355
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
setChannelMessages(oldMessages => uniqBy([...oldMessages, newMessage], ({
|
|
356
|
+
const newMessage = data2 == null ? void 0 : data2.sendMessage;
|
|
357
|
+
setChannelMessages((oldMessages) => uniqBy([...oldMessages, newMessage], ({
|
|
350
358
|
id
|
|
351
359
|
}) => id));
|
|
352
|
-
setTotalCount(t => t + 1);
|
|
353
|
-
//Temporary fix.....//
|
|
360
|
+
setTotalCount((t) => t + 1);
|
|
354
361
|
setChannelToTop(channelToTop + 1);
|
|
355
362
|
setLoading(false);
|
|
356
|
-
setMsg(
|
|
363
|
+
setMsg("");
|
|
357
364
|
}
|
|
358
365
|
});
|
|
359
366
|
}
|
|
360
|
-
}
|
|
367
|
+
}, [setChannelMessages, channelId, images, channelToTop, expoTokens]);
|
|
361
368
|
const messageList = useMemo(() => {
|
|
362
369
|
let res = [];
|
|
363
|
-
const filteredMessages = channelMessages && (channelMessages
|
|
370
|
+
const filteredMessages = channelMessages && (channelMessages == null ? void 0 : channelMessages.length) > 0 ? uniqBy([...channelMessages], ({
|
|
364
371
|
id
|
|
365
372
|
}) => id) : [];
|
|
366
|
-
if (channelId && (filteredMessages
|
|
367
|
-
orderBy(channelMessages, [
|
|
368
|
-
var
|
|
373
|
+
if (channelId && (filteredMessages == null ? void 0 : filteredMessages.length) > 0) {
|
|
374
|
+
orderBy(channelMessages, ["createdAt"], ["desc"]).map((msg2) => {
|
|
375
|
+
var _a3, _b2, _c, _d;
|
|
369
376
|
let message = {
|
|
370
|
-
_id:
|
|
371
|
-
text:
|
|
377
|
+
_id: "",
|
|
378
|
+
text: "",
|
|
372
379
|
createdAt: 0,
|
|
373
380
|
user: {
|
|
374
|
-
_id:
|
|
375
|
-
name:
|
|
376
|
-
avatar:
|
|
381
|
+
_id: "",
|
|
382
|
+
name: "",
|
|
383
|
+
avatar: ""
|
|
377
384
|
},
|
|
378
|
-
type:
|
|
385
|
+
type: ""
|
|
379
386
|
};
|
|
380
|
-
const date = new Date(
|
|
381
|
-
message._id =
|
|
382
|
-
message.text =
|
|
387
|
+
const date = new Date(msg2.createdAt);
|
|
388
|
+
message._id = msg2.id;
|
|
389
|
+
message.text = msg2.message;
|
|
383
390
|
message.createdAt = date;
|
|
384
391
|
message.user = {
|
|
385
|
-
_id:
|
|
386
|
-
name:
|
|
387
|
-
avatar: (
|
|
388
|
-
}, message.image = (_c = (
|
|
389
|
-
message.type =
|
|
390
|
-
message.propsConfiguration =
|
|
391
|
-
message.replies = (_d =
|
|
392
|
+
_id: msg2.author.id,
|
|
393
|
+
name: msg2.author.givenName + " " + msg2.author.familyName,
|
|
394
|
+
avatar: (_a3 = msg2.author) == null ? void 0 : _a3.picture
|
|
395
|
+
}, message.image = (_c = (_b2 = msg2.files) == null ? void 0 : _b2.data[0]) == null ? void 0 : _c.url, message.sent = msg2 == null ? void 0 : msg2.isDelivered, message.received = msg2 == null ? void 0 : msg2.isRead;
|
|
396
|
+
message.type = msg2 == null ? void 0 : msg2.type;
|
|
397
|
+
message.propsConfiguration = msg2 == null ? void 0 : msg2.propsConfiguration;
|
|
398
|
+
message.replies = (_d = msg2 == null ? void 0 : msg2.replies) != null ? _d : [];
|
|
392
399
|
message.isShowThreadMessage = isShowThreadMessage;
|
|
393
400
|
res.push(message);
|
|
394
401
|
});
|
|
395
402
|
}
|
|
396
|
-
return (res
|
|
403
|
+
return (res == null ? void 0 : res.length) > 0 ? uniqBy([...res], ({
|
|
397
404
|
_id
|
|
398
405
|
}) => _id) : [];
|
|
399
|
-
//return res;
|
|
400
406
|
}, [channelMessages, channelId]);
|
|
401
|
-
const renderSend = props => {
|
|
402
|
-
return React__default.createElement(Send,
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
style: {
|
|
407
|
-
marginBottom: 5,
|
|
408
|
-
marginRight: 5
|
|
409
|
-
},
|
|
410
|
-
size: 32,
|
|
411
|
-
color: channelId || (rest === null || rest === void 0 ? void 0 : rest.isCreateNewChannel) ? '#2e64e5' : '#b8b2b2'
|
|
412
|
-
})));
|
|
407
|
+
const renderSend = (props) => {
|
|
408
|
+
return /* @__PURE__ */ React__default.createElement(Send, __spreadProps(__spreadValues({}, props), { disabled: channelId || (rest == null ? void 0 : rest.isCreateNewChannel) ? false : true }), /* @__PURE__ */ React__default.createElement(Box, null, /* @__PURE__ */ React__default.createElement(MaterialCommunityIcons, { name: "send-circle", style: {
|
|
409
|
+
marginBottom: 5,
|
|
410
|
+
marginRight: 5
|
|
411
|
+
}, size: 32, color: channelId || (rest == null ? void 0 : rest.isCreateNewChannel) ? "#2e64e5" : "#b8b2b2" })));
|
|
413
412
|
};
|
|
414
|
-
const renderMessageText = props => {
|
|
415
|
-
var
|
|
413
|
+
const renderMessageText = (props) => {
|
|
414
|
+
var _a3, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U;
|
|
416
415
|
const {
|
|
417
416
|
currentMessage
|
|
418
417
|
} = props;
|
|
419
|
-
const lastReply = ((
|
|
420
|
-
if (currentMessage.type ===
|
|
421
|
-
const attachment = (_f = (_e = currentMessage
|
|
422
|
-
let action =
|
|
423
|
-
let actionId =
|
|
418
|
+
const lastReply = ((_b2 = (_a3 = currentMessage == null ? void 0 : currentMessage.replies) == null ? void 0 : _a3.data) == null ? void 0 : _b2.length) > 0 ? (_d = (_c = currentMessage == null ? void 0 : currentMessage.replies) == null ? void 0 : _c.data) == null ? void 0 : _d[0] : null;
|
|
419
|
+
if (currentMessage.type === "ALERT") {
|
|
420
|
+
const attachment = (_f = (_e = currentMessage == null ? void 0 : currentMessage.propsConfiguration) == null ? void 0 : _e.contents) == null ? void 0 : _f.attachment;
|
|
421
|
+
let action = "";
|
|
422
|
+
let actionId = "";
|
|
424
423
|
let params = {};
|
|
425
|
-
if ((_g = attachment
|
|
426
|
-
const extraParams = (_h = attachment
|
|
427
|
-
const route = (
|
|
424
|
+
if ((_g = attachment == null ? void 0 : attachment.callToAction) == null ? void 0 : _g.extraParams) {
|
|
425
|
+
const extraParams = (_h = attachment == null ? void 0 : attachment.callToAction) == null ? void 0 : _h.extraParams;
|
|
426
|
+
const route = (_i = extraParams == null ? void 0 : extraParams.route) != null ? _i : null;
|
|
428
427
|
let path = null;
|
|
429
428
|
let param = null;
|
|
430
429
|
if (role && role == PreDefinedRole.Guest) {
|
|
431
|
-
path = ((
|
|
432
|
-
param = ((
|
|
430
|
+
path = ((_j = route == null ? void 0 : route.guest) == null ? void 0 : _j.name) ? (_l = (_k = route == null ? void 0 : route.guest) == null ? void 0 : _k.name) != null ? _l : null : null;
|
|
431
|
+
param = ((_m = route == null ? void 0 : route.guest) == null ? void 0 : _m.params) ? (_o = (_n = route == null ? void 0 : route.guest) == null ? void 0 : _n.params) != null ? _o : null : null;
|
|
433
432
|
} else if (role && role == PreDefinedRole.Owner) {
|
|
434
|
-
path = ((
|
|
435
|
-
param = ((
|
|
433
|
+
path = ((_p = route == null ? void 0 : route.host) == null ? void 0 : _p.name) ? (_r = (_q = route == null ? void 0 : route.host) == null ? void 0 : _q.name) != null ? _r : null : null;
|
|
434
|
+
param = ((_s = route == null ? void 0 : route.host) == null ? void 0 : _s.params) ? (_u = (_t = route == null ? void 0 : route.host) == null ? void 0 : _t.params) != null ? _u : null : null;
|
|
436
435
|
} else {
|
|
437
|
-
path = ((
|
|
438
|
-
param = ((
|
|
436
|
+
path = ((_v = route == null ? void 0 : route.host) == null ? void 0 : _v.name) ? (_x = (_w = route == null ? void 0 : route.host) == null ? void 0 : _w.name) != null ? _x : null : null;
|
|
437
|
+
param = ((_y = route == null ? void 0 : route.host) == null ? void 0 : _y.params) ? (_A = (_z = route == null ? void 0 : route.host) == null ? void 0 : _z.params) != null ? _A : null : null;
|
|
439
438
|
}
|
|
440
439
|
action = path;
|
|
441
|
-
params =
|
|
442
|
-
} else if ((
|
|
440
|
+
params = __spreadValues({}, param);
|
|
441
|
+
} else if ((_B = attachment == null ? void 0 : attachment.callToAction) == null ? void 0 : _B.link) {
|
|
443
442
|
action = CALL_TO_ACTION_PATH;
|
|
444
|
-
actionId = (
|
|
443
|
+
actionId = (_C = attachment == null ? void 0 : attachment.callToAction) == null ? void 0 : _C.link.split("/").pop();
|
|
445
444
|
params = {
|
|
446
445
|
reservationId: actionId
|
|
447
446
|
};
|
|
448
447
|
}
|
|
449
|
-
return React__default.createElement(React__default.Fragment, null, (attachment
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
borderColor: CALL_TO_ACTION_BUTTON_BORDERCOLOR,
|
|
457
|
-
onPress: () => action && params && navigation.navigate(action, params)
|
|
458
|
-
}, React__default.createElement(ButtonText, {
|
|
459
|
-
color: CALL_TO_ACTION_TEXT_COLOR
|
|
460
|
-
}, attachment.callToAction.title)), React__default.createElement(MessageText, Object.assign({}, props, {
|
|
461
|
-
textStyle: {
|
|
462
|
-
left: {
|
|
463
|
-
marginLeft: 5,
|
|
464
|
-
color: CALL_TO_ACTION_TEXT_COLOR,
|
|
465
|
-
paddingHorizontal: 2
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
}))) : React__default.createElement(TouchableHighlight, {
|
|
469
|
-
underlayColor: '#c0c0c0',
|
|
470
|
-
style: {
|
|
471
|
-
width: '100%'
|
|
448
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, (attachment == null ? void 0 : attachment.callToAction) && action ? /* @__PURE__ */ React__default.createElement(Box, { bg: CALL_TO_ACTION_BOX_BGCOLOR, borderRadius: 15, pb: "$2" }, /* @__PURE__ */ React__default.createElement(
|
|
449
|
+
Button,
|
|
450
|
+
{
|
|
451
|
+
variant: "outline",
|
|
452
|
+
size: "sm",
|
|
453
|
+
borderColor: CALL_TO_ACTION_BUTTON_BORDERCOLOR,
|
|
454
|
+
onPress: () => action && params && navigation.navigate(action, params)
|
|
472
455
|
},
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
456
|
+
/* @__PURE__ */ React__default.createElement(ButtonText, { color: CALL_TO_ACTION_TEXT_COLOR }, attachment.callToAction.title)
|
|
457
|
+
), /* @__PURE__ */ React__default.createElement(MessageText, __spreadProps(__spreadValues({}, props), { textStyle: {
|
|
458
|
+
left: {
|
|
459
|
+
marginLeft: 5,
|
|
460
|
+
color: CALL_TO_ACTION_TEXT_COLOR,
|
|
461
|
+
paddingHorizontal: 2
|
|
462
|
+
}
|
|
463
|
+
} }))) : /* @__PURE__ */ React__default.createElement(TouchableHighlight, { underlayColor: "#c0c0c0", style: {
|
|
464
|
+
width: "100%"
|
|
465
|
+
}, onPress: () => {
|
|
466
|
+
if (currentMessage == null ? void 0 : currentMessage.isShowThreadMessage)
|
|
467
|
+
navigation.navigate(config.THREAD_MESSEGE_PATH, {
|
|
468
|
+
channelId,
|
|
469
|
+
title: "Message",
|
|
470
|
+
postParentId: currentMessage == null ? void 0 : currentMessage._id,
|
|
478
471
|
isPostParentIdThread: true
|
|
479
472
|
});
|
|
473
|
+
} }, /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(MessageText, __spreadProps(__spreadValues({}, props), { textStyle: {
|
|
474
|
+
left: {
|
|
475
|
+
marginLeft: 5
|
|
480
476
|
}
|
|
481
|
-
}, React__default.createElement(
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
bg: 'transparent',
|
|
499
|
-
size: 'sm'
|
|
500
|
-
}, React__default.createElement(AvatarFallbackText, null, startCase((_b = (_a = p === null || p === void 0 ? void 0 : p.author) === null || _a === void 0 ? void 0 : _a.username) === null || _b === void 0 ? void 0 : _b.charAt(0))), React__default.createElement(AvatarImage, {
|
|
501
|
-
alt: "user image",
|
|
502
|
-
style: {
|
|
503
|
-
borderRadius: 6,
|
|
504
|
-
borderWidth: 2,
|
|
505
|
-
borderColor: '#fff'
|
|
506
|
-
},
|
|
507
|
-
source: {
|
|
508
|
-
uri: (_c = p === null || p === void 0 ? void 0 : p.author) === null || _c === void 0 ? void 0 : _c.picture
|
|
509
|
-
}
|
|
510
|
-
}));
|
|
511
|
-
})), React__default.createElement(Text, {
|
|
512
|
-
style: {
|
|
513
|
-
fontSize: 12
|
|
514
|
-
},
|
|
515
|
-
fontWeight: '$bold',
|
|
516
|
-
color: '$blue800'
|
|
517
|
-
}, (_12 = currentMessage === null || currentMessage === void 0 ? void 0 : currentMessage.replies) === null || _12 === void 0 ? void 0 : _12.totalCount, ' ', ((_13 = currentMessage === null || currentMessage === void 0 ? void 0 : currentMessage.replies) === null || _13 === void 0 ? void 0 : _13.totalCount) == 1 ? 'reply' : 'replies'), React__default.createElement(Text, {
|
|
518
|
-
style: {
|
|
519
|
-
fontSize: 12
|
|
520
|
-
},
|
|
521
|
-
fontWeight: '$bold',
|
|
522
|
-
color: '$trueGray500'
|
|
523
|
-
}, lastReply ? createdAtText(lastReply === null || lastReply === void 0 ? void 0 : lastReply.createdAt) : '')))));
|
|
477
|
+
} })), ((_E = (_D = currentMessage == null ? void 0 : currentMessage.replies) == null ? void 0 : _D.data) == null ? void 0 : _E.length) > 0 && /* @__PURE__ */ React__default.createElement(HStack, { space: "sm", px: "$1", alignItems: "center" }, /* @__PURE__ */ React__default.createElement(HStack, null, (_J = (_I = (_H = (_G = (_F = currentMessage == null ? void 0 : currentMessage.replies) == null ? void 0 : _F.data) == null ? void 0 : _G.filter((v, i, a) => a.findIndex((t) => {
|
|
478
|
+
var _a4, _b3;
|
|
479
|
+
return ((_a4 = t == null ? void 0 : t.author) == null ? void 0 : _a4.id) === ((_b3 = v == null ? void 0 : v.author) == null ? void 0 : _b3.id);
|
|
480
|
+
}) === i)) == null ? void 0 : _H.slice(0, 2)) == null ? void 0 : _I.reverse()) == null ? void 0 : _J.map((p, i) => {
|
|
481
|
+
var _a4, _b3, _c2;
|
|
482
|
+
return /* @__PURE__ */ React__default.createElement(Avatar, { key: "conversations-view-key-" + i, bg: "transparent", size: "sm" }, /* @__PURE__ */ React__default.createElement(AvatarFallbackText, null, startCase((_b3 = (_a4 = p == null ? void 0 : p.author) == null ? void 0 : _a4.username) == null ? void 0 : _b3.charAt(0))), /* @__PURE__ */ React__default.createElement(AvatarImage, { alt: "user image", style: {
|
|
483
|
+
borderRadius: 6,
|
|
484
|
+
borderWidth: 2,
|
|
485
|
+
borderColor: "#fff"
|
|
486
|
+
}, source: {
|
|
487
|
+
uri: (_c2 = p == null ? void 0 : p.author) == null ? void 0 : _c2.picture
|
|
488
|
+
} }));
|
|
489
|
+
})), /* @__PURE__ */ React__default.createElement(Text, { style: {
|
|
490
|
+
fontSize: 12
|
|
491
|
+
}, fontWeight: "$bold", color: "$blue800" }, (_K = currentMessage == null ? void 0 : currentMessage.replies) == null ? void 0 : _K.totalCount, " ", ((_L = currentMessage == null ? void 0 : currentMessage.replies) == null ? void 0 : _L.totalCount) == 1 ? "reply" : "replies"), /* @__PURE__ */ React__default.createElement(Text, { style: {
|
|
492
|
+
fontSize: 12
|
|
493
|
+
}, fontWeight: "$bold", color: "$trueGray500" }, lastReply ? createdAtText(lastReply == null ? void 0 : lastReply.createdAt) : "")))));
|
|
524
494
|
} else {
|
|
525
|
-
return React__default.createElement(TouchableHighlight, {
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
title: 'Message',
|
|
534
|
-
postParentId: currentMessage === null || currentMessage === void 0 ? void 0 : currentMessage._id,
|
|
495
|
+
return /* @__PURE__ */ React__default.createElement(TouchableHighlight, { underlayColor: "#c0c0c0", style: {
|
|
496
|
+
width: "100%"
|
|
497
|
+
}, onPress: () => {
|
|
498
|
+
if (currentMessage == null ? void 0 : currentMessage.isShowThreadMessage)
|
|
499
|
+
navigation.navigate(config.THREAD_MESSEGE_PATH, {
|
|
500
|
+
channelId,
|
|
501
|
+
title: "Message",
|
|
502
|
+
postParentId: currentMessage == null ? void 0 : currentMessage._id,
|
|
535
503
|
isPostParentIdThread: true
|
|
536
504
|
});
|
|
505
|
+
} }, /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(MessageText, __spreadProps(__spreadValues({}, props), { textStyle: {
|
|
506
|
+
left: {
|
|
507
|
+
marginLeft: 5
|
|
537
508
|
}
|
|
538
|
-
}, React__default.createElement(
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
bg: 'transparent',
|
|
556
|
-
size: 'sm'
|
|
557
|
-
}, React__default.createElement(AvatarFallbackText, null, startCase((_b = (_a = p === null || p === void 0 ? void 0 : p.author) === null || _a === void 0 ? void 0 : _a.username) === null || _b === void 0 ? void 0 : _b.charAt(0))), React__default.createElement(AvatarImage, {
|
|
558
|
-
alt: "user image",
|
|
559
|
-
style: {
|
|
560
|
-
borderRadius: 6,
|
|
561
|
-
borderWidth: 2,
|
|
562
|
-
borderColor: '#fff'
|
|
563
|
-
},
|
|
564
|
-
source: {
|
|
565
|
-
uri: (_c = p === null || p === void 0 ? void 0 : p.author) === null || _c === void 0 ? void 0 : _c.picture
|
|
566
|
-
}
|
|
567
|
-
}));
|
|
568
|
-
})), React__default.createElement(Text, {
|
|
569
|
-
style: {
|
|
570
|
-
fontSize: 12
|
|
571
|
-
},
|
|
572
|
-
fontWeight: '$bold',
|
|
573
|
-
color: '$blue800'
|
|
574
|
-
}, (_21 = currentMessage === null || currentMessage === void 0 ? void 0 : currentMessage.replies) === null || _21 === void 0 ? void 0 : _21.totalCount, ' ', ((_22 = currentMessage === null || currentMessage === void 0 ? void 0 : currentMessage.replies) === null || _22 === void 0 ? void 0 : _22.totalCount) == 1 ? 'reply' : 'replies'), React__default.createElement(Text, {
|
|
575
|
-
style: {
|
|
576
|
-
fontSize: 12
|
|
577
|
-
},
|
|
578
|
-
fontWeight: '$bold',
|
|
579
|
-
color: '$trueGray500'
|
|
580
|
-
}, lastReply ? createdAtText(lastReply === null || lastReply === void 0 ? void 0 : lastReply.createdAt) : ''))));
|
|
509
|
+
} })), ((_N = (_M = currentMessage == null ? void 0 : currentMessage.replies) == null ? void 0 : _M.data) == null ? void 0 : _N.length) > 0 && /* @__PURE__ */ React__default.createElement(HStack, { space: "sm", px: "$1", alignItems: "center" }, /* @__PURE__ */ React__default.createElement(HStack, null, (_S = (_R = (_Q = (_P = (_O = currentMessage == null ? void 0 : currentMessage.replies) == null ? void 0 : _O.data) == null ? void 0 : _P.filter((v, i, a) => a.findIndex((t) => {
|
|
510
|
+
var _a4, _b3;
|
|
511
|
+
return ((_a4 = t == null ? void 0 : t.author) == null ? void 0 : _a4.id) === ((_b3 = v == null ? void 0 : v.author) == null ? void 0 : _b3.id);
|
|
512
|
+
}) === i)) == null ? void 0 : _Q.slice(0, 2)) == null ? void 0 : _R.reverse()) == null ? void 0 : _S.map((p, i) => {
|
|
513
|
+
var _a4, _b3, _c2;
|
|
514
|
+
return /* @__PURE__ */ React__default.createElement(Avatar, { key: "conversation-replies-key-" + i, bg: "transparent", size: "sm" }, /* @__PURE__ */ React__default.createElement(AvatarFallbackText, null, startCase((_b3 = (_a4 = p == null ? void 0 : p.author) == null ? void 0 : _a4.username) == null ? void 0 : _b3.charAt(0))), /* @__PURE__ */ React__default.createElement(AvatarImage, { alt: "user image", style: {
|
|
515
|
+
borderRadius: 6,
|
|
516
|
+
borderWidth: 2,
|
|
517
|
+
borderColor: "#fff"
|
|
518
|
+
}, source: {
|
|
519
|
+
uri: (_c2 = p == null ? void 0 : p.author) == null ? void 0 : _c2.picture
|
|
520
|
+
} }));
|
|
521
|
+
})), /* @__PURE__ */ React__default.createElement(Text, { style: {
|
|
522
|
+
fontSize: 12
|
|
523
|
+
}, fontWeight: "$bold", color: "$blue800" }, (_T = currentMessage == null ? void 0 : currentMessage.replies) == null ? void 0 : _T.totalCount, " ", ((_U = currentMessage == null ? void 0 : currentMessage.replies) == null ? void 0 : _U.totalCount) == 1 ? "reply" : "replies"), /* @__PURE__ */ React__default.createElement(Text, { style: {
|
|
524
|
+
fontSize: 12
|
|
525
|
+
}, fontWeight: "$bold", color: "$trueGray500" }, lastReply ? createdAtText(lastReply == null ? void 0 : lastReply.createdAt) : ""))));
|
|
581
526
|
}
|
|
582
527
|
};
|
|
583
|
-
const renderActions = props => {
|
|
584
|
-
return React__default.createElement(Actions,
|
|
585
|
-
icon: () => React__default.createElement(Ionicons, {
|
|
586
|
-
name: 'image',
|
|
587
|
-
size: 30,
|
|
588
|
-
color: 'black',
|
|
589
|
-
onPress: onSelectImages
|
|
590
|
-
})
|
|
591
|
-
}));
|
|
528
|
+
const renderActions = (props) => {
|
|
529
|
+
return /* @__PURE__ */ React__default.createElement(Actions, __spreadProps(__spreadValues({}, props), { icon: () => /* @__PURE__ */ React__default.createElement(Ionicons, { name: "image", size: 30, color: "black", onPress: onSelectImages }) }));
|
|
592
530
|
};
|
|
593
|
-
const renderAccessory = props => {
|
|
594
|
-
return React__default.createElement(Box, null, selectedImage !==
|
|
595
|
-
|
|
596
|
-
}, React__default.createElement(
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
531
|
+
const renderAccessory = (props) => {
|
|
532
|
+
return /* @__PURE__ */ React__default.createElement(Box, null, selectedImage !== "" ? /* @__PURE__ */ React__default.createElement(HStack, { alignItems: "center" }, /* @__PURE__ */ React__default.createElement(Image, { ml: "$3", key: selectedImage, alt: "image", source: {
|
|
533
|
+
uri: selectedImage
|
|
534
|
+
}, size: "xs" }), /* @__PURE__ */ React__default.createElement(
|
|
535
|
+
Button,
|
|
536
|
+
{
|
|
537
|
+
variant: "solid",
|
|
538
|
+
bg: "transparent",
|
|
539
|
+
onPress: () => {
|
|
540
|
+
setFiles([]);
|
|
541
|
+
setImage("");
|
|
542
|
+
setImages([]);
|
|
543
|
+
}
|
|
602
544
|
},
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
variant: 'solid',
|
|
606
|
-
bg: 'transparent',
|
|
607
|
-
//colorScheme={'secondary'}
|
|
608
|
-
onPress: () => {
|
|
609
|
-
setFiles([]);
|
|
610
|
-
setImage('');
|
|
611
|
-
setImages([]);
|
|
612
|
-
}
|
|
613
|
-
}, React__default.createElement(ButtonText, {
|
|
614
|
-
color: '$black'
|
|
615
|
-
}, "Cancel"))) : null);
|
|
545
|
+
/* @__PURE__ */ React__default.createElement(ButtonText, { color: "$black" }, "Cancel")
|
|
546
|
+
)) : null);
|
|
616
547
|
};
|
|
617
548
|
const setImageViewerObject = (obj, v) => {
|
|
618
549
|
setImageObject(obj);
|
|
619
550
|
setImageViewer(v);
|
|
620
551
|
};
|
|
621
552
|
const modalContent = React__default.useMemo(() => {
|
|
622
|
-
if (!imageObject)
|
|
553
|
+
if (!imageObject)
|
|
554
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null);
|
|
623
555
|
const {
|
|
624
556
|
image,
|
|
625
557
|
_id
|
|
626
558
|
} = imageObject;
|
|
627
|
-
return React__default.createElement(
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
559
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
560
|
+
CachedImage,
|
|
561
|
+
{
|
|
562
|
+
style: {
|
|
563
|
+
width: "100%",
|
|
564
|
+
height: "100%"
|
|
565
|
+
},
|
|
566
|
+
resizeMode: "cover",
|
|
567
|
+
cacheKey: `${_id}-slack-bubble-imageKey`,
|
|
568
|
+
source: {
|
|
569
|
+
uri: image,
|
|
570
|
+
expiresIn: 86400
|
|
571
|
+
},
|
|
572
|
+
alt: "image"
|
|
573
|
+
}
|
|
574
|
+
);
|
|
642
575
|
}, [imageObject]);
|
|
643
|
-
const renderMessage = useCallback(props => {
|
|
644
|
-
|
|
645
|
-
// currentMessage: { text: currText },
|
|
646
|
-
// } = props;
|
|
647
|
-
//let messageTextStyle: any;
|
|
648
|
-
// Make "pure emoji" messages much bigger than plain text.
|
|
649
|
-
// if (currText && emojiUtils.isPureEmojiString(currText)) {
|
|
650
|
-
// messageTextStyle = {
|
|
651
|
-
// fontSize: 28,
|
|
652
|
-
// // Emoji get clipped if lineHeight isn't increased; make it consistent across platforms.
|
|
653
|
-
// lineHeight: Platform.OS === 'android' ? 34 : 30,
|
|
654
|
-
// }
|
|
655
|
-
// }
|
|
656
|
-
// return <SlackMessage {...props} messageTextStyle={messageTextStyle} />;
|
|
657
|
-
return React__default.createElement(Message, Object.assign({}, props, {
|
|
658
|
-
isShowImageViewer: isShowImageViewer,
|
|
659
|
-
setImageViewer: setImageViewerObject
|
|
660
|
-
}));
|
|
576
|
+
const renderMessage = useCallback((props) => {
|
|
577
|
+
return /* @__PURE__ */ React__default.createElement(Message, __spreadProps(__spreadValues({}, props), { isShowImageViewer, setImageViewer: setImageViewerObject }));
|
|
661
578
|
}, [isShowImageViewer]);
|
|
662
|
-
// const renderMessage = (props: any) => {
|
|
663
|
-
// // const {
|
|
664
|
-
// // currentMessage: { text: currText },
|
|
665
|
-
// // } = props;
|
|
666
|
-
// //let messageTextStyle: any;
|
|
667
|
-
// // Make "pure emoji" messages much bigger than plain text.
|
|
668
|
-
// // if (currText && emojiUtils.isPureEmojiString(currText)) {
|
|
669
|
-
// // messageTextStyle = {
|
|
670
|
-
// // fontSize: 28,
|
|
671
|
-
// // // Emoji get clipped if lineHeight isn't increased; make it consistent across platforms.
|
|
672
|
-
// // lineHeight: Platform.OS === 'android' ? 34 : 30,
|
|
673
|
-
// // }
|
|
674
|
-
// // }
|
|
675
|
-
// // return <SlackMessage {...props} messageTextStyle={messageTextStyle} />;
|
|
676
|
-
// return <SlackMessage {...props} isShowImageViewer={isShowImageViewer} setImageViewer={setImageViewerObject} />;
|
|
677
|
-
// };
|
|
678
579
|
let onScroll = false;
|
|
679
|
-
const onMomentumScrollBegin =
|
|
580
|
+
const onMomentumScrollBegin = async ({
|
|
680
581
|
nativeEvent
|
|
681
|
-
}) {
|
|
582
|
+
}) => {
|
|
682
583
|
onScroll = true;
|
|
683
|
-
console.log(
|
|
684
|
-
if (!loadingOldMessages && isCloseToTop(nativeEvent) && totalCount > (channelMessages
|
|
685
|
-
|
|
584
|
+
console.log("scroll top");
|
|
585
|
+
if (!loadingOldMessages && isCloseToTop(nativeEvent) && totalCount > (channelMessages == null ? void 0 : channelMessages.length)) {
|
|
586
|
+
await onFetchOld();
|
|
686
587
|
}
|
|
687
|
-
}
|
|
588
|
+
};
|
|
688
589
|
const onEndReached = () => {
|
|
689
|
-
console.log(
|
|
690
|
-
if (!onScroll)
|
|
691
|
-
|
|
590
|
+
console.log("on end reached");
|
|
591
|
+
if (!onScroll)
|
|
592
|
+
return;
|
|
692
593
|
onScroll = false;
|
|
693
|
-
// setLoadingOldMessages(true);
|
|
694
594
|
};
|
|
695
|
-
return React__default.createElement(React__default.Fragment, null, loadEarlierMsg && React__default.createElement(Spinner, {
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
}) : '',
|
|
728
|
-
scrollToBottom: true,
|
|
729
|
-
user: {
|
|
730
|
-
// _id: currentUser?.id || '',
|
|
731
|
-
_id: (auth === null || auth === void 0 ? void 0 : auth.id) || ''
|
|
732
|
-
},
|
|
733
|
-
isTyping: true,
|
|
734
|
-
alwaysShowSend: loading ? false : true,
|
|
735
|
-
//onLoadEarlier={onFetchOld}
|
|
736
|
-
//infiniteScroll={true}
|
|
737
|
-
renderSend: renderSend,
|
|
738
|
-
// loadEarlier={data?.messages?.totalCount > channelMessages.length}
|
|
739
|
-
//isLoadingEarlier={loadEarlierMsg}
|
|
740
|
-
//extraData={{ isLoadingEarlier: loadingOldMessages }}
|
|
741
|
-
// renderLoadEarlier={() =>
|
|
742
|
-
// !loadEarlierMsg && (
|
|
743
|
-
// <Center py={2}>
|
|
744
|
-
// <Button
|
|
745
|
-
// onPress={() => onFetchOld()}
|
|
746
|
-
// variant={'outline'}
|
|
747
|
-
// _text={{ color: 'black', fontSize: 15, fontWeight: 'bold' }}
|
|
748
|
-
// >
|
|
749
|
-
// Load earlier messages
|
|
750
|
-
// </Button>
|
|
751
|
-
// </Center>
|
|
752
|
-
// )
|
|
753
|
-
// }
|
|
754
|
-
renderMessageText: renderMessageText,
|
|
755
|
-
minInputToolbarHeight: 50,
|
|
756
|
-
renderActions: channelId && renderActions,
|
|
757
|
-
renderAccessory: renderAccessory,
|
|
758
|
-
renderMessage: renderMessage,
|
|
759
|
-
renderChatFooter: () => React__default.createElement(React__default.Fragment, null, React__default.createElement(ImageViewerModal, {
|
|
760
|
-
isVisible: isShowImageViewer,
|
|
761
|
-
setVisible: setImageViewer,
|
|
762
|
-
modalContent: modalContent
|
|
763
|
-
}), React__default.createElement(SubscriptionHandler, {
|
|
764
|
-
channelId: channelId === null || channelId === void 0 ? void 0 : channelId.toString(),
|
|
765
|
-
subscribeToNewMessages: () => subscribeToMore({
|
|
595
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, loadEarlierMsg && /* @__PURE__ */ React__default.createElement(Spinner, { color: "$blue500" }), /* @__PURE__ */ React__default.createElement(
|
|
596
|
+
GiftedChat,
|
|
597
|
+
{
|
|
598
|
+
ref: messageRootListRef,
|
|
599
|
+
wrapInSafeArea: false,
|
|
600
|
+
renderLoading: () => /* @__PURE__ */ React__default.createElement(Spinner, { color: "$blue500" }),
|
|
601
|
+
messages: messageList,
|
|
602
|
+
listViewProps: {
|
|
603
|
+
onEndReached,
|
|
604
|
+
onEndReachedThreshold: 0.5,
|
|
605
|
+
onMomentumScrollBegin
|
|
606
|
+
},
|
|
607
|
+
onSend: (messages) => {
|
|
608
|
+
var _a3, _b2, _c, _d, _e, _f;
|
|
609
|
+
return (rest == null ? void 0 : rest.isCreateNewChannel) && !channelId ? ((_a3 = rest == null ? void 0 : rest.newChannelData) == null ? void 0 : _a3.type) === ((_b2 = RoomType) == null ? void 0 : _b2.Direct) ? createDirectChannel((_d = (_c = messages[0]) == null ? void 0 : _c.text) != null ? _d : " ") : null : channelId && handleSend((_f = (_e = messages[0]) == null ? void 0 : _e.text) != null ? _f : " ");
|
|
610
|
+
},
|
|
611
|
+
text: msg ? msg : " ",
|
|
612
|
+
onInputTextChanged: (text) => setMsg(text),
|
|
613
|
+
renderFooter: () => loading ? /* @__PURE__ */ React__default.createElement(Spinner, { color: "$blue500" }) : imageLoading ? /* @__PURE__ */ React__default.createElement(Spinner, { color: "$blue500" }) : "",
|
|
614
|
+
scrollToBottom: true,
|
|
615
|
+
user: {
|
|
616
|
+
_id: (auth == null ? void 0 : auth.id) || ""
|
|
617
|
+
},
|
|
618
|
+
isTyping: true,
|
|
619
|
+
alwaysShowSend: loading ? false : true,
|
|
620
|
+
renderSend,
|
|
621
|
+
renderMessageText,
|
|
622
|
+
minInputToolbarHeight: 50,
|
|
623
|
+
renderActions: channelId && renderActions,
|
|
624
|
+
renderAccessory,
|
|
625
|
+
renderMessage,
|
|
626
|
+
renderChatFooter: () => /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(ImageViewerModal, { isVisible: isShowImageViewer, setVisible: setImageViewer, modalContent }), /* @__PURE__ */ React__default.createElement(SubscriptionHandler, { channelId: channelId == null ? void 0 : channelId.toString(), subscribeToNewMessages: () => subscribeToMore({
|
|
766
627
|
document: OnChatMessageAddedDocument,
|
|
767
628
|
variables: {
|
|
768
|
-
channelId: channelId
|
|
629
|
+
channelId: channelId == null ? void 0 : channelId.toString()
|
|
769
630
|
},
|
|
770
631
|
updateQuery: (prev, {
|
|
771
632
|
subscriptionData
|
|
772
633
|
}) => {
|
|
773
|
-
var
|
|
774
|
-
if (!subscriptionData.data)
|
|
634
|
+
var _a3, _b2, _c, _d, _e;
|
|
635
|
+
if (!subscriptionData.data)
|
|
636
|
+
return prev;
|
|
775
637
|
setSkip(0);
|
|
776
|
-
const newMessage = (
|
|
777
|
-
((
|
|
778
|
-
const totalMsgCount = ((_c = prev
|
|
779
|
-
setChannelMessages(oldMessages => uniqBy([...oldMessages, newMessage], ({
|
|
638
|
+
const newMessage = (_a3 = subscriptionData == null ? void 0 : subscriptionData.data) == null ? void 0 : _a3.chatMessageAdded;
|
|
639
|
+
((_b2 = prev == null ? void 0 : prev.messages) == null ? void 0 : _b2.data) ? [...prev.messages.data, newMessage] : [];
|
|
640
|
+
const totalMsgCount = ((_c = prev == null ? void 0 : prev.messages) == null ? void 0 : _c.totalCount) + 1;
|
|
641
|
+
setChannelMessages((oldMessages) => uniqBy([...oldMessages, newMessage], ({
|
|
780
642
|
id
|
|
781
643
|
}) => id));
|
|
782
644
|
setTotalCount(totalMsgCount);
|
|
783
|
-
const merged =
|
|
784
|
-
messages:
|
|
785
|
-
data: [...(
|
|
645
|
+
const merged = __spreadProps(__spreadValues({}, prev), {
|
|
646
|
+
messages: __spreadProps(__spreadValues({}, prev == null ? void 0 : prev.messages), {
|
|
647
|
+
data: [...(_e = (_d = prev == null ? void 0 : prev.messages) == null ? void 0 : _d.data) != null ? _e : [], newMessage],
|
|
786
648
|
totalCount: totalMsgCount
|
|
787
649
|
})
|
|
788
650
|
});
|
|
789
651
|
return merged;
|
|
790
|
-
// return Object.assign({}, prev, {
|
|
791
|
-
// messages: {
|
|
792
|
-
// data: [...prev.messages.data, newMessage],
|
|
793
|
-
// totalCount: prev.messages.totalCount + 1,
|
|
794
|
-
// },
|
|
795
|
-
// });
|
|
796
652
|
}
|
|
797
|
-
})
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
653
|
+
}) })),
|
|
654
|
+
lightboxProps: {
|
|
655
|
+
underlayColor: "transparent",
|
|
656
|
+
springConfig: {
|
|
657
|
+
tension: 9e4,
|
|
658
|
+
friction: 9e4
|
|
659
|
+
},
|
|
660
|
+
disabled: true
|
|
661
|
+
}
|
|
806
662
|
}
|
|
807
|
-
|
|
663
|
+
));
|
|
808
664
|
};
|
|
809
665
|
const SubscriptionHandler = ({
|
|
810
666
|
subscribeToNewMessages,
|
|
811
667
|
channelId
|
|
812
668
|
}) => {
|
|
813
669
|
useEffect(() => subscribeToNewMessages(), [channelId]);
|
|
814
|
-
return React__default.createElement(React__default.Fragment, null);
|
|
670
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null);
|
|
815
671
|
};
|
|
816
672
|
const ConversationView = React__default.memo(ConversationViewComponent);export{ConversationView};//# sourceMappingURL=ConversationView.js.map
|