@adminide-stack/yantra-mobile 12.0.103-alpha.0 → 12.0.103-alpha.2

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 (101) hide show
  1. package/lib/components/CustomDrawer.js +4 -2
  2. package/lib/components/CustomDrawer.js.map +1 -1
  3. package/lib/features/expenses/ExpensesExperience.js +11 -1
  4. package/lib/features/expenses/ExpensesExperience.js.map +1 -1
  5. package/lib/features/expenses/components/ClaimForm.js +144 -23
  6. package/lib/features/expenses/components/ClaimForm.js.map +1 -1
  7. package/lib/features/expenses/receiptScan.js +36 -5
  8. package/lib/features/expenses/receiptScan.js.map +1 -1
  9. package/lib/features/expenses/starterCategories.js +7 -0
  10. package/lib/features/expenses/starterCategories.js.map +1 -0
  11. package/lib/features/health/HealthSyncRunner.js +13 -13
  12. package/lib/features/health/HealthSyncRunner.js.map +1 -1
  13. package/lib/features/health/buildDays.js +188 -113
  14. package/lib/features/health/buildDays.js.map +1 -1
  15. package/lib/features/health/fitnessClient.js +5 -5
  16. package/lib/features/health/fitnessClient.js.map +1 -1
  17. package/lib/features/health/healthConnectMapping.js +57 -29
  18. package/lib/features/health/healthConnectMapping.js.map +1 -1
  19. package/lib/features/health/healthConnectReader.js +23 -5
  20. package/lib/features/health/healthConnectReader.js.map +1 -1
  21. package/lib/features/health/healthSyncStore.js +5 -1
  22. package/lib/features/health/healthSyncStore.js.map +1 -1
  23. package/lib/features/health/healthkitMapping.js +115 -25
  24. package/lib/features/health/healthkitMapping.js.map +1 -1
  25. package/lib/features/health/healthkitReader.js +49 -39
  26. package/lib/features/health/healthkitReader.js.map +1 -1
  27. package/lib/features/health/healthkitWriter.js +3 -6
  28. package/lib/features/health/healthkitWriter.js.map +1 -1
  29. package/lib/features/health/hostHealth.js +3 -1
  30. package/lib/features/health/hostHealth.js.map +1 -1
  31. package/lib/features/health/intraday.js +115 -0
  32. package/lib/features/health/intraday.js.map +1 -0
  33. package/lib/features/health/model.js +3 -0
  34. package/lib/features/health/model.js.map +1 -1
  35. package/lib/features/health/reader.js +15 -0
  36. package/lib/features/health/reader.js.map +1 -1
  37. package/lib/features/health/sleep.js +59 -3
  38. package/lib/features/health/sleep.js.map +1 -1
  39. package/lib/features/health/syncEngine.js +35 -31
  40. package/lib/features/health/syncEngine.js.map +1 -1
  41. package/lib/features/health/syncState.js.map +1 -1
  42. package/lib/features/health/time.js +52 -52
  43. package/lib/features/health/time.js.map +1 -1
  44. package/lib/features/health/types.js +21 -4
  45. package/lib/features/health/types.js.map +1 -1
  46. package/lib/features/health/writeMapping.js +12 -12
  47. package/lib/features/health/writeMapping.js.map +1 -1
  48. package/lib/features/health/zones.js +1 -2
  49. package/lib/features/health/zones.js.map +1 -1
  50. package/lib/features/messaging/ActionSheet.js +104 -0
  51. package/lib/features/messaging/ActionSheet.js.map +1 -0
  52. package/lib/features/messaging/ChatAttachments.js +2 -6
  53. package/lib/features/messaging/ChatAttachments.js.map +1 -1
  54. package/lib/features/messaging/ChatComponents.js +512 -244
  55. package/lib/features/messaging/ChatComponents.js.map +1 -1
  56. package/lib/features/messaging/ChatInfoScreen.js +314 -0
  57. package/lib/features/messaging/ChatInfoScreen.js.map +1 -0
  58. package/lib/features/messaging/ContactsScreen.js +28 -11
  59. package/lib/features/messaging/ContactsScreen.js.map +1 -1
  60. package/lib/features/messaging/ConversationListScreen.js +274 -14
  61. package/lib/features/messaging/ConversationListScreen.js.map +1 -1
  62. package/lib/features/messaging/ForwardScreen.js +203 -0
  63. package/lib/features/messaging/ForwardScreen.js.map +1 -0
  64. package/lib/features/messaging/InviteSheet.js +43 -39
  65. package/lib/features/messaging/InviteSheet.js.map +1 -1
  66. package/lib/features/messaging/LinkPreviewCard.js +52 -24
  67. package/lib/features/messaging/LinkPreviewCard.js.map +1 -1
  68. package/lib/features/messaging/MessageActions.js +11 -15
  69. package/lib/features/messaging/MessageActions.js.map +1 -1
  70. package/lib/features/messaging/MessageInfoScreen.js +218 -0
  71. package/lib/features/messaging/MessageInfoScreen.js.map +1 -0
  72. package/lib/features/messaging/NativeChatExperience.js +248 -28
  73. package/lib/features/messaging/NativeChatExperience.js.map +1 -1
  74. package/lib/features/messaging/NotificationSettingsScreen.js +288 -0
  75. package/lib/features/messaging/NotificationSettingsScreen.js.map +1 -0
  76. package/lib/features/messaging/StarredMessagesScreen.js +161 -0
  77. package/lib/features/messaging/StarredMessagesScreen.js.map +1 -0
  78. package/lib/features/messaging/TapRow.js +46 -0
  79. package/lib/features/messaging/TapRow.js.map +1 -0
  80. package/lib/features/messaging/ThreadScreen.js +704 -81
  81. package/lib/features/messaging/ThreadScreen.js.map +1 -1
  82. package/lib/features/messaging/chatModel.js +217 -11
  83. package/lib/features/messaging/chatModel.js.map +1 -1
  84. package/lib/features/messaging/chatNotificationPrefs.js +47 -0
  85. package/lib/features/messaging/chatNotificationPrefs.js.map +1 -0
  86. package/lib/features/messaging/chatOperations.js +102 -2
  87. package/lib/features/messaging/chatOperations.js.map +1 -1
  88. package/lib/features/messaging/chatPushToken.js +25 -0
  89. package/lib/features/messaging/chatPushToken.js.map +1 -0
  90. package/lib/features/messaging/nativeChatChannelQuery.js.map +1 -1
  91. package/lib/features/messaging/useChatData.js +364 -15
  92. package/lib/features/messaging/useChatData.js.map +1 -1
  93. package/lib/features/messaging/usePressed.js +8 -0
  94. package/lib/features/messaging/usePressed.js.map +1 -0
  95. package/lib/index.js +1 -1
  96. package/lib/index.js.map +1 -1
  97. package/lib/screens/ChatNative/index.js +2 -1
  98. package/lib/screens/ChatNative/index.js.map +1 -1
  99. package/lib/screens/Health/index.js +20 -5
  100. package/lib/screens/Health/index.js.map +1 -1
  101. package/package.json +4 -4
