@messenger-box/platform-mobile 9.0.4-alpha.17 → 9.0.4-alpha.21
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/compute.js +2 -1
- package/lib/compute.js.map +1 -1
- package/lib/module.js.map +1 -1
- package/lib/routes.json +2 -1
- package/lib/screens/inbox/DialogMessages.js +4 -2
- package/lib/screens/inbox/DialogMessages.js.map +1 -1
- package/lib/screens/inbox/DialogThreadMessages.js +5 -3
- package/lib/screens/inbox/DialogThreadMessages.js.map +1 -1
- package/lib/screens/inbox/DialogThreads.js +31 -8
- package/lib/screens/inbox/DialogThreads.js.map +1 -1
- package/lib/screens/inbox/Inbox.js.map +1 -1
- package/lib/screens/inbox/components/CachedImage/index.js.map +1 -1
- package/lib/screens/inbox/components/DialogsListItem.js.map +1 -1
- package/lib/screens/inbox/components/ServiceDialogsListItem.js.map +1 -1
- package/lib/screens/inbox/components/SlackMessageContainer/ImageViewerModal.js.map +1 -1
- package/lib/screens/inbox/components/SlackMessageContainer/SlackBubble.js.map +1 -1
- package/lib/screens/inbox/components/SlackMessageContainer/SlackMessage.js.map +1 -1
- package/lib/screens/inbox/components/ThreadsViewItem.js.map +1 -1
- package/lib/screens/inbox/config/config.js.map +1 -1
- package/lib/screens/inbox/containers/ConversationView.js +26 -21
- package/lib/screens/inbox/containers/ConversationView.js.map +1 -1
- package/lib/screens/inbox/containers/Dialogs.js.map +1 -1
- package/lib/screens/inbox/containers/ThreadConversationView.d.ts +1 -1
- package/lib/screens/inbox/containers/ThreadConversationView.js +18 -5
- package/lib/screens/inbox/containers/ThreadConversationView.js.map +1 -1
- package/lib/screens/inbox/containers/ThreadsView.d.ts +6 -1
- package/lib/screens/inbox/containers/ThreadsView.js +36 -27
- package/lib/screens/inbox/containers/ThreadsView.js.map +1 -1
- package/package.json +4 -3
- package/src/screens/inbox/DialogMessages.tsx +8 -1
- package/src/screens/inbox/DialogThreadMessages.tsx +3 -3
- package/src/screens/inbox/DialogThreads.tsx +32 -11
- package/src/screens/inbox/containers/ConversationView.tsx +20 -15
- package/src/screens/inbox/containers/ThreadConversationView.tsx +18 -3
- package/src/screens/inbox/containers/ThreadsView.tsx +53 -28
|
@@ -16,6 +16,11 @@ import { config } from '../config';
|
|
|
16
16
|
const { MESSAGES_PER_PAGE } = config;
|
|
17
17
|
|
|
18
18
|
export interface ThreadsViewProps {
|
|
19
|
+
data: any;
|
|
20
|
+
loading: boolean;
|
|
21
|
+
refetch: any;
|
|
22
|
+
subscribeToMore: any;
|
|
23
|
+
error: any;
|
|
19
24
|
channelId?: string;
|
|
20
25
|
role?: string;
|
|
21
26
|
channelsDetail?: any;
|
|
@@ -27,7 +32,17 @@ interface IThreadSubscriptionHandlerProps {
|
|
|
27
32
|
channelId: string | undefined;
|
|
28
33
|
}
|
|
29
34
|
|
|
30
|
-
const ThreadsViewComponent = ({
|
|
35
|
+
const ThreadsViewComponent = ({
|
|
36
|
+
data,
|
|
37
|
+
loading: threadLoading,
|
|
38
|
+
refetch,
|
|
39
|
+
subscribeToMore,
|
|
40
|
+
error,
|
|
41
|
+
channelId,
|
|
42
|
+
role,
|
|
43
|
+
channelsDetail,
|
|
44
|
+
refetchChannelDetail,
|
|
45
|
+
}: ThreadsViewProps) => {
|
|
31
46
|
const { params } = useRoute<any>();
|
|
32
47
|
const auth = useSelector(userSelector);
|
|
33
48
|
const dispatch = useDispatch();
|
|
@@ -36,21 +51,21 @@ const ThreadsViewComponent = ({ channelId, role, channelsDetail, refetchChannelD
|
|
|
36
51
|
const [refreshing, setRefresh] = useState<boolean>(false);
|
|
37
52
|
const [threadData, setThreadsData] = useState<any>([]);
|
|
38
53
|
|
|
39
|
-
const {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
} = useThreadMessagesQuery({
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
});
|
|
54
|
+
// const {
|
|
55
|
+
// data,
|
|
56
|
+
// loading: threadLoading,
|
|
57
|
+
// error,
|
|
58
|
+
// refetch,
|
|
59
|
+
// subscribeToMore,
|
|
60
|
+
// } = useThreadMessagesQuery({
|
|
61
|
+
// variables: {
|
|
62
|
+
// channelId: channelId?.toString(),
|
|
63
|
+
// role: role?.toString(),
|
|
64
|
+
// limit: MESSAGES_PER_PAGE,
|
|
65
|
+
// repliesLimit2: 5,
|
|
66
|
+
// },
|
|
67
|
+
// // fetchPolicy: 'cache-and-network',
|
|
68
|
+
// });
|
|
54
69
|
|
|
55
70
|
// const { data: threadCreatedUpdated } = useOnThreadCreatedUpdatedSubscription({
|
|
56
71
|
// variables: { channelId: channelId?.toString() },
|
|
@@ -64,6 +79,7 @@ const ThreadsViewComponent = ({ channelId, role, channelsDetail, refetchChannelD
|
|
|
64
79
|
channelId: channelId?.toString(),
|
|
65
80
|
role: role?.toString(),
|
|
66
81
|
limit: MESSAGES_PER_PAGE,
|
|
82
|
+
repliesLimit2: 5,
|
|
67
83
|
});
|
|
68
84
|
// .then(({ data }) => {
|
|
69
85
|
// if (!data?.threadMessages?.data) {
|
|
@@ -80,7 +96,7 @@ const ThreadsViewComponent = ({ channelId, role, channelsDetail, refetchChannelD
|
|
|
80
96
|
// Do something when the screen is unfocused
|
|
81
97
|
// Useful for cleanup functions
|
|
82
98
|
};
|
|
83
|
-
}, [
|
|
99
|
+
}, []),
|
|
84
100
|
);
|
|
85
101
|
|
|
86
102
|
// React.useEffect(() => {
|
|
@@ -121,9 +137,12 @@ const ThreadsViewComponent = ({ channelId, role, channelsDetail, refetchChannelD
|
|
|
121
137
|
// }, [threadData]);
|
|
122
138
|
|
|
123
139
|
const threads = React.useMemo(() => {
|
|
124
|
-
if (!data?.threadMessages?.data?.length) return null;
|
|
125
|
-
const { data: newThreads } = data?.threadMessages;
|
|
126
|
-
|
|
140
|
+
// if (!data?.threadMessages?.data?.length) return null;
|
|
141
|
+
// const { data: newThreads } = data?.threadMessages;
|
|
142
|
+
if (data?.threadMessages?.data?.length == 0) return [];
|
|
143
|
+
const threadsFiltered = data?.threadMessages?.data
|
|
144
|
+
? uniqBy([...data?.threadMessages?.data], ({ id }: any) => id)
|
|
145
|
+
: [];
|
|
127
146
|
return orderBy(threadsFiltered, ['updatedAt'], ['desc']) || [];
|
|
128
147
|
}, [data]);
|
|
129
148
|
|
|
@@ -163,6 +182,7 @@ const ThreadsViewComponent = ({ channelId, role, channelsDetail, refetchChannelD
|
|
|
163
182
|
channelId: channelId?.toString(),
|
|
164
183
|
role: role?.toString(),
|
|
165
184
|
limit: MESSAGES_PER_PAGE,
|
|
185
|
+
repliesLimit2: 5,
|
|
166
186
|
});
|
|
167
187
|
// .then(({ data }) => {
|
|
168
188
|
// if (!data?.threadMessages?.data) {
|
|
@@ -191,6 +211,7 @@ const ThreadsViewComponent = ({ channelId, role, channelsDetail, refetchChannelD
|
|
|
191
211
|
// </Center>
|
|
192
212
|
// );
|
|
193
213
|
// }
|
|
214
|
+
console.log('threadLoading', threadLoading, ' threads?.length=', threads?.length);
|
|
194
215
|
|
|
195
216
|
return (
|
|
196
217
|
<Box
|
|
@@ -220,13 +241,15 @@ const ThreadsViewComponent = ({ channelId, role, channelsDetail, refetchChannelD
|
|
|
220
241
|
)}
|
|
221
242
|
ListEmptyComponent={() => (
|
|
222
243
|
<>
|
|
223
|
-
{!threadLoading || threads?.length == 0}
|
|
224
|
-
|
|
225
|
-
<
|
|
226
|
-
<
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
244
|
+
{/* {!threadLoading || threads?.length == 0} */}
|
|
245
|
+
{!threadLoading && threads?.length == 0 && (
|
|
246
|
+
<Box p={'$5'}>
|
|
247
|
+
<Center mt={'$6'}>
|
|
248
|
+
<Ionicons name="chatbubbles" size={50} />
|
|
249
|
+
<Text>You don't have any message yet!</Text>
|
|
250
|
+
</Center>
|
|
251
|
+
</Box>
|
|
252
|
+
)}
|
|
230
253
|
</>
|
|
231
254
|
)}
|
|
232
255
|
ListFooterComponent={() => (
|
|
@@ -284,4 +307,6 @@ const SubscriptionHandler = ({ subscribeToNewMessages, channelId }: IThreadSubsc
|
|
|
284
307
|
return <></>;
|
|
285
308
|
};
|
|
286
309
|
|
|
287
|
-
export const ThreadsView =
|
|
310
|
+
export const ThreadsView = ThreadsViewComponent;
|
|
311
|
+
|
|
312
|
+
// export const ThreadsView = React.memo(ThreadsViewComponent);
|