stream-chat-react-native-core 5.28.1-beta.1 → 5.29.0-beta.1

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 (381) hide show
  1. package/lib/commonjs/components/Attachment/Attachment.js +2 -2
  2. package/lib/commonjs/components/Attachment/Attachment.js.map +1 -1
  3. package/lib/commonjs/components/Attachment/AudioAttachment.js +247 -115
  4. package/lib/commonjs/components/Attachment/AudioAttachment.js.map +1 -1
  5. package/lib/commonjs/components/Attachment/FileAttachmentGroup.js +30 -50
  6. package/lib/commonjs/components/Attachment/FileAttachmentGroup.js.map +1 -1
  7. package/lib/commonjs/components/Attachment/VideoThumbnail.js +3 -3
  8. package/lib/commonjs/components/Attachment/VideoThumbnail.js.map +1 -1
  9. package/lib/commonjs/components/Channel/Channel.js +43 -1
  10. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  11. package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +24 -0
  12. package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  13. package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js +6 -6
  14. package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -1
  15. package/lib/commonjs/components/Message/Message.js +1 -1
  16. package/lib/commonjs/components/Message/Message.js.map +1 -1
  17. package/lib/commonjs/components/Message/MessageSimple/MessageContent.js +1 -1
  18. package/lib/commonjs/components/Message/MessageSimple/MessageContent.js.map +1 -1
  19. package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js +1 -1
  20. package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js.map +1 -1
  21. package/lib/commonjs/components/Message/hooks/useMessageActions.js +4 -2
  22. package/lib/commonjs/components/Message/hooks/useMessageActions.js.map +1 -1
  23. package/lib/commonjs/components/MessageInput/FileUploadPreview.js +55 -74
  24. package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
  25. package/lib/commonjs/components/MessageInput/InputButtons.js +1 -1
  26. package/lib/commonjs/components/MessageInput/InputButtons.js.map +1 -1
  27. package/lib/commonjs/components/MessageInput/MessageInput.js +250 -43
  28. package/lib/commonjs/components/MessageInput/MessageInput.js.map +1 -1
  29. package/lib/commonjs/components/MessageInput/SendButton.js +9 -7
  30. package/lib/commonjs/components/MessageInput/SendButton.js.map +1 -1
  31. package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecorder.js +221 -0
  32. package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecorder.js.map +1 -0
  33. package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js +121 -0
  34. package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js.map +1 -0
  35. package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingInProgress.js +68 -0
  36. package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingInProgress.js.map +1 -0
  37. package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingLockIndicator.js +75 -0
  38. package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingLockIndicator.js.map +1 -0
  39. package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.js +87 -0
  40. package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.js.map +1 -0
  41. package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingWaveform.js +47 -0
  42. package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingWaveform.js.map +1 -0
  43. package/lib/commonjs/components/MessageInput/hooks/useAudioController.js +452 -0
  44. package/lib/commonjs/components/MessageInput/hooks/useAudioController.js.map +1 -0
  45. package/lib/commonjs/components/MessageInput/utils/audioSampling.js +91 -0
  46. package/lib/commonjs/components/MessageInput/utils/audioSampling.js.map +1 -0
  47. package/lib/commonjs/components/MessageInput/utils/normalizeAudioLevel.js +18 -0
  48. package/lib/commonjs/components/MessageInput/utils/normalizeAudioLevel.js.map +1 -0
  49. package/lib/commonjs/components/ProgressControl/ProgressControl.js +57 -40
  50. package/lib/commonjs/components/ProgressControl/ProgressControl.js.map +1 -1
  51. package/lib/commonjs/components/ProgressControl/WaveProgressBar.js +162 -0
  52. package/lib/commonjs/components/ProgressControl/WaveProgressBar.js.map +1 -0
  53. package/lib/commonjs/components/Reply/Reply.js +45 -20
  54. package/lib/commonjs/components/Reply/Reply.js.map +1 -1
  55. package/lib/commonjs/components/index.js +66 -0
  56. package/lib/commonjs/components/index.js.map +1 -1
  57. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +23 -12
  58. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  59. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +24 -0
  60. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  61. package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js +76 -28
  62. package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
  63. package/lib/commonjs/contexts/themeContext/utils/theme.js +62 -7
  64. package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
  65. package/lib/commonjs/i18n/en.json +2 -0
  66. package/lib/commonjs/i18n/es.json +11 -9
  67. package/lib/commonjs/i18n/fr.json +11 -9
  68. package/lib/commonjs/i18n/he.json +11 -9
  69. package/lib/commonjs/i18n/hi.json +11 -9
  70. package/lib/commonjs/i18n/it.json +11 -9
  71. package/lib/commonjs/i18n/ja.json +11 -9
  72. package/lib/commonjs/i18n/ko.json +11 -9
  73. package/lib/commonjs/i18n/nl.json +11 -9
  74. package/lib/commonjs/i18n/pt-BR.json +11 -9
  75. package/lib/commonjs/i18n/ru.json +11 -9
  76. package/lib/commonjs/i18n/tr.json +11 -9
  77. package/lib/commonjs/icons/ArrowLeft.js +27 -0
  78. package/lib/commonjs/icons/ArrowLeft.js.map +1 -0
  79. package/lib/commonjs/icons/ArrowUp.js +26 -0
  80. package/lib/commonjs/icons/ArrowUp.js.map +1 -0
  81. package/lib/commonjs/icons/Audio.js +24 -24
  82. package/lib/commonjs/icons/Audio.js.map +1 -1
  83. package/lib/commonjs/icons/CircleStop.js +27 -0
  84. package/lib/commonjs/icons/CircleStop.js.map +1 -0
  85. package/lib/commonjs/icons/Delete.js +17 -6
  86. package/lib/commonjs/icons/Delete.js.map +1 -1
  87. package/lib/commonjs/icons/Lock.js +30 -0
  88. package/lib/commonjs/icons/Lock.js.map +1 -0
  89. package/lib/commonjs/icons/Mic.js +30 -0
  90. package/lib/commonjs/icons/Mic.js.map +1 -0
  91. package/lib/commonjs/icons/Pause.js +15 -20
  92. package/lib/commonjs/icons/Pause.js.map +1 -1
  93. package/lib/commonjs/icons/Play.js +18 -10
  94. package/lib/commonjs/icons/Play.js.map +1 -1
  95. package/lib/commonjs/icons/SendCheck.js +30 -0
  96. package/lib/commonjs/icons/SendCheck.js.map +1 -0
  97. package/lib/commonjs/icons/SendRight.js +24 -6
  98. package/lib/commonjs/icons/SendRight.js.map +1 -1
  99. package/lib/commonjs/icons/SendUp.js +24 -6
  100. package/lib/commonjs/icons/SendUp.js.map +1 -1
  101. package/lib/commonjs/icons/Stop.js +19 -0
  102. package/lib/commonjs/icons/Stop.js.map +1 -0
  103. package/lib/commonjs/icons/index.js +77 -0
  104. package/lib/commonjs/icons/index.js.map +1 -1
  105. package/lib/commonjs/native.js +10 -1
  106. package/lib/commonjs/native.js.map +1 -1
  107. package/lib/commonjs/utils/getTrimmedAttachmentTitle.js +11 -0
  108. package/lib/commonjs/utils/getTrimmedAttachmentTitle.js.map +1 -0
  109. package/lib/commonjs/version.json +1 -1
  110. package/lib/module/components/Attachment/Attachment.js +2 -2
  111. package/lib/module/components/Attachment/Attachment.js.map +1 -1
  112. package/lib/module/components/Attachment/AudioAttachment.js +247 -115
  113. package/lib/module/components/Attachment/AudioAttachment.js.map +1 -1
  114. package/lib/module/components/Attachment/FileAttachmentGroup.js +30 -50
  115. package/lib/module/components/Attachment/FileAttachmentGroup.js.map +1 -1
  116. package/lib/module/components/Attachment/VideoThumbnail.js +3 -3
  117. package/lib/module/components/Attachment/VideoThumbnail.js.map +1 -1
  118. package/lib/module/components/Channel/Channel.js +43 -1
  119. package/lib/module/components/Channel/Channel.js.map +1 -1
  120. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +24 -0
  121. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  122. package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js +6 -6
  123. package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -1
  124. package/lib/module/components/Message/Message.js +1 -1
  125. package/lib/module/components/Message/Message.js.map +1 -1
  126. package/lib/module/components/Message/MessageSimple/MessageContent.js +1 -1
  127. package/lib/module/components/Message/MessageSimple/MessageContent.js.map +1 -1
  128. package/lib/module/components/Message/MessageSimple/MessageSimple.js +1 -1
  129. package/lib/module/components/Message/MessageSimple/MessageSimple.js.map +1 -1
  130. package/lib/module/components/Message/hooks/useMessageActions.js +4 -2
  131. package/lib/module/components/Message/hooks/useMessageActions.js.map +1 -1
  132. package/lib/module/components/MessageInput/FileUploadPreview.js +55 -74
  133. package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
  134. package/lib/module/components/MessageInput/InputButtons.js +1 -1
  135. package/lib/module/components/MessageInput/InputButtons.js.map +1 -1
  136. package/lib/module/components/MessageInput/MessageInput.js +250 -43
  137. package/lib/module/components/MessageInput/MessageInput.js.map +1 -1
  138. package/lib/module/components/MessageInput/SendButton.js +9 -7
  139. package/lib/module/components/MessageInput/SendButton.js.map +1 -1
  140. package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecorder.js +221 -0
  141. package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecorder.js.map +1 -0
  142. package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js +121 -0
  143. package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js.map +1 -0
  144. package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingInProgress.js +68 -0
  145. package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingInProgress.js.map +1 -0
  146. package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingLockIndicator.js +75 -0
  147. package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingLockIndicator.js.map +1 -0
  148. package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.js +87 -0
  149. package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.js.map +1 -0
  150. package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingWaveform.js +47 -0
  151. package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingWaveform.js.map +1 -0
  152. package/lib/module/components/MessageInput/hooks/useAudioController.js +452 -0
  153. package/lib/module/components/MessageInput/hooks/useAudioController.js.map +1 -0
  154. package/lib/module/components/MessageInput/utils/audioSampling.js +91 -0
  155. package/lib/module/components/MessageInput/utils/audioSampling.js.map +1 -0
  156. package/lib/module/components/MessageInput/utils/normalizeAudioLevel.js +18 -0
  157. package/lib/module/components/MessageInput/utils/normalizeAudioLevel.js.map +1 -0
  158. package/lib/module/components/ProgressControl/ProgressControl.js +57 -40
  159. package/lib/module/components/ProgressControl/ProgressControl.js.map +1 -1
  160. package/lib/module/components/ProgressControl/WaveProgressBar.js +162 -0
  161. package/lib/module/components/ProgressControl/WaveProgressBar.js.map +1 -0
  162. package/lib/module/components/Reply/Reply.js +45 -20
  163. package/lib/module/components/Reply/Reply.js.map +1 -1
  164. package/lib/module/components/index.js +66 -0
  165. package/lib/module/components/index.js.map +1 -1
  166. package/lib/module/contexts/messageInputContext/MessageInputContext.js +23 -12
  167. package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  168. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +24 -0
  169. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  170. package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js +76 -28
  171. package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
  172. package/lib/module/contexts/themeContext/utils/theme.js +62 -7
  173. package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
  174. package/lib/module/i18n/en.json +2 -0
  175. package/lib/module/i18n/es.json +11 -9
  176. package/lib/module/i18n/fr.json +11 -9
  177. package/lib/module/i18n/he.json +11 -9
  178. package/lib/module/i18n/hi.json +11 -9
  179. package/lib/module/i18n/it.json +11 -9
  180. package/lib/module/i18n/ja.json +11 -9
  181. package/lib/module/i18n/ko.json +11 -9
  182. package/lib/module/i18n/nl.json +11 -9
  183. package/lib/module/i18n/pt-BR.json +11 -9
  184. package/lib/module/i18n/ru.json +11 -9
  185. package/lib/module/i18n/tr.json +11 -9
  186. package/lib/module/icons/ArrowLeft.js +27 -0
  187. package/lib/module/icons/ArrowLeft.js.map +1 -0
  188. package/lib/module/icons/ArrowUp.js +26 -0
  189. package/lib/module/icons/ArrowUp.js.map +1 -0
  190. package/lib/module/icons/Audio.js +24 -24
  191. package/lib/module/icons/Audio.js.map +1 -1
  192. package/lib/module/icons/CircleStop.js +27 -0
  193. package/lib/module/icons/CircleStop.js.map +1 -0
  194. package/lib/module/icons/Delete.js +17 -6
  195. package/lib/module/icons/Delete.js.map +1 -1
  196. package/lib/module/icons/Lock.js +30 -0
  197. package/lib/module/icons/Lock.js.map +1 -0
  198. package/lib/module/icons/Mic.js +30 -0
  199. package/lib/module/icons/Mic.js.map +1 -0
  200. package/lib/module/icons/Pause.js +15 -20
  201. package/lib/module/icons/Pause.js.map +1 -1
  202. package/lib/module/icons/Play.js +18 -10
  203. package/lib/module/icons/Play.js.map +1 -1
  204. package/lib/module/icons/SendCheck.js +30 -0
  205. package/lib/module/icons/SendCheck.js.map +1 -0
  206. package/lib/module/icons/SendRight.js +24 -6
  207. package/lib/module/icons/SendRight.js.map +1 -1
  208. package/lib/module/icons/SendUp.js +24 -6
  209. package/lib/module/icons/SendUp.js.map +1 -1
  210. package/lib/module/icons/Stop.js +19 -0
  211. package/lib/module/icons/Stop.js.map +1 -0
  212. package/lib/module/icons/index.js +77 -0
  213. package/lib/module/icons/index.js.map +1 -1
  214. package/lib/module/native.js +10 -1
  215. package/lib/module/native.js.map +1 -1
  216. package/lib/module/utils/getTrimmedAttachmentTitle.js +11 -0
  217. package/lib/module/utils/getTrimmedAttachmentTitle.js.map +1 -0
  218. package/lib/module/version.json +1 -1
  219. package/lib/typescript/components/Attachment/Attachment.d.ts.map +1 -1
  220. package/lib/typescript/components/Attachment/AudioAttachment.d.ts +3 -8
  221. package/lib/typescript/components/Attachment/AudioAttachment.d.ts.map +1 -1
  222. package/lib/typescript/components/Attachment/FileAttachmentGroup.d.ts.map +1 -1
  223. package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
  224. package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts +15 -3
  225. package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts.map +1 -1
  226. package/lib/typescript/components/ImageGallery/components/ImageGalleryVideoControl.d.ts.map +1 -1
  227. package/lib/typescript/components/Message/MessageSimple/MessageContent.d.ts.map +1 -1
  228. package/lib/typescript/components/Message/MessageSimple/MessageSimple.d.ts.map +1 -1
  229. package/lib/typescript/components/MessageInput/FileUploadPreview.d.ts +1 -1
  230. package/lib/typescript/components/MessageInput/FileUploadPreview.d.ts.map +1 -1
  231. package/lib/typescript/components/MessageInput/InputButtons.d.ts.map +1 -1
  232. package/lib/typescript/components/MessageInput/MessageInput.d.ts +1 -1
  233. package/lib/typescript/components/MessageInput/MessageInput.d.ts.map +1 -1
  234. package/lib/typescript/components/MessageInput/SendButton.d.ts.map +1 -1
  235. package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecorder.d.ts +51 -0
  236. package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecorder.d.ts.map +1 -0
  237. package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingButton.d.ts +43 -0
  238. package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingButton.d.ts.map +1 -0
  239. package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingInProgress.d.ts +29 -0
  240. package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingInProgress.d.ts.map +1 -0
  241. package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingLockIndicator.d.ts +22 -0
  242. package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingLockIndicator.d.ts.map +1 -0
  243. package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.d.ts +31 -0
  244. package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.d.ts.map +1 -0
  245. package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingWaveform.d.ts +19 -0
  246. package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingWaveform.d.ts.map +1 -0
  247. package/lib/typescript/components/MessageInput/hooks/useAudioController.d.ts +28 -0
  248. package/lib/typescript/components/MessageInput/hooks/useAudioController.d.ts.map +1 -0
  249. package/lib/typescript/components/MessageInput/utils/audioSampling.d.ts +11 -0
  250. package/lib/typescript/components/MessageInput/utils/audioSampling.d.ts.map +1 -0
  251. package/lib/typescript/components/MessageInput/utils/normalizeAudioLevel.d.ts +5 -0
  252. package/lib/typescript/components/MessageInput/utils/normalizeAudioLevel.d.ts.map +1 -0
  253. package/lib/typescript/components/ProgressControl/ProgressControl.d.ts +2 -2
  254. package/lib/typescript/components/ProgressControl/ProgressControl.d.ts.map +1 -1
  255. package/lib/typescript/components/ProgressControl/WaveProgressBar.d.ts +11 -0
  256. package/lib/typescript/components/ProgressControl/WaveProgressBar.d.ts.map +1 -0
  257. package/lib/typescript/components/Reply/Reply.d.ts.map +1 -1
  258. package/lib/typescript/components/index.d.ts +6 -0
  259. package/lib/typescript/components/index.d.ts.map +1 -1
  260. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +70 -4
  261. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts.map +1 -1
  262. package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
  263. package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts.map +1 -1
  264. package/lib/typescript/contexts/messageInputContext/hooks/useMessageDetailsForState.d.ts.map +1 -1
  265. package/lib/typescript/contexts/themeContext/utils/theme.d.ts +62 -7
  266. package/lib/typescript/contexts/themeContext/utils/theme.d.ts.map +1 -1
  267. package/lib/typescript/i18n/en.json +2 -0
  268. package/lib/typescript/i18n/es.json +11 -9
  269. package/lib/typescript/i18n/fr.json +11 -9
  270. package/lib/typescript/i18n/he.json +11 -9
  271. package/lib/typescript/i18n/hi.json +11 -9
  272. package/lib/typescript/i18n/it.json +11 -9
  273. package/lib/typescript/i18n/ja.json +11 -9
  274. package/lib/typescript/i18n/ko.json +11 -9
  275. package/lib/typescript/i18n/nl.json +11 -9
  276. package/lib/typescript/i18n/pt-BR.json +11 -9
  277. package/lib/typescript/i18n/ru.json +11 -9
  278. package/lib/typescript/i18n/tr.json +11 -9
  279. package/lib/typescript/icons/ArrowLeft.d.ts +8 -0
  280. package/lib/typescript/icons/ArrowLeft.d.ts.map +1 -0
  281. package/lib/typescript/icons/ArrowUp.d.ts +9 -0
  282. package/lib/typescript/icons/ArrowUp.d.ts.map +1 -0
  283. package/lib/typescript/icons/Audio.d.ts.map +1 -1
  284. package/lib/typescript/icons/CircleStop.d.ts +8 -0
  285. package/lib/typescript/icons/CircleStop.d.ts.map +1 -0
  286. package/lib/typescript/icons/Delete.d.ts +5 -1
  287. package/lib/typescript/icons/Delete.d.ts.map +1 -1
  288. package/lib/typescript/icons/Lock.d.ts +9 -0
  289. package/lib/typescript/icons/Lock.d.ts.map +1 -0
  290. package/lib/typescript/icons/Mic.d.ts +8 -0
  291. package/lib/typescript/icons/Mic.d.ts.map +1 -0
  292. package/lib/typescript/icons/Pause.d.ts +3 -1
  293. package/lib/typescript/icons/Pause.d.ts.map +1 -1
  294. package/lib/typescript/icons/Play.d.ts +3 -1
  295. package/lib/typescript/icons/Play.d.ts.map +1 -1
  296. package/lib/typescript/icons/SendCheck.d.ts +8 -0
  297. package/lib/typescript/icons/SendCheck.d.ts.map +1 -0
  298. package/lib/typescript/icons/SendRight.d.ts +5 -1
  299. package/lib/typescript/icons/SendRight.d.ts.map +1 -1
  300. package/lib/typescript/icons/SendUp.d.ts +5 -1
  301. package/lib/typescript/icons/SendUp.d.ts.map +1 -1
  302. package/lib/typescript/icons/Stop.d.ts +4 -0
  303. package/lib/typescript/icons/Stop.d.ts.map +1 -0
  304. package/lib/typescript/icons/index.d.ts +7 -0
  305. package/lib/typescript/icons/index.d.ts.map +1 -1
  306. package/lib/typescript/native.d.ts +49 -0
  307. package/lib/typescript/native.d.ts.map +1 -1
  308. package/lib/typescript/types/types.d.ts +6 -0
  309. package/lib/typescript/types/types.d.ts.map +1 -1
  310. package/lib/typescript/utils/Streami18n.d.ts +2 -0
  311. package/lib/typescript/utils/Streami18n.d.ts.map +1 -1
  312. package/lib/typescript/utils/getTrimmedAttachmentTitle.d.ts +2 -0
  313. package/lib/typescript/utils/getTrimmedAttachmentTitle.d.ts.map +1 -0
  314. package/package.json +1 -1
  315. package/src/components/Attachment/Attachment.tsx +7 -2
  316. package/src/components/Attachment/AudioAttachment.tsx +223 -119
  317. package/src/components/Attachment/FileAttachmentGroup.tsx +35 -55
  318. package/src/components/Attachment/VideoThumbnail.tsx +1 -1
  319. package/src/components/Channel/Channel.tsx +32 -0
  320. package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +24 -0
  321. package/src/components/ImageGallery/__tests__/ImageGallery.test.tsx +1 -1
  322. package/src/components/ImageGallery/__tests__/ImageGalleryVideoControl.test.tsx +2 -2
  323. package/src/components/ImageGallery/components/ImageGalleryVideoControl.tsx +2 -7
  324. package/src/components/Message/Message.tsx +1 -1
  325. package/src/components/Message/MessageSimple/MessageContent.tsx +2 -1
  326. package/src/components/Message/MessageSimple/MessageSimple.tsx +2 -1
  327. package/src/components/Message/hooks/useMessageActions.tsx +2 -2
  328. package/src/components/MessageInput/FileUploadPreview.tsx +67 -98
  329. package/src/components/MessageInput/InputButtons.tsx +2 -1
  330. package/src/components/MessageInput/MessageInput.tsx +320 -49
  331. package/src/components/MessageInput/SendButton.tsx +7 -3
  332. package/src/components/MessageInput/__tests__/MessageInput.test.js +0 -1
  333. package/src/components/MessageInput/__tests__/__snapshots__/SendButton.test.js.snap +132 -48
  334. package/src/components/MessageInput/components/AudioRecorder/AudioRecorder.tsx +313 -0
  335. package/src/components/MessageInput/components/AudioRecorder/AudioRecordingButton.tsx +192 -0
  336. package/src/components/MessageInput/components/AudioRecorder/AudioRecordingInProgress.tsx +114 -0
  337. package/src/components/MessageInput/components/AudioRecorder/AudioRecordingLockIndicator.tsx +85 -0
  338. package/src/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.tsx +102 -0
  339. package/src/components/MessageInput/components/AudioRecorder/AudioRecordingWaveform.tsx +62 -0
  340. package/src/components/MessageInput/hooks/useAudioController.tsx +288 -0
  341. package/src/components/MessageInput/utils/audioSampling.ts +108 -0
  342. package/src/components/MessageInput/utils/normalizeAudioLevel.ts +20 -0
  343. package/src/components/ProgressControl/ProgressControl.tsx +69 -40
  344. package/src/components/ProgressControl/WaveProgressBar.tsx +180 -0
  345. package/src/components/Reply/Reply.tsx +89 -56
  346. package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +38 -20
  347. package/src/components/index.ts +6 -0
  348. package/src/contexts/messageInputContext/MessageInputContext.tsx +95 -10
  349. package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +25 -0
  350. package/src/contexts/messageInputContext/hooks/useMessageDetailsForState.ts +80 -27
  351. package/src/contexts/themeContext/utils/theme.ts +111 -14
  352. package/src/i18n/en.json +2 -0
  353. package/src/i18n/es.json +11 -9
  354. package/src/i18n/fr.json +11 -9
  355. package/src/i18n/he.json +11 -9
  356. package/src/i18n/hi.json +11 -9
  357. package/src/i18n/it.json +11 -9
  358. package/src/i18n/ja.json +11 -9
  359. package/src/i18n/ko.json +11 -9
  360. package/src/i18n/nl.json +11 -9
  361. package/src/i18n/pt-BR.json +11 -9
  362. package/src/i18n/ru.json +11 -9
  363. package/src/i18n/tr.json +11 -9
  364. package/src/icons/ArrowLeft.tsx +18 -0
  365. package/src/icons/ArrowUp.tsx +19 -0
  366. package/src/icons/Audio.tsx +24 -24
  367. package/src/icons/CircleStop.tsx +18 -0
  368. package/src/icons/Delete.tsx +14 -8
  369. package/src/icons/Lock.tsx +22 -0
  370. package/src/icons/Mic.tsx +20 -0
  371. package/src/icons/Pause.tsx +12 -11
  372. package/src/icons/Play.tsx +9 -13
  373. package/src/icons/SendCheck.tsx +18 -0
  374. package/src/icons/SendRight.tsx +16 -7
  375. package/src/icons/SendUp.tsx +16 -7
  376. package/src/icons/Stop.tsx +12 -0
  377. package/src/icons/index.ts +7 -0
  378. package/src/native.ts +69 -0
  379. package/src/types/types.ts +6 -0
  380. package/src/utils/getTrimmedAttachmentTitle.ts +5 -0
  381. package/src/version.json +1 -1