@@ -1,6 +1,101 @@
1
- import {jsxs,jsx}from'react/jsx-runtime';import*as React from'react';import {StyleSheet,Platform,View,Pressable,Text,ActivityIndicator,FlatList,TextInput}from'react-native';import {AppKeyboardAvoidingView}from'../../components/AppKeyboardAvoidingView.js';import {SafeAreaView}from'react-native-safe-area-context';import {MaterialCommunityIcons}from'@expo/vector-icons';import {Avatar,ConnectionBanner,InlineBanner,EmptyState,MessageBubble,DaySeparator}from'./ChatComponents.js';import {dayLabel}from'./chatModel.js';import {MessageActionsOverlay}from'./MessageActions.js';import {StagedAttachments,RecordingBar,AttachSheet,ImageViewer}from'./ChatAttachments.js';function ThreadScreen({
1
+ import {jsxs,jsx}from'react/jsx-runtime';import*as React from'react';import {StyleSheet,Platform,View,Pressable,Text,TextInput,ActivityIndicator,FlatList,Animated,PanResponder}from'react-native';import {SafeAreaView}from'react-native-safe-area-context';import {MaterialCommunityIcons}from'@expo/vector-icons';import {AppKeyboardAvoidingView}from'../../components/AppKeyboardAvoidingView.js';import {Avatar,ConnectionBanner,InlineBanner,DaySeparator,UnreadDivider,MessageBubble,ReplyQuote}from'./ChatComponents.js';import {ActionSheet}from'./ActionSheet.js';import {replyRefOf,canEditMessage,canDeleteForEveryone,firstUnreadId,dayLabel,messageStatus,timeLabel}from'./chatModel.js';import {MessageActionsOverlay}from'./MessageActions.js';import {StagedAttachments,RecordingBar,AttachSheet,ImageViewer}from'./ChatAttachments.js';var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ const JUMP_BUTTON_OFFSET = 320;
21
+ const REPLY_SWIPE_TRIGGER = 56;
22
+ const REPLY_SWIPE_MAX = 80;
23
+ function SwipeToReply({
24
+ enabled,
25
+ theme,
26
+ onReply,
27
+ children
28
+ }) {
29
+ const dx = React.useRef(new Animated.Value(0)).current;
30
+ const armed = React.useRef(false);
31
+ const onReplyRef = React.useRef(onReply);
32
+ onReplyRef.current = onReply;
33
+ const responder = React.useMemo(() => PanResponder.create({
34
+ onMoveShouldSetPanResponder: (_, g) => enabled && g.dx > 12 && Math.abs(g.dx) > Math.abs(g.dy) * 2,
35
+ onPanResponderMove: (_, g) => {
36
+ const x = Math.max(0, Math.min(REPLY_SWIPE_MAX, g.dx));
37
+ dx.setValue(x);
38
+ armed.current = x >= REPLY_SWIPE_TRIGGER;
39
+ },
40
+ onPanResponderRelease: () => {
41
+ if (armed.current) onReplyRef.current();
42
+ armed.current = false;
43
+ Animated.spring(dx, {
44
+ toValue: 0,
45
+ useNativeDriver: true,
46
+ bounciness: 6
47
+ }).start();
48
+ },
49
+ onPanResponderTerminate: () => {
50
+ armed.current = false;
51
+ Animated.spring(dx, {
52
+ toValue: 0,
53
+ useNativeDriver: true
54
+ }).start();
55
+ },
56
+ onPanResponderTerminationRequest: () => true
57
+ }), [dx, enabled]);
58
+ const iconOpacity = dx.interpolate({
59
+ inputRange: [0, REPLY_SWIPE_TRIGGER],
60
+ outputRange: [0, 1],
61
+ extrapolate: "clamp"
62
+ });
63
+ return /* @__PURE__ */ jsxs(View, { children: [
64
+ /* @__PURE__ */ jsx(Animated.View, { pointerEvents: "none", style: [styles.swipeIcon, {
65
+ opacity: iconOpacity
66
+ }], children: /* @__PURE__ */ jsx(View, { style: [styles.swipeIconPlate, {
67
+ backgroundColor: theme.isDark ? theme.surface : theme.chipBg
68
+ }], children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "reply", size: 18, color: theme.textMuted }) }) }),
69
+ /* @__PURE__ */ jsx(Animated.View, __spreadProps(__spreadValues({ style: {
70
+ transform: [{
71
+ translateX: dx
72
+ }]
73
+ } }, responder.panHandlers), { children }))
74
+ ] });
75
+ }
76
+ function ThreadScreen({
2
77
  title,
78
+ subtitle,
3
79
  avatarUrl,
80
+ isGroup,
81
+ muted,
82
+ viewerId,
83
+ readWatermark,
84
+ deliveredWatermark,
85
+ initialUnreadCount,
86
+ typingText,
87
+ infoLabel,
88
+ onDraftChange,
89
+ onEdit,
90
+ onDeleteForEveryone,
91
+ onDeleteForMe,
92
+ onStar,
93
+ onForward,
94
+ onSearch,
95
+ onLoadUntil,
96
+ initialJumpTo,
97
+ initialDraft,
98
+ onShowInfo,
4
99
  messages,
5
100
  loading,
6
101
  loadingMore,
@@ -9,6 +104,7 @@ import {jsxs,jsx}from'react/jsx-runtime';import*as React from'react';import {Sty
9
104
  connectionState,
10
105
  haptics,
11
106
  onBack,
107
+ onOpenInfo,
12
108
  onSend,
13
109
  onLoadMore,
14
110
  onRetry,
@@ -23,12 +119,29 @@ import {jsxs,jsx}from'react/jsx-runtime';import*as React from'react';import {Sty
23
119
  onOpenLink
24
120
  }) {
25
121
  var _a;
26
- const [draft, setDraft] = React.useState("");
122
+ const [draft, setDraft] = React.useState(initialDraft != null ? initialDraft : "");
123
+ const draftRestored = React.useRef(Boolean(initialDraft));
124
+ React.useEffect(() => {
125
+ if (draftRestored.current || !initialDraft) return;
126
+ draftRestored.current = true;
127
+ setDraft((current) => current || initialDraft);
128
+ }, [initialDraft]);
27
129
  const [staged, setStaged] = React.useState([]);
28
130
  const [attachOpen, setAttachOpen] = React.useState(false);
29
131
  const [recordingSince, setRecordingSince] = React.useState(null);
30
132
  const [viewerUrl, setViewerUrl] = React.useState(null);
31
133
  const [composerError, setComposerError] = React.useState(null);
134
+ const [replyTo, setReplyTo] = React.useState(null);
135
+ const [editing, setEditing] = React.useState(null);
136
+ const [deleteTarget, setDeleteTarget] = React.useState(null);
137
+ const [menuOpen, setMenuOpen] = React.useState(false);
138
+ const [searchOpen, setSearchOpen] = React.useState(false);
139
+ const [searchQuery, setSearchQuery] = React.useState("");
140
+ const [searchHits, setSearchHits] = React.useState(null);
141
+ const [searching, setSearching] = React.useState(false);
142
+ const [highlightId, setHighlightId] = React.useState(null);
143
+ const inputRef = React.useRef(null);
144
+ const listRef = React.useRef(null);
32
145
  const canAttach = Boolean(media && onSendAttachments);
33
146
  const canRecord = Boolean(audio && onSendAttachments);
34
147
  const [selected, setSelected] = React.useState(null);
@@ -43,10 +156,40 @@ import {jsxs,jsx}from'react/jsx-runtime';import*as React from'react';import {Sty
43
156
  pendingShare.current = null;
44
157
  if (text) onShareText == null ? void 0 : onShareText(text);
45
158
  }, [onShareText]);
159
+ const startReply = React.useCallback((message) => {
160
+ var _a2;
161
+ haptics == null ? void 0 : haptics.impact("light");
162
+ setReplyTo(replyRefOf(message));
163
+ (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
164
+ }, [haptics]);
46
165
  const actions = React.useMemo(() => {
47
166
  var _a2;
48
167
  const body = (_a2 = selectedMessage == null ? void 0 : selectedMessage.body.trim()) != null ? _a2 : "";
49
168
  const list = [];
169
+ const at = Date.now();
170
+ if (selectedMessage) {
171
+ const target = selectedMessage;
172
+ list.push({
173
+ key: "reply",
174
+ label: "Reply",
175
+ icon: "reply",
176
+ onPress: () => {
177
+ setSelected(null);
178
+ startReply(target);
179
+ }
180
+ });
181
+ if (onForward && body) {
182
+ list.push({
183
+ key: "forward",
184
+ label: "Forward",
185
+ icon: "share",
186
+ onPress: () => {
187
+ setSelected(null);
188
+ onForward(target);
189
+ }
190
+ });
191
+ }
192
+ }
50
193
  if (onCopyText && body) {
51
194
  list.push({
52
195
  key: "copy",
@@ -70,25 +213,229 @@ import {jsxs,jsx}from'react/jsx-runtime';import*as React from'react';import {Sty
70
213
  }
71
214
  });
72
215
  }
216
+ if (selectedMessage && onShowInfo && selectedMessage.isMine && !selectedMessage.isDeleted && (!selectedMessage.sendState || selectedMessage.sendState === "sent")) {
217
+ const target = selectedMessage;
218
+ list.push({
219
+ key: "info",
220
+ label: "Info",
221
+ icon: "information-outline",
222
+ onPress: () => {
223
+ setSelected(null);
224
+ onShowInfo(target);
225
+ }
226
+ });
227
+ }
228
+ if (selectedMessage && onStar) {
229
+ const target = selectedMessage;
230
+ list.push({
231
+ key: "star",
232
+ label: target.starred ? "Unstar" : "Star",
233
+ icon: target.starred ? "star-off-outline" : "star-outline",
234
+ onPress: () => {
235
+ setSelected(null);
236
+ onStar(target.id, !target.starred);
237
+ }
238
+ });
239
+ }
240
+ if (selectedMessage && onEdit && canEditMessage(selectedMessage, at)) {
241
+ const target = selectedMessage;
242
+ list.push({
243
+ key: "edit",
244
+ label: "Edit",
245
+ icon: "pencil-outline",
246
+ onPress: () => {
247
+ var _a3;
248
+ setSelected(null);
249
+ setReplyTo(null);
250
+ setEditing({
251
+ id: target.id,
252
+ original: target.body,
253
+ draftBefore: draft
254
+ });
255
+ setDraft(target.body);
256
+ (_a3 = inputRef.current) == null ? void 0 : _a3.focus();
257
+ }
258
+ });
259
+ }
260
+ if (selectedMessage && (onDeleteForMe || onDeleteForEveryone)) {
261
+ const target = selectedMessage;
262
+ list.push({
263
+ key: "delete",
264
+ label: "Delete",
265
+ icon: "delete-outline",
266
+ onPress: () => {
267
+ setSelected(null);
268
+ setDeleteTarget(target);
269
+ }
270
+ });
271
+ }
272
+ return list;
273
+ }, [selectedMessage, onCopyText, onShareText, flushPendingShare, startReply, onForward, onStar, onEdit, onDeleteForMe, onDeleteForEveryone, onShowInfo, draft]);
274
+ const deleteActions = React.useMemo(() => {
275
+ const target = deleteTarget;
276
+ if (!target) return [];
277
+ const list = [];
278
+ if (onDeleteForEveryone && canDeleteForEveryone(target, Date.now())) {
279
+ list.push({
280
+ key: "delete-everyone",
281
+ label: "Delete for everyone",
282
+ icon: "delete-outline",
283
+ destructive: true,
284
+ onPress: () => onDeleteForEveryone(target.id)
285
+ });
286
+ }
287
+ if (onDeleteForMe) {
288
+ list.push({
289
+ key: "delete-me",
290
+ label: "Delete for me",
291
+ icon: "delete-outline",
292
+ destructive: true,
293
+ onPress: () => onDeleteForMe(target.id)
294
+ });
295
+ }
73
296
  return list;
74
- }, [selectedMessage, onCopyText, onShareText, flushPendingShare]);
75
- const now = React.useMemo(() => Date.now(), []);
297
+ }, [deleteTarget, onDeleteForEveryone, onDeleteForMe]);
298
+ const [now, setNow] = React.useState(() => Date.now());
299
+ React.useEffect(() => {
300
+ const t = setInterval(() => setNow(Date.now()), 6e4);
301
+ return () => clearInterval(t);
302
+ }, []);
76
303
  const rendered = React.useMemo(() => messages.slice().reverse(), [messages]);
77
304
  const canSend = draft.trim().length > 0 || staged.length > 0;
305
+ const [unreadAnchor, setUnreadAnchor] = React.useState(null);
306
+ const anchorDecided = React.useRef(false);
307
+ React.useEffect(() => {
308
+ if (anchorDecided.current || loading || !messages.length) return;
309
+ anchorDecided.current = true;
310
+ const id = firstUnreadId(messages, initialUnreadCount != null ? initialUnreadCount : 0);
311
+ if (id) setUnreadAnchor({
312
+ id,
313
+ count: initialUnreadCount != null ? initialUnreadCount : 0
314
+ });
315
+ }, [loading, messages, initialUnreadCount]);
316
+ const [scrolledUp, setScrolledUp] = React.useState(false);
317
+ const [missed, setMissed] = React.useState(0);
318
+ const newestId = messages.length ? messages[messages.length - 1].id : null;
319
+ const lastNewest = React.useRef(newestId);
320
+ React.useEffect(() => {
321
+ const previous = lastNewest.current;
322
+ lastNewest.current = newestId;
323
+ if (!previous || previous === newestId || !scrolledUp) return;
324
+ const newest = messages[messages.length - 1];
325
+ if (newest && !newest.isMine) setMissed((n) => n + 1);
326
+ }, [newestId, scrolledUp, messages]);
327
+ const onScroll = React.useCallback((e) => {
328
+ const up = e.nativeEvent.contentOffset.y > JUMP_BUTTON_OFFSET;
329
+ setScrolledUp(up);
330
+ if (!up) setMissed(0);
331
+ }, []);
332
+ const jumpToLatest = React.useCallback(() => {
333
+ var _a2;
334
+ (_a2 = listRef.current) == null ? void 0 : _a2.scrollToOffset({
335
+ offset: 0,
336
+ animated: true
337
+ });
338
+ setMissed(0);
339
+ }, []);
340
+ const renderedRef = React.useRef(rendered);
341
+ renderedRef.current = rendered;
342
+ const scrollTo = React.useCallback((messageId) => {
343
+ var _a2;
344
+ const index = renderedRef.current.findIndex((m) => m.id === messageId);
345
+ if (index < 0) return false;
346
+ (_a2 = listRef.current) == null ? void 0 : _a2.scrollToIndex({
347
+ index,
348
+ animated: true,
349
+ viewPosition: 0.5
350
+ });
351
+ setHighlightId(messageId);
352
+ setTimeout(() => setHighlightId((id) => id === messageId ? null : id), 1400);
353
+ return true;
354
+ }, []);
355
+ const jumpToMessage = React.useCallback((messageId) => {
356
+ if (scrollTo(messageId) || !onLoadUntil) return;
357
+ void onLoadUntil(messageId).then((found) => {
358
+ if (found) setTimeout(() => scrollTo(messageId), 120);
359
+ else setComposerError("That message is too far back to show here.");
360
+ });
361
+ }, [scrollTo, onLoadUntil]);
362
+ const jumpedTo = React.useRef(null);
363
+ React.useEffect(() => {
364
+ if (!initialJumpTo || loading || jumpedTo.current === initialJumpTo) return;
365
+ jumpedTo.current = initialJumpTo;
366
+ setTimeout(() => jumpToMessage(initialJumpTo), 250);
367
+ }, [initialJumpTo, loading, jumpToMessage]);
368
+ const runSearch = React.useCallback(async (query) => {
369
+ const q = query.trim();
370
+ if (!onSearch || q.length < 2) {
371
+ setSearchHits(null);
372
+ return;
373
+ }
374
+ setSearching(true);
375
+ try {
376
+ setSearchHits(await onSearch(q));
377
+ } catch (e) {
378
+ setSearchHits([]);
379
+ } finally {
380
+ setSearching(false);
381
+ }
382
+ }, [onSearch]);
383
+ React.useEffect(() => {
384
+ if (!searchOpen) return void 0;
385
+ const t = setTimeout(() => void runSearch(searchQuery), 350);
386
+ return () => clearTimeout(t);
387
+ }, [searchOpen, searchQuery, runSearch]);
388
+ const closeSearch = React.useCallback(() => {
389
+ setSearchOpen(false);
390
+ setSearchQuery("");
391
+ setSearchHits(null);
392
+ }, []);
393
+ const menuActions = React.useMemo(() => {
394
+ const list = [];
395
+ if (onOpenInfo) {
396
+ list.push({
397
+ key: "info",
398
+ label: infoLabel != null ? infoLabel : "Chat info",
399
+ icon: "information-outline",
400
+ onPress: onOpenInfo
401
+ });
402
+ }
403
+ if (onSearch) {
404
+ list.push({
405
+ key: "search",
406
+ label: "Search",
407
+ icon: "magnify",
408
+ onPress: () => setSearchOpen(true)
409
+ });
410
+ }
411
+ return list;
412
+ }, [onOpenInfo, onSearch, infoLabel]);
78
413
  const submit = React.useCallback(() => {
79
414
  const text = draft.trim();
415
+ const quote = replyTo;
416
+ if (editing) {
417
+ if (text && text !== editing.original.trim()) onEdit == null ? void 0 : onEdit(editing.id, text);
418
+ setEditing(null);
419
+ setDraft(editing.draftBefore);
420
+ return;
421
+ }
80
422
  if (staged.length && onSendAttachments) {
81
423
  setDraft("");
82
424
  setStaged([]);
425
+ setReplyTo(null);
83
426
  haptics == null ? void 0 : haptics.impact("light");
84
- onSendAttachments(staged, text, "image");
427
+ onSendAttachments(staged, text, "image", quote);
428
+ jumpToLatest();
85
429
  return;
86
430
  }
87
431
  if (!text) return;
88
432
  setDraft("");
433
+ setReplyTo(null);
434
+ onDraftChange == null ? void 0 : onDraftChange("");
89
435
  haptics == null ? void 0 : haptics.impact("light");
90
- onSend(text);
91
- }, [draft, staged, haptics, onSend, onSendAttachments]);
436
+ onSend(text, quote);
437
+ jumpToLatest();
438
+ }, [draft, staged, replyTo, editing, haptics, onSend, onSendAttachments, onEdit, onDraftChange, jumpToLatest]);
92
439
  const pendingPick = React.useRef(null);
