@planningcenter/chat-react-native 4.3.0-rc.3 → 4.3.0-rc.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 (63) hide show
  1. package/build/components/conversation/message_form.d.ts +2 -1
  2. package/build/components/conversation/message_form.d.ts.map +1 -1
  3. package/build/components/conversation/message_form.js +167 -370
  4. package/build/components/conversation/message_form.js.map +1 -1
  5. package/build/components/conversation/message_list.d.ts +5 -2
  6. package/build/components/conversation/message_list.d.ts.map +1 -1
  7. package/build/components/conversation/message_list.js +187 -67
  8. package/build/components/conversation/message_list.js.map +1 -1
  9. package/build/components/conversation/missing_message.d.ts +2 -0
  10. package/build/components/conversation/missing_message.d.ts.map +1 -0
  11. package/build/components/conversation/missing_message.js +139 -0
  12. package/build/components/conversation/missing_message.js.map +1 -0
  13. package/build/hooks/groups/use_group_members_for_new_conversation.d.ts +4 -3
  14. package/build/hooks/groups/use_group_members_for_new_conversation.d.ts.map +1 -1
  15. package/build/hooks/use_conversation_messages.d.ts +14 -5
  16. package/build/hooks/use_conversation_messages.d.ts.map +1 -1
  17. package/build/hooks/use_conversation_messages.js +218 -42
  18. package/build/hooks/use_conversation_messages.js.map +1 -1
  19. package/build/hooks/use_conversation_messages_jolt_events.d.ts.map +1 -1
  20. package/build/hooks/use_conversation_messages_jolt_events.js +58 -42
  21. package/build/hooks/use_conversation_messages_jolt_events.js.map +1 -1
  22. package/build/hooks/use_mark_latest_message_read.d.ts +2 -1
  23. package/build/hooks/use_mark_latest_message_read.d.ts.map +1 -1
  24. package/build/hooks/use_mark_latest_message_read.js +4 -3
  25. package/build/hooks/use_mark_latest_message_read.js.map +1 -1
  26. package/build/hooks/use_read_receipts.d.ts +4 -3
  27. package/build/hooks/use_read_receipts.d.ts.map +1 -1
  28. package/build/hooks/use_suspense_api.d.ts +10 -6
  29. package/build/hooks/use_suspense_api.d.ts.map +1 -1
  30. package/build/hooks/use_suspense_api.js +83 -63
  31. package/build/hooks/use_suspense_api.js.map +1 -1
  32. package/build/screens/conversation_screen.d.ts +1 -0
  33. package/build/screens/conversation_screen.d.ts.map +1 -1
  34. package/build/screens/conversation_screen.js +305 -203
  35. package/build/screens/conversation_screen.js.map +1 -1
  36. package/build/screens/notification_settings/hooks/groups.d.ts +4 -3
  37. package/build/screens/notification_settings/hooks/groups.d.ts.map +1 -1
  38. package/build/types/api_primitives.d.ts +1 -0
  39. package/build/types/api_primitives.d.ts.map +1 -1
  40. package/build/types/api_primitives.js.map +1 -1
  41. package/build/utils/cache/messages_window.d.ts +11 -0
  42. package/build/utils/cache/messages_window.d.ts.map +1 -0
  43. package/build/utils/cache/messages_window.js +51 -0
  44. package/build/utils/cache/messages_window.js.map +1 -0
  45. package/build/utils/client/types.d.ts +1 -0
  46. package/build/utils/client/types.d.ts.map +1 -1
  47. package/build/utils/client/types.js.map +1 -1
  48. package/package.json +2 -2
  49. package/src/components/conversation/message_form.tsx +31 -3
  50. package/src/components/conversation/message_list.tsx +88 -4
  51. package/src/components/conversation/missing_message.tsx +66 -0
  52. package/src/hooks/__tests__/use_conversation_messages.test.tsx +333 -0
  53. package/src/hooks/__tests__/use_conversation_messages_jolt_events.test.tsx +87 -0
  54. package/src/hooks/__tests__/use_mark_latest_message_read.test.tsx +33 -0
  55. package/src/hooks/use_conversation_messages.ts +103 -17
  56. package/src/hooks/use_conversation_messages_jolt_events.ts +12 -2
  57. package/src/hooks/use_mark_latest_message_read.ts +4 -3
  58. package/src/hooks/use_suspense_api.ts +14 -6
  59. package/src/screens/conversation_screen.tsx +62 -13
  60. package/src/types/api_primitives.ts +1 -0
  61. package/src/utils/cache/__tests__/messages_window.test.ts +78 -0
  62. package/src/utils/cache/messages_window.ts +55 -0
  63. package/src/utils/client/types.ts +1 -0
