@ethora/chat-component-rn 26.7.4 → 26.7.5

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 (288) hide show
  1. package/CHANGELOG.md +0 -54
  2. package/README.md +8 -31
  3. package/lib/commonjs/assets/icons.js +2 -7
  4. package/lib/commonjs/assets/icons.js.map +1 -1
  5. package/lib/commonjs/components/Header/HeaderRoomList.js +6 -20
  6. package/lib/commonjs/components/Header/HeaderRoomList.js.map +1 -1
  7. package/lib/commonjs/components/MainComponents/ChatRoom.js +14 -36
  8. package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
  9. package/lib/commonjs/components/MainComponents/MessageList.js +23 -7
  10. package/lib/commonjs/components/MainComponents/MessageList.js.map +1 -1
  11. package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js +13 -14
  12. package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
  13. package/lib/commonjs/components/MainComponents/RoomList.js +32 -62
  14. package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
  15. package/lib/commonjs/components/Menu/HeaderRoomListMenu.js +98 -309
  16. package/lib/commonjs/components/Menu/HeaderRoomListMenu.js.map +1 -1
  17. package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js +110 -320
  18. package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
  19. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +213 -552
  20. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  21. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +2 -6
  22. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  23. package/lib/commonjs/components/Modals/Modal/Modal.js +0 -8
  24. package/lib/commonjs/components/Modals/Modal/Modal.js.map +1 -1
  25. package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js +1 -2
  26. package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js.map +1 -1
  27. package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js +104 -202
  28. package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
  29. package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js +0 -8
  30. package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
  31. package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js +2 -4
  32. package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
  33. package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js +21 -7
  34. package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
  35. package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js +244 -507
  36. package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
  37. package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js +46 -74
  38. package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
  39. package/lib/commonjs/components/Modals/styledModalComponents.js +2 -9
  40. package/lib/commonjs/components/Modals/styledModalComponents.js.map +1 -1
  41. package/lib/commonjs/components/RoomComponents/ChatRoomItem.js +7 -17
  42. package/lib/commonjs/components/RoomComponents/ChatRoomItem.js.map +1 -1
  43. package/lib/commonjs/components/styled/SendInput.js +11 -80
  44. package/lib/commonjs/components/styled/SendInput.js.map +1 -1
  45. package/lib/commonjs/components/styled/StyledComponents.js +3 -9
  46. package/lib/commonjs/components/styled/StyledComponents.js.map +1 -1
  47. package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js +4 -11
  48. package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
  49. package/lib/commonjs/context/xmppProvider.js +35 -6
  50. package/lib/commonjs/context/xmppProvider.js.map +1 -1
  51. package/lib/commonjs/helpers/updateMessagesTillLast.js +40 -12
  52. package/lib/commonjs/helpers/updateMessagesTillLast.js.map +1 -1
  53. package/lib/commonjs/hooks/useChatRoomFocus.js +9 -3
  54. package/lib/commonjs/hooks/useChatRoomFocus.js.map +1 -1
  55. package/lib/commonjs/hooks/useLogout.js +5 -0
  56. package/lib/commonjs/hooks/useLogout.js.map +1 -1
  57. package/lib/commonjs/hooks/useSendMessage.js +50 -23
  58. package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
  59. package/lib/commonjs/i18n/strings.js +1 -121
  60. package/lib/commonjs/i18n/strings.js.map +1 -1
  61. package/lib/commonjs/main.js +0 -6
  62. package/lib/commonjs/main.js.map +1 -1
  63. package/lib/commonjs/networking/api-requests/user.api.js +0 -59
  64. package/lib/commonjs/networking/api-requests/user.api.js.map +1 -1
  65. package/lib/commonjs/networking/outboundQueue.js +18 -0
  66. package/lib/commonjs/networking/outboundQueue.js.map +1 -1
  67. package/lib/commonjs/networking/stanzaHandlers.js +10 -1
  68. package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
  69. package/lib/commonjs/networking/xmppClient.js +107 -7
  70. package/lib/commonjs/networking/xmppClient.js.map +1 -1
  71. package/lib/commonjs/roomStore/chatSettingsSlice.js +1 -3
  72. package/lib/commonjs/roomStore/chatSettingsSlice.js.map +1 -1
  73. package/lib/commonjs/roomStore/roomsSlice.js +22 -3
  74. package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
  75. package/lib/module/assets/icons.js +1 -6
  76. package/lib/module/assets/icons.js.map +1 -1
  77. package/lib/module/components/Header/HeaderRoomList.js +6 -20
  78. package/lib/module/components/Header/HeaderRoomList.js.map +1 -1
  79. package/lib/module/components/MainComponents/ChatRoom.js +14 -36
  80. package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
  81. package/lib/module/components/MainComponents/MessageList.js +24 -8
  82. package/lib/module/components/MainComponents/MessageList.js.map +1 -1
  83. package/lib/module/components/MainComponents/ProfileImagePlaceholder.js +13 -14
  84. package/lib/module/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
  85. package/lib/module/components/MainComponents/RoomList.js +32 -62
  86. package/lib/module/components/MainComponents/RoomList.js.map +1 -1
  87. package/lib/module/components/Menu/HeaderRoomListMenu.js +101 -311
  88. package/lib/module/components/Menu/HeaderRoomListMenu.js.map +1 -1
  89. package/lib/module/components/Modals/AttachSheet/AttachSheet.js +113 -311
  90. package/lib/module/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
  91. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +217 -555
  92. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  93. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +2 -6
  94. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  95. package/lib/module/components/Modals/Modal/Modal.js +1 -9
  96. package/lib/module/components/Modals/Modal/Modal.js.map +1 -1
  97. package/lib/module/components/Modals/NewChatModal/ModalContent.js +1 -2
  98. package/lib/module/components/Modals/NewChatModal/ModalContent.js.map +1 -1
  99. package/lib/module/components/Modals/NewChatModal/NewChatModal.js +106 -205
  100. package/lib/module/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
  101. package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js +0 -8
  102. package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
  103. package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js +2 -4
  104. package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
  105. package/lib/module/components/Modals/UserProfileModal/EditUserModal.js +23 -9
  106. package/lib/module/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
  107. package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js +248 -509
  108. package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
  109. package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js +48 -76
  110. package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
  111. package/lib/module/components/Modals/styledModalComponents.js +2 -9
  112. package/lib/module/components/Modals/styledModalComponents.js.map +1 -1
  113. package/lib/module/components/RoomComponents/ChatRoomItem.js +7 -17
  114. package/lib/module/components/RoomComponents/ChatRoomItem.js.map +1 -1
  115. package/lib/module/components/styled/SendInput.js +12 -81
  116. package/lib/module/components/styled/SendInput.js.map +1 -1
  117. package/lib/module/components/styled/StyledComponents.js +3 -9
  118. package/lib/module/components/styled/StyledComponents.js.map +1 -1
  119. package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js +4 -11
  120. package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
  121. package/lib/module/context/xmppProvider.js +35 -6
  122. package/lib/module/context/xmppProvider.js.map +1 -1
  123. package/lib/module/helpers/updateMessagesTillLast.js +41 -13
  124. package/lib/module/helpers/updateMessagesTillLast.js.map +1 -1
  125. package/lib/module/hooks/useChatRoomFocus.js +9 -3
  126. package/lib/module/hooks/useChatRoomFocus.js.map +1 -1
  127. package/lib/module/hooks/useLogout.js +5 -0
  128. package/lib/module/hooks/useLogout.js.map +1 -1
  129. package/lib/module/hooks/useSendMessage.js +51 -24
  130. package/lib/module/hooks/useSendMessage.js.map +1 -1
  131. package/lib/module/i18n/strings.js +1 -121
  132. package/lib/module/i18n/strings.js.map +1 -1
  133. package/lib/module/main.js +1 -1
  134. package/lib/module/main.js.map +1 -1
  135. package/lib/module/networking/api-requests/user.api.js +0 -56
  136. package/lib/module/networking/api-requests/user.api.js.map +1 -1
  137. package/lib/module/networking/outboundQueue.js +17 -0
  138. package/lib/module/networking/outboundQueue.js.map +1 -1
  139. package/lib/module/networking/stanzaHandlers.js +10 -1
  140. package/lib/module/networking/stanzaHandlers.js.map +1 -1
  141. package/lib/module/networking/xmppClient.js +107 -7
  142. package/lib/module/networking/xmppClient.js.map +1 -1
  143. package/lib/module/roomStore/chatSettingsSlice.js +1 -3
  144. package/lib/module/roomStore/chatSettingsSlice.js.map +1 -1
  145. package/lib/module/roomStore/roomsSlice.js +20 -2
  146. package/lib/module/roomStore/roomsSlice.js.map +1 -1
  147. package/lib/typescript/assets/icons.d.ts +0 -16
  148. package/lib/typescript/assets/icons.d.ts.map +1 -1
  149. package/lib/typescript/components/Header/HeaderRoomList.d.ts.map +1 -1
  150. package/lib/typescript/components/MainComponents/ChatRoom.d.ts.map +1 -1
  151. package/lib/typescript/components/MainComponents/MessageList.d.ts.map +1 -1
  152. package/lib/typescript/components/MainComponents/ProfileImagePlaceholder.d.ts.map +1 -1
  153. package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
  154. package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts +0 -3
  155. package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts.map +1 -1
  156. package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts +0 -9
  157. package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts.map +1 -1
  158. package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts +0 -10
  159. package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
  160. package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts.map +1 -1
  161. package/lib/typescript/components/Modals/Modal/Modal.d.ts.map +1 -1
  162. package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts +2 -4
  163. package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts.map +1 -1
  164. package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts +1 -1
  165. package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts.map +1 -1
  166. package/lib/typescript/components/Modals/NewChatModal/UpdNewChatModal.d.ts.map +1 -1
  167. package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts +1 -6
  168. package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts.map +1 -1
  169. package/lib/typescript/components/Modals/UserProfileModal/EditUserModal.d.ts.map +1 -1
  170. package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts +0 -16
  171. package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts.map +1 -1
  172. package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts +0 -1
  173. package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts.map +1 -1
  174. package/lib/typescript/components/Modals/styledModalComponents.d.ts.map +1 -1
  175. package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts.map +1 -1
  176. package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
  177. package/lib/typescript/components/styled/StyledComponents.d.ts.map +1 -1
  178. package/lib/typescript/components/styled/StyledInputComponents/StyledInputComponents.d.ts.map +1 -1
  179. package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
  180. package/lib/typescript/helpers/updateMessagesTillLast.d.ts.map +1 -1
  181. package/lib/typescript/hooks/useChatRoomFocus.d.ts.map +1 -1
  182. package/lib/typescript/hooks/useLogout.d.ts.map +1 -1
  183. package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
  184. package/lib/typescript/i18n/strings.d.ts.map +1 -1
  185. package/lib/typescript/main.d.ts +1 -1
  186. package/lib/typescript/main.d.ts.map +1 -1
  187. package/lib/typescript/networking/api-requests/user.api.d.ts +0 -27
  188. package/lib/typescript/networking/api-requests/user.api.d.ts.map +1 -1
  189. package/lib/typescript/networking/outboundQueue.d.ts +16 -0
  190. package/lib/typescript/networking/outboundQueue.d.ts.map +1 -1
  191. package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
  192. package/lib/typescript/networking/xmppClient.d.ts +33 -1
  193. package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
  194. package/lib/typescript/roomStore/chatSettingsSlice.d.ts.map +1 -1
  195. package/lib/typescript/roomStore/roomsSlice.d.ts +18 -1
  196. package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
  197. package/lib/typescript/types/models/room.model.d.ts +15 -0
  198. package/lib/typescript/types/models/room.model.d.ts.map +1 -1
  199. package/lib/typescript/types/types.d.ts +20 -20
  200. package/lib/typescript/types/types.d.ts.map +1 -1
  201. package/package.json +1 -6
  202. package/src/assets/icons.tsx +9 -48
  203. package/src/components/Header/HeaderRoomList.tsx +5 -20
  204. package/src/components/MainComponents/ChatRoom.tsx +20 -38
  205. package/src/components/MainComponents/MessageList.tsx +24 -8
  206. package/src/components/MainComponents/ProfileImagePlaceholder.tsx +14 -21
  207. package/src/components/MainComponents/RoomList.tsx +34 -65
  208. package/src/components/Menu/HeaderRoomListMenu.tsx +71 -310
  209. package/src/components/Modals/AttachSheet/AttachSheet.tsx +97 -331
  210. package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +279 -598
  211. package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +2 -4
  212. package/src/components/Modals/Modal/Modal.tsx +0 -7
  213. package/src/components/Modals/NewChatModal/ModalContent.tsx +3 -6
  214. package/src/components/Modals/NewChatModal/NewChatModal.tsx +117 -219
  215. package/src/components/Modals/NewChatModal/UpdNewChatModal.tsx +1 -12
  216. package/src/components/Modals/SelectUsersModal/SelectUsersModal.tsx +4 -14
  217. package/src/components/Modals/UserProfileModal/EditUserModal.tsx +25 -9
  218. package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +307 -617
  219. package/src/components/Modals/UserSettingsModal/UserSettingsModal.tsx +58 -75
  220. package/src/components/Modals/styledModalComponents.tsx +2 -9
  221. package/src/components/RoomComponents/ChatRoomItem.tsx +7 -14
  222. package/src/components/styled/SendInput.tsx +12 -83
  223. package/src/components/styled/StyledComponents.ts +3 -9
  224. package/src/components/styled/StyledInputComponents/StyledInputComponents.tsx +4 -11
  225. package/src/context/xmppProvider.tsx +41 -8
  226. package/src/helpers/updateMessagesTillLast.tsx +42 -17
  227. package/src/hooks/useChatRoomFocus.ts +11 -3
  228. package/src/hooks/useLogout.tsx +7 -0
  229. package/src/hooks/useSendMessage.tsx +60 -24
  230. package/src/i18n/strings.ts +1 -121
  231. package/src/main.ts +1 -1
  232. package/src/networking/api-requests/user.api.ts +0 -71
  233. package/src/networking/outboundQueue.ts +29 -0
  234. package/src/networking/stanzaHandlers.ts +9 -1
  235. package/src/networking/xmppClient.ts +118 -7
  236. package/src/roomStore/chatSettingsSlice.ts +1 -3
  237. package/src/roomStore/roomsSlice.ts +20 -2
  238. package/src/types/models/room.model.ts +15 -0
  239. package/src/types/types.ts +20 -22
  240. package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js +0 -226
  241. package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js.map +0 -1
  242. package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js +0 -556
  243. package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js.map +0 -1
  244. package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js +0 -210
  245. package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js.map +0 -1
  246. package/lib/commonjs/helpers/getChatBackground.js +0 -23
  247. package/lib/commonjs/helpers/getChatBackground.js.map +0 -1
  248. package/lib/commonjs/helpers/mediaLibraryRuntime.js +0 -31
  249. package/lib/commonjs/helpers/mediaLibraryRuntime.js.map +0 -1
  250. package/lib/commonjs/helpers/pickImageAsset.js +0 -68
  251. package/lib/commonjs/helpers/pickImageAsset.js.map +0 -1
  252. package/lib/commonjs/helpers/sheetGestures.js +0 -32
  253. package/lib/commonjs/helpers/sheetGestures.js.map +0 -1
  254. package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js +0 -223
  255. package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js.map +0 -1
  256. package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js +0 -548
  257. package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js.map +0 -1
  258. package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js +0 -205
  259. package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js.map +0 -1
  260. package/lib/module/helpers/getChatBackground.js +0 -18
  261. package/lib/module/helpers/getChatBackground.js.map +0 -1
  262. package/lib/module/helpers/mediaLibraryRuntime.js +0 -25
  263. package/lib/module/helpers/mediaLibraryRuntime.js.map +0 -1
  264. package/lib/module/helpers/pickImageAsset.js +0 -63
  265. package/lib/module/helpers/pickImageAsset.js.map +0 -1
  266. package/lib/module/helpers/sheetGestures.js +0 -26
  267. package/lib/module/helpers/sheetGestures.js.map +0 -1
  268. package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts +0 -9
  269. package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts.map +0 -1
  270. package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts +0 -75
  271. package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts.map +0 -1
  272. package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts +0 -25
  273. package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts.map +0 -1
  274. package/lib/typescript/helpers/getChatBackground.d.ts +0 -15
  275. package/lib/typescript/helpers/getChatBackground.d.ts.map +0 -1
  276. package/lib/typescript/helpers/mediaLibraryRuntime.d.ts +0 -3
  277. package/lib/typescript/helpers/mediaLibraryRuntime.d.ts.map +0 -1
  278. package/lib/typescript/helpers/pickImageAsset.d.ts +0 -27
  279. package/lib/typescript/helpers/pickImageAsset.d.ts.map +0 -1
  280. package/lib/typescript/helpers/sheetGestures.d.ts +0 -20
  281. package/lib/typescript/helpers/sheetGestures.d.ts.map +0 -1
  282. package/src/components/Modals/ChatProfileModal/ReportChatModal.tsx +0 -244
  283. package/src/components/Modals/ProfileHeader/ProfileHeader.tsx +0 -615
  284. package/src/components/Modals/ProfileHeader/ProfileMenu.tsx +0 -217
  285. package/src/helpers/getChatBackground.ts +0 -18
  286. package/src/helpers/mediaLibraryRuntime.ts +0 -25
  287. package/src/helpers/pickImageAsset.ts +0 -68
  288. package/src/helpers/sheetGestures.ts +0 -25
