@planningcenter/chat-react-native 4.2.1-qa-staging.1 → 4.2.1-qa-staging.4

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