@droppii-org/chat-mobile 0.2.7 → 0.2.8

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 (323) hide show
  1. package/lib/module/components/AttachmentPreview.js +250 -0
  2. package/lib/module/components/AttachmentPreview.js.map +1 -0
  3. package/lib/module/components/MediaViewer/index.js +2 -0
  4. package/lib/module/components/MediaViewer/index.js.map +1 -0
  5. package/lib/module/components/MediaViewerModal.js +57 -0
  6. package/lib/module/components/MediaViewerModal.js.map +1 -0
  7. package/lib/module/components/MergedImageGrid.js +173 -0
  8. package/lib/module/components/MergedImageGrid.js.map +1 -0
  9. package/lib/module/components/ThreadCard/thread-card.utils.js +80 -4
  10. package/lib/module/components/ThreadCard/thread-card.utils.js.map +1 -1
  11. package/lib/module/components/messages/fileMessage/index.js +26 -0
  12. package/lib/module/components/messages/fileMessage/index.js.map +1 -0
  13. package/lib/module/components/messages/imageMessage/index.js +118 -0
  14. package/lib/module/components/messages/imageMessage/index.js.map +1 -0
  15. package/lib/module/components/messages/linkMessage/index.js +122 -0
  16. package/lib/module/components/messages/linkMessage/index.js.map +1 -0
  17. package/lib/module/components/messages/mergedMessage/index.js +37 -0
  18. package/lib/module/components/messages/mergedMessage/index.js.map +1 -0
  19. package/lib/module/components/messages/styles.js +41 -0
  20. package/lib/module/components/messages/styles.js.map +1 -0
  21. package/lib/module/components/messages/textMessage/index.js +38 -0
  22. package/lib/module/components/messages/textMessage/index.js.map +1 -0
  23. package/lib/module/components/messages/types.js +14 -0
  24. package/lib/module/components/messages/types.js.map +1 -0
  25. package/lib/module/components/messages/videoMessage/index.js +110 -0
  26. package/lib/module/components/messages/videoMessage/index.js.map +1 -0
  27. package/lib/module/config/api-endpoints.js +66 -0
  28. package/lib/module/config/api-endpoints.js.map +1 -0
  29. package/lib/module/config/attachment-priority.js +81 -0
  30. package/lib/module/config/attachment-priority.js.map +1 -0
  31. package/lib/module/config/configuration.js +50 -0
  32. package/lib/module/config/configuration.js.map +1 -0
  33. package/lib/module/config/index.js +22 -0
  34. package/lib/module/config/index.js.map +1 -0
  35. package/lib/module/core/index.js +19 -1
  36. package/lib/module/core/index.js.map +1 -1
  37. package/lib/module/core/useChatListener.js +0 -14
  38. package/lib/module/core/useChatListener.js.map +1 -1
  39. package/lib/module/hooks/message/useSendMessage.js +10 -5
  40. package/lib/module/hooks/message/useSendMessage.js.map +1 -1
  41. package/lib/module/hooks/useChatMessages.js +0 -3
  42. package/lib/module/hooks/useChatMessages.js.map +1 -1
  43. package/lib/module/hooks/useImageAttachment.js +263 -0
  44. package/lib/module/hooks/useImageAttachment.js.map +1 -0
  45. package/lib/module/hooks/useMediaViewer.js +24 -0
  46. package/lib/module/hooks/useMediaViewer.js.map +1 -0
  47. package/lib/module/hooks/useSendAttachment.js +182 -0
  48. package/lib/module/hooks/useSendAttachment.js.map +1 -0
  49. package/lib/module/hooks/useVideoAttachment.js +251 -0
  50. package/lib/module/hooks/useVideoAttachment.js.map +1 -0
  51. package/lib/module/index.js +13 -1
  52. package/lib/module/index.js.map +1 -1
  53. package/lib/module/screens/MediaView/VideoPlayer.js +177 -0
  54. package/lib/module/screens/MediaView/VideoPlayer.js.map +1 -0
  55. package/lib/module/screens/MediaView/index.js +264 -0
  56. package/lib/module/screens/MediaView/index.js.map +1 -0
  57. package/lib/module/screens/chat-detail/ChatComposer.js +190 -196
  58. package/lib/module/screens/chat-detail/ChatComposer.js.map +1 -1
  59. package/lib/module/screens/chat-detail/ChatDetail.js +94 -63
  60. package/lib/module/screens/chat-detail/ChatDetail.js.map +1 -1
  61. package/lib/module/screens/chat-detail/ChatListLegend.js +5 -13
  62. package/lib/module/screens/chat-detail/ChatListLegend.js.map +1 -1
  63. package/lib/module/screens/chat-detail/components/ChatInputActions.js +51 -0
  64. package/lib/module/screens/chat-detail/components/ChatInputActions.js.map +1 -0
  65. package/lib/module/screens/chat-detail/components/ChatMessageInput.js +93 -0
  66. package/lib/module/screens/chat-detail/components/ChatMessageInput.js.map +1 -0
  67. package/lib/module/screens/chat-detail/hooks/useAttachmentSendHandler.js +221 -0
  68. package/lib/module/screens/chat-detail/hooks/useAttachmentSendHandler.js.map +1 -0
  69. package/lib/module/screens/chat-detail/hooks/useChatComposerAnimation.js +114 -0
  70. package/lib/module/screens/chat-detail/hooks/useChatComposerAnimation.js.map +1 -0
  71. package/lib/module/screens/chat-detail/hooks/useChatComposerState.js +26 -0
  72. package/lib/module/screens/chat-detail/hooks/useChatComposerState.js.map +1 -0
  73. package/lib/module/screens/chat-detail/index.js +0 -1
  74. package/lib/module/screens/chat-detail/index.js.map +1 -1
  75. package/lib/module/screens/chat-detail/legend/LegendChatMessage.js +33 -13
  76. package/lib/module/screens/chat-detail/legend/LegendChatMessage.js.map +1 -1
  77. package/lib/module/screens/chat-detail/legend/messageTypes.js +15 -0
  78. package/lib/module/screens/chat-detail/legend/messageTypes.js.map +1 -0
  79. package/lib/module/screens/inbox/MessagesTab.js.map +1 -1
  80. package/lib/module/services/attachmentHandlers/fileAttachmentHandler.js +61 -0
  81. package/lib/module/services/attachmentHandlers/fileAttachmentHandler.js.map +1 -0
  82. package/lib/module/services/attachmentHandlers/imageAttachmentHandler.js +54 -0
  83. package/lib/module/services/attachmentHandlers/imageAttachmentHandler.js.map +1 -0
  84. package/lib/module/services/attachmentHandlers/index.js +12 -0
  85. package/lib/module/services/attachmentHandlers/index.js.map +1 -0
  86. package/lib/module/services/attachmentHandlers/videoAttachmentHandler.js +85 -0
  87. package/lib/module/services/attachmentHandlers/videoAttachmentHandler.js.map +1 -0
  88. package/lib/module/services/attachmentOrchestrator.js +225 -0
  89. package/lib/module/services/attachmentOrchestrator.js.map +1 -0
  90. package/lib/module/services/auth.js +35 -0
  91. package/lib/module/services/auth.js.map +1 -0
  92. package/lib/module/services/endpoints.js +20 -1
  93. package/lib/module/services/endpoints.js.map +1 -1
  94. package/lib/module/services/imageUpload.js +126 -0
  95. package/lib/module/services/imageUpload.js.map +1 -0
  96. package/lib/module/translation/resources/i18n.js +22 -8
  97. package/lib/module/translation/resources/i18n.js.map +1 -1
  98. package/lib/module/types/attachment.js +2 -0
  99. package/lib/module/types/attachment.js.map +1 -0
  100. package/lib/module/types/attachmentHandler.js +20 -0
  101. package/lib/module/types/attachmentHandler.js.map +1 -0
  102. package/lib/module/types/imageUpload.js +2 -0
  103. package/lib/module/types/imageUpload.js.map +1 -0
  104. package/lib/module/types/message.js +1 -0
  105. package/lib/module/types/message.js.map +1 -1
  106. package/lib/module/utils/chatImageDimens.js +148 -0
  107. package/lib/module/utils/chatImageDimens.js.map +1 -0
  108. package/lib/module/utils/device.js +65 -0
  109. package/lib/module/utils/device.js.map +1 -0
  110. package/lib/module/utils/imageUrlOptimizer.js +41 -0
  111. package/lib/module/utils/imageUrlOptimizer.js.map +1 -0
  112. package/lib/module/utils/imageUtils.js +69 -0
  113. package/lib/module/utils/imageUtils.js.map +1 -0
  114. package/lib/module/utils/resolveMessageType.js +3 -0
  115. package/lib/module/utils/resolveMessageType.js.map +1 -1
  116. package/lib/module/utils/ui.js +17 -0
  117. package/lib/module/utils/ui.js.map +1 -0
  118. package/lib/module/utils/url.js +1 -1
  119. package/lib/module/utils/url.js.map +1 -1
  120. package/lib/module/utils/videoThumbnail.js +62 -0
  121. package/lib/module/utils/videoThumbnail.js.map +1 -0
  122. package/lib/typescript/src/components/AttachmentPreview.d.ts +28 -0
  123. package/lib/typescript/src/components/AttachmentPreview.d.ts.map +1 -0
  124. package/lib/typescript/src/components/MediaViewer/index.d.ts +1 -0
  125. package/lib/typescript/src/components/MediaViewer/index.d.ts.map +1 -0
  126. package/lib/typescript/src/components/MediaViewerModal.d.ts +10 -0
  127. package/lib/typescript/src/components/MediaViewerModal.d.ts.map +1 -0
  128. package/lib/typescript/src/components/MergedImageGrid.d.ts +16 -0
  129. package/lib/typescript/src/components/MergedImageGrid.d.ts.map +1 -0
  130. package/lib/typescript/src/components/ThreadCard/thread-card.utils.d.ts.map +1 -1
  131. package/lib/typescript/src/components/messages/fileMessage/index.d.ts +3 -0
  132. package/lib/typescript/src/components/messages/fileMessage/index.d.ts.map +1 -0
  133. package/lib/typescript/src/components/messages/imageMessage/index.d.ts +3 -0
  134. package/lib/typescript/src/components/messages/imageMessage/index.d.ts.map +1 -0
  135. package/lib/typescript/src/components/messages/linkMessage/index.d.ts +9 -0
  136. package/lib/typescript/src/components/messages/linkMessage/index.d.ts.map +1 -0
  137. package/lib/typescript/src/components/messages/mergedMessage/index.d.ts +3 -0
  138. package/lib/typescript/src/components/messages/mergedMessage/index.d.ts.map +1 -0
  139. package/lib/typescript/src/components/messages/styles.d.ts +36 -0
  140. package/lib/typescript/src/components/messages/styles.d.ts.map +1 -0
  141. package/lib/typescript/src/components/messages/textMessage/index.d.ts +9 -0
  142. package/lib/typescript/src/components/messages/textMessage/index.d.ts.map +1 -0
  143. package/lib/typescript/src/components/messages/types.d.ts +10 -0
  144. package/lib/typescript/src/components/messages/types.d.ts.map +1 -0
  145. package/lib/typescript/src/components/messages/videoMessage/index.d.ts +3 -0
  146. package/lib/typescript/src/components/messages/videoMessage/index.d.ts.map +1 -0
  147. package/lib/typescript/src/config/api-endpoints.d.ts +40 -0
  148. package/lib/typescript/src/config/api-endpoints.d.ts.map +1 -0
  149. package/lib/typescript/src/config/attachment-priority.d.ts +31 -0
  150. package/lib/typescript/src/config/attachment-priority.d.ts.map +1 -0
  151. package/lib/typescript/src/config/configuration.d.ts +30 -0
  152. package/lib/typescript/src/config/configuration.d.ts.map +1 -0
  153. package/lib/typescript/src/config/index.d.ts +15 -0
  154. package/lib/typescript/src/config/index.d.ts.map +1 -0
  155. package/lib/typescript/src/core/index.d.ts +13 -1
  156. package/lib/typescript/src/core/index.d.ts.map +1 -1
  157. package/lib/typescript/src/core/useChatListener.d.ts.map +1 -1
  158. package/lib/typescript/src/hooks/message/useSendMessage.d.ts.map +1 -1
  159. package/lib/typescript/src/hooks/useChatMessages.d.ts.map +1 -1
  160. package/lib/typescript/src/hooks/useImageAttachment.d.ts +20 -0
  161. package/lib/typescript/src/hooks/useImageAttachment.d.ts.map +1 -0
  162. package/lib/typescript/src/hooks/useMediaViewer.d.ts +13 -0
  163. package/lib/typescript/src/hooks/useMediaViewer.d.ts.map +1 -0
  164. package/lib/typescript/src/hooks/useSendAttachment.d.ts +59 -0
  165. package/lib/typescript/src/hooks/useSendAttachment.d.ts.map +1 -0
  166. package/lib/typescript/src/hooks/useVideoAttachment.d.ts +29 -0
  167. package/lib/typescript/src/hooks/useVideoAttachment.d.ts.map +1 -0
  168. package/lib/typescript/src/index.d.ts +14 -1
  169. package/lib/typescript/src/index.d.ts.map +1 -1
  170. package/lib/typescript/src/screens/MediaView/VideoPlayer.d.ts +12 -0
  171. package/lib/typescript/src/screens/MediaView/VideoPlayer.d.ts.map +1 -0
  172. package/lib/typescript/src/screens/MediaView/index.d.ts +11 -0
  173. package/lib/typescript/src/screens/MediaView/index.d.ts.map +1 -0
  174. package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts +1 -1
  175. package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts.map +1 -1
  176. package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts +1 -1
  177. package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts.map +1 -1
  178. package/lib/typescript/src/screens/chat-detail/ChatListLegend.d.ts +1 -1
  179. package/lib/typescript/src/screens/chat-detail/ChatListLegend.d.ts.map +1 -1
  180. package/lib/typescript/src/screens/chat-detail/components/ChatInputActions.d.ts +8 -0
  181. package/lib/typescript/src/screens/chat-detail/components/ChatInputActions.d.ts.map +1 -0
  182. package/lib/typescript/src/screens/chat-detail/components/ChatMessageInput.d.ts +15 -0
  183. package/lib/typescript/src/screens/chat-detail/components/ChatMessageInput.d.ts.map +1 -0
  184. package/lib/typescript/src/screens/chat-detail/hooks/useAttachmentSendHandler.d.ts +23 -0
  185. package/lib/typescript/src/screens/chat-detail/hooks/useAttachmentSendHandler.d.ts.map +1 -0
  186. package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerAnimation.d.ts +15 -0
  187. package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerAnimation.d.ts.map +1 -0
  188. package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerState.d.ts +13 -0
  189. package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerState.d.ts.map +1 -0
  190. package/lib/typescript/src/screens/chat-detail/index.d.ts +0 -2
  191. package/lib/typescript/src/screens/chat-detail/index.d.ts.map +1 -1
  192. package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts +3 -1
  193. package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts.map +1 -1
  194. package/lib/typescript/src/screens/chat-detail/legend/messageTypes.d.ts +13 -0
  195. package/lib/typescript/src/screens/chat-detail/legend/messageTypes.d.ts.map +1 -0
  196. package/lib/typescript/src/screens/chat-detail/types.d.ts +4 -1
  197. package/lib/typescript/src/screens/chat-detail/types.d.ts.map +1 -1
  198. package/lib/typescript/src/services/attachmentHandlers/fileAttachmentHandler.d.ts +22 -0
  199. package/lib/typescript/src/services/attachmentHandlers/fileAttachmentHandler.d.ts.map +1 -0
  200. package/lib/typescript/src/services/attachmentHandlers/imageAttachmentHandler.d.ts +3 -0
  201. package/lib/typescript/src/services/attachmentHandlers/imageAttachmentHandler.d.ts.map +1 -0
  202. package/lib/typescript/src/services/attachmentHandlers/index.d.ts +5 -0
  203. package/lib/typescript/src/services/attachmentHandlers/index.d.ts.map +1 -0
  204. package/lib/typescript/src/services/attachmentHandlers/videoAttachmentHandler.d.ts +31 -0
  205. package/lib/typescript/src/services/attachmentHandlers/videoAttachmentHandler.d.ts.map +1 -0
  206. package/lib/typescript/src/services/attachmentOrchestrator.d.ts +5 -0
  207. package/lib/typescript/src/services/attachmentOrchestrator.d.ts.map +1 -0
  208. package/lib/typescript/src/services/auth.d.ts +19 -0
  209. package/lib/typescript/src/services/auth.d.ts.map +1 -0
  210. package/lib/typescript/src/services/endpoints.d.ts +11 -1
  211. package/lib/typescript/src/services/endpoints.d.ts.map +1 -1
  212. package/lib/typescript/src/services/imageUpload.d.ts +7 -0
  213. package/lib/typescript/src/services/imageUpload.d.ts.map +1 -0
  214. package/lib/typescript/src/translation/resources/i18n.d.ts.map +1 -1
  215. package/lib/typescript/src/types/attachment.d.ts +72 -0
  216. package/lib/typescript/src/types/attachment.d.ts.map +1 -0
  217. package/lib/typescript/src/types/attachmentHandler.d.ts +13 -0
  218. package/lib/typescript/src/types/attachmentHandler.d.ts.map +1 -0
  219. package/lib/typescript/src/types/imageUpload.d.ts +26 -0
  220. package/lib/typescript/src/types/imageUpload.d.ts.map +1 -0
  221. package/lib/typescript/src/types/message.d.ts +1 -0
  222. package/lib/typescript/src/types/message.d.ts.map +1 -1
  223. package/lib/typescript/src/utils/chatImageDimens.d.ts +34 -0
  224. package/lib/typescript/src/utils/chatImageDimens.d.ts.map +1 -0
  225. package/lib/typescript/src/utils/device.d.ts +7 -0
  226. package/lib/typescript/src/utils/device.d.ts.map +1 -0
  227. package/lib/typescript/src/utils/imageUrlOptimizer.d.ts +12 -0
  228. package/lib/typescript/src/utils/imageUrlOptimizer.d.ts.map +1 -0
  229. package/lib/typescript/src/utils/imageUtils.d.ts +9 -0
  230. package/lib/typescript/src/utils/imageUtils.d.ts.map +1 -0
  231. package/lib/typescript/src/utils/resolveMessageType.d.ts.map +1 -1
  232. package/lib/typescript/src/utils/ui.d.ts +13 -0
  233. package/lib/typescript/src/utils/ui.d.ts.map +1 -0
  234. package/lib/typescript/src/utils/videoThumbnail.d.ts +16 -0
  235. package/lib/typescript/src/utils/videoThumbnail.d.ts.map +1 -0
  236. package/package.json +15 -3
  237. package/src/components/AttachmentPreview.tsx +304 -0
  238. package/src/components/MediaViewer/index.tsx +0 -0
  239. package/src/components/MediaViewerModal.tsx +70 -0
  240. package/src/components/MergedImageGrid.tsx +238 -0
  241. package/src/components/ThreadCard/thread-card.utils.ts +95 -4
  242. package/src/components/messages/fileMessage/index.tsx +30 -0
  243. package/src/components/messages/imageMessage/index.tsx +137 -0
  244. package/src/components/messages/linkMessage/index.tsx +162 -0
  245. package/src/components/messages/mergedMessage/index.tsx +45 -0
  246. package/src/components/messages/styles.ts +39 -0
  247. package/src/components/messages/textMessage/index.tsx +53 -0
  248. package/src/components/messages/types.ts +22 -0
  249. package/src/components/messages/videoMessage/index.tsx +120 -0
  250. package/src/config/api-endpoints.ts +72 -0
  251. package/src/config/attachment-priority.ts +93 -0
  252. package/src/config/configuration.ts +50 -0
  253. package/src/config/index.ts +19 -0
  254. package/src/core/index.ts +25 -1
  255. package/src/core/useChatListener.ts +0 -21
  256. package/src/hooks/message/useSendMessage.ts +12 -5
  257. package/src/hooks/useChatMessages.ts +0 -4
  258. package/src/hooks/useImageAttachment.ts +348 -0
  259. package/src/hooks/useMediaViewer.ts +32 -0
  260. package/src/hooks/useSendAttachment.ts +295 -0
  261. package/src/hooks/useVideoAttachment.ts +334 -0
  262. package/src/index.tsx +13 -1
  263. package/src/screens/MediaView/VideoPlayer.tsx +211 -0
  264. package/src/screens/MediaView/index.tsx +327 -0
  265. package/src/screens/chat-detail/ChatComposer.tsx +206 -271
  266. package/src/screens/chat-detail/ChatDetail.tsx +142 -89
  267. package/src/screens/chat-detail/ChatListLegend.tsx +9 -11
  268. package/src/screens/chat-detail/components/ChatInputActions.tsx +71 -0
  269. package/src/screens/chat-detail/components/ChatMessageInput.tsx +127 -0
  270. package/src/screens/chat-detail/hooks/useAttachmentSendHandler.ts +291 -0
  271. package/src/screens/chat-detail/hooks/useChatComposerAnimation.ts +184 -0
  272. package/src/screens/chat-detail/hooks/useChatComposerState.ts +40 -0
  273. package/src/screens/chat-detail/index.ts +0 -2
  274. package/src/screens/chat-detail/legend/LegendChatMessage.tsx +47 -24
  275. package/src/screens/chat-detail/legend/messageTypes.tsx +13 -0
  276. package/src/screens/chat-detail/types.ts +5 -1
  277. package/src/screens/inbox/MessagesTab.tsx +1 -1
  278. package/src/services/attachmentHandlers/fileAttachmentHandler.ts +78 -0
  279. package/src/services/attachmentHandlers/imageAttachmentHandler.ts +54 -0
  280. package/src/services/attachmentHandlers/index.ts +10 -0
  281. package/src/services/attachmentHandlers/videoAttachmentHandler.ts +114 -0
  282. package/src/services/attachmentOrchestrator.ts +300 -0
  283. package/src/services/auth.ts +34 -0
  284. package/src/services/endpoints.ts +24 -1
  285. package/src/services/imageUpload.ts +162 -0
  286. package/src/translation/resources/i18n.ts +22 -8
  287. package/src/types/attachment.ts +85 -0
  288. package/src/types/attachmentHandler.ts +31 -0
  289. package/src/types/imageUpload.ts +28 -0
  290. package/src/types/message.ts +1 -0
  291. package/src/utils/chatImageDimens.ts +178 -0
  292. package/src/utils/device.ts +73 -0
  293. package/src/utils/imageUrlOptimizer.ts +56 -0
  294. package/src/utils/imageUtils.ts +76 -0
  295. package/src/utils/resolveMessageType.ts +2 -0
  296. package/src/utils/ui.ts +19 -0
  297. package/src/utils/url.ts +1 -1
  298. package/src/utils/videoThumbnail.ts +85 -0
  299. package/lib/module/screens/chat-detail/ChatList.js +0 -147
  300. package/lib/module/screens/chat-detail/ChatList.js.map +0 -1
  301. package/lib/module/screens/chat-detail/ChatTextBubble.js +0 -62
  302. package/lib/module/screens/chat-detail/ChatTextBubble.js.map +0 -1
  303. package/lib/module/screens/chat-detail/legend/message-types.js +0 -244
  304. package/lib/module/screens/chat-detail/legend/message-types.js.map +0 -1
  305. package/lib/module/screens/chat-detail/messages/ChatMessageBubble.js +0 -24
  306. package/lib/module/screens/chat-detail/messages/ChatMessageBubble.js.map +0 -1
  307. package/lib/module/screens/chat-detail/messages/types.js +0 -4
  308. package/lib/module/screens/chat-detail/messages/types.js.map +0 -1
  309. package/lib/typescript/src/screens/chat-detail/ChatList.d.ts +0 -3
  310. package/lib/typescript/src/screens/chat-detail/ChatList.d.ts.map +0 -1
  311. package/lib/typescript/src/screens/chat-detail/ChatTextBubble.d.ts +0 -3
  312. package/lib/typescript/src/screens/chat-detail/ChatTextBubble.d.ts.map +0 -1
  313. package/lib/typescript/src/screens/chat-detail/legend/message-types.d.ts +0 -13
  314. package/lib/typescript/src/screens/chat-detail/legend/message-types.d.ts.map +0 -1
  315. package/lib/typescript/src/screens/chat-detail/messages/ChatMessageBubble.d.ts +0 -3
  316. package/lib/typescript/src/screens/chat-detail/messages/ChatMessageBubble.d.ts.map +0 -1
  317. package/lib/typescript/src/screens/chat-detail/messages/types.d.ts +0 -13
  318. package/lib/typescript/src/screens/chat-detail/messages/types.d.ts.map +0 -1
  319. package/src/screens/chat-detail/ChatList.tsx +0 -190
  320. package/src/screens/chat-detail/ChatTextBubble.tsx +0 -73
  321. package/src/screens/chat-detail/legend/message-types.tsx +0 -304
  322. package/src/screens/chat-detail/messages/ChatMessageBubble.tsx +0 -23
  323. package/src/screens/chat-detail/messages/types.ts +0 -14
