@ethora/chat-component-rn 26.7.5 → 26.7.6

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 (308) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +31 -8
  3. package/lib/commonjs/assets/icons.js +7 -2
  4. package/lib/commonjs/assets/icons.js.map +1 -1
  5. package/lib/commonjs/components/Header/HeaderRoomList.js +26 -7
  6. package/lib/commonjs/components/Header/HeaderRoomList.js.map +1 -1
  7. package/lib/commonjs/components/MainComponents/ChatHeader.js +5 -2
  8. package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
  9. package/lib/commonjs/components/MainComponents/ChatRoom.js +36 -14
  10. package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
  11. package/lib/commonjs/components/MainComponents/MessageList.js +7 -23
  12. package/lib/commonjs/components/MainComponents/MessageList.js.map +1 -1
  13. package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js +14 -13
  14. package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
  15. package/lib/commonjs/components/MainComponents/RoomList.js +208 -35
  16. package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
  17. package/lib/commonjs/components/Menu/HeaderRoomListMenu.js +317 -98
  18. package/lib/commonjs/components/Menu/HeaderRoomListMenu.js.map +1 -1
  19. package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js +320 -110
  20. package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
  21. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +552 -213
  22. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  23. package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js +226 -0
  24. package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js.map +1 -0
  25. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +6 -2
  26. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  27. package/lib/commonjs/components/Modals/Modal/Modal.js +8 -0
  28. package/lib/commonjs/components/Modals/Modal/Modal.js.map +1 -1
  29. package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js +2 -1
  30. package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js.map +1 -1
  31. package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js +202 -104
  32. package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
  33. package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js +8 -0
  34. package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
  35. package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js +556 -0
  36. package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js.map +1 -0
  37. package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js +210 -0
  38. package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js.map +1 -0
  39. package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js +4 -2
  40. package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
  41. package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js +7 -21
  42. package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
  43. package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js +507 -244
  44. package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
  45. package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js +74 -46
  46. package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
  47. package/lib/commonjs/components/Modals/styledModalComponents.js +9 -2
  48. package/lib/commonjs/components/Modals/styledModalComponents.js.map +1 -1
  49. package/lib/commonjs/components/RoomComponents/ChatRoomItem.js +17 -7
  50. package/lib/commonjs/components/RoomComponents/ChatRoomItem.js.map +1 -1
  51. package/lib/commonjs/components/styled/SendInput.js +80 -11
  52. package/lib/commonjs/components/styled/SendInput.js.map +1 -1
  53. package/lib/commonjs/components/styled/StyledComponents.js +9 -3
  54. package/lib/commonjs/components/styled/StyledComponents.js.map +1 -1
  55. package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js +11 -4
  56. package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
  57. package/lib/commonjs/context/xmppProvider.js +23 -38
  58. package/lib/commonjs/context/xmppProvider.js.map +1 -1
  59. package/lib/commonjs/helpers/getChatBackground.js +23 -0
  60. package/lib/commonjs/helpers/getChatBackground.js.map +1 -0
  61. package/lib/commonjs/helpers/mediaLibraryRuntime.js +31 -0
  62. package/lib/commonjs/helpers/mediaLibraryRuntime.js.map +1 -0
  63. package/lib/commonjs/helpers/pickImageAsset.js +68 -0
  64. package/lib/commonjs/helpers/pickImageAsset.js.map +1 -0
  65. package/lib/commonjs/helpers/sheetGestures.js +32 -0
  66. package/lib/commonjs/helpers/sheetGestures.js.map +1 -0
  67. package/lib/commonjs/helpers/updateMessagesTillLast.js +12 -40
  68. package/lib/commonjs/helpers/updateMessagesTillLast.js.map +1 -1
  69. package/lib/commonjs/hooks/useChatRoomFocus.js +3 -9
  70. package/lib/commonjs/hooks/useChatRoomFocus.js.map +1 -1
  71. package/lib/commonjs/hooks/useLogout.js +0 -5
  72. package/lib/commonjs/hooks/useLogout.js.map +1 -1
  73. package/lib/commonjs/hooks/useSendMessage.js +23 -50
  74. package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
  75. package/lib/commonjs/i18n/strings.js +121 -1
  76. package/lib/commonjs/i18n/strings.js.map +1 -1
  77. package/lib/commonjs/main.js +6 -0
  78. package/lib/commonjs/main.js.map +1 -1
  79. package/lib/commonjs/networking/api-requests/user.api.js +59 -0
  80. package/lib/commonjs/networking/api-requests/user.api.js.map +1 -1
  81. package/lib/commonjs/networking/authRefresh.js +12 -2
  82. package/lib/commonjs/networking/authRefresh.js.map +1 -1
  83. package/lib/commonjs/networking/outboundQueue.js +0 -18
  84. package/lib/commonjs/networking/outboundQueue.js.map +1 -1
  85. package/lib/commonjs/networking/stanzaHandlers.js +1 -10
  86. package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
  87. package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js +8 -1
  88. package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
  89. package/lib/commonjs/networking/xmppClient.js +7 -107
  90. package/lib/commonjs/networking/xmppClient.js.map +1 -1
  91. package/lib/commonjs/roomStore/chatSettingsSlice.js +3 -1
  92. package/lib/commonjs/roomStore/chatSettingsSlice.js.map +1 -1
  93. package/lib/commonjs/roomStore/roomsSlice.js +3 -22
  94. package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
  95. package/lib/module/assets/icons.js +6 -1
  96. package/lib/module/assets/icons.js.map +1 -1
  97. package/lib/module/components/Header/HeaderRoomList.js +26 -7
  98. package/lib/module/components/Header/HeaderRoomList.js.map +1 -1
  99. package/lib/module/components/MainComponents/ChatHeader.js +5 -2
  100. package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
  101. package/lib/module/components/MainComponents/ChatRoom.js +36 -14
  102. package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
  103. package/lib/module/components/MainComponents/MessageList.js +8 -24
  104. package/lib/module/components/MainComponents/MessageList.js.map +1 -1
  105. package/lib/module/components/MainComponents/ProfileImagePlaceholder.js +14 -13
  106. package/lib/module/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
  107. package/lib/module/components/MainComponents/RoomList.js +207 -35
  108. package/lib/module/components/MainComponents/RoomList.js.map +1 -1
  109. package/lib/module/components/Menu/HeaderRoomListMenu.js +319 -101
  110. package/lib/module/components/Menu/HeaderRoomListMenu.js.map +1 -1
  111. package/lib/module/components/Modals/AttachSheet/AttachSheet.js +311 -113
  112. package/lib/module/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
  113. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +555 -217
  114. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  115. package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js +223 -0
  116. package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js.map +1 -0
  117. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +6 -2
  118. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  119. package/lib/module/components/Modals/Modal/Modal.js +9 -1
  120. package/lib/module/components/Modals/Modal/Modal.js.map +1 -1
  121. package/lib/module/components/Modals/NewChatModal/ModalContent.js +2 -1
  122. package/lib/module/components/Modals/NewChatModal/ModalContent.js.map +1 -1
  123. package/lib/module/components/Modals/NewChatModal/NewChatModal.js +205 -106
  124. package/lib/module/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
  125. package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js +8 -0
  126. package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
  127. package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js +548 -0
  128. package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js.map +1 -0
  129. package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js +205 -0
  130. package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js.map +1 -0
  131. package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js +4 -2
  132. package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
  133. package/lib/module/components/Modals/UserProfileModal/EditUserModal.js +9 -23
  134. package/lib/module/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
  135. package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js +509 -248
  136. package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
  137. package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js +76 -48
  138. package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
  139. package/lib/module/components/Modals/styledModalComponents.js +9 -2
  140. package/lib/module/components/Modals/styledModalComponents.js.map +1 -1
  141. package/lib/module/components/RoomComponents/ChatRoomItem.js +17 -7
  142. package/lib/module/components/RoomComponents/ChatRoomItem.js.map +1 -1
  143. package/lib/module/components/styled/SendInput.js +81 -12
  144. package/lib/module/components/styled/SendInput.js.map +1 -1
  145. package/lib/module/components/styled/StyledComponents.js +9 -3
  146. package/lib/module/components/styled/StyledComponents.js.map +1 -1
  147. package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js +11 -4
  148. package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
  149. package/lib/module/context/xmppProvider.js +23 -38
  150. package/lib/module/context/xmppProvider.js.map +1 -1
  151. package/lib/module/helpers/getChatBackground.js +18 -0
  152. package/lib/module/helpers/getChatBackground.js.map +1 -0
  153. package/lib/module/helpers/mediaLibraryRuntime.js +25 -0
  154. package/lib/module/helpers/mediaLibraryRuntime.js.map +1 -0
  155. package/lib/module/helpers/pickImageAsset.js +63 -0
  156. package/lib/module/helpers/pickImageAsset.js.map +1 -0
  157. package/lib/module/helpers/sheetGestures.js +26 -0
  158. package/lib/module/helpers/sheetGestures.js.map +1 -0
  159. package/lib/module/helpers/updateMessagesTillLast.js +13 -41
  160. package/lib/module/helpers/updateMessagesTillLast.js.map +1 -1
  161. package/lib/module/hooks/useChatRoomFocus.js +3 -9
  162. package/lib/module/hooks/useChatRoomFocus.js.map +1 -1
  163. package/lib/module/hooks/useLogout.js +0 -5
  164. package/lib/module/hooks/useLogout.js.map +1 -1
  165. package/lib/module/hooks/useSendMessage.js +24 -51
  166. package/lib/module/hooks/useSendMessage.js.map +1 -1
  167. package/lib/module/i18n/strings.js +121 -1
  168. package/lib/module/i18n/strings.js.map +1 -1
  169. package/lib/module/main.js +1 -1
  170. package/lib/module/main.js.map +1 -1
  171. package/lib/module/networking/api-requests/user.api.js +56 -0
  172. package/lib/module/networking/api-requests/user.api.js.map +1 -1
  173. package/lib/module/networking/authRefresh.js +12 -2
  174. package/lib/module/networking/authRefresh.js.map +1 -1
  175. package/lib/module/networking/outboundQueue.js +0 -17
  176. package/lib/module/networking/outboundQueue.js.map +1 -1
  177. package/lib/module/networking/stanzaHandlers.js +1 -10
  178. package/lib/module/networking/stanzaHandlers.js.map +1 -1
  179. package/lib/module/networking/xmpp/presenceInRoom.xmpp.js +8 -1
  180. package/lib/module/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
  181. package/lib/module/networking/xmppClient.js +7 -107
  182. package/lib/module/networking/xmppClient.js.map +1 -1
  183. package/lib/module/roomStore/chatSettingsSlice.js +3 -1
  184. package/lib/module/roomStore/chatSettingsSlice.js.map +1 -1
  185. package/lib/module/roomStore/roomsSlice.js +2 -20
  186. package/lib/module/roomStore/roomsSlice.js.map +1 -1
  187. package/lib/typescript/assets/icons.d.ts +16 -0
  188. package/lib/typescript/assets/icons.d.ts.map +1 -1
  189. package/lib/typescript/components/Header/HeaderRoomList.d.ts.map +1 -1
  190. package/lib/typescript/components/MainComponents/ChatHeader.d.ts.map +1 -1
  191. package/lib/typescript/components/MainComponents/ChatRoom.d.ts.map +1 -1
  192. package/lib/typescript/components/MainComponents/MessageList.d.ts.map +1 -1
  193. package/lib/typescript/components/MainComponents/ProfileImagePlaceholder.d.ts.map +1 -1
  194. package/lib/typescript/components/MainComponents/RoomList.d.ts +7 -0
  195. package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
  196. package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts +3 -0
  197. package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts.map +1 -1
  198. package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts +9 -0
  199. package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts.map +1 -1
  200. package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts +10 -0
  201. package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
  202. package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts +9 -0
  203. package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts.map +1 -0
  204. package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts.map +1 -1
  205. package/lib/typescript/components/Modals/Modal/Modal.d.ts.map +1 -1
  206. package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts +4 -2
  207. package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts.map +1 -1
  208. package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts +1 -1
  209. package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts.map +1 -1
  210. package/lib/typescript/components/Modals/NewChatModal/UpdNewChatModal.d.ts.map +1 -1
  211. package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts +75 -0
  212. package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts.map +1 -0
  213. package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts +25 -0
  214. package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts.map +1 -0
  215. package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts +6 -1
  216. package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts.map +1 -1
  217. package/lib/typescript/components/Modals/UserProfileModal/EditUserModal.d.ts.map +1 -1
  218. package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts +16 -0
  219. package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts.map +1 -1
  220. package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts +1 -0
  221. package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts.map +1 -1
  222. package/lib/typescript/components/Modals/styledModalComponents.d.ts.map +1 -1
  223. package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts.map +1 -1
  224. package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
  225. package/lib/typescript/components/styled/StyledComponents.d.ts.map +1 -1
  226. package/lib/typescript/components/styled/StyledInputComponents/StyledInputComponents.d.ts.map +1 -1
  227. package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
  228. package/lib/typescript/helpers/getChatBackground.d.ts +15 -0
  229. package/lib/typescript/helpers/getChatBackground.d.ts.map +1 -0
  230. package/lib/typescript/helpers/mediaLibraryRuntime.d.ts +3 -0
  231. package/lib/typescript/helpers/mediaLibraryRuntime.d.ts.map +1 -0
  232. package/lib/typescript/helpers/pickImageAsset.d.ts +27 -0
  233. package/lib/typescript/helpers/pickImageAsset.d.ts.map +1 -0
  234. package/lib/typescript/helpers/sheetGestures.d.ts +20 -0
  235. package/lib/typescript/helpers/sheetGestures.d.ts.map +1 -0
  236. package/lib/typescript/helpers/updateMessagesTillLast.d.ts.map +1 -1
  237. package/lib/typescript/hooks/useChatRoomFocus.d.ts.map +1 -1
  238. package/lib/typescript/hooks/useLogout.d.ts.map +1 -1
  239. package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
  240. package/lib/typescript/i18n/strings.d.ts.map +1 -1
  241. package/lib/typescript/main.d.ts +1 -1
  242. package/lib/typescript/main.d.ts.map +1 -1
  243. package/lib/typescript/networking/api-requests/user.api.d.ts +27 -0
  244. package/lib/typescript/networking/api-requests/user.api.d.ts.map +1 -1
  245. package/lib/typescript/networking/authRefresh.d.ts +4 -1
  246. package/lib/typescript/networking/authRefresh.d.ts.map +1 -1
  247. package/lib/typescript/networking/outboundQueue.d.ts +0 -16
  248. package/lib/typescript/networking/outboundQueue.d.ts.map +1 -1
  249. package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
  250. package/lib/typescript/networking/xmpp/presenceInRoom.xmpp.d.ts.map +1 -1
  251. package/lib/typescript/networking/xmppClient.d.ts +1 -33
  252. package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
  253. package/lib/typescript/roomStore/chatSettingsSlice.d.ts.map +1 -1
  254. package/lib/typescript/roomStore/roomsSlice.d.ts +1 -18
  255. package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
  256. package/lib/typescript/types/models/room.model.d.ts +0 -15
  257. package/lib/typescript/types/models/room.model.d.ts.map +1 -1
  258. package/lib/typescript/types/types.d.ts +30 -20
  259. package/lib/typescript/types/types.d.ts.map +1 -1
  260. package/package.json +6 -1
  261. package/src/assets/icons.tsx +48 -9
  262. package/src/components/Header/HeaderRoomList.tsx +24 -6
  263. package/src/components/MainComponents/ChatHeader.tsx +5 -2
  264. package/src/components/MainComponents/ChatRoom.tsx +38 -20
  265. package/src/components/MainComponents/MessageList.tsx +8 -24
  266. package/src/components/MainComponents/ProfileImagePlaceholder.tsx +21 -14
  267. package/src/components/MainComponents/RoomList.tsx +236 -39
  268. package/src/components/Menu/HeaderRoomListMenu.tsx +328 -75
  269. package/src/components/Modals/AttachSheet/AttachSheet.tsx +331 -97
  270. package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +598 -279
  271. package/src/components/Modals/ChatProfileModal/ReportChatModal.tsx +244 -0
  272. package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +4 -2
  273. package/src/components/Modals/Modal/Modal.tsx +7 -0
  274. package/src/components/Modals/NewChatModal/ModalContent.tsx +6 -3
  275. package/src/components/Modals/NewChatModal/NewChatModal.tsx +219 -117
  276. package/src/components/Modals/NewChatModal/UpdNewChatModal.tsx +12 -1
  277. package/src/components/Modals/ProfileHeader/ProfileHeader.tsx +615 -0
  278. package/src/components/Modals/ProfileHeader/ProfileMenu.tsx +217 -0
  279. package/src/components/Modals/SelectUsersModal/SelectUsersModal.tsx +14 -4
  280. package/src/components/Modals/UserProfileModal/EditUserModal.tsx +9 -25
  281. package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +617 -307
  282. package/src/components/Modals/UserSettingsModal/UserSettingsModal.tsx +75 -58
  283. package/src/components/Modals/styledModalComponents.tsx +9 -2
  284. package/src/components/RoomComponents/ChatRoomItem.tsx +14 -7
  285. package/src/components/styled/SendInput.tsx +83 -12
  286. package/src/components/styled/StyledComponents.ts +9 -3
  287. package/src/components/styled/StyledInputComponents/StyledInputComponents.tsx +11 -4
  288. package/src/context/xmppProvider.tsx +27 -46
  289. package/src/helpers/getChatBackground.ts +18 -0
  290. package/src/helpers/mediaLibraryRuntime.ts +25 -0
  291. package/src/helpers/pickImageAsset.ts +68 -0
  292. package/src/helpers/sheetGestures.ts +25 -0
  293. package/src/helpers/updateMessagesTillLast.tsx +17 -42
  294. package/src/hooks/useChatRoomFocus.ts +3 -11
  295. package/src/hooks/useLogout.tsx +0 -7
  296. package/src/hooks/useSendMessage.tsx +24 -60
  297. package/src/i18n/strings.ts +121 -1
  298. package/src/main.ts +1 -1
  299. package/src/networking/api-requests/user.api.ts +71 -0
  300. package/src/networking/authRefresh.ts +25 -4
  301. package/src/networking/outboundQueue.ts +0 -29
  302. package/src/networking/stanzaHandlers.ts +1 -9
  303. package/src/networking/xmpp/presenceInRoom.xmpp.ts +6 -1
  304. package/src/networking/xmppClient.ts +7 -118
  305. package/src/roomStore/chatSettingsSlice.ts +3 -1
  306. package/src/roomStore/roomsSlice.ts +2 -20
  307. package/src/types/models/room.model.ts +0 -15
  308. package/src/types/types.ts +32 -20