93
440
  const runPendingPick = React.useCallback(() => {
94
441
  const source = pendingPick.current;
@@ -108,6 +455,12 @@ import {jsxs,jsx}from'react/jsx-runtime';import*as React from'react';import {Sty
108
455
  setAttachOpen(false);
109
456
  if (Platform.OS !== "ios") setTimeout(runPendingPick, 400);
110
457
  }, [media, runPendingPick]);
458
+ const openCamera = React.useCallback(() => {
459
+ if (!media) return;
460
+ setComposerError(null);
461
+ pendingPick.current = "camera";
462
+ runPendingPick();
463
+ }, [media, runPendingPick]);
111
464
  const startRecording = React.useCallback(async () => {
112
465
  if (!audio) return;
113
466
  setComposerError(null);
@@ -134,114 +487,253 @@ import {jsxs,jsx}from'react/jsx-runtime';import*as React from'react';import {Sty
134
487
  const file = await audio.stopRecording();
135
488
  if (file && onSendAttachments) {
136
489
  haptics == null ? void 0 : haptics.impact("light");
137
- onSendAttachments([file], "", "audio");
490
+ onSendAttachments([file], "", "audio", replyTo);
491
+ setReplyTo(null);
138
492
  }
139
493
  } catch (e) {
140
494
  setComposerError(e instanceof Error ? e.message : "Could not send the recording.");
141
495
  }
142
- }, [audio, haptics, onSendAttachments]);
496
+ }, [audio, haptics, onSendAttachments, replyTo]);
143
497
  const recordingRef = React.useRef(recordingSince);