@@ -0,0 +1,291 @@
1
+ import { useCallback } from 'react';
2
+ import RNFS from 'react-native-fs';
3
+ import { isVideoFromPicker } from '../../../utils/imageUtils';
4
+ import VideoThumbnailUtil from '../../../utils/videoThumbnail';
5
+ import { ImageUploadAPI } from '../../../services/imageUpload';
6
+ import UIUtils from '../../../utils/ui';
7
+ import type { DMessageItem } from '../../../types/chat';
8
+
9
+ interface AttachmentItem {
10
+ image: any;
11
+ uploadedUrl?: string;
12
+ uploadProgress?: number;
13
+ error?: any;
14
+ isUploading?: boolean;
15
+ }
16
+
17
+ interface UseAttachmentSendHandlerProps {
18
+ selectedImages: AttachmentItem[];
19
+ sendAttachments: (
20
+ items: any[],
21
+ _: any,
22
+ onMessageSent?: (message: DMessageItem) => void
23
+ ) => Promise<boolean>;
24
+ clearAllImages: () => void;
25
+ onSend?: () => void;
26
+ onMessageSent?: (message: DMessageItem) => void;
27
+ textMessage?: string;
28
+ urlMetadata?: any;
29
+ onSendText?: (text: string, urlMetadata?: any) => void;
30
+ }
31
+
32
+ export const useAttachmentSendHandler = ({
33
+ selectedImages,
34
+ sendAttachments,
35
+ clearAllImages,
36
+ onSend,
37
+ onMessageSent,
38
+ textMessage,
39
+ urlMetadata,
40
+ onSendText,
41
+ }: UseAttachmentSendHandlerProps) => {
42
+ const handleSend = useCallback(async () => {
43
+ console.log('[ChatComposer] handleSend called', {
44
+ selectedImagesCount: selectedImages.length,
45
+ selectedImagesData: selectedImages.map((img: any) => ({
46
+ filename: img.image.filename,
47
+ isUploading: img.isUploading,
48
+ uploadedUrl: img.uploadedUrl ? 'SET' : 'MISSING',
49
+ uploadProgress: img.uploadProgress,
50
+ })),
51
+ });
52
+
53
+ // Separate images and videos from selectedImages
54
+ const actualImages = selectedImages.filter(
55
+ (img: any) => !isVideoFromPicker(img.image)
56
+ );
57
+ const videosFromGallery = selectedImages.filter((img: any) =>
58
+ isVideoFromPicker(img.image)
59
+ );
60
+
61
+ console.log('🎬 [ChatComposer] Separation result:', {
62
+ actualImagesCount: actualImages.length,
63
+ videosFromGalleryCount: videosFromGallery.length,
64
+ videosFromGalleryList: videosFromGallery.map((v: any) => ({
65
+ filename: v.image.filename,
66
+ uploadedUrl: v.uploadedUrl,
67
+ })),
68
+ });
69
+
70
+ const uploadedImages = actualImages.filter((img: any) => img.uploadedUrl);
71
+ const uploadedVideosFromGallery = videosFromGallery.filter(
72
+ (vid: any) => vid.uploadedUrl
73
+ );
74
+
75
+ // Auto-generate thumbnails for gallery videos
76
+ const galleryVideoThumbnails: Record<
77
+ string,
78
+ { url: string; size: number }
79
+ > = {};
80
+
81
+ if (uploadedVideosFromGallery.length > 0) {
82
+ console.log(
83
+ '[ChatComposer] Auto-generating thumbnails for gallery videos...'
84
+ );
85
+
86
+ for (const vidItem of uploadedVideosFromGallery) {
87
+ let cachedVideoPath: string | null = null;
88
+ try {
89
+ const originalVideoPath = vidItem.image.path;
90
+ const videoDuration = (vidItem.image as any).duration || 0;
91
+ const videoMime = (vidItem.image as any).mime;
92
+ const filename = vidItem.image.filename || 'video.mp4';
93
+
94
+ console.log('[ChatComposer] Generating thumbnail for:', {
95
+ filename,
96
+ originalVideoPath,
97
+ videoDuration,
98
+ videoMime,
99
+ uploadedUrl: vidItem.uploadedUrl,
100
+ });
101
+
102
+ // Copy video to persistent location
103
+ const ext = filename.split('.').pop() || 'mp4';
104
+ const cachedFileName = `thumb-cache-${Date.now()}-${Math.random()
105
+ .toString(36)
106
+ .slice(2)}.${ext}`;
107
+ cachedVideoPath = `${RNFS.DocumentDirectoryPath}/${cachedFileName}`;
108
+
109
+ console.log('[ChatComposer] Copying video to cache:', {
110
+ from: originalVideoPath,
111
+ to: cachedVideoPath,
112
+ });
113
+
114
+ await RNFS.copyFile(originalVideoPath, cachedVideoPath);
115
+ console.log('[ChatComposer] Video cached successfully');
116
+
117
+ // Use smaller time offset if video is very short
118
+ const timeMs = Math.min(1000, Math.floor(videoDuration / 2));
119
+
120
+ console.log('[ChatComposer] Thumbnail settings:', {
121
+ timeMs,
122
+ quality: 80,
123
+ videoPath: cachedVideoPath,
124
+ });
125
+
126
+ // Generate thumbnail from cached copy
127
+ const thumbnail = await VideoThumbnailUtil.generateThumbnail(
128
+ cachedVideoPath,
129
+ { time: timeMs, quality: 80 }
130
+ );
131
+
132
+ if (!thumbnail) {
133
+ throw new Error('Failed to generate thumbnail');
134
+ }
135
+
136
+ console.log('[ChatComposer] Thumbnail generated:', {
137
+ path: thumbnail.path,
138
+ width: thumbnail.width,
139
+ height: thumbnail.height,
140
+ });
141
+
142
+ // Upload thumbnail
143
+ const baseName = vidItem.image.filename?.split('.')[0] || 'video';
144
+ const uploadedThumbnail = await ImageUploadAPI.uploadImageFile(
145
+ {
146
+ path: thumbnail.path,
147
+ filename: `thumb-${baseName}.jpg`,
148
+ size: 0,
149
+ width: thumbnail.width || 320,
150
+ height: thumbnail.height || 180,
151
+ mime: 'image/jpeg',
152
+ },
153
+ (progress) => {
154
+ console.log('[ChatComposer] Thumbnail upload progress:', {
155
+ percentage: progress,
156
+ });
157
+ }
158
+ );
159
+
160
+ if (!uploadedThumbnail?.url) {
161
+ throw new Error('No thumbnail URL returned');
162
+ }
163
+
164
+ // Store thumbnail data
165
+ galleryVideoThumbnails[vidItem.image.path] = {
166
+ url: uploadedThumbnail.url,
167
+ size: uploadedThumbnail.size || 0,
168
+ };
169
+
170
+ console.log('[ChatComposer] Thumbnail ready:', {
171
+ url: uploadedThumbnail.url,
172
+ size: uploadedThumbnail.size,
173
+ });
174
+ console.log(
175
+ `✅ [ChatComposer] THUMBNAIL URL: ${uploadedThumbnail.url}`
176
+ );
177
+ } catch (error) {
178
+ console.error('[ChatComposer] Thumbnail generation error:', error);
179
+ UIUtils.toast.open({
180
+ title: 'Thumbnail Error',
181
+ message: `Failed to generate thumbnail for ${vidItem.image.filename}`,
182
+ theme: 'danger',
183
+ });
184
+ return;
185
+ } finally {
186
+ // Cleanup cached video file
187
+ if (cachedVideoPath) {
188
+ try {
189
+ await RNFS.unlink(cachedVideoPath);
190
+ console.log('[ChatComposer] Cleaned up cached video:', {
191
+ path: cachedVideoPath,
192
+ });
193
+ } catch (err) {
194
+ console.warn('[ChatComposer] Failed to clean cached video:', err);
195
+ }
196
+ }
197
+ }
198
+ }
199
+ }
200
+
201
+ const allUploadedVideos = [...uploadedVideosFromGallery];
202
+
203
+ console.log('[ChatComposer] handleSend summary:', {
204
+ actualImages: actualImages.length,
205
+ uploadedImages: uploadedImages.length,
206
+ videosFromGallery: videosFromGallery.length,
207
+ uploadedVideosFromGallery: uploadedVideosFromGallery.length,
208
+ allUploadedVideos: allUploadedVideos.length,
209
+ });
210
+
211
+ // Log thumbnail URLs
212
+ if (uploadedVideosFromGallery.length > 0) {
213
+ uploadedVideosFromGallery.forEach((vid: any) => {
214
+ const thumbnail = galleryVideoThumbnails[vid.image.path];
215
+ console.log(`✅ [ChatComposer] Gallery Video Thumbnail:`, {
216
+ filename: vid.image.filename,
217
+ thumbnailUrl: thumbnail?.url || 'NOT FOUND',
218
+ videoUrl: vid.uploadedUrl,
219
+ });
220
+ });
221
+ }
222
+
223
+ // Send images and videos if any
224
+ if (uploadedImages.length > 0 || allUploadedVideos.length > 0) {
225
+ const attachmentItems = [
226
+ ...uploadedImages.map((img: any) => ({
227
+ ...img,
228
+ type: 'image' as const,
229
+ })),
230
+ // Videos from gallery picker with auto-generated thumbnails
231
+ ...uploadedVideosFromGallery.map((vid: any) => {
232
+ const thumbnail = galleryVideoThumbnails[vid.image.path];
233
+ return {
234
+ type: 'video' as const,
235
+ video: vid.image,
236
+ uploadProgress: vid.uploadProgress,
237
+ error: vid.error,
238
+ isUploading: vid.isUploading,
239
+ uploadedUrl: vid.uploadedUrl,
240
+ thumbnailUrl: thumbnail?.url,
241
+ thumbnailSize: thumbnail?.size,
242
+ };
243
+ }),
244
+ ];
245
+
246
+ console.log('[ChatComposer] Sending attachments...', {
247
+ imagesCount: uploadedImages.length,
248
+ videosCount: uploadedVideosFromGallery.length,
249
+ hasTextMessage: !!textMessage,
250
+ });
251
+
252
+ const success = await sendAttachments(
253
+ attachmentItems,
254
+ undefined,
255
+ onMessageSent
256
+ );
257
+
258
+ console.log('[ChatComposer] Attachments send result:', { success });
259
+
260
+ if (success) {
261
+ clearAllImages();
262
+ console.log('[ChatComposer] Images cleared after successful send');
263
+
264
+ // Send text message after attachments (follows attachment priority order)
265
+ // Note: urlMetadata is only passed if preview is still visible (not dismissed)
266
+ if (textMessage && onSendText) {
267
+ console.log('[ChatComposer] Sending text message after attachments', {
268
+ hasPreview: !!urlMetadata,
269
+ previewUrl: urlMetadata?.url,
270
+ });
271
+ onSendText(textMessage, urlMetadata);
272
+ }
273
+ }
274
+ return;
275
+ }
276
+
277
+ // Send text message only if no attachments
278
+ onSend?.();
279
+ }, [
280
+ selectedImages,
281
+ sendAttachments,
282
+ clearAllImages,
283
+ onSend,
284
+ onMessageSent,
285
+ textMessage,
286
+ urlMetadata,
287
+ onSendText,
288
+ ]);
289
+
290
+ return { handleSend };
291
+ };
@@ -0,0 +1,184 @@
1
+ import { useCallback, useEffect, useRef } from 'react';
2
+ import { Keyboard } from 'react-native';
3
+ import {
4
+ runOnJS,
5
+ useAnimatedReaction,
6
+ useAnimatedStyle,
7
+ useSharedValue,
8
+ withTiming,
9
+ } from 'react-native-reanimated';
10
+ import {
11
+ useKeyboardState,
12
+ useReanimatedKeyboardAnimation,
13
+ } from 'react-native-keyboard-controller';
14
+
15
+ const ACCESSORY_ANIMATION_MS = 250;
16
+ const ACCESSORY_SETTLE_MS = 150;
17
+
18
+ interface UseChatComposerAnimationProps {
19
+ isAttachmentOpen: boolean;
20
+ panelHeight: number;
21
+ onAttachmentOpenChange: (isOpen: boolean) => void;
22
+ }
23
+
24
+ interface UseChatComposerAnimationReturn {
25
+ attachmentHeightSV: any;
26
+ accessorySlotStyle: any;
27
+ toggleAttachmentVisibility: () => void;
28
+ openAttachment: () => void;
29
+ closeAttachment: () => void;
30
+ }
31
+
32
+ export const useChatComposerAnimation = ({
33
+ isAttachmentOpen,
34
+ panelHeight,
35
+ onAttachmentOpenChange,
36
+ }: UseChatComposerAnimationProps): UseChatComposerAnimationReturn => {
37
+ const isSwitchingToAttachmentRef = useRef(false);
38
+ const panelHeightSV = useSharedValue(panelHeight);
39
+ const attachmentHeightSV = useSharedValue(0);
40
+ const switchKeyboardHeightSV = useSharedValue(0);
41
+ const isKeyboardToAttachmentSwitchSV = useSharedValue(false);
42
+
43
+ const isKeyboardVisible = useKeyboardState((state) => state.isVisible);
44
+ const keyboardHeight = useKeyboardState((state) => state.height);
45
+ const { progress: keyboardProgress } = useReanimatedKeyboardAnimation();
46
+
47
+ useEffect(() => {
48
+ panelHeightSV.value = panelHeight;
49
+ }, [panelHeight, panelHeightSV]);
50
+
51
+ const openAttachment = useCallback(() => {
52
+ attachmentHeightSV.value = withTiming(panelHeight, {
53
+ duration: ACCESSORY_ANIMATION_MS,
54
+ });
55
+ onAttachmentOpenChange(true);
56
+ }, [attachmentHeightSV, panelHeight, onAttachmentOpenChange]);
57
+
58
+ const closeAttachment = useCallback(() => {
59
+ attachmentHeightSV.value = withTiming(0, {
60
+ duration: ACCESSORY_ANIMATION_MS,
61
+ });
62
+ onAttachmentOpenChange(false);
63
+ }, [attachmentHeightSV, onAttachmentOpenChange]);
64
+
65
+ const finishKeyboardToAttachmentSwitch = useCallback(() => {
66
+ if (!isSwitchingToAttachmentRef.current) {
67
+ return;
68
+ }
69
+
70
+ isSwitchingToAttachmentRef.current = false;
71
+ isKeyboardToAttachmentSwitchSV.value = false;
72
+
73
+ const targetHeight = panelHeightSV.value;
74
+ const startHeight = switchKeyboardHeightSV.value;
75
+
76
+ if (Math.abs(startHeight - targetHeight) < 1) {
77
+ attachmentHeightSV.value = targetHeight;
78
+ return;
79
+ }
80
+
81
+ attachmentHeightSV.value = withTiming(targetHeight, {
82
+ duration: ACCESSORY_SETTLE_MS,
83
+ });
84
+ }, [
85
+ attachmentHeightSV,
86
+ isKeyboardToAttachmentSwitchSV,
87
+ panelHeightSV,
88
+ switchKeyboardHeightSV,
89
+ ]);
90
+
91
+ useEffect(() => {
92
+ if (!isKeyboardVisible && isSwitchingToAttachmentRef.current) {
93
+ finishKeyboardToAttachmentSwitch();
94
+ }
95
+ }, [finishKeyboardToAttachmentSwitch, isKeyboardVisible]);
96
+
97
+ useAnimatedReaction(
98
+ () => ({
99
+ switching: isKeyboardToAttachmentSwitchSV.value,
100
+ progress: keyboardProgress.value,
101
+ }),
102
+ (current, previous) => {
103
+ if (
104
+ current.switching &&
105
+ current.progress === 0 &&
106
+ (previous?.progress ?? 1) > 0
107
+ ) {
108
+ runOnJS(finishKeyboardToAttachmentSwitch)();
109
+ }
110
+ },
111
+ [finishKeyboardToAttachmentSwitch]
112
+ );
113
+
114
+ useEffect(() => {
115
+ // Close panel when keyboard becomes visible (unless doing keyboard↔panel switch)
116
+ // Don't depend on closeAttachment to avoid triggering effect when callback changes
117
+ if (
118
+ !isSwitchingToAttachmentRef.current &&
119
+ isKeyboardVisible &&
120
+ isAttachmentOpen
121
+ ) {
122
+ attachmentHeightSV.value = withTiming(0, {
123
+ duration: ACCESSORY_ANIMATION_MS,
124
+ });
125
+ onAttachmentOpenChange(false);
126
+ }
127
+ }, [
128
+ isAttachmentOpen,
129
+ isKeyboardVisible,
130
+ attachmentHeightSV,
131
+ onAttachmentOpenChange,
132
+ ]);
133
+
134
+ const accessorySlotStyle = useAnimatedStyle(() => {
135
+ if (isKeyboardToAttachmentSwitchSV.value) {
136
+ return {
137
+ height: switchKeyboardHeightSV.value * (1 - keyboardProgress.value),
138
+ };
139
+ }
140
+
141
+ return {
142
+ height: attachmentHeightSV.value,
143
+ };
144
+ });
145
+
146
+ const toggleAttachmentVisibility = useCallback(() => {
147
+ // Use animated value as source of truth, not stale state
148
+ const isOpen = attachmentHeightSV.value > 0;
149
+
150
+ if (isOpen) {
151
+ closeAttachment();
152
+ return;
153
+ }
154
+
155
+ if (isKeyboardVisible && keyboardHeight > 0) {
156
+ // Dismiss keyboard first, then open attachment
157
+ Keyboard.dismiss();
158
+ isSwitchingToAttachmentRef.current = true;
159
+ switchKeyboardHeightSV.value = keyboardHeight;
160
+ isKeyboardToAttachmentSwitchSV.value = true;
161
+ onAttachmentOpenChange(true);
162
+ return;
163
+ }
164
+
165
+ openAttachment();
166
+ }, [
167
+ closeAttachment,
168
+ isKeyboardVisible,
169
+ keyboardHeight,
170
+ isKeyboardToAttachmentSwitchSV,
171
+ onAttachmentOpenChange,
172
+ switchKeyboardHeightSV,
173
+ openAttachment,
174
+ attachmentHeightSV,
175
+ ]);
176
+
177
+ return {
178
+ attachmentHeightSV,
179
+ accessorySlotStyle,
180
+ toggleAttachmentVisibility,
181
+ openAttachment,
182
+ closeAttachment,
183
+ };
184
+ };
@@ -0,0 +1,40 @@
1
+ import { useState, useMemo, useRef } from 'react';
2
+
3
+ interface UseChatComposerStateReturn {
4
+ isAttachmentOpen: boolean;
5
+ setIsAttachmentOpen: (open: boolean) => void;
6
+ isInputFocused: boolean;
7
+ setIsInputFocused: (focused: boolean) => void;
8
+ isInputWrapped: boolean;
9
+ setIsInputWrapped: (wrapped: boolean) => void;
10
+ isMultilineInput: boolean;
11
+ inputRef: React.RefObject<any>;
12
+ }
13
+
14
+ export const useChatComposerState = (
15
+ value: string
16
+ ): UseChatComposerStateReturn => {
17
+ const [isAttachmentOpen, setIsAttachmentOpen] = useState(false);
18
+ const [isInputFocused, setIsInputFocused] = useState(false);
19
+ const [isInputWrapped, setIsInputWrapped] = useState(false);
20
+ const inputRef = useRef<any>(null);
21
+
22
+ const isMultilineInput = useMemo(() => {
23
+ if (!value) {
24
+ return false;
25
+ }
26
+
27
+ return value.includes('\n') || isInputWrapped;
28
+ }, [isInputWrapped, value]);
29
+
30
+ return {
31
+ isAttachmentOpen,
32
+ setIsAttachmentOpen,
33
+ isInputFocused,
34
+ setIsInputFocused,
35
+ isInputWrapped,
36
+ setIsInputWrapped,
37
+ isMultilineInput,
38
+ inputRef,
39
+ };
40
+ };
@@ -1,6 +1,5 @@
1
1
  export { default as ChatDetail } from './ChatDetail';
