@droppii-org/chat-mobile 0.2.82 → 0.2.84

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 (45) hide show
  1. package/lib/module/components/messages/linkMessage/index.js +33 -29
  2. package/lib/module/components/messages/linkMessage/index.js.map +1 -1
  3. package/lib/module/components/messages/quotedMessage/index.js +79 -55
  4. package/lib/module/components/messages/quotedMessage/index.js.map +1 -1
  5. package/lib/module/components/messages/stickerMessage/index.js +38 -13
  6. package/lib/module/components/messages/stickerMessage/index.js.map +1 -1
  7. package/lib/module/components/messages/textMessage/index.js +41 -22
  8. package/lib/module/components/messages/textMessage/index.js.map +1 -1
  9. package/lib/module/components/messages/types.js.map +1 -1
  10. package/lib/module/screens/chat-detail/ChatListLegend.js +16 -8
  11. package/lib/module/screens/chat-detail/ChatListLegend.js.map +1 -1
  12. package/lib/module/screens/chat-detail/components/ChatMessageInput.js +2 -2
  13. package/lib/module/screens/chat-detail/components/ChatMessageInput.js.map +1 -1
  14. package/lib/module/screens/chat-detail/legend/LegendChatDay.js +4 -9
  15. package/lib/module/screens/chat-detail/legend/LegendChatDay.js.map +1 -1
  16. package/lib/module/screens/chat-detail/legend/LegendChatMessage.js +9 -1
  17. package/lib/module/screens/chat-detail/legend/LegendChatMessage.js.map +1 -1
  18. package/lib/module/utils/legendListMessage.js +9 -1
  19. package/lib/module/utils/legendListMessage.js.map +1 -1
  20. package/lib/typescript/src/components/messages/linkMessage/index.d.ts +2 -2
  21. package/lib/typescript/src/components/messages/linkMessage/index.d.ts.map +1 -1
  22. package/lib/typescript/src/components/messages/quotedMessage/index.d.ts.map +1 -1
  23. package/lib/typescript/src/components/messages/stickerMessage/index.d.ts +2 -2
  24. package/lib/typescript/src/components/messages/stickerMessage/index.d.ts.map +1 -1
  25. package/lib/typescript/src/components/messages/textMessage/index.d.ts +2 -2
  26. package/lib/typescript/src/components/messages/textMessage/index.d.ts.map +1 -1
  27. package/lib/typescript/src/components/messages/types.d.ts +1 -0
  28. package/lib/typescript/src/components/messages/types.d.ts.map +1 -1
  29. package/lib/typescript/src/screens/chat-detail/ChatListLegend.d.ts.map +1 -1
  30. package/lib/typescript/src/screens/chat-detail/legend/LegendChatDay.d.ts.map +1 -1
  31. package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts +2 -1
  32. package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts.map +1 -1
  33. package/lib/typescript/src/utils/legendListMessage.d.ts +4 -3
  34. package/lib/typescript/src/utils/legendListMessage.d.ts.map +1 -1
  35. package/package.json +1 -1
  36. package/src/components/messages/linkMessage/index.tsx +41 -34
  37. package/src/components/messages/quotedMessage/index.tsx +95 -64
  38. package/src/components/messages/stickerMessage/index.tsx +40 -11
  39. package/src/components/messages/textMessage/index.tsx +55 -33
  40. package/src/components/messages/types.ts +1 -0
  41. package/src/screens/chat-detail/ChatListLegend.tsx +19 -5
  42. package/src/screens/chat-detail/components/ChatMessageInput.tsx +2 -2
  43. package/src/screens/chat-detail/legend/LegendChatDay.tsx +6 -9
  44. package/src/screens/chat-detail/legend/LegendChatMessage.tsx +18 -1
  45. package/src/utils/legendListMessage.ts +13 -4
