@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.
Files changed (36) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/lib/compute.js +2 -1
  3. package/lib/compute.js.map +1 -1
  4. package/lib/module.js.map +1 -1
  5. package/lib/routes.json +2 -1
  6. package/lib/screens/inbox/DialogMessages.js +4 -2
  7. package/lib/screens/inbox/DialogMessages.js.map +1 -1
  8. package/lib/screens/inbox/DialogThreadMessages.js +5 -3
  9. package/lib/screens/inbox/DialogThreadMessages.js.map +1 -1
  10. package/lib/screens/inbox/DialogThreads.js +31 -8
  11. package/lib/screens/inbox/DialogThreads.js.map +1 -1
  12. package/lib/screens/inbox/Inbox.js.map +1 -1
  13. package/lib/screens/inbox/components/CachedImage/index.js.map +1 -1
  14. package/lib/screens/inbox/components/DialogsListItem.js.map +1 -1
  15. package/lib/screens/inbox/components/ServiceDialogsListItem.js.map +1 -1
  16. package/lib/screens/inbox/components/SlackMessageContainer/ImageViewerModal.js.map +1 -1
  17. package/lib/screens/inbox/components/SlackMessageContainer/SlackBubble.js.map +1 -1
  18. package/lib/screens/inbox/components/SlackMessageContainer/SlackMessage.js.map +1 -1
  19. package/lib/screens/inbox/components/ThreadsViewItem.js.map +1 -1
  20. package/lib/screens/inbox/config/config.js.map +1 -1
  21. package/lib/screens/inbox/containers/ConversationView.js +26 -21
  22. package/lib/screens/inbox/containers/ConversationView.js.map +1 -1
  23. package/lib/screens/inbox/containers/Dialogs.js.map +1 -1
  24. package/lib/screens/inbox/containers/ThreadConversationView.d.ts +1 -1
  25. package/lib/screens/inbox/containers/ThreadConversationView.js +18 -5
  26. package/lib/screens/inbox/containers/ThreadConversationView.js.map +1 -1
  27. package/lib/screens/inbox/containers/ThreadsView.d.ts +6 -1
  28. package/lib/screens/inbox/containers/ThreadsView.js +36 -27
  29. package/lib/screens/inbox/containers/ThreadsView.js.map +1 -1
  30. package/package.json +4 -3
  31. package/src/screens/inbox/DialogMessages.tsx +8 -1
  32. package/src/screens/inbox/DialogThreadMessages.tsx +3 -3
  33. package/src/screens/inbox/DialogThreads.tsx +32 -11
  34. package/src/screens/inbox/containers/ConversationView.tsx +20 -15
  35. package/src/screens/inbox/containers/ThreadConversationView.tsx +18 -3
  36. 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 = ({ channelId, role, channelsDetail, refetchChannelDetail }: ThreadsViewProps) => {
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
- data,
41
- loading: threadLoading,
42
- error,
43
- refetch,
44
- subscribeToMore,
45
- } = useThreadMessagesQuery({
46
- variables: {
47
- channelId: channelId?.toString(),
48
- role: role?.toString(),
49
- limit: MESSAGES_PER_PAGE,
50
- repliesLimit2: 5,
51
- },
52
- fetchPolicy: 'cache-and-network',
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
- }, [channelId]),
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
- const threadsFiltered = newThreads ? uniqBy([...newThreads], ({ id }: any) => id) : [];
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
- <Box p={'$5'}>
225
- <Center mt={'$6'}>
226
- <Ionicons name="chatbubbles" size={50} />
227
- <Text>You don't have any message yet!</Text>
228
- </Center>
229
- </Box>
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 = React.memo(ThreadsViewComponent);
310
+ export const ThreadsView = ThreadsViewComponent;
311
+
312
+ // export const ThreadsView = React.memo(ThreadsViewComponent);