144
498
  recordingRef.current = recordingSince;
145
499
  React.useEffect(() => () => {
146
500
  if (recordingRef.current) void (audio == null ? void 0 : audio.cancelRecording());
147
501
  }, [audio]);
148
- return /* @__PURE__ */ jsxs(AppKeyboardAvoidingView, { style: styles.fill, behavior: Platform.OS === "ios" ? "padding" : void 0, keyboardVerticalOffset: 0, children: [
149
- /* @__PURE__ */ jsx(SafeAreaView, { edges: ["top"], style: {
150
- backgroundColor: theme.headerBg
151
- }, children: /* @__PURE__ */ jsxs(View, { style: {
152
- flexDirection: "row",
153
- alignItems: "center",
154
- paddingHorizontal: 4,
155
- paddingVertical: 6,
156
- borderBottomWidth: StyleSheet.hairlineWidth,
157
- borderBottomColor: theme.border,
502
+ const headerSubtitle = typingText || subtitle || "";
503
+ return /* @__PURE__ */ jsxs(AppKeyboardAvoidingView, { style: [styles.fill, {
504
+ backgroundColor: theme.threadBg
505
+ }], behavior: Platform.OS === "ios" ? "padding" : void 0, keyboardVerticalOffset: 0, children: [
506
+ /* @__PURE__ */ jsxs(SafeAreaView, { edges: ["top"], style: {
158
507
  backgroundColor: theme.headerBg
159
508
  }, children: [
160
- /* @__PURE__ */ jsx(Pressable, { onPress: onBack, hitSlop: 10, accessibilityRole: "button", accessibilityLabel: "Back", children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "chevron-left", size: 32, color: theme.accent }) }),
161
- /* @__PURE__ */ jsxs(Pressable, { onPress: onBack, accessibilityRole: "button", style: {
509
+ /* @__PURE__ */ jsxs(View, { style: {
162
510
  flexDirection: "row",
163
511
  alignItems: "center",
164
- flex: 1,
165
- marginLeft: 4,
166
- minWidth: 0
512
+ paddingLeft: 4,
513
+ paddingRight: 8,
514
+ paddingVertical: 6,
515
+ minHeight: 52,
516
+ borderBottomWidth: StyleSheet.hairlineWidth,
517
+ borderBottomColor: theme.border,
518
+ backgroundColor: theme.headerBg
167
519
  }, children: [
168
- /* @__PURE__ */ jsx(Avatar, { name: title, uri: avatarUrl, theme, size: 36 }),
169
- /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: {
520
+ /* @__PURE__ */ jsx(Pressable, { onPress: onBack, hitSlop: 10, accessibilityRole: "button", accessibilityLabel: "Back", style: styles.headerIcon, testID: "chat-thread-back", children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "chevron-left", size: 32, color: theme.accent }) }),
521
+ /* @__PURE__ */ jsx(Pressable, { onPress: onOpenInfo != null ? onOpenInfo : void 0, disabled: !onOpenInfo, accessibilityRole: "button", accessibilityLabel: onOpenInfo ? `${title}, chat info` : title, style: {
170
522
  flex: 1,
171
- fontSize: 17,
172
- fontWeight: "600",
173
- color: theme.text,
174
- marginLeft: 10
175
- }, children: title })
523
+ minWidth: 0
524
+ }, testID: "chat-thread-header", children: /* @__PURE__ */ jsxs(View, { style: {
525
+ flexDirection: "row",
526
+ alignItems: "center",
527
+ minWidth: 0
528
+ }, children: [
529
+ /* @__PURE__ */ jsx(Avatar, { name: title, uri: avatarUrl, theme, size: 38, variant: "initials" }),
530
+ /* @__PURE__ */ jsxs(View, { style: {
531
+ flex: 1,
532
+ minWidth: 0,
533
+ marginLeft: 10
534
+ }, children: [
535
+ /* @__PURE__ */ jsxs(View, { style: {
536
+ flexDirection: "row",
537
+ alignItems: "center"
538
+ }, children: [
539
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: {
540
+ flexShrink: 1,
541
+ fontSize: 17,
542
+ fontWeight: "600",
543
+ color: theme.text
544
+ }, children: title }),
545
+ muted ? /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "bell-off", size: 14, color: theme.textMuted, style: {
546
+ marginLeft: 5
547
+ }, accessibilityLabel: "Muted" }) : null
548
+ ] }),
549
+ headerSubtitle ? /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: {
550
+ fontSize: 13,
551
+ color: typingText ? theme.accent : theme.textMuted,
552
+ marginTop: 1
553
+ }, testID: "chat-thread-subtitle", children: headerSubtitle }) : null
554
+ ] })
555
+ ] }) }),
556
+ menuActions.length ? /* @__PURE__ */ jsx(Pressable, { onPress: () => setMenuOpen(true), hitSlop: 8, accessibilityRole: "button", accessibilityLabel: "Chat menu", style: styles.headerIcon, testID: "chat-thread-menu", children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "dots-vertical", size: 24, color: theme.textMuted }) }) : null
176
557
  ] }),
177
- /* @__PURE__ */ jsx(Pressable, { hitSlop: 8, accessibilityRole: "button", accessibilityLabel: "More options", children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "dots-vertical", size: 22, color: theme.textMuted }) })
178
- ] }) }),
558
+ searchOpen ? /* @__PURE__ */ jsxs(View, { style: [styles.searchBar, {
559
+ backgroundColor: theme.headerBg,
560
+ borderBottomColor: theme.border,
561
+ flexDirection: "row"
562
+ }], children: [
563
+ /* @__PURE__ */ jsxs(View, { style: [styles.searchField, {
564
+ backgroundColor: theme.composerField,
565
+ flexDirection: "row"
566
+ }], children: [
567
+ /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "magnify", size: 20, color: theme.textMuted }),
568
+ /* @__PURE__ */ jsx(TextInput, { value: searchQuery, onChangeText: setSearchQuery, placeholder: "Search this chat", placeholderTextColor: theme.textMuted, autoFocus: true, returnKeyType: "search", style: [styles.searchInput, {
569
+ color: theme.text
570
+ }], testID: "chat-thread-search" }),
571
+ searching ? /* @__PURE__ */ jsx(ActivityIndicator, { size: "small", color: theme.textMuted }) : null
572
+ ] }),
573
+ /* @__PURE__ */ jsx(Pressable, { onPress: closeSearch, hitSlop: 8, accessibilityRole: "button", style: styles.searchCancel, children: /* @__PURE__ */ jsx(Text, { style: {
574
+ color: theme.accent,
575
+ fontSize: 16
576
+ }, children: "Cancel" }) })
577
+ ] }) : null
578
+ ] }),
179
579
  /* @__PURE__ */ jsx(ConnectionBanner, { state: connectionState, theme }),