2
2
  export { default as ChatDetailHeader } from './ChatDetailHeader';
3
- export { ChatList } from './ChatList';
4
3
  export { ChatComposer } from './ChatComposer';
5
4
  export { ChatQuickActions } from './ChatQuickActions';
6
5
  export { ChatAttachmentPanel } from './ChatAttachmentPanel';
@@ -33,7 +32,6 @@ export {
33
32
  DChatMessageType,
34
33
  CUSTOM_MESSAGE_DATA_TYPE,
35
34
  } from '../../types/message';
36
- export type { ChatMessageBubbleProps } from './messages/types';
37
35
  export {
38
36
  mapOpenIMMessageToGiftedChat,
39
37
  mapOpenIMMessagesToGiftedChat,
@@ -2,28 +2,33 @@ import { memo } from 'react';
2
2
  import type { ComponentType } from 'react';
3
3
  import { MessageType } from '@droppii/openim-rn-client-sdk';
4
4
  import type { DMessageItem } from '../../../types/chat';
5
- import {
6
- LegendTextMessage,
7
- LegendImageMessage,
8
- LegendVideoMessage,
9
- LegendFileMessage,
10
- LegendLinkMessage,
11
- } from './message-types';
5
+ import type { MediaItem } from '../../../hooks/useMediaViewer';
6
+ import { TextMessage } from '../../../components/messages/textMessage';
7
+ import { ImageMessage } from '../../../components/messages/imageMessage';
8
+ import { VideoMessage } from '../../../components/messages/videoMessage';
9
+ import { FileMessage } from '../../../components/messages/fileMessage';
10
+ import { LinkMessage } from '../../../components/messages/linkMessage';
11
+ import { MergedMessage } from '../../../components/messages/mergedMessage';
12
12
 
13
13
  interface LegendChatMessageProps {
14
14
  message: DMessageItem;
15
15
  isOutgoing: boolean;
16
16
  createdAtTime: number;
17
+ onMediaPress?: (items: MediaItem[], index?: number) => void;
17
18
  }
18
19
 
20
+ // OpenIM message types (not all exposed as MessageType enum)
21
+ const MERGED_MESSAGE_TYPE = 107; // MergerMessage - merged/grouped messages
22
+
19
23
  const messageComponentMap: Partial<Record<MessageType, ComponentType<any>>> = {
20
- [MessageType.TextMessage]: LegendTextMessage,
21
- [MessageType.AtTextMessage]: LegendTextMessage,
22
- [MessageType.QuoteMessage]: LegendTextMessage,
23
- [MessageType.UrlTextMessage]: LegendLinkMessage,
24
- [MessageType.PictureMessage]: LegendImageMessage,
25
- [MessageType.VideoMessage]: LegendVideoMessage,
26
- [MessageType.FileMessage]: LegendFileMessage,
24
+ [MessageType.TextMessage]: TextMessage,
25
+ [MessageType.AtTextMessage]: TextMessage,
26
+ [MessageType.QuoteMessage]: TextMessage,
27
+ [MessageType.UrlTextMessage]: LinkMessage,
28
+ [MessageType.PictureMessage]: ImageMessage,
29
+ [MessageType.VideoMessage]: VideoMessage,
30
+ [MessageType.FileMessage]: FileMessage,
31
+ [MERGED_MESSAGE_TYPE]: MergedMessage,
27
32
  };
28
33
 
29
34
  /**
@@ -31,17 +36,35 @@ const messageComponentMap: Partial<Record<MessageType, ComponentType<any>>> = {
31
36
  * based on message type. Extensible for new message types.
32
37
  */
33
38
  export const LegendChatMessage = memo(
34
- ({ message, isOutgoing, createdAtTime }: LegendChatMessageProps) => {
39
+ ({
40
+ message,
41
+ isOutgoing,
42
+ createdAtTime,
43
+ onMediaPress,
44
+ }: LegendChatMessageProps) => {
35
45
  const MessageComponent =
36
- messageComponentMap[message?.contentType] ?? LegendTextMessage;
37
-
38
- return (
39
- <MessageComponent
40
- message={message}
41
- isOutgoing={isOutgoing}
42
- createdAtTime={createdAtTime}
43
- />
44
- );
46
+ messageComponentMap[message?.contentType] ?? TextMessage;
47
+
48
+ // Only pass onMediaPress to components that use it
49
+ const mediaTypes = [
50
+ MessageType.PictureMessage,
51
+ MessageType.VideoMessage,
52
+ MERGED_MESSAGE_TYPE,
53
+ ];
54
+ const hasMediaPress =
55
+ mediaTypes.includes(message?.contentType) && onMediaPress;
56
+
57
+ const props: any = {
58
+ message,
59
+ isOutgoing,
60
+ createdAtTime,
61
+ };
62
+
63
+ if (hasMediaPress) {
64
+ props.onMediaPress = onMediaPress;
65
+ }
66
+
67
+ return <MessageComponent {...props} />;
45
68
  }
46
69
  );
47
70
 
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Message type components - re-exports from components/messages
3
+ * Stateless message components live in components/messages
4
+ */
5
+
6
+ export type { BaseLegendMessageProps } from '../../../components/messages/types';
7
+ export { formatMessageTime } from '../../../components/messages/types';
8
+ export { TextMessage } from '../../../components/messages/textMessage';
9
+ export { ImageMessage } from '../../../components/messages/imageMessage';
10
+ export { VideoMessage } from '../../../components/messages/videoMessage';
11
+ export { FileMessage } from '../../../components/messages/fileMessage';
12
+ export { MergedMessage } from '../../../components/messages/mergedMessage';
13
+ export { messageStyles } from '../../../components/messages/styles';
@@ -1,4 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
+
3
+ import type { MediaItem } from '../../hooks/useMediaViewer';
2
4
  import type { DConversationItem, DMessageItem } from '../../types/chat';
3
5
  import type { IUrlMetadata } from '../../types/common';
4
6
  import type { PeerType } from '@droppii/openim-rn-client-sdk';
@@ -59,10 +61,11 @@ export interface ChatAttachmentPanelProps {
59
61
  export interface ChatComposerProps {
60
62
  value?: string;
61
63
  placeholder?: string;
62
- onChangeText?: (text: string) => void;
64
+ onChangeText?: (text?: string) => void;
63
65
  onSend?: (urlMetadata?: IUrlMetadata) => void;
64
66
  onPressAttach?: () => void;
65
67
  onPressEmoji?: () => void;
68
+ onMessageSent?: (message: DMessageItem) => void;
66
69
  showQuickActions?: boolean;
67
70
  quickActions?: DChatQuickAction[];
68
71
  attachmentActions?: DChatAttachmentAction[];
@@ -85,6 +88,7 @@ export interface ChatListProps {
85
88
  onLoadNewer?: () => void;
86
89
  isLoadingNewer?: boolean;
87
90
  hasMoreNewer?: boolean;
91
+ onMediaPress?: (items: MediaItem[], index?: number) => void;
88
92
  }
89
93
 
90
94
  export interface ChatDetailProps extends Omit<
@@ -1,5 +1,5 @@
1
1
  import { memo, useCallback } from 'react';
2
- import { GestureResponderEvent, ActivityIndicator } from 'react-native';
2
+ import { type GestureResponderEvent, ActivityIndicator } from 'react-native';
3
3
  import { KContainer, KDivider, KLabel, KColors } from '@droppii/libs';
4
4
  import { useConversationList } from '../../hooks/useConversationList';
5
5
  import { ThreadCard } from '../../components/ThreadCard';