@messenger-box/platform-mobile 0.0.1-alpha.392 → 0.0.1-alpha.393
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 +4 -0
- package/lib/index.js +167 -586
- package/lib/index.js.map +1 -1
- package/package.json +4 -4
- package/src/screens/inbox/components/DialogsListItem.tsx +85 -27
- package/src/screens/inbox/components/SlackMessageContainer/SlackMessage.tsx +36 -12
- package/src/screens/inbox/config/config.ts +1 -1
- package/src/screens/inbox/containers/ConversationView.tsx +72 -561
- package/src/screens/inbox/containers/ThreadConversationView.tsx +35 -33
|
@@ -77,6 +77,7 @@ export interface AlertMessageAttachmentsInterface {
|
|
|
77
77
|
|
|
78
78
|
interface IThreadSubscriptionHandlerProps {
|
|
79
79
|
subscribeToNewMessages: () => any;
|
|
80
|
+
channelId: string;
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
const ThreadConversationViewComponent = ({ channelId, postParentId, isPostParentIdThread, role }: any) => {
|
|
@@ -201,19 +202,19 @@ const ThreadConversationViewComponent = ({ channelId, postParentId, isPostParent
|
|
|
201
202
|
}, [parentId]);
|
|
202
203
|
|
|
203
204
|
useEffect(() => {
|
|
204
|
-
if (threadMessagesData?.threadMessages?.data) {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
// if (!isPostParentIdThread) {
|
|
213
|
-
// // setTotalCount((pc: any) => pc + threadTotalCount);
|
|
214
|
-
// setChannelMessages((oldMessages: any) => uniqBy([...threadMessage, ...oldMessages], ({ id }) => id));
|
|
215
|
-
// }
|
|
205
|
+
//if (threadMessagesData?.threadMessages?.data) {
|
|
206
|
+
// console.log('threadMessagesData?.threadMessages', JSON.stringify(threadMessagesData?.threadMessages));
|
|
207
|
+
const threads: any = threadMessagesData?.threadMessages;
|
|
208
|
+
if (threadPost?.length == 0 && threads?.data?.length > 0) {
|
|
209
|
+
const threadMessage = threads?.data?.map((t: any) => t?.post);
|
|
210
|
+
setThreadPost(threadMessage);
|
|
211
|
+
setChannelMessages((oldMessages: any) => uniqBy([...threadMessage, ...oldMessages], ({ id }) => id));
|
|
216
212
|
}
|
|
213
|
+
// if (!isPostParentIdThread) {
|
|
214
|
+
// // setTotalCount((pc: any) => pc + threadTotalCount);
|
|
215
|
+
// setChannelMessages((oldMessages: any) => uniqBy([...threadMessage, ...oldMessages], ({ id }) => id));
|
|
216
|
+
// }
|
|
217
|
+
// }
|
|
217
218
|
}, [threadMessagesData, threadPost, isPostParentIdThread]);
|
|
218
219
|
|
|
219
220
|
// React.useEffect(() => {
|
|
@@ -225,17 +226,17 @@ const ThreadConversationViewComponent = ({ channelId, postParentId, isPostParent
|
|
|
225
226
|
// }
|
|
226
227
|
// }, [newThreadMsg]);
|
|
227
228
|
|
|
228
|
-
React.useEffect(() => {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}, [newThreadMsg, skip, parentId]);
|
|
229
|
+
// React.useEffect(() => {
|
|
230
|
+
// if (newThreadMsg) {
|
|
231
|
+
// console.log('newThreadMsg');
|
|
232
|
+
// refetch({
|
|
233
|
+
// channelId: !parentId || parentId == 0 ? null : channelId?.toString(),
|
|
234
|
+
// parentId: !parentId || parentId == 0 ? null : parentId?.toString(),
|
|
235
|
+
// limit: MESSAGES_PER_PAGE,
|
|
236
|
+
// skip: 0,
|
|
237
|
+
// });
|
|
238
|
+
// }
|
|
239
|
+
// }, [newThreadMsg, skip, parentId]);
|
|
239
240
|
|
|
240
241
|
// useEffect(() => {
|
|
241
242
|
// if (data?.messages?.data && (loadingOldMessages || channelMessages.length === 0)) {
|
|
@@ -278,13 +279,13 @@ const ThreadConversationViewComponent = ({ channelId, postParentId, isPostParent
|
|
|
278
279
|
|
|
279
280
|
if (loadingOldMessages && channelMessages) setLoadingOldMessages(false);
|
|
280
281
|
|
|
281
|
-
if (
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
) {
|
|
286
|
-
|
|
287
|
-
}
|
|
282
|
+
// if (
|
|
283
|
+
// channelMessages &&
|
|
284
|
+
// channelMessages?.length == MESSAGES_PER_PAGE &&
|
|
285
|
+
// totalCount > channelMessages?.length
|
|
286
|
+
// ) {
|
|
287
|
+
// onFetchOld();
|
|
288
|
+
// }
|
|
288
289
|
}
|
|
289
290
|
|
|
290
291
|
// if (threadPost?.length > 0 && channelMessages.length == (0 || MESSAGES_PER_PAGE)) {
|
|
@@ -910,6 +911,7 @@ const ThreadConversationViewComponent = ({ channelId, postParentId, isPostParent
|
|
|
910
911
|
modalContent={modalContent}
|
|
911
912
|
/>
|
|
912
913
|
<SubscriptionHandler
|
|
914
|
+
channelId={channelId}
|
|
913
915
|
subscribeToNewMessages={() =>
|
|
914
916
|
subscribeToMore({
|
|
915
917
|
document: CHAT_MESSAGE_ADDED,
|
|
@@ -926,7 +928,7 @@ const ThreadConversationViewComponent = ({ channelId, postParentId, isPostParent
|
|
|
926
928
|
: [];
|
|
927
929
|
const totalMsgCount = prev?.messages?.totalCount + 1;
|
|
928
930
|
const merged = {
|
|
929
|
-
...prev,
|
|
931
|
+
...prev?.messages,
|
|
930
932
|
messages: {
|
|
931
933
|
...prev?.messages,
|
|
932
934
|
data: mergedData,
|
|
@@ -969,8 +971,8 @@ const ThreadConversationViewComponent = ({ channelId, postParentId, isPostParent
|
|
|
969
971
|
);
|
|
970
972
|
};
|
|
971
973
|
|
|
972
|
-
const SubscriptionHandler = ({ subscribeToNewMessages }: IThreadSubscriptionHandlerProps) => {
|
|
973
|
-
useEffect(() => subscribeToNewMessages(), []);
|
|
974
|
+
const SubscriptionHandler = ({ subscribeToNewMessages, channelId }: IThreadSubscriptionHandlerProps) => {
|
|
975
|
+
useEffect(() => subscribeToNewMessages(), [channelId]);
|
|
974
976
|
return <></>;
|
|
975
977
|
};
|
|
976
978
|
|