180
580
  /* @__PURE__ */ jsx(InlineBanner, { message: error, theme, onDismiss: onDismissError }),
181
581
  /* @__PURE__ */ jsx(InlineBanner, { message: composerError, theme, onDismiss: () => setComposerError(null) }),
182
582
  loading && messages.length === 0 ? /* @__PURE__ */ jsx(View, { style: [styles.center, {
183
- backgroundColor: theme.threadBg,
184
583
  flex: 1
185
- }], children: /* @__PURE__ */ jsx(ActivityIndicator, { color: theme.accent }) }) : /* @__PURE__ */ jsx(FlatList, { inverted: true, data: rendered, style: {
186
- flex: 1,
187
- backgroundColor: theme.threadBg
188
- }, keyExtractor: (m) => m.id, renderItem: ({
189
- item,
190
- index
191
- }) => {
192
- const older = rendered[index + 1];
193
- const newer = index > 0 ? rendered[index - 1] : null;
194
- const sameAuthor = (a, b) => Boolean(a && !a.isDeleted && !b.isDeleted && a.authorId && a.authorId === b.authorId);
195
- const showAuthor = !older || older.authorId !== item.authorId;
196
- const groupWithPrevious = sameAuthor(older, item);
197
- const groupWithNext = sameAuthor(newer, item);
198
- const label = dayLabel(item.createdAt, now);
199
- const olderLabel = older ? dayLabel(older.createdAt, now) : null;
200
- return /* @__PURE__ */ jsxs(View, { children: [
201
- /* @__PURE__ */ jsx(MessageBubble, { message: item, theme, fileBaseUrl: media == null ? void 0 : media.fileBaseUrl, audio, onOpenImage: setViewerUrl, linkPreviews, onOpenLink, showAuthor, groupWithPrevious, groupWithNext, onRetry: () => onRetry(item.id), onLongPress: (
202
- // Only confirmed messages can be reacted to or acted on.
203
- !item.isDeleted && (!item.sendState || item.sendState === "sent") ? (frame) => {
204
- haptics == null ? void 0 : haptics.impact("medium");
205
- setSelected({
206
- id: item.id,
207
- frame
208
- });
209
- } : void 0
210
- ) }),
211
- olderLabel !== label ? /* @__PURE__ */ jsx(DaySeparator, { label, theme }) : null
212
- ] });
213
- }, onEndReached: onLoadMore, onEndReachedThreshold: 0.4, ListFooterComponent: loadingMore ? /* @__PURE__ */ jsx(ActivityIndicator, { style: styles.moreSpinner, size: "small" }) : null, contentContainerStyle: rendered.length === 0 ? styles.listContentEmpty : void 0, ListEmptyComponent: /* @__PURE__ */ jsx(View, { style: styles.emptyInverted, children: /* @__PURE__ */ jsx(EmptyState, { icon: "message-text-outline", title: "No messages yet", detail: "Messages you send stay in this chat.", theme }) }), keyboardDismissMode: "interactive", keyboardShouldPersistTaps: "handled", testID: "chat-thread" }),
584
+ }], children: /* @__PURE__ */ jsx(ActivityIndicator, { color: theme.accent }) }) : /* @__PURE__ */ jsxs(View, { style: styles.fill, children: [
585
+ /* @__PURE__ */ jsx(FlatList, { ref: listRef, inverted: true, data: rendered, style: styles.fill, keyExtractor: (m) => m.id, onScroll, scrollEventThrottle: 100, onScrollToIndexFailed: (info) => {
586
+ var _a2;
587
+ (_a2 = listRef.current) == null ? void 0 : _a2.scrollToOffset({
588
+ offset: info.averageItemLength * info.index,
589
+ animated: true
590
+ });
591
+ }, renderItem: ({
592
+ item,
593
+ index
594
+ }) => {
595
+ const older = rendered[index + 1];
596
+ const label = dayLabel(item.createdAt, now);
597
+ const olderLabel = older ? dayLabel(older.createdAt, now) : null;
598
+ const newDay = olderLabel !== label;
599
+ const sameRun = (a, b) => Boolean(a && !a.isDeleted && !b.isDeleted && a.authorId && a.authorId === b.authorId);
600
+ const startsBand = (unreadAnchor == null ? void 0 : unreadAnchor.id) === item.id;
601
+ const groupWithPrevious = sameRun(older, item) && !newDay && !startsBand;
602
+ return /* @__PURE__ */ jsxs(View, { children: [
603
+ newDay ? /* @__PURE__ */ jsx(DaySeparator, { label, theme }) : null,
604
+ startsBand && unreadAnchor ? /* @__PURE__ */ jsx(UnreadDivider, { count: unreadAnchor.count, theme }) : null,
605
+ /* @__PURE__ */ jsx(SwipeToReply, { enabled: !item.isDeleted && (!item.sendState || item.sendState === "sent"), theme, onReply: () => startReply(item), children: /* @__PURE__ */ jsx(MessageBubble, { message: item, theme, status: item.isMine ? messageStatus(item, readWatermark != null ? readWatermark : 0, deliveredWatermark != null ? deliveredWatermark : 0) : void 0, viewerId, fileBaseUrl: media == null ? void 0 : media.fileBaseUrl, audio, onOpenImage: setViewerUrl, linkPreviews, onOpenLink, showAuthor: Boolean(isGroup) && !groupWithPrevious, groupWithPrevious, highlighted: highlightId === item.id, onPressQuote: jumpToMessage, onRetry: () => onRetry(item.id), onLongPress: (
606
+ // Only confirmed messages can be reacted to or acted on.
607
+ !item.isDeleted && (!item.sendState || item.sendState === "sent") ? (frame) => {
608
+ haptics == null ? void 0 : haptics.impact("medium");
609
+ setSelected({
610
+ id: item.id,
611
+ frame
612
+ });
613
+ } : void 0
614
+ ) }) })
615
+ ] });
616
+ }, onEndReached: onLoadMore, onEndReachedThreshold: 0.4, ListHeaderComponent: /* @__PURE__ */ jsx(View, { style: styles.listBottomGap }), ListFooterComponent: loadingMore ? /* @__PURE__ */ jsx(ActivityIndicator, { style: styles.moreSpinner, size: "small", color: theme.textMuted }) : null, contentContainerStyle: rendered.length === 0 ? styles.listContentEmpty : void 0, ListEmptyComponent: /* @__PURE__ */ jsx(View, { style: styles.emptyInverted, children: /* @__PURE__ */ jsxs(View, { style: [styles.emptyChip, {
617
+ backgroundColor: theme.chipBg
618
+ }], children: [
619
+ /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "lock-outline", size: 14, color: theme.chipText }),
620
+ /* @__PURE__ */ jsx(Text, { style: [styles.emptyChipText, {
621
+ color: theme.chipText
622
+ }], children: "Messages you send appear here. Say hi!" })
623
+ ] }) }), keyboardDismissMode: "interactive", keyboardShouldPersistTaps: "handled", testID: "chat-thread" }),
624
+ searchOpen && searchHits ? /* @__PURE__ */ jsx(View, { style: [StyleSheet.absoluteFill, {
625
+ backgroundColor: theme.bg
626
+ }], testID: "chat-thread-search-results", children: /* @__PURE__ */ jsx(FlatList, { data: searchHits, keyExtractor: (h) => h.id, keyboardShouldPersistTaps: "handled", ListEmptyComponent: /* @__PURE__ */ jsx(Text, { style: [styles.searchEmpty, {
627
+ color: theme.textMuted
628
+ }], children: "No messages found" }), renderItem: ({
629
+ item
630
+ }) => /* @__PURE__ */ jsx(Pressable, { onPress: () => {
631
+ closeSearch();
632
+ jumpToMessage(item.id);
633
+ }, accessibilityRole: "button", children: /* @__PURE__ */ jsxs(View, { style: [styles.searchHit, {
634
+ borderBottomColor: theme.border
635
+ }], children: [
636
+ /* @__PURE__ */ jsxs(View, { style: {
637
+ flexDirection: "row",
638
+ justifyContent: "space-between"
639
+ }, children: [
640
+ /* @__PURE__ */ jsx(Text, { style: [styles.searchHitAuthor, {
641
+ color: theme.text
642
+ }], numberOfLines: 1, children: item.authorName }),
643
+ /* @__PURE__ */ jsx(Text, { style: {
644
+ color: theme.textMuted,
645
+ fontSize: 12
646
+ }, children: `${dayLabel(item.createdAt, now)} ${timeLabel(item.createdAt)}` })
647
+ ] }),
648
+ /* @__PURE__ */ jsx(Text, { style: {
649
+ color: theme.textMuted,
650
+ fontSize: 15,
651
+ marginTop: 2
652
+ }, numberOfLines: 2, children: item.body })
653
+ ] }) }) }) }) : null,
654
+ scrolledUp ? /* @__PURE__ */ jsxs(Pressable, { onPress: jumpToLatest, accessibilityRole: "button", accessibilityLabel: missed ? `${missed} new messages, jump to latest` : "Jump to latest", style: [styles.jumpButton, {
655
+ backgroundColor: theme.isDark ? theme.surface : theme.bg
656
+ }], testID: "chat-jump-latest", children: [
657
+ /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "chevron-double-down", size: 22, color: theme.textMuted }),
658
+ missed ? /* @__PURE__ */ jsx(View, { style: [styles.jumpBadge, {
659
+ backgroundColor: theme.unread
660
+ }], children: /* @__PURE__ */ jsx(Text, { style: styles.jumpBadgeText, children: missed > 99 ? "99+" : missed }) }) : null
661
+ ] }) : null
662
+ ] }),
214
663
  /* @__PURE__ */ jsx(StagedAttachments, { files: staged, theme, onRemove: (index) => setStaged((prev) => prev.filter((_, i) => i !== index)) }),
