@planningcenter/chat-react-native 4.2.1-qa-staging.2 → 4.2.1-qa-staging.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.
Files changed (87) hide show
  1. package/build/components/conversation/message_form.d.ts.map +1 -1
  2. package/build/components/conversation/message_form.js +1 -1
  3. package/build/components/conversation/message_form.js.map +1 -1
  4. package/build/contexts/conversation_context.d.ts +3 -1
  5. package/build/contexts/conversation_context.d.ts.map +1 -1
  6. package/build/contexts/conversation_context.js +23 -18
  7. package/build/contexts/conversation_context.js.map +1 -1
  8. package/build/hooks/use_conversation_message_lookup.d.ts +7 -0
  9. package/build/hooks/use_conversation_message_lookup.d.ts.map +1 -0
  10. package/build/hooks/use_conversation_message_lookup.js +52 -0
  11. package/build/hooks/use_conversation_message_lookup.js.map +1 -0
  12. package/build/hooks/use_conversation_messages.d.ts +1 -0
  13. package/build/hooks/use_conversation_messages.d.ts.map +1 -1
  14. package/build/hooks/use_conversation_messages.js +8 -1
  15. package/build/hooks/use_conversation_messages.js.map +1 -1
  16. package/build/hooks/use_conversation_messages_jolt_events.d.ts +12 -4
  17. package/build/hooks/use_conversation_messages_jolt_events.d.ts.map +1 -1
  18. package/build/hooks/use_conversation_messages_jolt_events.js +82 -88
  19. package/build/hooks/use_conversation_messages_jolt_events.js.map +1 -1
  20. package/build/hooks/use_fetch_newer_messages.d.ts.map +1 -1
  21. package/build/hooks/use_fetch_newer_messages.js +27 -21
  22. package/build/hooks/use_fetch_newer_messages.js.map +1 -1
  23. package/build/hooks/use_fetch_newer_on_foreground.d.ts +1 -1
  24. package/build/hooks/use_fetch_newer_on_foreground.d.ts.map +1 -1
  25. package/build/hooks/use_fetch_newer_on_foreground.js +2 -1
  26. package/build/hooks/use_fetch_newer_on_foreground.js.map +1 -1
  27. package/build/hooks/use_held_back_messages.d.ts +11 -0
  28. package/build/hooks/use_held_back_messages.d.ts.map +1 -0
  29. package/build/hooks/use_held_back_messages.js +24 -0
  30. package/build/hooks/use_held_back_messages.js.map +1 -0
  31. package/build/hooks/use_message_create_or_update.d.ts.map +1 -1
  32. package/build/hooks/use_message_create_or_update.js +91 -80
  33. package/build/hooks/use_message_create_or_update.js.map +1 -1
  34. package/build/hooks/use_message_reaction_toggle.d.ts.map +1 -1
  35. package/build/hooks/use_message_reaction_toggle.js +45 -40
  36. package/build/hooks/use_message_reaction_toggle.js.map +1 -1
  37. package/build/screens/conversation_new/components/services_form.js.map +1 -1
  38. package/build/screens/conversation_screen.d.ts.map +1 -1
  39. package/build/screens/conversation_screen.js +485 -156
  40. package/build/screens/conversation_screen.js.map +1 -1
  41. package/build/screens/message_actions_screen.d.ts.map +1 -1
  42. package/build/screens/message_actions_screen.js +21 -26
  43. package/build/screens/message_actions_screen.js.map +1 -1
  44. package/build/screens/message_report_screen.d.ts.map +1 -1
  45. package/build/screens/message_report_screen.js +17 -44
  46. package/build/screens/message_report_screen.js.map +1 -1
  47. package/build/screens/reactions_screen.d.ts.map +1 -1
  48. package/build/screens/reactions_screen.js +70 -88
  49. package/build/screens/reactions_screen.js.map +1 -1
  50. package/build/utils/cache/find_message_in_caches.d.ts +4 -0
  51. package/build/utils/cache/find_message_in_caches.d.ts.map +1 -0
  52. package/build/utils/cache/find_message_in_caches.js +16 -0
  53. package/build/utils/cache/find_message_in_caches.js.map +1 -0
  54. package/build/utils/cache/optimistically_update_message.d.ts +2 -1
  55. package/build/utils/cache/optimistically_update_message.d.ts.map +1 -1
  56. package/build/utils/cache/optimistically_update_message.js +4 -4
  57. package/build/utils/cache/optimistically_update_message.js.map +1 -1
  58. package/build/utils/cache/prepend_newer_page.d.ts +1 -1
  59. package/build/utils/cache/prepend_newer_page.d.ts.map +1 -1
  60. package/build/utils/cache/prepend_newer_page.js +10 -9
  61. package/build/utils/cache/prepend_newer_page.js.map +1 -1
  62. package/package.json +3 -3
  63. package/src/__tests__/hooks/use_conversation_messages.test.ts +22 -0
  64. package/src/__tests__/hooks/use_conversation_messages_jolt_events.test.ts +22 -25
  65. package/src/components/conversation/message_form.tsx +1 -2
  66. package/src/contexts/conversation_context.tsx +6 -1
  67. package/src/hooks/__tests__/use_fetch_newer_messages.test.tsx +68 -0
  68. package/src/hooks/__tests__/use_held_back_messages.test.tsx +60 -0
  69. package/src/hooks/__tests__/use_message_reaction_toggle.test.tsx +73 -0
  70. package/src/hooks/use_conversation_message_lookup.ts +29 -0
  71. package/src/hooks/use_conversation_messages.ts +9 -0
  72. package/src/hooks/use_conversation_messages_jolt_events.ts +43 -41
  73. package/src/hooks/use_fetch_newer_messages.ts +19 -12
  74. package/src/hooks/use_fetch_newer_on_foreground.ts +2 -2
  75. package/src/hooks/use_held_back_messages.ts +33 -0
  76. package/src/hooks/use_message_create_or_update.ts +8 -8
  77. package/src/hooks/use_message_reaction_toggle.ts +3 -1
  78. package/src/screens/conversation_new/components/services_form.tsx +1 -1
  79. package/src/screens/conversation_screen.tsx +20 -20
  80. package/src/screens/message_actions_screen.tsx +3 -5
  81. package/src/screens/message_report_screen.tsx +2 -3
  82. package/src/screens/reactions_screen.tsx +2 -4
  83. package/src/utils/cache/__tests__/find_message_in_caches.test.ts +37 -0
  84. package/src/utils/cache/__tests__/prepend_newer_page.test.ts +13 -14
  85. package/src/utils/cache/find_message_in_caches.ts +20 -0
  86. package/src/utils/cache/optimistically_update_message.ts +2 -5
  87. package/src/utils/cache/prepend_newer_page.ts +7 -10