@@ -1,19 +1,41 @@
1
1
  /** @format */
2
2
 
3
- import React, { useEffect, useRef, useState } from 'react';
3
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
4
4
  import {
5
+ ActivityIndicator,
5
6
  Animated,
6
7
  Easing,
8
+ Image,
7
9
  Modal,
10
+ PanResponder,
8
11
  Platform,
12
+ ScrollView,
9
13
  StyleSheet,
10
14
  Text,
11
15
  TouchableOpacity,
12
16
  View,
13
17
  } from 'react-native';
14
- import { CameraIcon, DocumentIcon, MediaIcon } from '../../../assets/icons';
18
+ import { CameraIcon, DocumentIcon } from '../../../assets/icons';
15
19
  import { useChatSettingState } from '../../../hooks/useChatSettingState';
16
20
  import { chatTextStyle } from '../../../helpers/typography';
21
+ import { getMediaLibrary } from '../../../helpers/mediaLibraryRuntime';
22
+ import {
23
+ shouldClaimVerticalDrag,
24
+ shouldDismissOnDrag,
25
+ } from '../../../helpers/sheetGestures';
26
+
27
+ interface RecentItem {
28
+ id: string;
29
+ uri: string;
30
+ filename: string;
31
+ }
32
+
33
+ export interface PickedMedia {
34
+ uri: string;
35
+ name: string;
36
+ mimeType?: string;
37
+ isVideo: boolean;
38
+ }
17
39
 