215
- recordingSince ? /* @__PURE__ */ jsx(RecordingBar, { theme, startedAt: recordingSince, onCancel: () => void finishRecording(false), onSend: () => void finishRecording(true) }) : /* @__PURE__ */ jsxs(View, { style: {
664
+ editing && !recordingSince ? /* @__PURE__ */ jsxs(View, { style: [styles.replyBar, {
665
+ backgroundColor: theme.composerBar,
666
+ flexDirection: "row"
667
+ }], testID: "chat-composer-editing", children: [
668
+ /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "pencil", size: 18, color: theme.accent, style: styles.editIcon }),
669
+ /* @__PURE__ */ jsxs(View, { style: {
670
+ flex: 1
671
+ }, children: [
672
+ /* @__PURE__ */ jsx(Text, { style: {
673
+ color: theme.accent,
674
+ fontSize: 13,
675
+ fontWeight: "600"
676
+ }, children: "Edit message" }),
677
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: {
678
+ color: theme.textMuted,
679
+ fontSize: 14
680
+ }, children: editing.original })
681
+ ] }),
682
+ /* @__PURE__ */ jsx(Pressable, { onPress: () => {
683
+ if (editing) setDraft(editing.draftBefore);
684
+ setEditing(null);
685
+ }, hitSlop: 10, accessibilityRole: "button", accessibilityLabel: "Cancel edit", style: styles.replyClose, children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "close", size: 20, color: theme.textMuted }) })
686
+ ] }) : null,
687
+ replyTo && !recordingSince ? /* @__PURE__ */ jsxs(View, { style: [styles.replyBar, {
688
+ backgroundColor: theme.composerBar,
689
+ flexDirection: "row"
690
+ }], testID: "chat-composer-reply", children: [
691
+ /* @__PURE__ */ jsx(View, { style: {
692
+ flex: 1
693
+ }, children: /* @__PURE__ */ jsx(ReplyQuote, { reply: replyTo, theme, viewerId, compact: true }) }),
694
+ /* @__PURE__ */ jsx(Pressable, { onPress: () => setReplyTo(null), hitSlop: 10, accessibilityRole: "button", accessibilityLabel: "Cancel reply", style: styles.replyClose, children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "close", size: 20, color: theme.textMuted }) })
695
+ ] }) : null,
696
+ recordingSince ? /* @__PURE__ */ jsx(RecordingBar, { theme, startedAt: recordingSince, onCancel: () => void finishRecording(false), onSend: () => void finishRecording(true) }) : /* @__PURE__ */ jsx(SafeAreaView, { edges: ["bottom"], style: {
697
+ backgroundColor: theme.composerBar
698
+ }, children: /* @__PURE__ */ jsxs(View, { style: {
216
699
  flexDirection: "row",
217
700
  alignItems: "flex-end",
218
- paddingHorizontal: 8,
219
- paddingVertical: 8,
701
+ paddingHorizontal: 6,
702
+ paddingVertical: 6,
220
703
  backgroundColor: theme.composerBar
221
704
  }, children: [
222
- canAttach ? /* @__PURE__ */ jsx(Pressable, { onPress: () => setAttachOpen(true), hitSlop: 6, accessibilityRole: "button", accessibilityLabel: "Add photos", style: styles.composerIcon, testID: "chat-composer-attach", children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "plus-circle-outline", size: 28, color: theme.textMuted }) }) : null,
705
+ canAttach ? /* @__PURE__ */ jsx(Pressable, { onPress: () => setAttachOpen(true), hitSlop: 6, accessibilityRole: "button", accessibilityLabel: "Attach", style: styles.composerIcon, testID: "chat-composer-attach", children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "plus", size: 28, color: theme.accent }) }) : null,
223
706
  /* @__PURE__ */ jsx(View, { style: {
224
707
  flex: 1,
225
708
  flexDirection: "row",
226
709
  alignItems: "flex-end",
227
- backgroundColor: theme.bg,
710
+ backgroundColor: theme.composerField,
228
711
  borderRadius: 20,
229
- borderWidth: StyleSheet.hairlineWidth,
712
+ borderWidth: theme.isDark ? 0 : StyleSheet.hairlineWidth,
230
713
  borderColor: theme.border,
231
- paddingHorizontal: 12,
714
+ paddingHorizontal: 14,
232
715
  minHeight: 38,
233
- marginHorizontal: 6
234
- }, children: /* @__PURE__ */ jsx(TextInput, { value: draft, onChangeText: setDraft, placeholder: "Message", placeholderTextColor: theme.textMuted, style: {
716
+ marginHorizontal: 4
717
+ }, children: /* @__PURE__ */ jsx(TextInput, { ref: inputRef, value: draft, onChangeText: (text) => {
718
+ setDraft(text);
719
+ if (!editing) onDraftChange == null ? void 0 : onDraftChange(text);
720
+ }, placeholder: "Message", placeholderTextColor: theme.textMuted, style: {
235
721
  flex: 1,
236
722
  color: theme.text,
237
723
  fontSize: 17,
238
724
  paddingVertical: Platform.OS === "ios" ? 8 : 6,
239
725
  maxHeight: 120
240
726
  }, multiline: true, blurOnSubmit: false, testID: "chat-composer-input" }) }),
241
- canSend || !canRecord ? /* @__PURE__ */ jsx(Pressable, { onPress: canSend ? submit : void 0, disabled: !canSend, accessibilityRole: "button", accessibilityLabel: "Send message", style: [styles.composerSend, {
727
+ canSend || !canRecord ? /* @__PURE__ */ jsx(Pressable, { onPress: canSend ? submit : void 0, disabled: !canSend, accessibilityRole: "button", accessibilityLabel: editing ? "Save edit" : "Send message", style: [styles.composerSend, {
242
728
  backgroundColor: canSend ? theme.accent : theme.border
243
- }], testID: "chat-composer-send", children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "arrow-up", size: 22, color: theme.onAccent }) }) : /* @__PURE__ */ jsx(Pressable, { onPress: () => void startRecording(), hitSlop: 6, accessibilityRole: "button", accessibilityLabel: "Record voice message", style: styles.composerSend, testID: "chat-composer-mic", children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "microphone-outline", size: 26, color: theme.textMuted }) })
244
- ] }),
729
+ }], testID: "chat-composer-send", children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: editing ? "check" : "send", size: editing ? 22 : 20, color: theme.onAccent, style: editing ? null : styles.sendGlyph }) }) : /* @__PURE__ */ jsxs(View, { style: {
730
+ flexDirection: "row",
731
+ alignItems: "center"
732
+ }, children: [
733
+ canAttach ? /* @__PURE__ */ jsx(Pressable, { onPress: openCamera, hitSlop: 6, accessibilityRole: "button", accessibilityLabel: "Take a photo", style: styles.composerIcon, testID: "chat-composer-camera", children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "camera-outline", size: 26, color: theme.accent }) }) : null,
734
+ /* @__PURE__ */ jsx(Pressable, { onPress: () => void startRecording(), hitSlop: 6, accessibilityRole: "button", accessibilityLabel: "Record voice message", style: styles.composerIcon, testID: "chat-composer-mic", children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "microphone-outline", size: 26, color: theme.accent }) })
735
+ ] })
736
+ ] }) }),
245
737
  /* @__PURE__ */ jsx(AttachSheet, { visible: attachOpen, theme, onClose: () => setAttachOpen(false), onPhotos: () => pick("library"), onCamera: () => pick("camera"), onDismissed: Platform.OS === "ios" ? runPendingPick : void 0 }),