@@ -18,12 +18,13 @@ import { ConversationContextProvider } from '../contexts/conversation_context';
18
18
  import { useMessageAvailableMembersAction } from '../hooks/direct_messages/use_message_available_members_action';
19
19
  import { useConversation } from '../hooks/use_conversation';
20
20
  import { useConversationJoltEvents } from '../hooks/use_conversation_jolt_events';
21
- import { useConversationMessages } from '../hooks/use_conversation_messages';
21
+ import { dropMessagesWindowIfBehind, useConversationMessages } from '../hooks/use_conversation_messages';
22
22
  import { useConversationMessagesJoltEvents } from '../hooks/use_conversation_messages_jolt_events';
23
23
  import { useMarkLatestMessageRead } from '../hooks/use_mark_latest_message_read';
24
24
  import { analyticsEvents, normalizeAnalyticsMetadata, usePublishProductAnalyticsEvent } from '../hooks/use_product_analytics';
25
25
  import { useRestAwayFromDismissEdge } from '../hooks/use_rest_away_from_dismiss_edge';
26
26
  import { useVideoModerationJoltEvents } from '../hooks/use_video_moderation_jolt_events';
27
+ import { Log } from '../utils';
27
28
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
28
29
  export function ConversationScreen(t0) {
29
30
  const $ = _c(13);
@@ -96,7 +97,7 @@ export function ConversationScreen(t0) {
96
97
  return t6;
97
98
  }
98
99
  function ConversationScreenContent(t0) {
99
- const $ = _c(80);
100
+ const $ = _c(103);
100
101
  const {
101
102
  route
102
103
  } = t0;
@@ -106,67 +107,76 @@ function ConversationScreenContent(t0) {
106
107
  conversation_id,
107
108
  editing_message_id,
108
109
  reply_root_id,
109
- reply_root_author_name
110
+ reply_root_author_name,
111
+ initial_message_id
110
112
  } = route.params;
111
113
  const {
112
114
  data: conversation
113
115
  } = useConversation(route.params);
114
116
  let t1;
115
- if ($[0] !== conversation_id || $[1] !== reply_root_id) {
117
+ if ($[0] !== conversation_id || $[1] !== initial_message_id || $[2] !== reply_root_id) {
116
118
  t1 = {
117
119
  conversation_id,
118
- reply_root_id
120
+ reply_root_id,
121
+ anchor: initial_message_id
119
122
  };
120
123
  $[0] = conversation_id;
121
- $[1] = reply_root_id;
122
- $[2] = t1;
124
+ $[1] = initial_message_id;
125
+ $[2] = reply_root_id;
126
+ $[3] = t1;
123
127
  } else {
124
- t1 = $[2];
128
+ t1 = $[3];
125
129
  }
126
130
  const {
127
131
  messages,
132
+ behind,
128
133
  fetchNextPage,
134
+ fetchNewer,
135
+ fetchLiveWindow,
129
136
  hasNextPage
130
137
  } = useConversationMessages(t1);
131
138
  let t2;
132
- if ($[3] !== conversation_id) {
139
+ if ($[4] !== conversation_id) {
133
140
  t2 = {
134
141
  conversationId: conversation_id
135
142
  };
136
- $[3] = conversation_id;
137
- $[4] = t2;
143
+ $[4] = conversation_id;
144
+ $[5] = t2;
138
145
  } else {
139
- t2 = $[4];
146
+ t2 = $[5];
140
147
  }
141
148
  useConversationJoltEvents(t2);
142
149
  let t3;
143
- if ($[5] !== conversation_id) {
150
+ if ($[6] !== conversation_id) {
144
151
  t3 = {
145
152
  conversationId: conversation_id
146
153
  };
147
- $[5] = conversation_id;
148
- $[6] = t3;
154
+ $[6] = conversation_id;
155
+ $[7] = t3;
149
156
  } else {
150
- t3 = $[6];
157
+ t3 = $[7];
151
158
  }
152
159
  useConversationMessagesJoltEvents(t3);
153
160
  const {
154
161
  markHandledByMessageForm
155
162
  } = useVideoModerationJoltEvents();
156
163
  useEnsureConversationsRouteExists();
157
- let t4;
158
- if ($[7] !== conversation || $[8] !== messages) {
159
- t4 = {
164
+ const t4 = !behind;
165
+ let t5;
166
+ if ($[8] !== conversation || $[9] !== messages || $[10] !== t4) {
167
+ t5 = {
160
168
  conversation,
161
- messages
169
+ messages,
170
+ enabled: t4
162
171
  };
163
- $[7] = conversation;
164
- $[8] = messages;
165
- $[9] = t4;
172
+ $[8] = conversation;
173
+ $[9] = messages;
174
+ $[10] = t4;
175
+ $[11] = t5;
166
176
  } else {
167
- t4 = $[9];
177
+ t5 = $[11];
168
178
  }
169
- useMarkLatestMessageRead(t4);
179
+ useMarkLatestMessageRead(t5);
170
180
  const noMessages = messages.length === 0;
171
181
  const {
172
182
  repliesDisabled,
@@ -176,57 +186,57 @@ function ConversationScreenContent(t0) {
176
186
  } = conversation;
177
187
  const canReply = memberAbility?.canReply;
178
188
  const showLeaderDisabledReplyBanner = canReply && repliesDisabled;
179
- let t5;
180
- if ($[10] !== editing_message_id || $[11] !== messages) {
181
- let t6;
182
- if ($[13] !== editing_message_id) {
183
- t6 = m => String(m.id) === String(editing_message_id);
184
- $[13] = editing_message_id;
185
- $[14] = t6;
189
+ let t6;
190
+ if ($[12] !== editing_message_id || $[13] !== messages) {
191
+ let t7;
192
+ if ($[15] !== editing_message_id) {
193
+ t7 = m => String(m.id) === String(editing_message_id);
194
+ $[15] = editing_message_id;
195
+ $[16] = t7;
186
196
  } else {
187
- t6 = $[14];
197
+ t7 = $[16];
188
198
  }
189
- t5 = messages.find(t6);
190
- $[10] = editing_message_id;
191
- $[11] = messages;
192
- $[12] = t5;
199
+ t6 = messages.find(t7);
200
+ $[12] = editing_message_id;
201
+ $[13] = messages;
202
+ $[14] = t6;
193
203
  } else {
194
- t5 = $[12];
204
+ t6 = $[14];
195
205
  }
196
- const currentlyEditingMessage = t5;
197
- let t6;
198
- if ($[15] !== reply_root_author_name) {
199
- t6 = reply_root_author_name?.split(" ")[0];
200
- $[15] = reply_root_author_name;
201
- $[16] = t6;
206
+ const currentlyEditingMessage = t6;
207
+ let t7;
208
+ if ($[17] !== reply_root_author_name) {
209
+ t7 = reply_root_author_name?.split(" ")[0];
210
+ $[17] = reply_root_author_name;
211
+ $[18] = t7;
202
212
  } else {
203
- t6 = $[16];
213
+ t7 = $[18];
204
214
  }
205
- const replyRootAuthorFirstName = t6;
215
+ const replyRootAuthorFirstName = t7;
206
216
  const replyHeaderTitle = replyRootAuthorFirstName ? `Reply to ${replyRootAuthorFirstName}` : "Reply";
207
217
  const muted = conversation.conversationMembership?.muted ?? conversation.muted;
208
218
  const listRef = useRef(null);
209
219
  const [showJumpToBottomButton, setShowJumpToBottomButton] = useState(false);
210
- let t7;
211
- if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
212
- t7 = event => {
220
+ let t8;
221
+ if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
222
+ t8 = event => {
213
223
  const offsetY = event.nativeEvent.contentOffset.y;
214
224
  setShowJumpToBottomButton(offsetY > 200);
215
225
  };
216
- $[17] = t7;
226
+ $[19] = t8;
217
227
  } else {
218
- t7 = $[17];
228
+ t8 = $[19];
219
229
  }
220
- const trackScroll = t7;
221
- let t8;
222
- if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
223
- t8 = {
230
+ const trackScroll = t8;
231
+ let t9;
232
+ if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
233
+ t9 = {
224
234
  listRef,
225
235
  enabled: Platform.OS === "ios"
226
236
  };
227
- $[18] = t8;
237
+ $[20] = t9;
228
238
  } else {
229
- t8 = $[18];
239
+ t9 = $[20];
230
240
  }
231
241
  const {
232
242
  restOffset,
@@ -234,23 +244,52 @@ function ConversationScreenContent(t0) {
234
244
  onContentSizeChange,
235
245
  onMomentumScrollEnd,
236
246
  onScrollEndDrag
237
- } = useRestAwayFromDismissEdge(t8);
238
- let t9;
239
- if ($[19] !== restOffset) {
240
- t9 = () => {
247
+ } = useRestAwayFromDismissEdge(t9);
248
+ const [anchorMessageId, setAnchorMessageId] = useState(initial_message_id);
249
+ let t10;
250
+ if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
251
+ t10 = () => setAnchorMessageId(null);
252
+ $[21] = t10;
253
+ } else {
254
+ t10 = $[21];
255
+ }
256
+ const releaseAnchor = t10;
257
+ let t11;
258
+ if ($[22] !== restOffset) {
259
+ t11 = t12 => {
260
+ const animated = t12 === undefined ? true : t12;
261
+ releaseAnchor();
241
262
  listRef.current?.scrollToOffset({
242
- offset: restOffset
263
+ offset: restOffset,
264
+ animated
243
265
  });
244
266
  };
245
- $[19] = restOffset;
246
- $[20] = t9;
267
+ $[22] = restOffset;
268
+ $[23] = t11;
247
269
  } else {
248
- t9 = $[20];
270
+ t11 = $[23];
249
271
  }
250
- const handleReturnToBottom = t9;
251
- let t10;
252
- if ($[21] !== badges?.[0] || $[22] !== conversation.deleted || $[23] !== muted || $[24] !== navigation || $[25] !== replyHeaderTitle || $[26] !== reply_root_id || $[27] !== title) {
253
- t10 = () => {
272
+ const handleReturnToBottom = t11;
273
+ const logWindowFetchFailure = _temp;
274
+ let t12;
275
+ if ($[24] !== behind || $[25] !== fetchLiveWindow || $[26] !== handleReturnToBottom) {
276
+ t12 = async () => {
277
+ if (behind) {
278
+ await fetchLiveWindow();
279
+ }
280
+ handleReturnToBottom(false);
281
+ };
282
+ $[24] = behind;
283
+ $[25] = fetchLiveWindow;
284
+ $[26] = handleReturnToBottom;
285
+ $[27] = t12;
286
+ } else {
287
+ t12 = $[27];
288
+ }
289
+ const returnToLatest = t12;
290
+ let t13;
291
+ if ($[28] !== badges?.[0] || $[29] !== conversation.deleted || $[30] !== muted || $[31] !== navigation || $[32] !== replyHeaderTitle || $[33] !== reply_root_id || $[34] !== title) {
292
+ t13 = () => {
254
293
  if (reply_root_id) {
255
294
  navigation.setParams({
256
295
  title: replyHeaderTitle
@@ -264,86 +303,124 @@ function ConversationScreenContent(t0) {
264
303
  });
265
304
  }
266
305
  };
267
- $[21] = badges?.[0];
268
- $[22] = conversation.deleted;
269
- $[23] = muted;
270
- $[24] = navigation;
271
- $[25] = replyHeaderTitle;
272
- $[26] = reply_root_id;
273
- $[27] = title;
274
- $[28] = t10;
275
- } else {
276
- t10 = $[28];
277
- }
278
- const t11 = conversation?.deleted;
279
- let t12;
280
- if ($[29] !== badges || $[30] !== muted || $[31] !== navigation || $[32] !== replyHeaderTitle || $[33] !== reply_root_id || $[34] !== t11 || $[35] !== title) {
281
- t12 = [navigation, title, badges, t11, reply_root_id, replyHeaderTitle, muted];
282
- $[29] = badges;
306
+ $[28] = badges?.[0];
307
+ $[29] = conversation.deleted;
283
308
  $[30] = muted;
284
309
  $[31] = navigation;
285
310
  $[32] = replyHeaderTitle;
286
311
  $[33] = reply_root_id;
287
- $[34] = t11;
288
- $[35] = title;
289
- $[36] = t12;
312
+ $[34] = title;
313
+ $[35] = t13;
314
+ } else {
315
+ t13 = $[35];
316
+ }
317
+ const t14 = conversation?.deleted;
318
+ let t15;
319
+ if ($[36] !== badges || $[37] !== muted || $[38] !== navigation || $[39] !== replyHeaderTitle || $[40] !== reply_root_id || $[41] !== t14 || $[42] !== title) {
320
+ t15 = [navigation, title, badges, t14, reply_root_id, replyHeaderTitle, muted];
321
+ $[36] = badges;
322
+ $[37] = muted;
323
+ $[38] = navigation;
324
+ $[39] = replyHeaderTitle;
325
+ $[40] = reply_root_id;
326
+ $[41] = t14;
327
+ $[42] = title;
328
+ $[43] = t15;
329
+ } else {
330
+ t15 = $[43];
331
+ }
332
+ useEffect(t13, t15);
333
+ let t16;
334
+ let t17;
335
+ if ($[44] !== initial_message_id || $[45] !== navigation) {
336
+ t16 = () => {
337
+ if (!initial_message_id) {
338
+ return;
339
+ }
340
+ navigation.setParams({
341
+ initial_message_id: null
342
+ });
343
+ };
344
+ t17 = [initial_message_id, navigation];
345
+ $[44] = initial_message_id;
346
+ $[45] = navigation;
347
+ $[46] = t16;
348
+ $[47] = t17;
349
+ } else {
350
+ t16 = $[46];
351
+ t17 = $[47];
352
+ }
353
+ useEffect(t16, t17);
354
+ let t18;
355
+ let t19;
356
+ if ($[48] !== conversation_id || $[49] !== reply_root_id) {
357
+ t18 = () => () => dropMessagesWindowIfBehind({
358
+ conversation_id,
359
+ reply_root_id
360
+ });
361
+ t19 = [conversation_id, reply_root_id];
362
+ $[48] = conversation_id;
363
+ $[49] = reply_root_id;
364
+ $[50] = t18;
365
+ $[51] = t19;
290
366
  } else {
291
- t12 = $[36];
367
+ t18 = $[50];
368
+ t19 = $[51];
292
369
  }
293
- useEffect(t10, t12);
370
+ useEffect(t18, t19);
294
371
  if (!conversation || conversation.deleted) {
295
- let t13;
296
- if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
297
- t13 = /*#__PURE__*/_jsx(BlankState.Imagery, {
372
+ let t20;
373
+ if ($[52] === Symbol.for("react.memo_cache_sentinel")) {
374
+ t20 = /*#__PURE__*/_jsx(BlankState.Imagery, {
298
375
  name: "general.outlinedTextMessage"
299
376
  });
300
- $[37] = t13;
377
+ $[52] = t20;
301
378
  } else {
302
- t13 = $[37];
379
+ t20 = $[52];
303
380
  }
304
- let t14;
305
- if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
306
- t14 = /*#__PURE__*/_jsx(BlankState.Content, {
381
+ let t21;
382
+ if ($[53] === Symbol.for("react.memo_cache_sentinel")) {
383
+ t21 = /*#__PURE__*/_jsx(BlankState.Content, {
307
384
  children: /*#__PURE__*/_jsx(BlankState.Heading, {
308
385
  children: "This conversation has been deleted"
309
386
  })
310
387
  });
311
- $[38] = t14;
388
+ $[53] = t21;
312
389
  } else {
313
- t14 = $[38];
390
+ t21 = $[53];
314
391
  }
315
- let t15;
316
- if ($[39] !== navigation.goBack) {
317
- t15 = /*#__PURE__*/_jsxs(BlankState.Root, {
318
- children: [t13, t14, /*#__PURE__*/_jsx(BlankState.Button, {
392
+ let t22;
393
+ if ($[54] !== navigation.goBack) {
394
+ t22 = /*#__PURE__*/_jsxs(BlankState.Root, {
395
+ children: [t20, t21, /*#__PURE__*/_jsx(BlankState.Button, {
319
396
  onPress: navigation.goBack,
320
397
  title: "Back to conversations",
321
398
  accessibilityHint: "Navigates back to the conversations list",
322
399
  accessibilityRole: "link"
323
400
  })]
324
401
  });
325
- $[39] = navigation.goBack;
326
- $[40] = t15;
402
+ $[54] = navigation.goBack;
403
+ $[55] = t22;
327
404
  } else {
328
- t15 = $[40];
405
+ t22 = $[55];
329
406
  }
330
- let t16;
331
- if ($[41] !== styles.container || $[42] !== t15) {
332
- t16 = /*#__PURE__*/_jsx(View, {
407
+ let t23;
408
+ if ($[56] !== styles.container || $[57] !== t22) {
409
+ t23 = /*#__PURE__*/_jsx(View, {
333
410
  style: styles.container,
334
- children: t15
411
+ children: t22
335
412
  });
336
- $[41] = styles.container;
337
- $[42] = t15;
338
- $[43] = t16;
413
+ $[56] = styles.container;
414
+ $[57] = t22;
415
+ $[58] = t23;
339
416
  } else {
340
- t16 = $[43];
417
+ t23 = $[58];
341
418
  }
342
- return t16;
419
+ return t23;
343
420
  }
344
- let t13;
345
- if ($[44] !== conversation || $[45] !== conversation_id || $[46] !== fetchNextPage || $[47] !== hasNextPage || $[48] !== messages || $[49] !== noMessages || $[50] !== onContentSizeChange || $[51] !== onLayout || $[52] !== onMomentumScrollEnd || $[53] !== onScrollEndDrag || $[54] !== reply_root_id || $[55] !== styles.emptyState) {
346
- t13 = noMessages ? /*#__PURE__*/_jsx(View, {
421
+ let t20;
422
+ if ($[59] !== anchorMessageId || $[60] !== behind || $[61] !== conversation || $[62] !== conversation_id || $[63] !== fetchNewer || $[64] !== fetchNextPage || $[65] !== hasNextPage || $[66] !== messages || $[67] !== noMessages || $[68] !== onContentSizeChange || $[69] !== onLayout || $[70] !== onMomentumScrollEnd || $[71] !== onScrollEndDrag || $[72] !== reply_root_id || $[73] !== styles.emptyState) {
423
+ t20 = noMessages ? /*#__PURE__*/_jsx(View, {
347
424
  style: styles.emptyState,
348
425
  children: /*#__PURE__*/_jsx(ConversationStartBanner, {
349
426
  conversation: conversation,
@@ -355,115 +432,138 @@ function ConversationScreenContent(t0) {
355
432
  conversationId: conversation_id,
356
433
  messages: messages,
357
434
  replyRootId: reply_root_id,
435
+ anchorMessageId: anchorMessageId,
436
+ behind: behind,
358
437
  hasNextPage: hasNextPage,
359
438
  onEndReached: () => fetchNextPage(),
439
+ onStartReached: () => fetchNewer().catch(logWindowFetchFailure),
360
440
  onScroll: trackScroll,
361
441
  onLayout: onLayout,
362
442
  onContentSizeChange: onContentSizeChange,
363
443
  onScrollEndDrag: onScrollEndDrag,
364
444
  onMomentumScrollEnd: onMomentumScrollEnd
365
445
  });
366
- $[44] = conversation;
367
- $[45] = conversation_id;
368
- $[46] = fetchNextPage;
369
- $[47] = hasNextPage;
370
- $[48] = messages;
371
- $[49] = noMessages;
372
- $[50] = onContentSizeChange;
373
- $[51] = onLayout;
374
- $[52] = onMomentumScrollEnd;
375
- $[53] = onScrollEndDrag;
376
- $[54] = reply_root_id;
377
- $[55] = styles.emptyState;
378
- $[56] = t13;
379
- } else {
380
- t13 = $[56];
381
- }
382
- let t14;
383
- if ($[57] !== handleReturnToBottom || $[58] !== showJumpToBottomButton) {
384
- t14 = /*#__PURE__*/_jsx(JumpToBottomButton, {
385
- onPress: handleReturnToBottom,
386
- visible: showJumpToBottomButton
446
+ $[59] = anchorMessageId;
447
+ $[60] = behind;
448
+ $[61] = conversation;
449
+ $[62] = conversation_id;
450
+ $[63] = fetchNewer;
451
+ $[64] = fetchNextPage;
452
+ $[65] = hasNextPage;
453
+ $[66] = messages;
454
+ $[67] = noMessages;
455
+ $[68] = onContentSizeChange;
456
+ $[69] = onLayout;
457
+ $[70] = onMomentumScrollEnd;
458
+ $[71] = onScrollEndDrag;
459
+ $[72] = reply_root_id;
460
+ $[73] = styles.emptyState;
461
+ $[74] = t20;
462
+ } else {
463
+ t20 = $[74];
464
+ }
465
+ let t21;
466
+ if ($[75] !== behind || $[76] !== handleReturnToBottom || $[77] !== returnToLatest) {
467
+ t21 = () => behind ? returnToLatest().catch(logWindowFetchFailure) : handleReturnToBottom();
468
+ $[75] = behind;
469
+ $[76] = handleReturnToBottom;
470
+ $[77] = returnToLatest;
471
+ $[78] = t21;
472
+ } else {
473
+ t21 = $[78];
474
+ }
475
+ const t22 = showJumpToBottomButton || behind;
476
+ let t23;
477
+ if ($[79] !== t21 || $[80] !== t22) {
478
+ t23 = /*#__PURE__*/_jsx(JumpToBottomButton, {
479
+ onPress: t21,
480
+ visible: t22
387
481
  });
388
- $[57] = handleReturnToBottom;
389
- $[58] = showJumpToBottomButton;
390
- $[59] = t14;
482
+ $[79] = t21;
483
+ $[80] = t22;
484
+ $[81] = t23;
391
485
  } else {
392
- t14 = $[59];
486
+ t23 = $[81];
393
487
  }
394
- let t15;
395
- if ($[60] !== noMessages) {
396
- t15 = !noMessages && /*#__PURE__*/_jsx(TypingIndicator, {});
397
- $[60] = noMessages;
398
- $[61] = t15;
488
+ let t24;
489
+ if ($[82] !== noMessages) {
490
+ t24 = !noMessages && /*#__PURE__*/_jsx(TypingIndicator, {});
491
+ $[82] = noMessages;
492
+ $[83] = t24;
399
493
  } else {
400
- t15 = $[61];
494
+ t24 = $[83];
401
495
  }
402
- let t16;
403
- if ($[62] !== showLeaderDisabledReplyBanner) {
404
- t16 = showLeaderDisabledReplyBanner && /*#__PURE__*/_jsx(LeaderMessagesDisabledBanner, {});
405
- $[62] = showLeaderDisabledReplyBanner;
406
- $[63] = t16;
496
+ let t25;
497
+ if ($[84] !== showLeaderDisabledReplyBanner) {
498
+ t25 = showLeaderDisabledReplyBanner && /*#__PURE__*/_jsx(LeaderMessagesDisabledBanner, {});
499
+ $[84] = showLeaderDisabledReplyBanner;
500
+ $[85] = t25;
407
501
  } else {
408
- t16 = $[63];
502
+ t25 = $[85];
409
503
  }
410
- let t17;
411
- if ($[64] !== canReply || $[65] !== conversation || $[66] !== currentlyEditingMessage || $[67] !== markHandledByMessageForm || $[68] !== replyRootAuthorFirstName || $[69] !== reply_root_id) {
412
- t17 = /*#__PURE__*/_jsx(ConversationBottomBar, {
504
+ let t26;
505
+ if ($[86] !== canReply || $[87] !== conversation || $[88] !== currentlyEditingMessage || $[89] !== markHandledByMessageForm || $[90] !== replyRootAuthorFirstName || $[91] !== reply_root_id || $[92] !== returnToLatest) {
506
+ t26 = /*#__PURE__*/_jsx(ConversationBottomBar, {
413
507
  conversation: conversation,
414
508
  canReply: canReply,
415
509
  replyRootAuthorFirstName: replyRootAuthorFirstName,
416
510
  replyRootId: reply_root_id,
417
511
  currentlyEditingMessage: currentlyEditingMessage,
418
- onFlaggedInMessageForm: markHandledByMessageForm
512
+ onFlaggedInMessageForm: markHandledByMessageForm,
513
+ onBeforeSubmit: returnToLatest
419
514
  });
420
- $[64] = canReply;
421
- $[65] = conversation;
422
- $[66] = currentlyEditingMessage;
423
- $[67] = markHandledByMessageForm;
424
- $[68] = replyRootAuthorFirstName;
425
- $[69] = reply_root_id;
426
- $[70] = t17;
427
- } else {
428
- t17 = $[70];
429
- }
430
- let t18;
431
- if ($[71] !== t13 || $[72] !== t14 || $[73] !== t15 || $[74] !== t16 || $[75] !== t17) {
432
- t18 = /*#__PURE__*/_jsxs(KeyboardView, {
433
- children: [t13, t14, t15, t16, t17]
515
+ $[86] = canReply;
516
+ $[87] = conversation;
517
+ $[88] = currentlyEditingMessage;
518
+ $[89] = markHandledByMessageForm;
519
+ $[90] = replyRootAuthorFirstName;
520
+ $[91] = reply_root_id;
521
+ $[92] = returnToLatest;
522
+ $[93] = t26;
523
+ } else {
524
+ t26 = $[93];
525
+ }
526
+ let t27;
527
+ if ($[94] !== t20 || $[95] !== t23 || $[96] !== t24 || $[97] !== t25 || $[98] !== t26) {
528
+ t27 = /*#__PURE__*/_jsxs(KeyboardView, {
529
+ children: [t20, t23, t24, t25, t26]
434
530
  });
435
- $[71] = t13;
436
- $[72] = t14;
437
- $[73] = t15;
438
- $[74] = t16;
439
- $[75] = t17;
440
- $[76] = t18;
441
- } else {
442
- t18 = $[76];
443
- }
444
- let t19;
445
- if ($[77] !== styles.container || $[78] !== t18) {
446
- t19 = /*#__PURE__*/_jsx(View, {
531
+ $[94] = t20;
532
+ $[95] = t23;
533
+ $[96] = t24;
534
+ $[97] = t25;
535
+ $[98] = t26;
536
+ $[99] = t27;
537
+ } else {
538
+ t27 = $[99];
539
+ }
540
+ let t28;
541
+ if ($[100] !== styles.container || $[101] !== t27) {
542
+ t28 = /*#__PURE__*/_jsx(View, {
447
543
  style: styles.container,
448
- children: t18
544
+ children: t27
449
545
  });
450
- $[77] = styles.container;
451
- $[78] = t18;
452
- $[79] = t19;
546
+ $[100] = styles.container;
547
+ $[101] = t27;
548
+ $[102] = t28;
453
549
  } else {
454
- t19 = $[79];
550
+ t28 = $[102];
455
551
  }
456
- return t19;
552
+ return t28;
553
+ }
554
+ function _temp(error) {
555
+ return Log.error("conversation window fetch failed", error);
457
556
  }
458
557
  function ConversationBottomBar(t0) {
459
- const $ = _c(15);
558
+ const $ = _c(16);
460
559
  const {
461
560
  conversation,
462
561
  canReply,
463
562
  replyRootAuthorFirstName,
464
563
  replyRootId,
465
564
  currentlyEditingMessage,
466
- onFlaggedInMessageForm
565
+ onFlaggedInMessageForm,
566
+ onBeforeSubmit
467
567
  } = t0;
468
568
  const messageLink = useMessageAvailableMembersAction(conversation);
469
569
  if (conversation.disabled) {
@@ -513,24 +613,26 @@ function ConversationBottomBar(t0) {
513
613
  t5 = $[7];
514
614
  }
515
615
  let t6;
516
- if ($[8] !== conversation || $[9] !== currentlyEditingMessage || $[10] !== onFlaggedInMessageForm || $[11] !== replyRootAuthorFirstName || $[12] !== replyRootId || $[13] !== t1) {
616
+ if ($[8] !== conversation || $[9] !== currentlyEditingMessage || $[10] !== onBeforeSubmit || $[11] !== onFlaggedInMessageForm || $[12] !== replyRootAuthorFirstName || $[13] !== replyRootId || $[14] !== t1) {
517
617
  t6 = /*#__PURE__*/_jsxs(MessageForm.Root, {
518
618
  replyRootAuthorFirstName: replyRootAuthorFirstName,
519
619
  conversation: conversation,
520
620
  replyRootId: replyRootId,
521
621
  currentlyEditingMessage: currentlyEditingMessage,
522
622
  onFlaggedInMessageForm: onFlaggedInMessageForm,
623
+ onBeforeSubmit: onBeforeSubmit,
523
624
  children: [t2, t3, t4, t5]
524
625
  }, t1);
525
626
  $[8] = conversation;
526
627
  $[9] = currentlyEditingMessage;
527
- $[10] = onFlaggedInMessageForm;
528
- $[11] = replyRootAuthorFirstName;
529
- $[12] = replyRootId;
530
- $[13] = t1;
531
- $[14] = t6;
628
+ $[10] = onBeforeSubmit;
629
+ $[11] = onFlaggedInMessageForm;
630
+ $[12] = replyRootAuthorFirstName;
631
+ $[13] = replyRootId;
632
+ $[14] = t1;
633
+ $[15] = t6;
532
634
  } else {
533
- t6 = $[14];
635
+ t6 = $[15];
534
636
  }
535
637
  return t6;
536
638
  }
@@ -753,7 +855,7 @@ const useEnsureConversationsRouteExists = () => {
753
855
  t0 = () => {
754
856
  const navigationState = navigation.getState();
755
857
  const routes = navigationState?.routes || [];
756
- const conversationsRoute = routes.find(_temp);
858
+ const conversationsRoute = routes.find(_temp2);
757
859
  if (conversationsRoute) {
758
860
  return;
759
861
  }
@@ -786,7 +888,7 @@ const useEnsureConversationsRouteExists = () => {
786
888
  }
787
889
  useEffect(t0, t2);
788
890
  };
789
- function _temp(r) {
891
+ function _temp2(r) {
790
892
  return r.name === "Conversations";
791
893
  }
792
894
  //# sourceMappingURL=conversation_screen.js.map