18
40
  interface AttachSheetProps {
19
41
  visible: boolean;
@@ -21,13 +43,54 @@ interface AttachSheetProps {
21
43
  onCamera: () => void;
22
44
  onGallery: () => void;
23
45
  onDocument: () => void;
46
+ onPickMedia?: (media: PickedMedia) => void;
24
47
  primaryColor?: string;
25
48
  }
26
49
 
27
50
  // Starting translateY for the sheet. Larger than any realistic sheet
28
51
  // height so it sits fully below the viewport before opening; the exact
29
52
  // number doesn't matter visually because it animates to 0.
30
- const SHEET_OFFSCREEN = 600;
53
+ const SHEET_OFFSCREEN = 800;
54
+ // Re-exported so this sheet's own tests keep addressing them here.
55
+ export { shouldClaimVerticalDrag, shouldDismissOnDrag };
56
+
57
+ const RECENTS_COUNT = 12;
58
+ const THUMB_SIZE = 88;
59
+ const THUMB_DECODE = THUMB_SIZE * 2;
60
+
61
+ const EXT_MIME: Record<string, string> = {
62
+ jpg: 'image/jpeg',
63
+ jpeg: 'image/jpeg',
64
+ png: 'image/png',
65
+ gif: 'image/gif',
66
+ webp: 'image/webp',
67
+ heic: 'image/heic',
68
+ heif: 'image/heif',
69
+ };
70
+
71
+ const guessMimeType = (name: string) => {
72
+ const ext = name.split('.').pop()?.toLowerCase() ?? '';
73
+ return EXT_MIME[ext] ?? 'image/jpeg';
74
+ };
75
+
76
+ const toRecentItem = async (
77
+ MediaLibrary: any,
78
+ asset: any
79
+ ): Promise<RecentItem | null> => {
80
+ const filename = asset?.filename || `photo_${asset?.id ?? Date.now()}`;
81
+ if (asset?.uri && !asset.uri.startsWith('ph://')) {
82
+ return { id: asset.id, uri: asset.uri, filename };
83
+ }
84
+ try {
85
+ const info = await MediaLibrary?.getAssetInfoAsync?.(asset, {
86
+ shouldDownloadFromNetwork: false,
87
+ });
88
+ if (!info?.localUri) {return null;}
89
+ return { id: asset.id, uri: info.localUri, filename };
90
+ } catch {
91
+ return null;
92
+ }
93
+ };
31
94
 
32
95
  const AttachSheet: React.FC<AttachSheetProps> = ({
33
96
  visible,
@@ -35,16 +98,17 @@ const AttachSheet: React.FC<AttachSheetProps> = ({
35
98
  onCamera,
36
99
  onGallery,
37
100
  onDocument,
101
+ onPickMedia,
38
102
  primaryColor = '#0052CD',
39
103
  }) => {
40
104
  const { config } = useChatSettingState();
41
105
  const ts = config?.typography?.attachSheet;
42
- // Pending handler captured on row tap — runs once the EXIT animation
43
- // finishes so iOS doesn't try to present an image picker over a
44
- // still-dismissing modal (was the original reason for the
45
- // platform-split + Modal.onDismiss dance). The animation completion
46
- // callback now drives this on both platforms.
47
106
  const pendingRef = useRef<(() => void) | null>(null);
107
+ const runPending = () => {
108
+ const fn = pendingRef.current;
109
+ pendingRef.current = null;
110
+ fn?.();
111
+ };
48
112
 
49
113
  // Local "modal stays mounted while animating out" state. The parent
50
114
  // controls `visible`; we mirror it but delay unmount until the exit
@@ -63,6 +127,9 @@ const AttachSheet: React.FC<AttachSheetProps> = ({
63
127
  new Animated.Value(SHEET_OFFSCREEN)
64
128
  ).current;
65
129
 
130
+ const onCloseRef = useRef(onClose);
131
+ onCloseRef.current = onClose;
132
+
66
133
  useEffect(() => {
67
134
  if (visible) {
68
135
  setMounted(true);
@@ -95,8 +162,6 @@ const AttachSheet: React.FC<AttachSheetProps> = ({
95
162
  return () => cancelAnimationFrame(raf);
96
163
  }
97
164
  if (!mounted) {return;}
98
- // Exit: fade the backdrop, slide the sheet down, then unmount and
99
- // fire any pending picker handler.
100
165
  Animated.parallel([
101
166
  Animated.timing(backdropOpacity, {
102
167
  toValue: 0,
@@ -113,43 +178,133 @@ const AttachSheet: React.FC<AttachSheetProps> = ({
113
178
  ]).start(({ finished }) => {
114
179
  if (!finished) {return;} // interrupted (rapid re-open) → leave state alone
115
180
  setMounted(false);
116
- const fn = pendingRef.current;
117
- pendingRef.current = null;
118
- fn?.();
181
+ if (Platform.OS !== 'ios') {
182
+ runPending();
183
+ }
119
184
  });
120
185
  return undefined;
121
186
  }, [visible]); // eslint-disable-line react-hooks/exhaustive-deps
122
187
 
188
+ const makeDragResponder = (claimOnStart: boolean) =>
189
+ PanResponder.create({
190
+ onStartShouldSetPanResponder: () => claimOnStart,
191
+ // Capture, so a pull that starts on a row (whose Touchable grabbed
192
+ // the responder on touch-down) still drags the sheet.
193
+ onMoveShouldSetPanResponderCapture: (_evt, g) =>
194
+ claimOnStart || shouldClaimVerticalDrag(g.dy, g.dx),
195
+ onMoveShouldSetPanResponder: (_evt, g) =>
196
+ claimOnStart || shouldClaimVerticalDrag(g.dy, g.dx),
197
+ onPanResponderTerminationRequest: () => false,
198
+ onPanResponderMove: (_evt, g) => {
199
+ sheetTranslateY.setValue(Math.max(0, g.dy));
200
+ },
201
+ onPanResponderRelease: (_evt, g) => {
202
+ if (shouldDismissOnDrag(g.dy, g.vy)) {
203
+ onCloseRef.current();
204
+ return;
205
+ }
206
+ Animated.spring(sheetTranslateY, {
207
+ toValue: 0,
208
+ tension: 90,
209
+ friction: 14,
210
+ useNativeDriver: true,
211
+ }).start();
212
+ },
213
+ onPanResponderTerminate: () => {
214
+ Animated.spring(sheetTranslateY, {
215
+ toValue: 0,
216
+ tension: 90,
217
+ friction: 14,
218
+ useNativeDriver: true,
219
+ }).start();
220
+ },
221
+ });
222
+
223
+ const sheetPanRef = useRef<ReturnType<typeof makeDragResponder> | null>(null);
224
+ const grabberPanRef = useRef<ReturnType<typeof makeDragResponder> | null>(null);
225
+ if (!sheetPanRef.current) {sheetPanRef.current = makeDragResponder(false);}
226
+ if (!grabberPanRef.current) {grabberPanRef.current = makeDragResponder(true);}
227
+ const sheetPan = sheetPanRef.current;
228
+ const grabberPan = grabberPanRef.current;
229
+
230
+ const [recents, setRecents] = useState<RecentItem[]>([]);
231
+ const [loadingRecents, setLoadingRecents] = useState(false);
232
+ const lastLoadRef = useRef(0);
233
+ const RECENTS_TTL_MS = 15000;
234
+
235
+ const loadRecents = useCallback(async () => {
236
+ const MediaLibrary = getMediaLibrary();
237
+ if (!MediaLibrary?.getAssetsAsync) {
238
+ setLoadingRecents(false);
239
+ return;
240
+ }
241
+ try {
242
+ const perm = await MediaLibrary.getPermissionsAsync();
243
+ if (!perm?.granted) {
244
+ setRecents([]);
245
+ return;
246
+ }
247
+ const page = await MediaLibrary.getAssetsAsync({
248
+ first: RECENTS_COUNT,
249
+ sortBy: [MediaLibrary.SortBy?.creationTime ?? 'creationTime'],
250
+ mediaType: [MediaLibrary.MediaType?.photo ?? 'photo'],
251
+ });
252
+ const items = await Promise.all(
253
+ (page?.assets ?? []).map((asset: any) => toRecentItem(MediaLibrary, asset))
254
+ );
255
+ lastLoadRef.current = Date.now();
256
+ setRecents(items.filter(Boolean) as RecentItem[]);
257
+ } catch (err) {
258
+ console.warn('AttachSheet: could not read recent media', err);
259
+ setRecents([]);
260
+ } finally {
261
+ setLoadingRecents(false);
262
+ }
263
+ }, []);
264
+
265
+ useEffect(() => {
266
+ if (!visible) {return undefined;}
267
+ if (recents.length && Date.now() - lastLoadRef.current < RECENTS_TTL_MS) {
268
+ return undefined;
269
+ }
270
+ setLoadingRecents(true);
271
+ const timer = setTimeout(() => {
272
+ loadRecents();
273
+ }, 250);
274
+ return () => clearTimeout(timer);
275
+ }, [visible]);
276
+
123
277
  const trigger = (handler: () => void) => () => {
124
- // Capture the handler and ask parent to close. The exit-animation
125
- // completion above fires `handler` AFTER the sheet has slid away,
126
- // so iOS no longer tries to present a picker over a dismissing
127
- // modal — and Android no longer needs the ad-hoc 150ms setTimeout.
128
278
  pendingRef.current = handler;
279
+ if (Platform.OS === 'ios') {
280
+ setMounted(false);
281
+ }
129
282
  onClose();
130
283
  };
131
284
 
285
+ const handleRecentPress = (item: RecentItem) =>
286
+ trigger(() => {
287
+ if (onPickMedia) {
288
+ onPickMedia({
289
+ uri: item.uri,
290
+ name: item.filename,
291
+ mimeType: guessMimeType(item.filename),
292
+ isVideo: false,
293
+ });
294
+ } else {
295
+ onGallery();
296
+ }
297
+ });
298
+
132
299
  const rows: {
300
+ id: string;
133
301
  label: string;
134
- hint: string;
135
302
  Icon: React.ComponentType<any>;
136
303
  handler: () => void;
137
304
  }[] = [
138
305
  {
139
- label: 'Take photo',
140
- hint: 'Capture with the camera',
141
- Icon: CameraIcon,
142
- handler: onCamera,
143
- },
144
- {
145
- label: 'Photo or video',
146
- hint: 'Pick from your library',
147
- Icon: MediaIcon,
148
- handler: onGallery,
149
- },
150
- {
151
- label: 'Document',
152
- hint: 'Choose a file',
306
+ id: 'Document',
307
+ label: 'Upload a File',
153
308
  Icon: DocumentIcon,
154
309
  handler: onDocument,
155
310
  },
@@ -166,11 +321,13 @@ const AttachSheet: React.FC<AttachSheetProps> = ({
166
321
  onRequestClose={onClose}
167
322
  // Hardware-back / iOS gesture also routes through onClose, which
168
323
  // flips `visible` and triggers our exit animation above.
324
+ onDismiss={Platform.OS === 'ios' ? runPending : undefined}
169
325
  >
170
326
  <Animated.View
171
327
  style={[styles.backdrop, { opacity: backdropOpacity }]}
172
328
  >
173
329
  <TouchableOpacity
330
+ testID="attach-backdrop"
174
331
  style={StyleSheet.absoluteFill}
175
332
  activeOpacity={1}
176
333
  onPress={onClose}
@@ -180,42 +337,101 @@ const AttachSheet: React.FC<AttachSheetProps> = ({
180
337
  styles.sheet,
181
338
  { transform: [{ translateY: sheetTranslateY }] },
182
339
  ]}
340
+ {...sheetPan.panHandlers}
183
341
  >
184
- <TouchableOpacity activeOpacity={1}>
342
+ <View
343
+ testID="attach-grabber"
344
+ style={styles.grabberArea}
345
+ {...grabberPan.panHandlers}
346
+ >
185
347
  <View style={styles.grabber} />
186
- <Text style={[styles.title, chatTextStyle(ts?.title)]}>Attach</Text>
187
- {rows.map(({ label, hint, Icon, handler }, idx) => (
188
- <TouchableOpacity
189
- key={label}
190
- activeOpacity={0.6}
348
+ </View>
349
+
350
+ {/* Photos & Videos ------------------------------------------------ */}
351
+ <View style={styles.sectionHeader}>
352
+ <Text style={[styles.sectionTitle, chatTextStyle(ts?.title)]}>
353
+ Photos & Videos
354
+ </Text>
355
+ <TouchableOpacity
356
+ testID="attach-view-library"
357
+ activeOpacity={0.6}
358
+ onPress={trigger(onGallery)}
359
+ hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
360
+ >
361
+ <Text
191
362
  style={[
192
- styles.row,
193
- idx < rows.length - 1 && styles.rowDivider,
363
+ styles.sectionAction,
364
+ { color: primaryColor },
365
+ chatTextStyle(ts?.viewLibrary),
194
366
  ]}
195
- onPress={trigger(handler)}
196
367
  >
197
- <View
198
- style={[
199
- styles.iconBubble,
200
- { backgroundColor: primaryColor + '14' },
201
- ]}
202
- >
203
- <Icon color={primaryColor} width={20} height={20} />
204
- </View>
205
- <View style={styles.rowText}>
206
- <Text style={[styles.rowLabel, chatTextStyle(ts?.rowLabel)]}>{label}</Text>
207
- <Text style={[styles.rowHint, chatTextStyle(ts?.rowHint)]}>{hint}</Text>
208
- </View>
368
+ View Library
369
+ </Text>
370
+ </TouchableOpacity>
371
+ </View>
372
+
373
+ <ScrollView
374
+ horizontal
375
+ showsHorizontalScrollIndicator={false}
376
+ contentContainerStyle={styles.strip}
377
+ keyboardShouldPersistTaps="handled"
378
+ >
379
+ {/* Camera tile — always first, works without library access. */}
380
+ <TouchableOpacity
381
+ testID="attach-row-Camera"
382
+ activeOpacity={0.7}
383
+ style={styles.cameraTile}
384
+ onPress={trigger(onCamera)}
385
+ >
386
+ <CameraIcon color="#8A8A8E" width={26} height={26} />
387
+ </TouchableOpacity>
388
+
389
+ {loadingRecents && recents.length === 0 && (
390
+ <View style={styles.loadingTile}>
391
+ <ActivityIndicator color="#8A8A8E" />
392
+ </View>
393
+ )}
394
+
395
+ {recents.map((item) => (
396
+ <TouchableOpacity
397
+ key={item.id}
398
+ testID={`attach-recent-${item.id}`}
399
+ activeOpacity={0.8}
400
+ style={styles.thumbWrap}
401
+ onPress={handleRecentPress(item)}
402
+ >
403
+ <Image
404
+ source={{
405
+ uri: item.uri,
406
+ width: THUMB_DECODE,
407
+ height: THUMB_DECODE,
408
+ }}
409
+ style={styles.thumb}
410
+ resizeMethod="resize"
411
+ resizeMode="cover"
412
+ fadeDuration={0}
413
+ />
209
414
  </TouchableOpacity>
210
415
  ))}
416
+ </ScrollView>
417
+
418
+ <View style={styles.rowsDivider} />
419
+ {rows.map(({ id, label, Icon, handler }) => (
211
420
  <TouchableOpacity
421
+ key={id}
422
+ testID={`attach-row-${id}`}
212
423
  activeOpacity={0.6}
213
- style={styles.cancelRow}
214
- onPress={onClose}
424
+ style={styles.row}
425
+ onPress={trigger(handler)}
215
426
  >
216
- <Text style={[styles.cancelLabel, chatTextStyle(ts?.cancelButton)]}>Cancel</Text>
427
+ <View style={styles.rowIcon}>
428
+ <Icon color="#1C1C1E" width={20} height={20} />
429
+ </View>
430
+ <Text style={[styles.rowLabel, chatTextStyle(ts?.rowLabel)]}>
431
+ {label}
432
+ </Text>
217
433
  </TouchableOpacity>
218
- </TouchableOpacity>
434
+ ))}
219
435
  </Animated.View>
220
436
  </Animated.View>
221
437
  </Modal>
@@ -232,7 +448,7 @@ const styles = StyleSheet.create({
232
448
  backgroundColor: '#fff',
233
449
  borderTopLeftRadius: 24,
234
450
  borderTopRightRadius: 24,
235
- paddingTop: 8,
451
+ paddingTop: 4,
236
452
  paddingBottom: Platform.OS === 'ios' ? 32 : 20,
237
453
  shadowColor: '#000',
238
454
  shadowOffset: { width: 0, height: -2 },
@@ -240,65 +456,83 @@ const styles = StyleSheet.create({
240
456
  shadowRadius: 12,
241
457
  elevation: 16,
242
458
  },
459
+ grabberArea: {
460
+ alignItems: 'center',
461
+ paddingTop: 10,
462
+ paddingBottom: 14,
463
+ },
243
464
  grabber: {
244
- alignSelf: 'center',
245
465
  width: 40,
246
466
  height: 4,
247
467
  borderRadius: 2,
248
468
  backgroundColor: '#D9D9DE',
249
- marginBottom: 12,
250
469
  },
251
- title: {
252
- fontSize: 13,
253
- fontWeight: '600',
254
- color: '#8A8A8E',
255
- letterSpacing: 0.4,
256
- textTransform: 'uppercase',
257
- paddingHorizontal: 20,
258
- paddingBottom: 8,
259
- },
260
- row: {
470
+ sectionHeader: {
261
471
  flexDirection: 'row',
262
472
  alignItems: 'center',
473
+ justifyContent: 'space-between',
263
474
  paddingHorizontal: 20,
264
- paddingVertical: 14,
475
+ paddingBottom: 12,
265
476
  },
266
- rowDivider: {
267
- borderBottomWidth: StyleSheet.hairlineWidth,
268
- borderBottomColor: '#EFEFF2',
477
+ sectionTitle: {
478
+ fontSize: 17,
479
+ fontWeight: '700',
480
+ color: '#1C1C1E',
269
481
  },
270
- iconBubble: {
271
- width: 40,
272
- height: 40,
273
- borderRadius: 20,
482
+ sectionAction: {
483
+ fontSize: 15,
484
+ fontWeight: '500',
485
+ },
486
+ strip: {
487
+ paddingHorizontal: 16,
488
+ paddingBottom: 16,
489
+ gap: 8,
490
+ },
491
+ cameraTile: {
492
+ width: THUMB_SIZE,
493
+ height: THUMB_SIZE,
494
+ borderRadius: 16,
495
+ borderWidth: 1,
496
+ borderColor: '#E4E4E9',
497
+ backgroundColor: '#FAFAFC',
274
498
  alignItems: 'center',
275
499
  justifyContent: 'center',
276
- marginRight: 14,
277
500
  },
278
- rowText: {
279
- flex: 1,
501
+ loadingTile: {
502
+ width: THUMB_SIZE,
503
+ height: THUMB_SIZE,
504
+ alignItems: 'center',
505
+ justifyContent: 'center',
280
506
  },
281
- rowLabel: {
282
- fontSize: 16,
283
- fontWeight: '500',
284
- color: '#1C1C1E',
507
+ thumbWrap: {
508
+ width: THUMB_SIZE,
509
+ height: THUMB_SIZE,
510
+ borderRadius: 16,
511
+ overflow: 'hidden',
512
+ backgroundColor: '#EFEFF2',
513
+ },
514
+ thumb: {
515
+ width: '100%',
516
+ height: '100%',
285
517
  },
286
- rowHint: {
287
- fontSize: 12,
288
- color: '#8A8A8E',
289
- marginTop: 2,
518
+ rowsDivider: {
519
+ height: StyleSheet.hairlineWidth,
520
+ backgroundColor: '#EFEFF2',
290
521
  },
291
- cancelRow: {
292
- marginTop: 8,
293
- marginHorizontal: 16,
294
- paddingVertical: 14,
295
- borderRadius: 14,
522
+ row: {
523
+ flexDirection: 'row',
296
524
  alignItems: 'center',
297
- backgroundColor: '#F2F2F7',
525
+ paddingHorizontal: 20,
526
+ paddingVertical: 16,
298
527
  },
299
- cancelLabel: {
528
+ rowIcon: {
529
+ width: 28,
530
+ alignItems: 'center',
531
+ marginRight: 12,
532
+ },
533
+ rowLabel: {
300
534
  fontSize: 16,
301
- fontWeight: '600',
535
+ fontWeight: '500',
302
536
  color: '#1C1C1E',
303
537
  },
304
538
  });