246
738
  /* @__PURE__ */ jsx(ImageViewer, { url: viewerUrl, onClose: () => setViewerUrl(null) }),
247
739
  /* @__PURE__ */ jsx(MessageActionsOverlay, { message: selectedMessage, frame: (_a = selected == null ? void 0 : selected.frame) != null ? _a : null, theme, actions, onReact: (emoji) => {
@@ -250,7 +742,9 @@ import {jsxs,jsx}from'react/jsx-runtime';import*as React from'react';import {Sty
250
742
  onReact(selectedMessage.id, emoji);
251
743
  }
252
744
  setSelected(null);
253
- }, onClose: closeActions, onDismissed: Platform.OS === "ios" ? flushPendingShare : void 0 })
745
+ }, onClose: closeActions, onDismissed: Platform.OS === "ios" ? flushPendingShare : void 0 }),
746
+ /* @__PURE__ */ jsx(ActionSheet, { visible: Boolean(deleteTarget), title: "Delete message?", actions: deleteActions, theme, onClose: () => setDeleteTarget(null), testID: "chat-delete-sheet" }),
747
+ /* @__PURE__ */ jsx(ActionSheet, { visible: menuOpen, actions: menuActions, theme, onClose: () => setMenuOpen(false), testID: "chat-thread-menu-sheet" })
254
748
  ] });