@@ -26,7 +26,7 @@ import {
26
26
  import { useVideoPlayer, VideoView } from 'expo-video';
27
27
  import { PlayIcon } from '../../../assets/icons';
28
28
  import * as FileSystem from 'expo-file-system/legacy';
29
- import { getMediaLibrary } from '../../../helpers/mediaLibraryRuntime';
29
+ import * as MediaLibrary from 'expo-media-library';
30
30
  import { useToast } from '../../../context/ToastContext';
31
31
  import PdfViewer from './PdfView';
32
32
  import DocumentViewer from './DocumentViewer';
@@ -129,8 +129,6 @@ const FilePreviewModal: React.FC<FilePreviewModalProps> = ({
129
129
  if (!activeFile) {return null;}
130
130
 
131
131
  const requestStoragePermission = async () => {
132
- const MediaLibrary = getMediaLibrary();
133
- if (!MediaLibrary?.requestPermissionsAsync) {return false;}
134
132
  try {
135
133
  const { status } = await MediaLibrary.requestPermissionsAsync();
136
134
  return status === 'granted';
@@ -160,7 +158,7 @@ const FilePreviewModal: React.FC<FilePreviewModalProps> = ({
160
158
  const download = await FileSystem.downloadAsync(withFileToken(activeFile.fileURL), filePath);
161
159
 
162
160
  if (download.status === 200) {
163
- await getMediaLibrary()?.saveToLibraryAsync(download.uri);
161
+ await MediaLibrary.saveToLibraryAsync(download.uri);
164
162
  showToast({
165
163
  id: Date.now().toString(),
166
164
  title: 'Success',
@@ -37,13 +37,6 @@ const Modal: React.FC<ModalProps> = ({ children, modal, setOpenModal }) => {
37
37
 
38
38
  return <ModalComponent handleCloseModal={handleClose} />;
39
39
  };
40
- // Modals that present themselves (a real RN <Modal>, so the dim covers
41
- // the whole window rather than stopping at this component's frame) must
42
- // not also sit inside the shared in-tree backdrop — that would dim twice.
43
- if (modal === MODAL_TYPES.NEW_CHAT) {
44
- return <>{renderModalContent()}{children}</>;
45
- }
46
-
47
40
  return (
48
41
  modal && (
49
42
  <ModalBackground
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { PickedImage } from '../../../helpers/pickImageAsset';
3
2
  import {
4
3
  ModalContainer,
5
4
  CloseButton,
@@ -20,13 +19,12 @@ type ModalContentProps = {
20
19
  roomName: string;
21
20
  roomDescription: string;
22
21
  chatType: ChatAccessOption;
23
- profileImage: string | PickedImage | null;
22
+ profileImage: string | File | null;
24
23
  setActiveTab: (tab: '0' | '1' | null) => void;
25
24
  handleRoomNameChange: (e: string) => void;
26
25
  setRoomDescription: (description: string) => void;
27
26
  setChatType: (type: ChatAccessOption) => void;
28
- setProfileImage: (image: string | PickedImage | null) => void;
29
- onUploadImage: () => void;
27
+ setProfileImage: (image: string | File | null) => void;
30
28
  selectedUsers: any[];
31
29
  setSelectedUsers: (users: any[]) => void;
32
30
  handleCreateRoom: () => void;
@@ -42,7 +40,6 @@ const ModalContent: React.FC<ModalContentProps> = ({
42
40
  roomDescription,
43
41
  chatType,
44
42
  profileImage,
45
- onUploadImage,
46
43
  setActiveTab,
47
44
  handleRoomNameChange,
48
45
  setChatType,
@@ -65,7 +62,7 @@ const ModalContent: React.FC<ModalContentProps> = ({
65
62
  <ModalTitle>Create New Chat</ModalTitle>
66
63
  <ProfileImagePlaceholder
67
64
  size={120}
68
- upload={{ active: true, onUpload: onUploadImage }}
65
+ upload={{ active: true, onUpload: setProfileImage }}
69
66
  remove={{
70
67
  enabled: true,
71
68
  onRemoveClick: () => setProfileImage(null),
@@ -1,24 +1,20 @@
1
- import React, { useState, useMemo } from 'react';
2
- import { CameraIcon } from '../../../assets/icons';
1
+ import React, { useState, useEffect, useMemo } from 'react';
2
+ import Button from '../../styled/Button';
3
+ import { AddNewIcon, AddPhotoIcon } from '../../../assets/icons';
3
4
  import { RootState } from '../../../roomStore';
4
5
  import { useXmppClient } from '../../../context/xmppProvider';
6
+ import {
7
+ CloseButton,
8
+ GroupContainer,
9
+ ModalBackground,
10
+ ModalContainer,
11
+ ModalTitle,
12
+ } from '../styledModalComponents';
5
13
  import { addRoomViaApi, setCurrentRoom, updateRoom } from '../../../roomStore/roomsSlice';
14
+ import InputWithLabel from '../../styled/StyledInput';
6
15
  import { uploadFile } from '../../../networking/api-requests/auth.api';
7
- import {
8
- ActivityIndicator,
9
- Alert,
10
- Image,
11
- Linking,
12
- Modal,
13
- Pressable,
14
- StyleSheet,
15
- Text,
16
- TextInput,
17
- TouchableOpacity,
18
- View,
19
- } from 'react-native';
20
- import { getIconColor } from '../../../helpers/getIconColor';
21
- import { useT } from '../../../i18n/useT';
16
+ import { ProfileImagePlaceholder } from '../../MainComponents/ProfileImagePlaceholder';
17
+ import { Text, Alert, Linking } from 'react-native';
22
18
  import * as ImagePicker from 'expo-image-picker';
23
19
  import { ApiRoom, ChatAccessOption, RoomMember } from '../../../types/models/room.model';
24
20
  import { createRoomFromApi } from '../../../helpers/createRoomFromApi';
@@ -28,16 +24,16 @@ import { useChatSettingState } from '../../../hooks/useChatSettingState';
28
24
  import { useToast } from '../../../context/ToastContext';
29
25
 
30
26
  interface NewChatModalProps {
31
- handleCloseModal?: () => void;
27
+ handleCloseModal?: any;
32
28
  }
33
29
 
34
30
  const NewChatModal: React.FC<NewChatModalProps> = ({
35
31
  // Some call sites mount `<NewChatModal />` with no props (e.g. the
36
- // empty-state in ChatRoom when roomsList is empty). There is nothing to
37
- // dismiss back to there, so Cancel just resets the form.
38
- handleCloseModal: handleClose,
32
+ // empty-state in ChatRoom when roomsList is empty). Default to a noop
33
+ // so the Close/Cancel buttons don't throw "handleClose is not a
34
+ // function".
35
+ handleCloseModal: handleClose = () => {},
39
36
  }) => {
40
- const t = useT();
41
37
  const config = useAppSelector(
42
38
  (state: RootState) => state.chatSettingStore.config
43
39
  );
@@ -47,7 +43,9 @@ const NewChatModal: React.FC<NewChatModalProps> = ({
47
43
  const { user } = useChatSettingState();
48
44
  const { showToast } = useToast();
49
45
 
46
+ const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
50
47
  const [loading, setLoading] = useState<boolean>(false);
48
+ const [activeTab, setActiveTab] = useState<'0' | '1' | null>('0');
51
49
 
52
50
  const [roomName, setRoomName] = useState<string>('');
53
51
  const [roomDescription, setRoomDescription] = useState<string>('');
@@ -67,7 +65,7 @@ const NewChatModal: React.FC<NewChatModalProps> = ({
67
65
 
68
66
  const validateRoomName = (name: string) => {
69
67
  if (name.trim().length < 3) {
70
- return t('modal.newChat.nameTooShort');
68
+ return 'Room name must be at least 3 characters.';
71
69
  }
72
70
  return '';
73
71
  };
@@ -99,17 +97,13 @@ const NewChatModal: React.FC<NewChatModalProps> = ({
99
97
  }));
100
98
  };
101
99
 
102
- const resetForm = () => {
100
+ const handleOpenModal = () => setIsModalOpen(true);
101
+ const handleCloseModal = () => {
102
+ handleClose();
103
+ setActiveTab('0');
104
+ setIsModalOpen(false);
103
105
  setRoomName('');
104
- setRoomDescription('');
105
- setProfileImage(null);
106
106
  setSelectedUsers([]);
107
- setErrors({ name: '', description: '' });
108
- };
109
-
110
- const handleCloseModal = () => {
111
- resetForm();
112
- handleClose?.();
113
107
  };
114
108
 
115
109
  const onUpload = async () => {
@@ -135,7 +129,7 @@ const NewChatModal: React.FC<NewChatModalProps> = ({
135
129
  quality: 0.8,
136
130
  });
137
131
 
138
- if (result.canceled) {return;}
132
+ if (result.canceled) return;
139
133
 
140
134
  const asset = result.assets[0];
141
135
  const originalName = asset.uri.split('/').pop();
@@ -167,7 +161,7 @@ const NewChatModal: React.FC<NewChatModalProps> = ({
167
161
  usersArrayLength
168
162
  );
169
163
 
170
- if (!normalizedChat || !client) {return;}
164
+ if (!normalizedChat || !client) return;
171
165
 
172
166
  dispatch(
173
167
  addRoomViaApi({
@@ -267,199 +261,103 @@ const NewChatModal: React.FC<NewChatModalProps> = ({
267
261
  }
268
262
  }
269
263
 
270
- resetForm();
264
+ setIsModalOpen(false);
265
+ setErrors({ name: '', description: '' });
266
+ setProfileImage(null);
267
+ setRoomName('');
268
+ setRoomDescription('');
271
269
  setLoading(false);
272
270
  }
273
271
  };
274
272
 
275
- const primary = getIconColor(config);
276
- const pickedUri =
277
- profileImage && typeof profileImage === 'object' && 'uri' in profileImage
278
- ? profileImage.uri
279
- : typeof profileImage === 'string'
280
- ? profileImage
281
- : null;
282
-
283
273
  return (
284
- // A real <Modal> rather than an in-tree overlay: the SDK renders inside
285
- // whatever frame the host gives it, so an in-tree backdrop stopped at
286
- // the component's edge and left the host's own chrome (tab bars and
287
- // such) lit. This one dims the whole window.
288
- <Modal
289
- transparent
290
- visible
291
- animationType="fade"
292
- statusBarTranslucent
293
- onRequestClose={handleCloseModal}
294
- >
295
- <View style={styles.backdrop}>
296
- <Pressable
297
- testID="new-chat-backdrop"
298
- style={StyleSheet.absoluteFill}
299
- onPress={handleCloseModal}
300
- />
301
- <View style={styles.card}>
302
- <Text style={styles.title}>{t('modal.newChat.title')}</Text>
303
-
304
- <TouchableOpacity
305
- testID="new-chat-picture"
306
- activeOpacity={0.8}
307
- onPress={onUpload}
308
- onLongPress={pickedUri ? onRemoveClick : undefined}
309
- style={[styles.picture, { backgroundColor: primary }]}
310
- >
311
- {pickedUri ? (
312
- <Image source={{ uri: pickedUri }} style={styles.pictureImage} />
313
- ) : (
314
- <CameraIcon color="#FFFFFF" width={26} height={26} />
315
- )}
316
- </TouchableOpacity>
317
-
318
- <TextInput
319
- testID="new-chat-name"
320
- style={styles.input}
321
- value={roomName}
322
- onChangeText={handleRoomNameChange}
323
- placeholder={t('modal.newChat.roomNamePlaceholder')}
324
- placeholderTextColor="#8C8C8C"
325
- returnKeyType="next"
326
- />
327
- {!!errors.name && roomName.length > 0 && (
328
- <Text testID="new-chat-name-error" style={styles.error}>
329
- {errors.name}
330
- </Text>
331
- )}
332
-
333
- <TextInput
334
- testID="new-chat-description"
335
- style={[styles.input, styles.textArea]}
336
- value={roomDescription}
337
- onChangeText={handleRoomDescriptionChange}
338
- placeholder={t('modal.newChat.descriptionPlaceholder')}
339
- placeholderTextColor="#8C8C8C"
340
- multiline
274
+ <>
275
+ {/* <Button
276
+ style={{
277
+ padding: 8,
278
+ borderRadius: 16,
279
+ backgroundColor: "transparent",
280
+ }}
281
+ color="black"
282
+ unstyled
283
+ EndIcon={<AddNewIcon color={config?.colors?.primary} />}
284
+ onPress={handleOpenModal}
285
+ /> */}
286
+
287
+ <ModalBackground
288
+ // visible={isModalOpen}
289
+ // transparent={true}
290
+ // animationType="fade"
291
+ // onRequestClose={handleCloseModal}
292
+ >
293
+ <ModalContainer>
294
+ <CloseButton onPress={handleCloseModal}>
295
+ <Text style={{ fontSize: 24, padding: 5 }}>&times;</Text>
296
+ </CloseButton>
297
+ <ModalTitle>Create New Chat</ModalTitle>
298
+ <ProfileImagePlaceholder
299
+ size={120}
300
+ upload={{ active: true, onUpload }}
301
+ remove={{ enabled: true, onRemoveClick }}
302
+ placeholderIcon={<AddPhotoIcon color="#0052CD" />}
303
+ icon={
304
+ profileImage && typeof profileImage === 'object' && 'uri' in profileImage
305
+ ? { uri: profileImage.uri }
306
+ : profileImage
307
+ }
308
+ disableOverlay={!profileImage}
309
+ role="user"
341
310
  />
342
-
343
- <View style={styles.buttons}>
344
- <TouchableOpacity
345
- testID="new-chat-cancel"
346
- activeOpacity={0.7}
347
- style={[styles.button, styles.cancel]}
348
- onPress={handleCloseModal}
349
- >
350
- <Text style={styles.cancelLabel}>{t('action.cancel')}</Text>
351
- </TouchableOpacity>
352
- <TouchableOpacity
353
- testID="new-chat-submit"
354
- activeOpacity={0.7}
355
- disabled={!isValid || loading}
356
- style={[
357
- styles.button,
358
- { backgroundColor: primary, opacity: !isValid || loading ? 0.5 : 1 },
359
- ]}
311
+ <GroupContainer
312
+ style={{
313
+ flexDirection: 'column',
314
+ position: 'relative',
315
+ width: '100%',
316
+ }}
317
+ >
318
+ <InputWithLabel
319
+ color="#F5F7F9"
320
+ id="roomName"
321
+ value={roomName}
322
+ onChangeText={handleRoomNameChange}
323
+ placeholder="Enter Room Name"
324
+ helperText={errors.name}
325
+ error={!!errors.name}
326
+ />
327
+ <InputWithLabel
328
+ color="#F5F7F9"
329
+ id="roomDescription"
330
+ value={roomDescription}
331
+ onChangeText={handleRoomDescriptionChange}
332
+ placeholder="Enter Description"
333
+ helperText={errors.description}
334
+ error={!!errors.description}
335
+ />
336
+ </GroupContainer>
337
+
338
+ <GroupContainer>
339
+ <Button
360
340
  onPress={handleCreateRoom}
361
- >
362
- {loading ? (
363
- <ActivityIndicator color="#FFFFFF" />
364
- ) : (
365
- <Text style={styles.submitLabel}>
366
- {t('modal.newChat.createButton')}
367
- </Text>
368
- )}
369
- </TouchableOpacity>
370
- </View>
371
- </View>
372
- </View>
373
- </Modal>
341
+ text={'Create'}
342
+ style={{ width: '100%' }}
343
+ unstyled
344
+ variant="filled"
345
+ disabled={!isValid}
346
+ color="#fff"
347
+ />
348
+ <Button
349
+ onPress={handleCloseModal}
350
+ text={'Cancel'}
351
+ style={{ width: '100%' }}
352
+ unstyled
353
+ variant="outlined"
354
+ color="#0052CD"
355
+ />
356
+ </GroupContainer>
357
+ </ModalContainer>
358
+ </ModalBackground>
359
+ </>
374
360
  );
375
361
  };
376
362
 
377
- const styles = StyleSheet.create({
378
- backdrop: {
379
- flex: 1,
380
- // Opaque, per the design: the chat list behind stays hidden rather
381
- // than showing through a translucent dim.
382
- backgroundColor: '#E9EDF2',
383
- alignItems: 'center',
384
- justifyContent: 'center',
385
- padding: 24,
386
- },
387
- card: {
388
- width: '100%',
389
- maxWidth: 380,
390
- borderRadius: 20,
391
- backgroundColor: '#FFFFFF',
392
- padding: 20,
393
- shadowColor: '#121219',
394
- shadowOffset: { width: 0, height: 8 },
395
- shadowOpacity: 0.08,
396
- shadowRadius: 24,
397
- elevation: 6,
398
- },
399
- title: {
400
- fontSize: 17,
401
- fontWeight: '700',
402
- color: '#141414',
403
- textAlign: 'center',
404
- },
405
- picture: {
406
- alignSelf: 'center',
407
- width: 72,
408
- height: 72,
409
- borderRadius: 36,
410
- marginVertical: 18,
411
- alignItems: 'center',
412
- justifyContent: 'center',
413
- overflow: 'hidden',
414
- },
415
- pictureImage: {
416
- width: '100%',
417
- height: '100%',
418
- },
419
- input: {
420
- borderRadius: 12,
421
- backgroundColor: '#F4F5F7',
422
- paddingHorizontal: 14,
423
- paddingVertical: 12,
424
- fontSize: 15,
425
- color: '#141414',
426
- marginTop: 10,
427
- },
428
- textArea: {
429
- minHeight: 84,
430
- textAlignVertical: 'top',
431
- },
432
- error: {
433
- color: '#E53935',
434
- fontSize: 12,
435
- marginTop: 6,
436
- marginLeft: 4,
437
- },
438
- buttons: {
439
- flexDirection: 'row',
440
- gap: 12,
441
- marginTop: 20,
442
- },
443
- button: {
444
- flex: 1,
445
- height: 44,
446
- borderRadius: 12,
447
- alignItems: 'center',
448
- justifyContent: 'center',
449
- },
450
- cancel: {
451
- backgroundColor: '#E7E8EA',
452
- },
453
- cancelLabel: {
454
- fontSize: 15,
455
- fontWeight: '500',
456
- color: '#8C8C8C',
457
- },
458
- submitLabel: {
459
- fontSize: 15,
460
- fontWeight: '600',
461
- color: '#FFFFFF',
462
- },
463
- });
464
-
465
363
  export default NewChatModal;
@@ -1,5 +1,4 @@
1
1
  import React, { useState, useMemo } from 'react';
2
- import { pickImageAsset, PickedImage } from '../../../helpers/pickImageAsset';
3
2
  import Button from '../../styled/Button';
4
3
  import { AddNewIcon } from '../../../assets/icons';
5
4
  import { useDispatch, useSelector } from 'react-redux';
@@ -30,16 +29,7 @@ const NewChatModal: React.FC = () => {
30
29
  name: 'Public',
31
30
  id: 'public',
32
31
  });
33
- const [profileImage, setProfileImage] = useState<
34
- string | PickedImage | null
35
- >(null);
36
-
37
- const handleUploadImage = async () => {
38
- const picked = await pickImageAsset();
39
- if (picked) {
40
- setProfileImage(picked);
41
- }
42
- };
32
+ const [profileImage, setProfileImage] = useState<string | File | null>(null);
43
33
  const [errors, setErrors] = useState({ name: '', description: '' });
44
34
  const [selectedUsers, setSelectedUsers] = useState<RoomMember[]>([]);
45
35
 
@@ -129,7 +119,6 @@ const NewChatModal: React.FC = () => {
129
119
  setRoomDescription={setRoomDescription}
130
120
  setChatType={setChatType}
131
121
  setProfileImage={setProfileImage}
132
- onUploadImage={handleUploadImage}
133
122
  selectedUsers={selectedUsers}
134
123
  setSelectedUsers={setSelectedUsers}
135
124
  handleCreateRoom={handleCreateRoom}
@@ -17,13 +17,7 @@ import { useToast } from '../../../context/ToastContext';
17
17
  import { updateRoom } from '../../../roomStore/roomsSlice';
18
18
  import { Text } from 'react-native';
19
19
 
20
- interface SelectUsersModalProps {
21
- /** Render the opener yourself (the chat profile uses an "Add Members"
22
- * row). Falls back to the plain "Add more Users" button. */
23
- trigger?: (open: () => void) => React.ReactNode;
24
- }
25
-
26
- const SelectUsersModal: React.FC<SelectUsersModalProps> = ({ trigger }) => {
20
+ const SelectUsersModal: React.FC = () => {
27
21
  const { showToast } = useToast();
28
22
  const dispatch = useDispatch();
29
23
 
@@ -80,13 +74,9 @@ const SelectUsersModal: React.FC<SelectUsersModalProps> = ({ trigger }) => {
80
74
 
81
75
  return (
82
76
  <>
83
- {trigger ? (
84
- trigger(handleOpenModal)
85
- ) : (
86
- <ActionButton variant="filled" unstyled onPress={handleOpenModal}>
87
- Add more Users
88
- </ActionButton>
89
- )}
77
+ <ActionButton variant="filled" unstyled onPress={handleOpenModal}>
78
+ Add more Users
79
+ </ActionButton>
90
80
 
91
81
  {isModalOpen && (
92
82
  <ModalBackground>
@@ -8,10 +8,23 @@ import { updateProfile } from '../../../networking/api-requests/user.api';
8
8
  import { useDispatch } from 'react-redux';
9
9
  import { updateUser } from '../../../roomStore/chatSettingsSlice';
10
10
  import { View } from 'react-native';
11
- import { pickImageAsset, PickedImage } from '../../../helpers/pickImageAsset';
12
11
  import { AddPhotoIcon } from '../../../assets/icons';
13
12
  // import { actionUpdateUser } from '../actions';
14
13
 
14
+ const base64ToFile = (base64String: string, fileName: string) => {
15
+ const byteString = atob(base64String.split(',')[1]);
16
+ const arrayBuffer = new ArrayBuffer(byteString.length);
17
+ const uintArray = new Uint8Array(arrayBuffer);
18
+ for (let i = 0; i < byteString.length; i++) {
19
+ uintArray[i] = byteString.charCodeAt(i);
20
+ }
21
+ const blob = new Blob([uintArray], { type: 'image/jpeg' });
22
+ return new File([blob], fileName, {
23
+ type: 'image/jpeg',
24
+ lastModified: Date.now(),
25
+ });
26
+ };
27
+
15
28
  interface EditUserModalProps {
16
29
  setIsEditing: React.Dispatch<React.SetStateAction<boolean>>;
17
30
  modalUser: any;
@@ -28,7 +41,7 @@ const EditUserModal: React.FC<EditUserModalProps> = ({
28
41
  const [firstName, setFirstName] = useState(modalUser?.firstName || '');
29
42
  const [lastName, setLastName] = useState(modalUser?.lastName || '');
30
43
  const [description, setDescription] = useState(modalUser?.description || '');
31
- const [profileImage, setProfileImage] = useState<string | PickedImage>(
44
+ const [profileImage, setProfileImage] = useState<string | File>(
32
45
  modalUser?.profileImage
33
46
  );
34
47
 
@@ -36,8 +49,14 @@ const EditUserModal: React.FC<EditUserModalProps> = ({
36
49
  try {
37
50
  let fd = new FormData();
38
51
 
39
- if (profileImage && typeof profileImage !== 'string') {
40
- fd.append('file', profileImage as any);
52
+ if (
53
+ typeof profileImage === 'string' &&
54
+ profileImage.startsWith('data:image/')
55
+ ) {
56
+ const file = base64ToFile(profileImage, 'profileImage.jpg');
57
+ fd.append('file', file);
58
+ } else if (profileImage instanceof File) {
59
+ fd.append('file', profileImage);
41
60
  }
42
61
 
43
62
  fd.append('firstName', firstName);
@@ -63,11 +82,8 @@ const EditUserModal: React.FC<EditUserModalProps> = ({
63
82
  }
64
83
  };
65
84
 
66
- const handleProfileImageChange = async () => {
67
- const picked = await pickImageAsset();
68
- if (picked) {
69
- setProfileImage(picked);
70
- }
85
+ const handleProfileImageChange = (image: File) => {
86
+ setProfileImage(image);
71
87
  };
72
88
 
73
89
  return (