@@ -23,15 +23,17 @@ import { useConversationMessages } from '../hooks/use_conversation_messages';
23
23
  import { useConversationMessagesJoltEvents } from '../hooks/use_conversation_messages_jolt_events';
24
24
  import { useFetchNewerMessages } from '../hooks/use_fetch_newer_messages';
25
25
  import { useFetchNewerOnForeground } from '../hooks/use_fetch_newer_on_foreground';
26
+ import { useHeldBackMessages } from '../hooks/use_held_back_messages';
26
27
  import { useMarkLatestMessageRead } from '../hooks/use_mark_latest_message_read';
27
28
  import { analyticsEvents, normalizeAnalyticsMetadata, usePublishProductAnalyticsEvent } from '../hooks/use_product_analytics';
28
29
  import { useRestAwayFromDismissEdge } from '../hooks/use_rest_away_from_dismiss_edge';
29
30
  import { useVideoModerationJoltEvents } from '../hooks/use_video_moderation_jolt_events';
30
31
  import { gatedMessageCache } from '../utils/gated_message_cache';
32
+ import { getMessagesQueryKey } from '../utils/request/get_messages';
31
33
  import { decodeUlidTime } from '../utils/ulid';
32
34
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
33
35
  export function ConversationScreen(t0) {
34
- const $ = _c(19);
36
+ const $ = _c(24);
35
37
  const {
36
38
  route
37
39
  } = t0;
@@ -102,8 +104,22 @@ export function ConversationScreen(t0) {
102
104
  usePublishProductAnalyticsEvent(analyticsEvents.conversation_show_opened, t6);
103
105
  const t7 = reply_root_id ?? null;
104
106
  let t8;
105
- if ($[12] !== anchor || $[13] !== route) {
106
- t8 = anchor ? /*#__PURE__*/_jsx(AnchorNotFoundBoundary, {
107
+ if ($[12] !== anchor || $[13] !== conversation_id || $[14] !== reply_root_id) {
108
+ t8 = getMessagesQueryKey({
109
+ conversation_id,
110
+ reply_root_id,
111
+ anchor
112
+ });
113
+ $[12] = anchor;
114
+ $[13] = conversation_id;
115
+ $[14] = reply_root_id;
116
+ $[15] = t8;
117
+ } else {
118
+ t8 = $[15];
119
+ }
120
+ let t9;
121
+ if ($[16] !== anchor || $[17] !== route) {
122
+ t9 = anchor ? /*#__PURE__*/_jsx(AnchorNotFoundBoundary, {
107
123
  onAnchorNotFound: dropAnchor,
108
124
  children: /*#__PURE__*/_jsx(ConversationScreenContent, {
109
125
  route: route,
@@ -115,33 +131,37 @@ export function ConversationScreen(t0) {
115
131
  anchor: null,
116
132
  onExitAnchoredMode: exitAnchoredMode
117
133
  });
118
- $[12] = anchor;
119
- $[13] = route;
120
- $[14] = t8;
134
+ $[16] = anchor;
135
+ $[17] = route;
136
+ $[18] = t9;
121
137
  } else {
122
- t8 = $[14];
138
+ t9 = $[18];
123
139
  }
124
- let t9;
125
- if ($[15] !== conversation_id || $[16] !== t7 || $[17] !== t8) {
126
- t9 = /*#__PURE__*/_jsx(ConversationContextProvider, {
140
+ let t10;
141
+ if ($[19] !== conversation_id || $[20] !== t7 || $[21] !== t8 || $[22] !== t9) {
142
+ t10 = /*#__PURE__*/_jsx(ConversationContextProvider, {
127
143
  conversationId: conversation_id,
128
144
  currentPageReplyRootId: t7,
129
- children: t8
145
+ messagesQueryKey: t8,
146
+ children: t9
130
147
  });
131
- $[15] = conversation_id;
132
- $[16] = t7;
133
- $[17] = t8;
134
- $[18] = t9;
148
+ $[19] = conversation_id;
149
+ $[20] = t7;
150
+ $[21] = t8;
151
+ $[22] = t9;
152
+ $[23] = t10;
135
153
  } else {
136
- t9 = $[18];
154
+ t10 = $[23];
137
155
  }
138
- return t9;
156
+ return t10;
139
157
  }
140
- function ConversationScreenContent({
141
- route,
142
- anchor,
143
- onExitAnchoredMode
144
- }) {
158
+ function ConversationScreenContent(t0) {
159
+ const $ = _c(118);
160
+ const {
161
+ route,
162
+ anchor,
163
+ onExitAnchoredMode
164
+ } = t0;
145
165
  const styles = useStyles();
146
166
  const navigation = useNavigation();
147
167
  const {
@@ -154,6 +174,20 @@ function ConversationScreenContent({
154
174
  data: conversation
155
175
  } = useConversation(route.params);
156
176
  const anchored = !!anchor;
177
+ let t1;
178
+ if ($[0] !== anchor || $[1] !== conversation_id || $[2] !== reply_root_id) {
179
+ t1 = {
180
+ conversation_id,
181
+ reply_root_id,
182
+ anchor
183
+ };
184
+ $[0] = anchor;
185
+ $[1] = conversation_id;
186
+ $[2] = reply_root_id;
187
+ $[3] = t1;
188
+ } else {
189
+ t1 = $[3];
190
+ }
157
191
  const {
158
192
  messages,
159
193
  fetchNextPage,
@@ -162,50 +196,124 @@ function ConversationScreenContent({
162
196
  hasPreviousPage,
163
197
  isFetchingPreviousPage,
164
198
  queryKey
165
- } = useConversationMessages({
166
- conversation_id,
167
- reply_root_id,
168
- anchor
169
- });
199
+ } = useConversationMessages(t1);
170
200
  const behindLatest = anchored && hasPreviousPage;
171
201
  const caughtUp = !hasPreviousPage;
172
202
  const [showJumpToBottomButton, setShowJumpToBottomButton] = useState(false);
173
203
  const readingHistory = showJumpToBottomButton;
174
- const skippedNewMessages = useRef(false);
175
- const messageCaches = [gatedMessageCache({
176
- queryKey,
177
- acceptNewMessages: caughtUp && !readingHistory,
178
- onSkippedNewMessage: () => {
179
- skippedNewMessages.current = true;
180
- }
181
- })];
182
204
  const newestMessageId = messages[0]?.id;
183
- useConversationJoltEvents({
184
- conversationId: conversation_id
185
- });
186
- useConversationMessagesJoltEvents({
187
- conversationId: conversation_id,
188
- messageCaches
189
- });
205
+ let t2;
206
+ if ($[4] !== conversation_id || $[5] !== queryKey || $[6] !== reply_root_id) {
207
+ t2 = {
208
+ conversation_id,
209
+ reply_root_id,
210
+ queryKey
211
+ };
212
+ $[4] = conversation_id;
213
+ $[5] = queryKey;
214
+ $[6] = reply_root_id;
215
+ $[7] = t2;
216
+ } else {
217
+ t2 = $[7];
218
+ }
219
+ const fetchNewer = useFetchNewerMessages(t2);
220
+ let t3;
221
+ if ($[8] !== caughtUp || $[9] !== fetchNewer || $[10] !== newestMessageId || $[11] !== readingHistory) {
222
+ t3 = {
223
+ fetchNewer,
224
+ newestMessageId,
225
+ readingHistory,
226
+ caughtUp
227
+ };
228
+ $[8] = caughtUp;
229
+ $[9] = fetchNewer;
230
+ $[10] = newestMessageId;
231
+ $[11] = readingHistory;
232
+ $[12] = t3;
233
+ } else {
234
+ t3 = $[12];
235
+ }
236
+ const {
237
+ onSkippedNewMessage
238
+ } = useHeldBackMessages(t3);
239
+ let t4;
240
+ if ($[13] !== conversation_id) {
241
+ t4 = {
242
+ conversationId: conversation_id
243
+ };
244
+ $[13] = conversation_id;
245
+ $[14] = t4;
246
+ } else {
247
+ t4 = $[14];
248
+ }
249
+ useConversationJoltEvents(t4);
250
+ const t5 = reply_root_id ?? null;
251
+ const t6 = caughtUp && !readingHistory;
252
+ let t7;
253
+ if ($[15] !== onSkippedNewMessage || $[16] !== queryKey || $[17] !== t6) {
254
+ t7 = gatedMessageCache({
255
+ queryKey,
256
+ acceptNewMessages: t6,
257
+ onSkippedNewMessage
258
+ });
259
+ $[15] = onSkippedNewMessage;
260
+ $[16] = queryKey;
261
+ $[17] = t6;
262
+ $[18] = t7;
263
+ } else {
264
+ t7 = $[18];
265
+ }
266
+ let t8;
267
+ if ($[19] !== conversation_id || $[20] !== t5 || $[21] !== t7) {
268
+ t8 = {
269
+ conversationId: conversation_id,
270
+ replyRootId: t5,
271
+ messageCache: t7
272
+ };
273
+ $[19] = conversation_id;
274
+ $[20] = t5;
275
+ $[21] = t7;
276
+ $[22] = t8;
277
+ } else {
278
+ t8 = $[22];
279
+ }
280
+ useConversationMessagesJoltEvents(t8);
190
281
  const {
191
282
  markHandledByMessageForm
192
283
  } = useVideoModerationJoltEvents();
193
284
  useEnsureConversationsRouteExists();
194
- useMarkLatestMessageRead({
195
- conversation,
196
- messages,
197
- enabled: !behindLatest
198
- });
199
- const fetchNewer = useFetchNewerMessages({
200
- conversation_id,
201
- reply_root_id,
202
- queryKey
203
- });
204
- useFetchNewerOnForeground({
205
- fetchNewer,
206
- newestMessageId,
207
- enabled: anchored && caughtUp
208
- });
285
+ const t9 = !behindLatest;
286
+ let t10;
287
+ if ($[23] !== conversation || $[24] !== messages || $[25] !== t9) {
288
+ t10 = {
289
+ conversation,
290
+ messages,
291
+ enabled: t9
292
+ };
293
+ $[23] = conversation;
294
+ $[24] = messages;
295
+ $[25] = t9;
296
+ $[26] = t10;
297
+ } else {
298
+ t10 = $[26];
299
+ }
300
+ useMarkLatestMessageRead(t10);
301
+ const t11 = anchored && caughtUp;
302
+ let t12;
303
+ if ($[27] !== fetchNewer || $[28] !== newestMessageId || $[29] !== t11) {
304
+ t12 = {
305
+ fetchNewer,
306
+ newestMessageId,
307
+ enabled: t11
308
+ };
309
+ $[27] = fetchNewer;
310
+ $[28] = newestMessageId;
311
+ $[29] = t11;
312
+ $[30] = t12;
313
+ } else {
314
+ t12 = $[30];
315
+ }
316
+ useFetchNewerOnForeground(t12);
209
317
  const noMessages = messages.length === 0;
210
318
  const {
211
319
  repliesDisabled,
@@ -215,127 +323,348 @@ function ConversationScreenContent({
215
323
  } = conversation;
216
324
  const canReply = memberAbility?.canReply;
217
325
  const showLeaderDisabledReplyBanner = canReply && repliesDisabled;
218
- const currentlyEditingMessage = messages.find(m => String(m.id) === String(editing_message_id));
219
- const replyRootAuthorFirstName = reply_root_author_name?.split(' ')[0];
220
- const replyHeaderTitle = replyRootAuthorFirstName ? `Reply to ${replyRootAuthorFirstName}` : 'Reply';
221
- // Prefer the membership for optimistic updates.
326
+ let t13;
327
+ if ($[31] !== editing_message_id || $[32] !== messages) {
328
+ let t14;
329
+ if ($[34] !== editing_message_id) {
330
+ t14 = m => String(m.id) === String(editing_message_id);
331
+ $[34] = editing_message_id;
332
+ $[35] = t14;
333
+ } else {
334
+ t14 = $[35];
335
+ }
336
+ t13 = messages.find(t14);
337
+ $[31] = editing_message_id;
338
+ $[32] = messages;
339
+ $[33] = t13;
340
+ } else {
341
+ t13 = $[33];
342
+ }
343
+ const currentlyEditingMessage = t13;
344
+ let t14;
345
+ if ($[36] !== reply_root_author_name) {
346
+ t14 = reply_root_author_name?.split(" ")[0];
347
+ $[36] = reply_root_author_name;
348
+ $[37] = t14;
349
+ } else {
350
+ t14 = $[37];
351
+ }
352
+ const replyRootAuthorFirstName = t14;
353
+ const replyHeaderTitle = replyRootAuthorFirstName ? `Reply to ${replyRootAuthorFirstName}` : "Reply";
222
354
  const muted = conversation.conversationMembership?.muted ?? conversation.muted;
223
355
  const listRef = useRef(null);
224
356
  const [hasDragged, setHasDragged] = useState(false);
225
357
  const holdListPosition = behindLatest || readingHistory;
358
+ let t15;
359
+ if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
360
+ t15 = {
361
+ listRef,
362
+ enabled: Platform.OS === "ios"
363
+ };
364
+ $[38] = t15;
365
+ } else {
366
+ t15 = $[38];
367
+ }
226
368
  const {
227
369
  restOffset,
228
370
  onLayout,
229
371
  onContentSizeChange,
230
372
  onMomentumScrollEnd,
231
373
  onScrollEndDrag
232
- } = useRestAwayFromDismissEdge({
233
- listRef,
234
- enabled: Platform.OS === 'ios'
235
- });
236
- const handleReturnToBottom = useCallback(() => {
237
- listRef.current?.scrollToOffset({
238
- offset: restOffset
239
- });
240
- }, [restOffset]);
241
- const exitAnchoredMode = useCallback(() => {
242
- onExitAnchoredMode();
243
- handleReturnToBottom();
244
- }, [handleReturnToBottom, onExitAnchoredMode]);
245
- const jumpToLatest = useCallback(() => {
246
- setShowJumpToBottomButton(false);
247
- if (behindLatest) exitAnchoredMode();else handleReturnToBottom();
248
- }, [behindLatest, exitAnchoredMode, handleReturnToBottom]);
249
- const trackScroll = event => {
250
- const offsetY = event.nativeEvent.contentOffset.y;
251
- setShowJumpToBottomButton(offsetY > 200);
252
- };
253
- const loadNewerMessages = () => {
254
- if (!hasPreviousPage || isFetchingPreviousPage) return;
255
- setHasDragged(false);
256
- fetchPreviousPage();
257
- };
258
- useEffect(() => {
259
- if (readingHistory || !caughtUp || !newestMessageId || !skippedNewMessages.current) return;
260
- skippedNewMessages.current = false;
261
- fetchNewer(newestMessageId);
262
- }, [caughtUp, fetchNewer, newestMessageId, readingHistory]);
263
- useEffect(() => {
264
- if (reply_root_id) {
265
- navigation.setParams({
266
- title: replyHeaderTitle
374
+ } = useRestAwayFromDismissEdge(t15);
375
+ let t16;
376
+ if ($[39] !== restOffset) {
377
+ t16 = () => {
378
+ listRef.current?.scrollToOffset({
379
+ offset: restOffset
380
+ });
381
+ };
382
+ $[39] = restOffset;
383
+ $[40] = t16;
384
+ } else {
385
+ t16 = $[40];
386
+ }
387
+ const handleReturnToBottom = t16;
388
+ let t17;
389
+ if ($[41] !== handleReturnToBottom || $[42] !== onExitAnchoredMode) {
390
+ t17 = () => {
391
+ onExitAnchoredMode();
392
+ handleReturnToBottom();
393
+ };
394
+ $[41] = handleReturnToBottom;
395
+ $[42] = onExitAnchoredMode;
396
+ $[43] = t17;
397
+ } else {
398
+ t17 = $[43];
399
+ }
400
+ const exitAnchoredMode = t17;
401
+ let t18;
402
+ if ($[44] !== anchored || $[45] !== exitAnchoredMode || $[46] !== handleReturnToBottom) {
403
+ t18 = () => {
404
+ setShowJumpToBottomButton(false);
405
+ if (anchored) {
406
+ exitAnchoredMode();
407
+ } else {
408
+ handleReturnToBottom();
409
+ }
410
+ };
411
+ $[44] = anchored;
412
+ $[45] = exitAnchoredMode;
413
+ $[46] = handleReturnToBottom;
414
+ $[47] = t18;
415
+ } else {
416
+ t18 = $[47];
417
+ }
418
+ const jumpToLatest = t18;
419
+ let t19;
420
+ if ($[48] === Symbol.for("react.memo_cache_sentinel")) {
421
+ t19 = event => {
422
+ const offsetY = event.nativeEvent.contentOffset.y;
423
+ setShowJumpToBottomButton(offsetY > 200);
424
+ };
425
+ $[48] = t19;
426
+ } else {
427
+ t19 = $[48];
428
+ }
429
+ const trackScroll = t19;
430
+ let t20;
431
+ if ($[49] !== fetchPreviousPage || $[50] !== hasPreviousPage || $[51] !== isFetchingPreviousPage) {
432
+ t20 = () => {
433
+ if (!hasPreviousPage || isFetchingPreviousPage) {
434
+ return;
435
+ }
436
+ setHasDragged(false);
437
+ fetchPreviousPage();
438
+ };
439
+ $[49] = fetchPreviousPage;
440
+ $[50] = hasPreviousPage;
441
+ $[51] = isFetchingPreviousPage;
442
+ $[52] = t20;
443
+ } else {
444
+ t20 = $[52];
445
+ }
446
+ const loadNewerMessages = t20;
447
+ let t21;
448
+ if ($[53] !== badges?.[0] || $[54] !== conversation.deleted || $[55] !== muted || $[56] !== navigation || $[57] !== replyHeaderTitle || $[58] !== reply_root_id || $[59] !== title) {
449
+ t21 = () => {
450
+ if (reply_root_id) {
451
+ navigation.setParams({
452
+ title: replyHeaderTitle
453
+ });
454
+ } else {
455
+ navigation.setParams({
456
+ title,
457
+ badge: badges?.[0],
458
+ deleted: conversation?.deleted,
459
+ muted
460
+ });
461
+ }
462
+ };
463
+ $[53] = badges?.[0];
464
+ $[54] = conversation.deleted;
465
+ $[55] = muted;
466
+ $[56] = navigation;
467
+ $[57] = replyHeaderTitle;
468
+ $[58] = reply_root_id;
469
+ $[59] = title;
470
+ $[60] = t21;
471
+ } else {
472
+ t21 = $[60];
473
+ }
474
+ const t22 = conversation?.deleted;
475
+ let t23;
476
+ if ($[61] !== badges || $[62] !== muted || $[63] !== navigation || $[64] !== replyHeaderTitle || $[65] !== reply_root_id || $[66] !== t22 || $[67] !== title) {
477
+ t23 = [navigation, title, badges, t22, reply_root_id, replyHeaderTitle, muted];
478
+ $[61] = badges;
479
+ $[62] = muted;
480
+ $[63] = navigation;
481
+ $[64] = replyHeaderTitle;
482
+ $[65] = reply_root_id;
483
+ $[66] = t22;
484
+ $[67] = title;
485
+ $[68] = t23;
486
+ } else {
487
+ t23 = $[68];
488
+ }
489
+ useEffect(t21, t23);
490
+ if (!conversation || conversation.deleted) {
491
+ let t24;
492
+ if ($[69] === Symbol.for("react.memo_cache_sentinel")) {
493
+ t24 = /*#__PURE__*/_jsx(BlankState.Imagery, {
494
+ name: "general.outlinedTextMessage"
267
495
  });
496
+ $[69] = t24;
268
497
  } else {
269
- navigation.setParams({
270
- title: title,
271
- badge: badges?.[0],
272
- deleted: conversation?.deleted,
273
- muted
498
+ t24 = $[69];
499
+ }
500
+ let t25;
501
+ if ($[70] === Symbol.for("react.memo_cache_sentinel")) {
502
+ t25 = /*#__PURE__*/_jsx(BlankState.Content, {
503
+ children: /*#__PURE__*/_jsx(BlankState.Heading, {
504
+ children: "This conversation has been deleted"
505
+ })
274
506
  });
507
+ $[70] = t25;
508
+ } else {
509
+ t25 = $[70];
275
510
  }
276
- }, [navigation, title, badges, conversation?.deleted, reply_root_id, replyHeaderTitle, muted]);
277
- if (!conversation || conversation.deleted) {
278
- return /*#__PURE__*/_jsx(View, {
279
- style: styles.container,
280
- children: /*#__PURE__*/_jsxs(BlankState.Root, {
281
- children: [/*#__PURE__*/_jsx(BlankState.Imagery, {
282
- name: "general.outlinedTextMessage"
283
- }), /*#__PURE__*/_jsx(BlankState.Content, {
284
- children: /*#__PURE__*/_jsx(BlankState.Heading, {
285
- children: "This conversation has been deleted"
286
- })
287
- }), /*#__PURE__*/_jsx(BlankState.Button, {
511
+ let t26;
512
+ if ($[71] !== navigation.goBack) {
513
+ t26 = /*#__PURE__*/_jsxs(BlankState.Root, {
514
+ children: [t24, t25, /*#__PURE__*/_jsx(BlankState.Button, {
288
515
  onPress: navigation.goBack,
289
516
  title: "Back to conversations",
290
517
  accessibilityHint: "Navigates back to the conversations list",
291
518
  accessibilityRole: "link"
292
519
  })]
520
+ });
521
+ $[71] = navigation.goBack;
522
+ $[72] = t26;
523
+ } else {
524
+ t26 = $[72];
525
+ }
526
+ let t27;
527
+ if ($[73] !== styles.container || $[74] !== t26) {
528
+ t27 = /*#__PURE__*/_jsx(View, {
529
+ style: styles.container,
530
+ children: t26
531
+ });
532
+ $[73] = styles.container;
533
+ $[74] = t26;
534
+ $[75] = t27;
535
+ } else {
536
+ t27 = $[75];
537
+ }
538
+ return t27;
539
+ }
540
+ let t24;
541
+ if ($[76] !== anchor || $[77] !== anchored || $[78] !== conversation || $[79] !== conversation_id || $[80] !== fetchNextPage || $[81] !== hasDragged || $[82] !== hasNextPage || $[83] !== holdListPosition || $[84] !== loadNewerMessages || $[85] !== messages || $[86] !== noMessages || $[87] !== onContentSizeChange || $[88] !== onLayout || $[89] !== onMomentumScrollEnd || $[90] !== onScrollEndDrag || $[91] !== reply_root_id || $[92] !== styles.emptyState) {
542
+ t24 = noMessages ? /*#__PURE__*/_jsx(View, {
543
+ style: styles.emptyState,
544
+ children: /*#__PURE__*/_jsx(ConversationStartBanner, {
545
+ conversation: conversation,
546
+ hasMessages: false
293
547
  })
548
+ }) : /*#__PURE__*/_jsx(MessageList, {
549
+ listRef: listRef,
550
+ conversation: conversation,
551
+ conversationId: conversation_id,
552
+ messages: messages,
553
+ replyRootId: reply_root_id,
554
+ anchorMessageId: anchor,
555
+ hasNextPage: hasNextPage,
556
+ onEndReached: () => fetchNextPage(),
557
+ onScroll: trackScroll,
558
+ onLayout: onLayout,
559
+ onContentSizeChange: onContentSizeChange,
560
+ onScrollEndDrag: onScrollEndDrag,
561
+ onMomentumScrollEnd: onMomentumScrollEnd,
562
+ onScrollBeginDrag: anchored ? () => setHasDragged(true) : undefined,
563
+ onStartReached: anchored && hasDragged ? loadNewerMessages : undefined,
564
+ onStartReachedThreshold: anchored ? 0.5 : undefined,
565
+ maintainVisibleContentPosition: holdListPosition ? {
566
+ minIndexForVisible: 0
567
+ } : undefined
294
568
  });
569
+ $[76] = anchor;
570
+ $[77] = anchored;
571
+ $[78] = conversation;
572
+ $[79] = conversation_id;
573
+ $[80] = fetchNextPage;
574
+ $[81] = hasDragged;
575
+ $[82] = hasNextPage;
576
+ $[83] = holdListPosition;
577
+ $[84] = loadNewerMessages;
578
+ $[85] = messages;
579
+ $[86] = noMessages;
580
+ $[87] = onContentSizeChange;
581
+ $[88] = onLayout;
582
+ $[89] = onMomentumScrollEnd;
583
+ $[90] = onScrollEndDrag;
584
+ $[91] = reply_root_id;
585
+ $[92] = styles.emptyState;
586
+ $[93] = t24;
587
+ } else {
588
+ t24 = $[93];
295
589
  }
296
- return /*#__PURE__*/_jsx(View, {
297
- style: styles.container,
298
- children: /*#__PURE__*/_jsxs(KeyboardView, {
299
- children: [noMessages ? /*#__PURE__*/_jsx(View, {
300
- style: styles.emptyState,
301
- children: /*#__PURE__*/_jsx(ConversationStartBanner, {
302
- conversation: conversation,
303
- hasMessages: false
304
- })
305
- }) : /*#__PURE__*/_jsx(MessageList, {
306
- listRef: listRef,
307
- conversation: conversation,
308
- conversationId: conversation_id,
309
- messages: messages,
310
- replyRootId: reply_root_id,
311
- anchorMessageId: anchor,
312
- hasNextPage: hasNextPage,
313
- onEndReached: () => fetchNextPage(),
314
- onScroll: trackScroll,
315
- onLayout: onLayout,
316
- onContentSizeChange: onContentSizeChange,
317
- onScrollEndDrag: onScrollEndDrag,
318
- onMomentumScrollEnd: onMomentumScrollEnd,
319
- onScrollBeginDrag: anchored ? () => setHasDragged(true) : undefined,
320
- onStartReached: anchored && hasDragged ? loadNewerMessages : undefined,
321
- onStartReachedThreshold: anchored ? 0.5 : undefined,
322
- maintainVisibleContentPosition: holdListPosition ? {
323
- minIndexForVisible: 0
324
- } : undefined
325
- }), /*#__PURE__*/_jsx(JumpToBottomButton, {
326
- onPress: jumpToLatest,
327
- visible: behindLatest || showJumpToBottomButton
328
- }), !noMessages && /*#__PURE__*/_jsx(TypingIndicator, {}), showLeaderDisabledReplyBanner && /*#__PURE__*/_jsx(LeaderMessagesDisabledBanner, {}), /*#__PURE__*/_jsx(ConversationBottomBar, {
329
- conversation: conversation,
330
- canReply: canReply,
331
- replyRootAuthorFirstName: replyRootAuthorFirstName,
332
- replyRootId: reply_root_id,
333
- currentlyEditingMessage: currentlyEditingMessage,
334
- onFlaggedInMessageForm: markHandledByMessageForm,
335
- onBeforeSubmit: jumpToLatest
336
- })]
337
- })
338
- });
590
+ const t25 = behindLatest || showJumpToBottomButton;
591
+ let t26;
592
+ if ($[94] !== jumpToLatest || $[95] !== t25) {
593
+ t26 = /*#__PURE__*/_jsx(JumpToBottomButton, {
594
+ onPress: jumpToLatest,
595
+ visible: t25
596
+ });
597
+ $[94] = jumpToLatest;
598
+ $[95] = t25;
599
+ $[96] = t26;
600
+ } else {
601
+ t26 = $[96];
602
+ }
603
+ let t27;
604
+ if ($[97] !== noMessages) {
605
+ t27 = !noMessages && /*#__PURE__*/_jsx(TypingIndicator, {});
606
+ $[97] = noMessages;
607
+ $[98] = t27;
608
+ } else {
609
+ t27 = $[98];
610
+ }
611
+ let t28;
612
+ if ($[99] !== showLeaderDisabledReplyBanner) {
613
+ t28 = showLeaderDisabledReplyBanner && /*#__PURE__*/_jsx(LeaderMessagesDisabledBanner, {});
614
+ $[99] = showLeaderDisabledReplyBanner;
615
+ $[100] = t28;
616
+ } else {
617
+ t28 = $[100];
618
+ }
619
+ let t29;
620
+ if ($[101] !== canReply || $[102] !== conversation || $[103] !== currentlyEditingMessage || $[104] !== jumpToLatest || $[105] !== markHandledByMessageForm || $[106] !== replyRootAuthorFirstName || $[107] !== reply_root_id) {
621
+ t29 = /*#__PURE__*/_jsx(ConversationBottomBar, {
622
+ conversation: conversation,
623
+ canReply: canReply,
624
+ replyRootAuthorFirstName: replyRootAuthorFirstName,
625
+ replyRootId: reply_root_id,
626
+ currentlyEditingMessage: currentlyEditingMessage,
627
+ onFlaggedInMessageForm: markHandledByMessageForm,
628
+ onBeforeSubmit: jumpToLatest
629
+ });
630
+ $[101] = canReply;
631
+ $[102] = conversation;
632
+ $[103] = currentlyEditingMessage;
633
+ $[104] = jumpToLatest;
634
+ $[105] = markHandledByMessageForm;
635
+ $[106] = replyRootAuthorFirstName;
636
+ $[107] = reply_root_id;
637
+ $[108] = t29;
638
+ } else {
639
+ t29 = $[108];
640
+ }
641
+ let t30;
642
+ if ($[109] !== t24 || $[110] !== t26 || $[111] !== t27 || $[112] !== t28 || $[113] !== t29) {
643
+ t30 = /*#__PURE__*/_jsxs(KeyboardView, {
644
+ children: [t24, t26, t27, t28, t29]
645
+ });
646
+ $[109] = t24;
647
+ $[110] = t26;
648
+ $[111] = t27;
649
+ $[112] = t28;
650
+ $[113] = t29;
651
+ $[114] = t30;
652
+ } else {
653
+ t30 = $[114];
654
+ }
655
+ let t31;
656
+ if ($[115] !== styles.container || $[116] !== t30) {
657
+ t31 = /*#__PURE__*/_jsx(View, {
658
+ style: styles.container,
659
+ children: t30
660
+ });
661
+ $[115] = styles.container;
662
+ $[116] = t30;
663
+ $[117] = t31;
664
+ } else {
665
+ t31 = $[117];
666
+ }
667
+ return t31;
339
668
  }
340
669
  function ConversationBottomBar(t0) {
341
670
  const $ = _c(16);