255
749
  }
256
750
  const styles = StyleSheet.create({
@@ -266,6 +760,9 @@ const styles = StyleSheet.create({
266
760
  flexGrow: 1,
267
761
  justifyContent: "center"
268
762
  },
763
+ listBottomGap: {
764
+ height: 8
765
+ },
269
766
  moreSpinner: {
270
767
  paddingVertical: 12
271
768
  },
@@ -274,18 +771,144 @@ const styles = StyleSheet.create({
274
771
  scaleY: -1
275
772
  }],
276
773
  paddingVertical: 24,
277
- alignItems: "center"
774
+ alignItems: "center",
775
+ paddingHorizontal: 32
776
+ },
777
+ emptyChip: {
778
+ flexDirection: "row",
779
+ alignItems: "center",
780
+ borderRadius: 8,
781
+ paddingHorizontal: 12,
782
+ paddingVertical: 8
783
+ },
784
+ emptyChipText: {
785
+ fontSize: 13,
786
+ marginLeft: 6,
787
+ textAlign: "center"
788
+ },
789
+ headerIcon: {
790
+ width: 40,
791
+ height: 40,
792
+ alignItems: "center",
793
+ justifyContent: "center"
278
794
  },
279
795
  composerIcon: {
796
+ width: 40,
797
+ height: 38,
798
+ alignItems: "center",
799
+ justifyContent: "center"
800
+ },
801
+ composerSend: {
802
+ width: 38,
803
+ height: 38,
804
+ borderRadius: 19,
805
+ alignItems: "center",
806
+ justifyContent: "center",
807
+ marginLeft: 2
808
+ },
809
+ /** The paper plane's optical center sits left of its box. */
810
+ sendGlyph: {
811
+ marginLeft: 3
812
+ },
813
+ replyBar: {
814
+ alignItems: "center",
815
+ paddingLeft: 10,
816
+ paddingRight: 4,
817
+ paddingTop: 8
818
+ },
819
+ replyClose: {
280
820
  width: 36,
281
821
  height: 36,
282
822
  alignItems: "center",
283
823
  justifyContent: "center"
284
824
  },
285
- composerSend: {
286
- width: 32,
287
- height: 32,
288
- borderRadius: 16,
825
+ editIcon: {
826
+ marginRight: 10
827
+ },
828
+ searchBar: {
829
+ alignItems: "center",
830
+ paddingHorizontal: 10,
831
+ paddingBottom: 8,
832
+ borderBottomWidth: StyleSheet.hairlineWidth
833
+ },
834
+ searchField: {
835
+ flex: 1,
836
+ alignItems: "center",
837
+ height: 36,
838
+ borderRadius: 10,
839
+ paddingHorizontal: 10
840
+ },
841
+ searchInput: {
842
+ flex: 1,
843
+ marginLeft: 6,
844
+ fontSize: 16,
845
+ paddingVertical: 0
846
+ },
847
+ searchCancel: {
848
+ marginLeft: 10,
849
+ paddingVertical: 6
850
+ },
851
+ searchEmpty: {
852
+ textAlign: "center",
853
+ marginTop: 40,
854
+ fontSize: 15
855
+ },
856
+ searchHit: {
857
+ paddingHorizontal: 16,
858
+ paddingVertical: 10,
859
+ borderBottomWidth: StyleSheet.hairlineWidth
860
+ },
861
+ searchHitAuthor: {
862
+ fontSize: 15,
863
+ fontWeight: "600",
864
+ flex: 1,
865
+ marginRight: 8
866
+ },
867
+ jumpButton: {
868
+ position: "absolute",
869
+ right: 12,
870
+ bottom: 12,
871
+ width: 40,
872
+ height: 40,
873
+ borderRadius: 20,
874
+ alignItems: "center",
875
+ justifyContent: "center",
876
+ shadowColor: "#0b141a",
877
+ shadowOpacity: 0.2,
878
+ shadowRadius: 3,
879
+ shadowOffset: {
880
+ width: 0,
881
+ height: 1
882
+ },
883
+ elevation: 3
884
+ },
885
+ jumpBadge: {
886
+ position: "absolute",
887
+ top: -6,
888
+ right: -4,
889
+ minWidth: 20,
890
+ height: 20,
891
+ borderRadius: 10,
892
+ paddingHorizontal: 5,
893
+ alignItems: "center",
894
+ justifyContent: "center"
895
+ },
896
+ jumpBadgeText: {
897
+ color: "#ffffff",
898
+ fontSize: 11,
899
+ fontWeight: "700"
900
+ },
901
+ swipeIcon: {
902
+ position: "absolute",
903
+ left: 8,
904
+ top: 0,
905
+ bottom: 0,
906
+ justifyContent: "center"
907
+ },
908
+ swipeIconPlate: {
909
+ width: 30,
910
+ height: 30,
911
+ borderRadius: 15,
289
912
  alignItems: "center",
290
913
  justifyContent: "center"
291
914
  }