@@ -1,11 +1,11 @@
1
- import React, { useEffect } from 'react';
2
- import { I18nManager, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
1
+ import React, { useEffect, useState } from 'react';
2
+ import { I18nManager, Pressable, StyleSheet, Text, View } from 'react-native';
3
3
 
4
4
  import dayjs from 'dayjs';
5
5
  import duration from 'dayjs/plugin/duration';
6
6
 
7
7
  import { useTheme } from '../../contexts';
8
- import { Pause, Play } from '../../icons';
8
+ import { Audio, Pause, Play } from '../../icons';
9
9
  import {
10
10
  PlaybackStatus,
11
11
  Sound,
@@ -14,85 +14,58 @@ import {
14
14
  VideoProgressData,
15
15
  } from '../../native';
16
16
  import type { FileUpload } from '../../types/types';
17
+ import { getTrimmedAttachmentTitle } from '../../utils/getTrimmedAttachmentTitle';
17
18
  import { ProgressControl } from '../ProgressControl/ProgressControl';
19
+ import { WaveProgressBar } from '../ProgressControl/WaveProgressBar';
18
20
 
19
21
  dayjs.extend(duration);
20
22
 
21
- const FILE_PREVIEW_HEIGHT = 70;
22
-
23
- const styles = StyleSheet.create({
24
- fileContainer: {
25
- borderRadius: 12,
26
- borderWidth: 1,
27
- flexDirection: 'row',
28
- height: FILE_PREVIEW_HEIGHT,
29
- paddingLeft: 8,
30
- paddingRight: 8,
31
- },
32
- fileContentContainer: { flexDirection: 'row', paddingRight: 40 },
33
- filenameText: {
34
- fontSize: 14,
35
- fontWeight: 'bold',
36
- paddingLeft: 10,
37
- },
38
- fileTextContainer: {
39
- justifyContent: 'space-around',
40
- },
41
- flatList: { marginBottom: 12, maxHeight: FILE_PREVIEW_HEIGHT * 2.5 + 16 },
42
- overlay: {
43
- borderRadius: 12,
44
- marginLeft: 8,
45
- marginRight: 8,
46
- },
47
- progressControlView: {
48
- flex: 8,
49
- },
50
- progressDurationText: {
51
- flex: 4,
52
- fontSize: 12,
53
- paddingLeft: 10,
54
- paddingRight: 8,
55
- },
56
- roundedView: {
57
- alignItems: 'center',
58
- alignSelf: 'center',
59
- borderRadius: 50,
60
- display: 'flex',
61
- elevation: 4,
62
- height: 36,
63
- justifyContent: 'center',
64
- shadowOffset: {
65
- height: 2,
66
- width: 0,
67
- },
68
- shadowOpacity: 0.23,
69
- shadowRadius: 2.62,
70
- width: 36,
71
- },
72
- });
73
-
74
- export type AudioAttachmentPropsWithContext = {
23
+ export type AudioAttachmentProps = {
75
24
  item: Omit<FileUpload, 'state'>;
76
25
  onLoad: (index: string, duration: number) => void;
77
26
  onPlayPause: (index: string, pausedStatus?: boolean) => void;
78
27
  onProgress: (index: string, currentTime?: number, hasEnd?: boolean) => void;
28
+ hideProgressBar?: boolean;
29
+ showSpeedSettings?: boolean;
79
30
  testID?: string;
80
31
  };
81
32
 
82
- const AudioAttachmentWithContext = (props: AudioAttachmentPropsWithContext) => {
33
+ /**
34
+ * AudioAttachment
35
+ * UI Component to preview the audio files
36
+ */
37
+ export const AudioAttachment = (props: AudioAttachmentProps) => {
38
+ const [width, setWidth] = useState(0);
39
+ const [currentSpeed, setCurrentSpeed] = useState<number>(1.0);
83
40
  const soundRef = React.useRef<SoundReturnType | null>(null);
84
- const { item, onLoad, onPlayPause, onProgress } = props;
41
+ const {
42
+ hideProgressBar = false,
43
+ item,
44
+ onLoad,
45
+ onPlayPause,
46
+ onProgress,
47
+ showSpeedSettings = false,
48
+ testID,
49
+ } = props;
85
50
 
51
+ /** This is for Native CLI Apps */
86
52
  const handleLoad = (payload: VideoPayloadData) => {
87
- onLoad(item.id, payload.duration);
53
+ onLoad(item.id, item.duration || payload.duration);
88
54
  };
89
55
 
56
+ /** This is for Native CLI Apps */
90
57
  const handleProgress = (data: VideoProgressData) => {
91
- if (data.currentTime && data.seekableDuration) {
58
+ if (data.currentTime <= data.seekableDuration) {
92
59
  onProgress(item.id, data.currentTime);
93
60
  }
94
61
  };
95
62
 
63
+ /** This is for Native CLI Apps */
64
+ const handleEnd = () => {
65
+ onPlayPause(item.id, true);
66
+ onProgress(item.id, item.duration, true);
67
+ };
68
+
96
69
  const handlePlayPause = async (isPausedStatusAvailable?: boolean) => {
97
70
  if (soundRef.current) {
98
71
  if (isPausedStatusAvailable === undefined) {
@@ -103,9 +76,13 @@ const AudioAttachmentWithContext = (props: AudioAttachmentPropsWithContext) => {
103
76
  if (soundRef.current.setPositionAsync) soundRef.current.setPositionAsync(0);
104
77
  }
105
78
  if (item.paused) {
79
+ // For expo CLI
106
80
  if (soundRef.current.playAsync) await soundRef.current.playAsync();
81
+ if (soundRef.current.setProgressUpdateIntervalAsync)
82
+ await soundRef.current.setProgressUpdateIntervalAsync(60);
107
83
  onPlayPause(item.id, false);
108
84
  } else {
85
+ // For expo CLI
109
86
  if (soundRef.current.pauseAsync) await soundRef.current.pauseAsync();
110
87
  onPlayPause(item.id, true);
111
88
  }
@@ -117,17 +94,15 @@ const AudioAttachmentWithContext = (props: AudioAttachmentPropsWithContext) => {
117
94
 
118
95
  const handleProgressDrag = async (position: number) => {
119
96
  onProgress(item.id, position);
97
+ // For native CLI
120
98
  if (soundRef.current?.seek) soundRef.current.seek(position);
99
+ // For expo CLI
121
100
  if (soundRef.current?.setPositionAsync) {
122
101
  await soundRef.current.setPositionAsync(position * 1000);
123
102
  }
124
103
  };
125
104
 
126
- const handleEnd = () => {
127
- onPlayPause(item.id, true);
128
- onProgress(item.id, item.duration, true);
129
- };
130
-
105
+ /** For Expo CLI */
131
106
  const onPlaybackStatusUpdate = (playbackStatus: PlaybackStatus) => {
132
107
  if (!playbackStatus.isLoaded) {
133
108
  // Update your UI for the unloaded state
@@ -136,7 +111,10 @@ const AudioAttachmentWithContext = (props: AudioAttachmentPropsWithContext) => {
136
111
  }
137
112
  } else {
138
113
  const { durationMillis, positionMillis } = playbackStatus;
139
- onLoad(item.id, durationMillis / 1000);
114
+ // This is done for Expo CLI where we don't get file duration from file picker
115
+ if (item.duration === 0) {
116
+ onLoad(item.id, durationMillis / 1000);
117
+ }
140
118
  // Update your UI for the loaded state
141
119
  if (playbackStatus.isPlaying) {
142
120
  // Update your UI for the playing state
@@ -187,24 +165,53 @@ const AudioAttachmentWithContext = (props: AudioAttachmentPropsWithContext) => {
187
165
  if (soundRef.current.pauseAsync) await soundRef.current.pauseAsync();
188
166
  } else {
189
167
  if (soundRef.current.playAsync) await soundRef.current.playAsync();
168
+ if (soundRef.current.setProgressUpdateIntervalAsync)
169
+ await soundRef.current.setProgressUpdateIntervalAsync(60);
190
170
  }
191
171
  }
192
172
  };
173
+ // For expo CLI
193
174
  if (!Sound.Player) {
194
175
  initalPlayPause();
195
176
  }
196
177
  }, [item.paused]);
197
178
 
179
+ const onSpeedChangeHandler = async () => {
180
+ if (currentSpeed === 2.0) {
181
+ setCurrentSpeed(1.0);
182
+ if (soundRef.current && soundRef.current.setRateAsync) {
183
+ await soundRef.current.setRateAsync(1.0);
184
+ }
185
+ } else {
186
+ if (currentSpeed === 1.0) {
187
+ setCurrentSpeed(1.5);
188
+ if (soundRef.current && soundRef.current.setRateAsync) {
189
+ await soundRef.current.setRateAsync(1.5);
190
+ }
191
+ } else if (currentSpeed === 1.5) {
192
+ setCurrentSpeed(2.0);
193
+ if (soundRef.current && soundRef.current.setRateAsync) {
194
+ await soundRef.current.setRateAsync(2.0);
195
+ }
196
+ }
197
+ }
198
+ };
199
+
198
200
  const {
199
201
  theme: {
200
- colors: { accent_blue, black, grey_dark, static_black, static_white },
202
+ audioAttachment: {
203
+ container,
204
+ leftContainer,
205
+ playPauseButton,
206
+ progressControlContainer,
207
+ progressDurationText,
208
+ rightContainer,
209
+ speedChangeButton,
210
+ speedChangeButtonText,
211
+ },
212
+ colors: { accent_blue, black, grey_dark, grey_whisper, static_black, static_white, white },
201
213
  messageInput: {
202
- fileUploadPreview: {
203
- audioAttachment: { progressControlView, progressDurationText, roundedView },
204
- fileContentContainer,
205
- filenameText,
206
- fileTextContainer,
207
- },
214
+ fileUploadPreview: { filenameText },
208
215
  },
209
216
  },
210
217
  } = useTheme();
@@ -215,28 +222,40 @@ const AudioAttachmentWithContext = (props: AudioAttachmentPropsWithContext) => {
215
222
  ? progressValueInSeconds / 3600 >= 1
216
223
  ? dayjs.duration(progressValueInSeconds, 'second').format('HH:mm:ss')
217
224
  : dayjs.duration(progressValueInSeconds, 'second').format('mm:ss')
218
- : '00:00';
219
-
220
- const lastIndexOfDot = item.file.name.lastIndexOf('.');
225
+ : dayjs.duration(item.duration ?? 0, 'second').format('mm:ss');
221
226
 
222
227
  return (
223
- <View style={[styles.fileContentContainer, fileContentContainer]}>
224
- <TouchableOpacity
228
+ <View
229
+ accessibilityLabel='audio-attachment-preview'
230
+ onLayout={({ nativeEvent }) => {
231
+ setWidth(nativeEvent.layout.width);
232
+ }}
233
+ style={[
234
+ styles.container,
235
+ {
236
+ backgroundColor: white,
237
+ borderColor: grey_whisper,
238
+ },
239
+ container,
240
+ ]}
241
+ testID={testID}
242
+ >
243
+ <Pressable
225
244
  accessibilityLabel='Play Pause Button'
226
245
  onPress={() => handlePlayPause()}
227
246
  style={[
228
- styles.roundedView,
229
- roundedView,
247
+ styles.playPauseButton,
230
248
  { backgroundColor: static_white, shadowColor: black },
249
+ playPauseButton,
231
250
  ]}
232
251
  >
233
252
  {item.paused ? (
234
- <Play height={24} pathFill={static_black} width={24} />
253
+ <Play fill={static_black} height={32} width={32} />
235
254
  ) : (
236
- <Pause height={24} pathFill={static_black} width={24} />
255
+ <Pause fill={static_black} height={32} width={32} />
237
256
  )}
238
- </TouchableOpacity>
239
- <View style={[styles.fileTextContainer, fileTextContainer]}>
257
+ </Pressable>
258
+ <View style={[styles.leftContainer, leftContainer]}>
240
259
  <Text
241
260
  accessibilityLabel='File Name'
242
261
  numberOfLines={1}
@@ -254,15 +273,9 @@ const AudioAttachmentWithContext = (props: AudioAttachmentPropsWithContext) => {
254
273
  filenameText,
255
274
  ]}
256
275
  >
257
- {item.file.name.slice(0, 12) + '...' + item.file.name.slice(lastIndexOfDot)}
276
+ {getTrimmedAttachmentTitle(item.file.name)}
258
277
  </Text>
259
- <View
260
- style={{
261
- alignItems: 'center',
262
- display: 'flex',
263
- flexDirection: 'row',
264
- }}
265
- >
278
+ <View style={styles.audioInfo}>
266
279
  {/* <ExpoSoundPlayer filePaused={!!item.paused} soundRef={soundRef} /> */}
267
280
  {Sound.Player && (
268
281
  <Sound.Player
@@ -270,6 +283,7 @@ const AudioAttachmentWithContext = (props: AudioAttachmentPropsWithContext) => {
270
283
  onLoad={handleLoad}
271
284
  onProgress={handleProgress}
272
285
  paused={item.paused as boolean}
286
+ rate={currentSpeed}
273
287
  soundRef={soundRef}
274
288
  testID='sound-player'
275
289
  uri={item.file.uri}
@@ -278,37 +292,127 @@ const AudioAttachmentWithContext = (props: AudioAttachmentPropsWithContext) => {
278
292
  <Text style={[styles.progressDurationText, { color: grey_dark }, progressDurationText]}>
279
293
  {progressDuration}
280
294
  </Text>
281
- <View style={[styles.progressControlView, progressControlView]}>
282
- <ProgressControl
283
- duration={item.duration as number}
284
- filledColor={accent_blue}
285
- onPlayPause={handlePlayPause}
286
- onProgressDrag={handleProgressDrag}
287
- progress={item.progress as number}
288
- testID='progress-control'
289
- width={120}
290
- />
291
- </View>
295
+ {!hideProgressBar && (
296
+ <View style={[styles.progressControlContainer, progressControlContainer]}>
297
+ {item.file.waveform_data ? (
298
+ <WaveProgressBar
299
+ amplitudesCount={35}
300
+ onPlayPause={handlePlayPause}
301
+ onProgressDrag={(position) => {
302
+ if (item.file.waveform_data) {
303
+ const progress = (position / 30) * (item.duration as number);
304
+ handleProgressDrag(progress);
305
+ }
306
+ }}
307
+ progress={item.progress as number}
308
+ waveformData={item.file.waveform_data}
309
+ />
310
+ ) : (
311
+ <ProgressControl
312
+ duration={item.duration as number}
313
+ filledColor={accent_blue}
314
+ onPlayPause={handlePlayPause}
315
+ onProgressDrag={handleProgressDrag}
316
+ progress={item.progress as number}
317
+ testID='progress-control'
318
+ width={width / 2}
319
+ />
320
+ )}
321
+ </View>
322
+ )}
292
323
  </View>
293
324
  </View>
325
+ {showSpeedSettings && (
326
+ <View style={[styles.rightContainer, rightContainer]}>
327
+ {item.progress === 0 || item.progress === 1 ? (
328
+ <Audio fill={'#ffffff'} />
329
+ ) : (
330
+ <Pressable
331
+ onPress={onSpeedChangeHandler}
332
+ style={[
333
+ styles.speedChangeButton,
334
+ { backgroundColor: static_white, shadowColor: black },
335
+ speedChangeButton,
336
+ ]}
337
+ >
338
+ <Text
339
+ style={[styles.speedChangeButtonText, speedChangeButtonText]}
340
+ >{`x${currentSpeed}`}</Text>
341
+ </Pressable>
342
+ )}
343
+ </View>
344
+ )}
294
345
  </View>
295
346
  );
296
347
  };
297
348
 
298
- export type AudioAttachmentProps = Partial<AudioAttachmentPropsWithContext> & {
299
- item: Omit<FileUpload, 'state'>;
300
- onLoad: (index: string, duration: number) => void;
301
- onPlayPause: (index: string, pausedStatus?: boolean) => void;
302
- onProgress: (index: string, currentTime?: number, hasEnd?: boolean) => void;
303
- testID: string;
304
- };
305
-
306
- /**
307
- * AudioAttachment
308
- * UI Component to preview the audio files
309
- */
310
- export const AudioAttachment = (props: AudioAttachmentProps) => (
311
- <AudioAttachmentWithContext {...props} />
312
- );
349
+ const styles = StyleSheet.create({
350
+ audioInfo: {
351
+ alignItems: 'center',
352
+ display: 'flex',
353
+ flexDirection: 'row',
354
+ },
355
+ container: {
356
+ alignItems: 'center',
357
+ borderRadius: 12,
358
+ borderWidth: 1,
359
+ flexDirection: 'row',
360
+ paddingHorizontal: 8,
361
+ paddingVertical: 12,
362
+ },
363
+ filenameText: {
364
+ fontSize: 14,
365
+ fontWeight: 'bold',
366
+ paddingBottom: 12,
367
+ paddingLeft: 8,
368
+ },
369
+ leftContainer: {
370
+ justifyContent: 'space-around',
371
+ },
372
+ playPauseButton: {
373
+ alignItems: 'center',
374
+ alignSelf: 'center',
375
+ borderRadius: 50,
376
+ display: 'flex',
377
+ elevation: 4,
378
+ justifyContent: 'center',
379
+ paddingVertical: 2,
380
+ shadowOffset: {
381
+ height: 2,
382
+ width: 0,
383
+ },
384
+ shadowOpacity: 0.23,
385
+ shadowRadius: 2.62,
386
+ width: 36,
387
+ },
388
+ progressControlContainer: {},
389
+ progressDurationText: {
390
+ fontSize: 12,
391
+ paddingLeft: 10,
392
+ paddingRight: 8,
393
+ },
394
+ rightContainer: {
395
+ marginLeft: 10,
396
+ },
397
+ speedChangeButton: {
398
+ alignItems: 'center',
399
+ alignSelf: 'center',
400
+ borderRadius: 50,
401
+ elevation: 4,
402
+ justifyContent: 'center',
403
+ paddingVertical: 5,
404
+ shadowOffset: {
405
+ height: 2,
406
+ width: 0,
407
+ },
408
+ shadowOpacity: 0.23,
409
+ shadowRadius: 2.62,
410
+ width: 36,
411
+ },
412
+ speedChangeButtonText: {
413
+ fontSize: 12,
414
+ fontWeight: '500',
415
+ },
416
+ });
313
417
 
314
418
  AudioAttachment.displayName = 'AudioAttachment{messageInput{audioAttachment}}';
@@ -19,23 +19,6 @@ import { isAudioPackageAvailable } from '../../native';
19
19
 
20
20
  import type { DefaultStreamChatGenerics } from '../../types/types';
21
21
 
22
- const FILE_PREVIEW_HEIGHT = 60;
23
-
24
- const styles = StyleSheet.create({
25
- container: {
26
- padding: 4,
27
- },
28
- fileContainer: {
29
- borderRadius: 12,
30
- borderWidth: 1,
31
- flexDirection: 'row',
32
- height: FILE_PREVIEW_HEIGHT,
33
- justifyContent: 'space-between',
34
- paddingLeft: 8,
35
- paddingRight: 8,
36
- },
37
- });
38
-
39
22
  export type FileAttachmentGroupPropsWithContext<
40
23
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
41
24
  > = Pick<MessageContextValue<StreamChatGenerics>, 'files'> &
@@ -67,7 +50,9 @@ const FileAttachmentGroupWithContext = <
67
50
  const [filesToDisplay, setFilesToDisplay] = useState<FilesToDisplayType[]>([]);
68
51
 
69
52
  useEffect(() => {
70
- setFilesToDisplay(files.map((file) => ({ ...file, duration: 0, paused: true, progress: 0 })));
53
+ setFilesToDisplay(
54
+ files.map((file) => ({ ...file, duration: file.duration || 0, paused: true, progress: 0 })),
55
+ );
71
56
  }, [files]);
72
57
 
73
58
  // Handler triggered when an audio is loaded in the message input. The initial state is defined for the audio here and the duration is set.
@@ -82,17 +67,17 @@ const FileAttachmentGroupWithContext = <
82
67
 
83
68
  // The handler which is triggered when the audio progresses/ the thumb is dragged in the progress control. The progressed duration is set here.
84
69
  const onProgress = (index: string, currentTime?: number, hasEnd?: boolean) => {
85
- setFilesToDisplay((prevFileUploads) =>
86
- prevFileUploads.map((fileUpload, id) => ({
87
- ...fileUpload,
70
+ setFilesToDisplay((prevFilesToDisplay) =>
71
+ prevFilesToDisplay.map((filesToDisplay, id) => ({
72
+ ...filesToDisplay,
88
73
  progress:
89
74
  id.toString() === index
90
75
  ? hasEnd
91
76
  ? 1
92
77
  : currentTime
93
- ? currentTime / (fileUpload.duration as number)
78
+ ? currentTime / (filesToDisplay.duration as number)
94
79
  : 0
95
- : fileUpload.progress,
80
+ : filesToDisplay.progress,
96
81
  })),
97
82
  );
98
83
  };
@@ -120,9 +105,8 @@ const FileAttachmentGroupWithContext = <
120
105
 
121
106
  const {
122
107
  theme: {
123
- colors: { grey_whisper, white },
124
108
  messageSimple: {
125
- fileAttachmentGroup: { container },
109
+ fileAttachmentGroup: { attachmentContainer, container },
126
110
  },
127
111
  },
128
112
  } = useTheme();
@@ -135,39 +119,29 @@ const FileAttachmentGroupWithContext = <
135
119
  style={[
136
120
  { paddingBottom: index !== files.length - 1 ? 4 : 0 },
137
121
  stylesProp.attachmentContainer,
122
+ attachmentContainer,
138
123
  ]}
139
124
  >
140
- {file.type === 'audio' && isAudioPackageAvailable() ? (
141
- <View
142
- accessibilityLabel='audio-attachment-preview'
143
- style={[
144
- styles.fileContainer,
145
- index === filesToDisplay.length - 1
146
- ? {
147
- marginBottom: 0,
148
- }
149
- : {},
150
- {
151
- backgroundColor: white,
152
- borderColor: grey_whisper,
153
- width: -16,
125
+ {(file.type === 'audio' || file.type === 'voiceRecording') &&
126
+ isAudioPackageAvailable() ? (
127
+ <AudioAttachment
128
+ item={{
129
+ duration: file.duration,
130
+ file: {
131
+ name: file.title as string,
132
+ uri: file.asset_url,
133
+ waveform_data: file.waveform_data,
154
134
  },
155
- ]}
156
- >
157
- <AudioAttachment
158
- item={{
159
- duration: file.duration,
160
- file: { name: file.title as string, uri: file.asset_url },
161
- id: index.toString(),
162
- paused: file.paused,
163
- progress: file.progress,
164
- }}
165
- onLoad={onLoad}
166
- onPlayPause={onPlayPause}
167
- onProgress={onProgress}
168
- testID='audio-attachment-preview'
169
- />
170
- </View>
135
+ id: index.toString(),
136
+ paused: file.paused,
137
+ progress: file.progress,
138
+ }}
139
+ onLoad={onLoad}
140
+ onPlayPause={onPlayPause}
141
+ onProgress={onProgress}
142
+ showSpeedSettings={true}
143
+ testID='audio-attachment-preview'
144
+ />
171
145
  ) : (
172
146
  <Attachment attachment={file} />
173
147
  )}
@@ -225,4 +199,10 @@ export const FileAttachmentGroup = <
225
199
  );
226
200
  };
227
201
 
202
+ const styles = StyleSheet.create({
203
+ container: {
204
+ padding: 4,
205
+ },
206
+ });
207
+
228
208
  FileAttachmentGroup.displayName = 'FileAttachmentGroup{messageSimple{fileAttachmentGroup}}';
@@ -55,7 +55,7 @@ export const VideoThumbnail = (props: VideoThumbnailProps) => {
55
55
  style={[styles.container, container, style]}
56
56
  >
57
57
  <View style={[styles.roundedView, roundedView, { backgroundColor: static_white }]}>
58
- <Play height={24} pathFill={static_black} width={24} />
58
+ <Play fill={static_black} height={32} width={32} />
59
59
  </View>
60
60
  </ImageBackground>
61
61
  );