@@ -47,6 +47,7 @@ interface LegendChatMessageProps {
47
47
  onLongPress?: () => void;
48
48
  customMessageItemFactory?: (m: MessageItem) => ReactNode;
49
49
  isHighlighted?: boolean;
50
+ isTimeRevealed?: boolean;
50
51
  /** Sender name above the bubble — first message of an incoming cluster. */
51
52
  showName?: boolean;
52
53
  /** Sender avatar beside the bubble — last message of an incoming cluster. */
@@ -87,6 +88,14 @@ const MEDIA_TYPES: number[] = [
87
88
 
88
89
  const SYSTEM_MESSAGE_TYPES: number[] = GROUP_NOTIFICATION_TYPES;
89
90
 
91
+ // Tapping these types must keep opening the media/file as today — they never
92
+ // participate in tap-to-reveal-time, so no Tap gesture is attached at all for
93
+ // them (avoids racing their own internal touchables for the same tap).
94
+ const TIME_REVEAL_EXCLUDED_TYPES: number[] = [
95
+ ...MEDIA_TYPES,
96
+ MessageType.FileMessage,
97
+ ];
98
+
90
99
  export const LegendChatMessage = memo(
91
100
  ({
92
101
  message,
@@ -99,6 +108,7 @@ export const LegendChatMessage = memo(
99
108
  onLongPress,
100
109
  customMessageItemFactory,
101
110
  isHighlighted,
111
+ isTimeRevealed,
102
112
  showName = false,
103
113
  showAvatar = false,
104
114
  showSenderGutter = false,
@@ -145,6 +155,9 @@ export const LegendChatMessage = memo(
145
155
  onPressUrl &&
146
156
  (message?.contentType === MessageType.UrlTextMessage ||
147
157
  message?.contentType === MessageType.AtTextMessage);
158
+ const canRevealTime = !TIME_REVEAL_EXCLUDED_TYPES.includes(
159
+ message?.contentType
160
+ );
148
161
 
149
162
  return (
150
163
  <KContainer.View style={messageStyles.wrapper} row alignItems>
@@ -176,7 +189,10 @@ export const LegendChatMessage = memo(
176
189
  {message.senderNickname}
177
190
  </KLabel.Text>
178
191
  )}
179
- <LongPressWrapper onPress={handlePress} onLongPress={handleLongPress}>
192
+ <LongPressWrapper
193
+ onPress={canRevealTime ? handlePress : undefined}
194
+ onLongPress={handleLongPress}
195
+ >
180
196
  <MessageComponent
181
197
  message={message}
182
198
  isOutgoing={isOutgoing}
@@ -184,6 +200,7 @@ export const LegendChatMessage = memo(
184
200
  onMediaPress={hasMediaPress ? onMediaPress : undefined}
185
201
  onPressUrl={hasUrlPress ? onPressUrl : undefined}
186
202
  isHighlighted={isHighlighted}
203
+ isTimeRevealed={canRevealTime && isTimeRevealed}
187
204
  groupPosition={groupPosition}
188
205
  />
189
206
  </LongPressWrapper>
@@ -48,9 +48,10 @@ export interface PrecomputedMessageData {
48
48
  messageId: string;
49
49
  dayStart: boolean;
50
50
  /**
51
- * More than GROUP_TIME_GAP has passed since the previous message. The list
52
- * marks these with a time label: the cluster break is real but, unlike a day
53
- * change, nothing else on screen would show why the run stopped.
51
+ * More than DIVIDER_TIME_GAP has passed since the previous message on the
52
+ * same day. The list marks these with a time-only divider so a long pause
53
+ * is visible even when nothing else on screen (day change, sender change)
54
+ * would show it.
54
55
  */
55
56
  timeBreak: boolean;
56
57
  createdAt: number;
@@ -60,6 +61,14 @@ export interface PrecomputedMessageData {
60
61
  /** Two messages further apart than this never share a cluster. */
61
62
  const GROUP_TIME_GAP = 300_000; // 5 minutes
62
63
 
64
+ /**
65
+ * Same-day gap that earns a standalone time divider (BR: 30 minutes) —
66
+ * intentionally separate from GROUP_TIME_GAP: a cluster can visually break on
67
+ * the shorter gap without a divider explaining it, since the spec's divider
68
+ * threshold and the grouping threshold are independent rules.
69
+ */
70
+ const DIVIDER_TIME_GAP = 1_800_000; // 30 minutes
71
+
63
72
  /** Virtual sender for bot conversations — see getGroupKey. */
64
73
  const BOT_GROUP_KEY = '__bot__';
65
74
 
@@ -145,7 +154,7 @@ export const precomputeLegendListData = (
145
154
  dayStart: dayStarts[index]!,
146
155
  timeBreak:
147
156
  prevTimestamp !== undefined &&
148
- createdAt - prevTimestamp > GROUP_TIME_GAP,
157
+ createdAt - prevTimestamp > DIVIDER_TIME_GAP,
149
158
  createdAt,
150
159
  groupPosition: 'solo',
151
160
  });