@ethora/chat-component-rn 26.8.1 → 26.8.2

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 (604) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/README.md +43 -10
  3. package/lib/commonjs/assets/icons.js +7 -2
  4. package/lib/commonjs/assets/icons.js.map +1 -1
  5. package/lib/commonjs/components/AuthForms/Login.js +4 -4
  6. package/lib/commonjs/components/AuthForms/Login.js.map +1 -1
  7. package/lib/commonjs/components/Header/HeaderRoomList.js +29 -8
  8. package/lib/commonjs/components/Header/HeaderRoomList.js.map +1 -1
  9. package/lib/commonjs/components/MainComponents/ChatHeader.js +9 -3
  10. package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
  11. package/lib/commonjs/components/MainComponents/ChatRoom.js +150 -14
  12. package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
  13. package/lib/commonjs/components/MainComponents/ChatWrapper.js +34 -13
  14. package/lib/commonjs/components/MainComponents/ChatWrapper.js.map +1 -1
  15. package/lib/commonjs/components/MainComponents/LoginWrapper.js +2 -1
  16. package/lib/commonjs/components/MainComponents/LoginWrapper.js.map +1 -1
  17. package/lib/commonjs/components/MainComponents/MediaMessage.js +29 -9
  18. package/lib/commonjs/components/MainComponents/MediaMessage.js.map +1 -1
  19. package/lib/commonjs/components/MainComponents/MessageContainer.js +5 -1
  20. package/lib/commonjs/components/MainComponents/MessageContainer.js.map +1 -1
  21. package/lib/commonjs/components/MainComponents/MessageList.js +13 -5
  22. package/lib/commonjs/components/MainComponents/MessageList.js.map +1 -1
  23. package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js +14 -13
  24. package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
  25. package/lib/commonjs/components/MainComponents/RoomList.js +208 -35
  26. package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
  27. package/lib/commonjs/components/Menu/HeaderRoomListMenu.js +317 -98
  28. package/lib/commonjs/components/Menu/HeaderRoomListMenu.js.map +1 -1
  29. package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js +322 -110
  30. package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
  31. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +546 -203
  32. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  33. package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js +226 -0
  34. package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js.map +1 -0
  35. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +69 -27
  36. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  37. package/lib/commonjs/components/Modals/FilePreviewModal/PdfView.js +2 -1
  38. package/lib/commonjs/components/Modals/FilePreviewModal/PdfView.js.map +1 -1
  39. package/lib/commonjs/components/Modals/Modal/Modal.js +8 -0
  40. package/lib/commonjs/components/Modals/Modal/Modal.js.map +1 -1
  41. package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js +2 -1
  42. package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js.map +1 -1
  43. package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js +202 -106
  44. package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
  45. package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js +8 -0
  46. package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
  47. package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js +563 -0
  48. package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js.map +1 -0
  49. package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js +210 -0
  50. package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js.map +1 -0
  51. package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js +4 -2
  52. package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
  53. package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js +7 -21
  54. package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
  55. package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js +507 -244
  56. package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
  57. package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js +74 -46
  58. package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
  59. package/lib/commonjs/components/Modals/styledModalComponents.js +9 -2
  60. package/lib/commonjs/components/Modals/styledModalComponents.js.map +1 -1
  61. package/lib/commonjs/components/RoomComponents/ChatRoomItem.js +21 -7
  62. package/lib/commonjs/components/RoomComponents/ChatRoomItem.js.map +1 -1
  63. package/lib/commonjs/components/RoomComponents/styled/LastMessageFile.js +22 -3
  64. package/lib/commonjs/components/RoomComponents/styled/LastMessageFile.js.map +1 -1
  65. package/lib/commonjs/components/RoomComponents/styled/LastMessagePhoto.js +17 -3
  66. package/lib/commonjs/components/RoomComponents/styled/LastMessagePhoto.js.map +1 -1
  67. package/lib/commonjs/components/RoomComponents/styled/LastMessageVideo.js +17 -3
  68. package/lib/commonjs/components/RoomComponents/styled/LastMessageVideo.js.map +1 -1
  69. package/lib/commonjs/components/VideoCalls/VideoCallSession.js +6 -3
  70. package/lib/commonjs/components/VideoCalls/VideoCallSession.js.map +1 -1
  71. package/lib/commonjs/components/styled/AudioMessage.js +2 -1
  72. package/lib/commonjs/components/styled/AudioMessage.js.map +1 -1
  73. package/lib/commonjs/components/styled/MessageImage.js +37 -9
  74. package/lib/commonjs/components/styled/MessageImage.js.map +1 -1
  75. package/lib/commonjs/components/styled/SendInput.js +80 -11
  76. package/lib/commonjs/components/styled/SendInput.js.map +1 -1
  77. package/lib/commonjs/components/styled/StyledComponents.js +9 -3
  78. package/lib/commonjs/components/styled/StyledComponents.js.map +1 -1
  79. package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js +11 -4
  80. package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
  81. package/lib/commonjs/components/styled/UnsupportedType.js +14 -4
  82. package/lib/commonjs/components/styled/UnsupportedType.js.map +1 -1
  83. package/lib/commonjs/components/styled/VideoMessage.js +119 -61
  84. package/lib/commonjs/components/styled/VideoMessage.js.map +1 -1
  85. package/lib/commonjs/context/xmppProvider.js +184 -59
  86. package/lib/commonjs/context/xmppProvider.js.map +1 -1
  87. package/lib/commonjs/helpers/createMessageFromXml.js +19 -1
  88. package/lib/commonjs/helpers/createMessageFromXml.js.map +1 -1
  89. package/lib/commonjs/helpers/ensureScopedChatCache.js +2 -2
  90. package/lib/commonjs/helpers/ensureScopedChatCache.js.map +1 -1
  91. package/lib/commonjs/helpers/getChatBackground.js +23 -0
  92. package/lib/commonjs/helpers/getChatBackground.js.map +1 -0
  93. package/lib/commonjs/helpers/getDisplayFileName.js +79 -0
  94. package/lib/commonjs/helpers/getDisplayFileName.js.map +1 -0
  95. package/lib/commonjs/helpers/getServerReadTimestamp.js +188 -0
  96. package/lib/commonjs/helpers/getServerReadTimestamp.js.map +1 -0
  97. package/lib/commonjs/helpers/historyPreloadScheduler.js +65 -2
  98. package/lib/commonjs/helpers/historyPreloadScheduler.js.map +1 -1
  99. package/lib/commonjs/helpers/initXmppRooms.js +14 -8
  100. package/lib/commonjs/helpers/initXmppRooms.js.map +1 -1
  101. package/lib/commonjs/helpers/insertMessageWithDelimiter.js +51 -9
  102. package/lib/commonjs/helpers/insertMessageWithDelimiter.js.map +1 -1
  103. package/lib/commonjs/helpers/isOwnMessage.js +75 -0
  104. package/lib/commonjs/helpers/isOwnMessage.js.map +1 -0
  105. package/lib/commonjs/helpers/keyboardLayout.js +12 -2
  106. package/lib/commonjs/helpers/keyboardLayout.js.map +1 -1
  107. package/lib/commonjs/helpers/mediaLibraryRuntime.js +31 -0
  108. package/lib/commonjs/helpers/mediaLibraryRuntime.js.map +1 -0
  109. package/lib/commonjs/helpers/mimeToExtension.js +6 -14
  110. package/lib/commonjs/helpers/mimeToExtension.js.map +1 -1
  111. package/lib/commonjs/helpers/msgSortableMs.js +37 -0
  112. package/lib/commonjs/helpers/msgSortableMs.js.map +1 -0
  113. package/lib/commonjs/helpers/persistCrypto.js +122 -0
  114. package/lib/commonjs/helpers/persistCrypto.js.map +1 -0
  115. package/lib/commonjs/helpers/pickImageAsset.js +68 -0
  116. package/lib/commonjs/helpers/pickImageAsset.js.map +1 -0
  117. package/lib/commonjs/helpers/pushPayload.js +71 -0
  118. package/lib/commonjs/helpers/pushPayload.js.map +1 -0
  119. package/lib/commonjs/helpers/resolveInitBeforeLoadUser.js +130 -17
  120. package/lib/commonjs/helpers/resolveInitBeforeLoadUser.js.map +1 -1
  121. package/lib/commonjs/helpers/secureFileUrl.js +101 -0
  122. package/lib/commonjs/helpers/secureFileUrl.js.map +1 -0
  123. package/lib/commonjs/helpers/secureKeyValue.js +83 -0
  124. package/lib/commonjs/helpers/secureKeyValue.js.map +1 -0
  125. package/lib/commonjs/helpers/secureStoreRuntime.js +59 -0
  126. package/lib/commonjs/helpers/secureStoreRuntime.js.map +1 -0
  127. package/lib/commonjs/helpers/secureUserStorage.js +75 -0
  128. package/lib/commonjs/helpers/secureUserStorage.js.map +1 -0
  129. package/lib/commonjs/helpers/shallowEqual.js +36 -0
  130. package/lib/commonjs/helpers/shallowEqual.js.map +1 -0
  131. package/lib/commonjs/helpers/sheetGestures.js +32 -0
  132. package/lib/commonjs/helpers/sheetGestures.js.map +1 -0
  133. package/lib/commonjs/hooks/useChatRoomFocus.js +45 -12
  134. package/lib/commonjs/hooks/useChatRoomFocus.js.map +1 -1
  135. package/lib/commonjs/hooks/useChatWrapperInit.js +30 -10
  136. package/lib/commonjs/hooks/useChatWrapperInit.js.map +1 -1
  137. package/lib/commonjs/hooks/useComposing.js +27 -0
  138. package/lib/commonjs/hooks/useComposing.js.map +1 -1
  139. package/lib/commonjs/hooks/useFileToken.js +10 -0
  140. package/lib/commonjs/hooks/useFileToken.js.map +1 -0
  141. package/lib/commonjs/hooks/useLogout.js +23 -7
  142. package/lib/commonjs/hooks/useLogout.js.map +1 -1
  143. package/lib/commonjs/hooks/usePendingNotification.js +8 -11
  144. package/lib/commonjs/hooks/usePendingNotification.js.map +1 -1
  145. package/lib/commonjs/hooks/useSendMessage.js +50 -14
  146. package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
  147. package/lib/commonjs/hooks/useUnreadMessagesCounter.js +6 -1
  148. package/lib/commonjs/hooks/useUnreadMessagesCounter.js.map +1 -1
  149. package/lib/commonjs/i18n/strings.js +145 -37
  150. package/lib/commonjs/i18n/strings.js.map +1 -1
  151. package/lib/commonjs/main.js +44 -0
  152. package/lib/commonjs/main.js.map +1 -1
  153. package/lib/commonjs/networking/api-requests/auth.api.js +134 -60
  154. package/lib/commonjs/networking/api-requests/auth.api.js.map +1 -1
  155. package/lib/commonjs/networking/api-requests/roomMembers.api.js +1 -1
  156. package/lib/commonjs/networking/api-requests/roomMembers.api.js.map +1 -1
  157. package/lib/commonjs/networking/api-requests/rooms.api.js +9 -9
  158. package/lib/commonjs/networking/api-requests/rooms.api.js.map +1 -1
  159. package/lib/commonjs/networking/api-requests/user.api.js +68 -9
  160. package/lib/commonjs/networking/api-requests/user.api.js.map +1 -1
  161. package/lib/commonjs/networking/apiClient.js +62 -112
  162. package/lib/commonjs/networking/apiClient.js.map +1 -1
  163. package/lib/commonjs/networking/authRefresh.js +332 -0
  164. package/lib/commonjs/networking/authRefresh.js.map +1 -0
  165. package/lib/commonjs/networking/stanzaHandlers.js +41 -28
  166. package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
  167. package/lib/commonjs/networking/xmpp/flushLastViewedToPrivateStore.js +46 -8
  168. package/lib/commonjs/networking/xmpp/flushLastViewedToPrivateStore.js.map +1 -1
  169. package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js +8 -1
  170. package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
  171. package/lib/commonjs/networking/xmpp/subscribeToRoomMessages.xmpp.js +5 -1
  172. package/lib/commonjs/networking/xmpp/subscribeToRoomMessages.xmpp.js.map +1 -1
  173. package/lib/commonjs/networking/xmppClient.js +124 -8
  174. package/lib/commonjs/networking/xmppClient.js.map +1 -1
  175. package/lib/commonjs/roomStore/chatSettingsSlice.js +26 -7
  176. package/lib/commonjs/roomStore/chatSettingsSlice.js.map +1 -1
  177. package/lib/commonjs/roomStore/index.js +35 -2
  178. package/lib/commonjs/roomStore/index.js.map +1 -1
  179. package/lib/commonjs/roomStore/persistence.js +226 -23
  180. package/lib/commonjs/roomStore/persistence.js.map +1 -1
  181. package/lib/commonjs/roomStore/roomsSlice.js +151 -38
  182. package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
  183. package/lib/commonjs/services/pushSubscriptionService.js +15 -13
  184. package/lib/commonjs/services/pushSubscriptionService.js.map +1 -1
  185. package/lib/commonjs/version.js +1 -1
  186. package/lib/module/assets/icons.js +6 -1
  187. package/lib/module/assets/icons.js.map +1 -1
  188. package/lib/module/components/AuthForms/Login.js +4 -4
  189. package/lib/module/components/AuthForms/Login.js.map +1 -1
  190. package/lib/module/components/Header/HeaderRoomList.js +29 -8
  191. package/lib/module/components/Header/HeaderRoomList.js.map +1 -1
  192. package/lib/module/components/MainComponents/ChatHeader.js +9 -3
  193. package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
  194. package/lib/module/components/MainComponents/ChatRoom.js +152 -16
  195. package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
  196. package/lib/module/components/MainComponents/ChatWrapper.js +35 -14
  197. package/lib/module/components/MainComponents/ChatWrapper.js.map +1 -1
  198. package/lib/module/components/MainComponents/LoginWrapper.js +2 -1
  199. package/lib/module/components/MainComponents/LoginWrapper.js.map +1 -1
  200. package/lib/module/components/MainComponents/MediaMessage.js +30 -10
  201. package/lib/module/components/MainComponents/MediaMessage.js.map +1 -1
  202. package/lib/module/components/MainComponents/MessageContainer.js +5 -1
  203. package/lib/module/components/MainComponents/MessageContainer.js.map +1 -1
  204. package/lib/module/components/MainComponents/MessageList.js +13 -5
  205. package/lib/module/components/MainComponents/MessageList.js.map +1 -1
  206. package/lib/module/components/MainComponents/ProfileImagePlaceholder.js +14 -13
  207. package/lib/module/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
  208. package/lib/module/components/MainComponents/RoomList.js +207 -35
  209. package/lib/module/components/MainComponents/RoomList.js.map +1 -1
  210. package/lib/module/components/Menu/HeaderRoomListMenu.js +319 -101
  211. package/lib/module/components/Menu/HeaderRoomListMenu.js.map +1 -1
  212. package/lib/module/components/Modals/AttachSheet/AttachSheet.js +313 -113
  213. package/lib/module/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
  214. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +549 -207
  215. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  216. package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js +223 -0
  217. package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js.map +1 -0
  218. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +70 -28
  219. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  220. package/lib/module/components/Modals/FilePreviewModal/PdfView.js +2 -1
  221. package/lib/module/components/Modals/FilePreviewModal/PdfView.js.map +1 -1
  222. package/lib/module/components/Modals/Modal/Modal.js +9 -1
  223. package/lib/module/components/Modals/Modal/Modal.js.map +1 -1
  224. package/lib/module/components/Modals/NewChatModal/ModalContent.js +2 -1
  225. package/lib/module/components/Modals/NewChatModal/ModalContent.js.map +1 -1
  226. package/lib/module/components/Modals/NewChatModal/NewChatModal.js +205 -108
  227. package/lib/module/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
  228. package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js +8 -0
  229. package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
  230. package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js +555 -0
  231. package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js.map +1 -0
  232. package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js +205 -0
  233. package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js.map +1 -0
  234. package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js +4 -2
  235. package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
  236. package/lib/module/components/Modals/UserProfileModal/EditUserModal.js +9 -23
  237. package/lib/module/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
  238. package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js +509 -248
  239. package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
  240. package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js +76 -48
  241. package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
  242. package/lib/module/components/Modals/styledModalComponents.js +9 -2
  243. package/lib/module/components/Modals/styledModalComponents.js.map +1 -1
  244. package/lib/module/components/RoomComponents/ChatRoomItem.js +21 -7
  245. package/lib/module/components/RoomComponents/ChatRoomItem.js.map +1 -1
  246. package/lib/module/components/RoomComponents/styled/LastMessageFile.js +22 -3
  247. package/lib/module/components/RoomComponents/styled/LastMessageFile.js.map +1 -1
  248. package/lib/module/components/RoomComponents/styled/LastMessagePhoto.js +17 -3
  249. package/lib/module/components/RoomComponents/styled/LastMessagePhoto.js.map +1 -1
  250. package/lib/module/components/RoomComponents/styled/LastMessageVideo.js +17 -3
  251. package/lib/module/components/RoomComponents/styled/LastMessageVideo.js.map +1 -1
  252. package/lib/module/components/VideoCalls/VideoCallSession.js +6 -3
  253. package/lib/module/components/VideoCalls/VideoCallSession.js.map +1 -1
  254. package/lib/module/components/styled/AudioMessage.js +2 -1
  255. package/lib/module/components/styled/AudioMessage.js.map +1 -1
  256. package/lib/module/components/styled/MessageImage.js +37 -9
  257. package/lib/module/components/styled/MessageImage.js.map +1 -1
  258. package/lib/module/components/styled/SendInput.js +81 -12
  259. package/lib/module/components/styled/SendInput.js.map +1 -1
  260. package/lib/module/components/styled/StyledComponents.js +9 -3
  261. package/lib/module/components/styled/StyledComponents.js.map +1 -1
  262. package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js +11 -4
  263. package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
  264. package/lib/module/components/styled/UnsupportedType.js +14 -4
  265. package/lib/module/components/styled/UnsupportedType.js.map +1 -1
  266. package/lib/module/components/styled/VideoMessage.js +120 -62
  267. package/lib/module/components/styled/VideoMessage.js.map +1 -1
  268. package/lib/module/context/xmppProvider.js +184 -60
  269. package/lib/module/context/xmppProvider.js.map +1 -1
  270. package/lib/module/helpers/createMessageFromXml.js +19 -1
  271. package/lib/module/helpers/createMessageFromXml.js.map +1 -1
  272. package/lib/module/helpers/ensureScopedChatCache.js +2 -2
  273. package/lib/module/helpers/ensureScopedChatCache.js.map +1 -1
  274. package/lib/module/helpers/getChatBackground.js +18 -0
  275. package/lib/module/helpers/getChatBackground.js.map +1 -0
  276. package/lib/module/helpers/getDisplayFileName.js +73 -0
  277. package/lib/module/helpers/getDisplayFileName.js.map +1 -0
  278. package/lib/module/helpers/getServerReadTimestamp.js +181 -0
  279. package/lib/module/helpers/getServerReadTimestamp.js.map +1 -0
  280. package/lib/module/helpers/historyPreloadScheduler.js +66 -3
  281. package/lib/module/helpers/historyPreloadScheduler.js.map +1 -1
  282. package/lib/module/helpers/initXmppRooms.js +14 -8
  283. package/lib/module/helpers/initXmppRooms.js.map +1 -1
  284. package/lib/module/helpers/insertMessageWithDelimiter.js +52 -9
  285. package/lib/module/helpers/insertMessageWithDelimiter.js.map +1 -1
  286. package/lib/module/helpers/isOwnMessage.js +70 -0
  287. package/lib/module/helpers/isOwnMessage.js.map +1 -0
  288. package/lib/module/helpers/keyboardLayout.js +12 -2
  289. package/lib/module/helpers/keyboardLayout.js.map +1 -1
  290. package/lib/module/helpers/mediaLibraryRuntime.js +25 -0
  291. package/lib/module/helpers/mediaLibraryRuntime.js.map +1 -0
  292. package/lib/module/helpers/mimeToExtension.js +6 -13
  293. package/lib/module/helpers/mimeToExtension.js.map +1 -1
  294. package/lib/module/helpers/msgSortableMs.js +32 -0
  295. package/lib/module/helpers/msgSortableMs.js.map +1 -0
  296. package/lib/module/helpers/persistCrypto.js +115 -0
  297. package/lib/module/helpers/persistCrypto.js.map +1 -0
  298. package/lib/module/helpers/pickImageAsset.js +63 -0
  299. package/lib/module/helpers/pickImageAsset.js.map +1 -0
  300. package/lib/module/helpers/pushPayload.js +63 -0
  301. package/lib/module/helpers/pushPayload.js.map +1 -0
  302. package/lib/module/helpers/resolveInitBeforeLoadUser.js +130 -16
  303. package/lib/module/helpers/resolveInitBeforeLoadUser.js.map +1 -1
  304. package/lib/module/helpers/secureFileUrl.js +91 -0
  305. package/lib/module/helpers/secureFileUrl.js.map +1 -0
  306. package/lib/module/helpers/secureKeyValue.js +75 -0
  307. package/lib/module/helpers/secureKeyValue.js.map +1 -0
  308. package/lib/module/helpers/secureStoreRuntime.js +52 -0
  309. package/lib/module/helpers/secureStoreRuntime.js.map +1 -0
  310. package/lib/module/helpers/secureUserStorage.js +72 -0
  311. package/lib/module/helpers/secureUserStorage.js.map +1 -0
  312. package/lib/module/helpers/shallowEqual.js +31 -0
  313. package/lib/module/helpers/shallowEqual.js.map +1 -0
  314. package/lib/module/helpers/sheetGestures.js +26 -0
  315. package/lib/module/helpers/sheetGestures.js.map +1 -0
  316. package/lib/module/hooks/useChatRoomFocus.js +46 -13
  317. package/lib/module/hooks/useChatRoomFocus.js.map +1 -1
  318. package/lib/module/hooks/useChatWrapperInit.js +30 -10
  319. package/lib/module/hooks/useChatWrapperInit.js.map +1 -1
  320. package/lib/module/hooks/useComposing.js +28 -1
  321. package/lib/module/hooks/useComposing.js.map +1 -1
  322. package/lib/module/hooks/useFileToken.js +5 -0
  323. package/lib/module/hooks/useFileToken.js.map +1 -0
  324. package/lib/module/hooks/useLogout.js +23 -7
  325. package/lib/module/hooks/useLogout.js.map +1 -1
  326. package/lib/module/hooks/usePendingNotification.js +8 -11
  327. package/lib/module/hooks/usePendingNotification.js.map +1 -1
  328. package/lib/module/hooks/useSendMessage.js +52 -16
  329. package/lib/module/hooks/useSendMessage.js.map +1 -1
  330. package/lib/module/hooks/useUnreadMessagesCounter.js +6 -1
  331. package/lib/module/hooks/useUnreadMessagesCounter.js.map +1 -1
  332. package/lib/module/i18n/strings.js +145 -37
  333. package/lib/module/i18n/strings.js.map +1 -1
  334. package/lib/module/main.js +14 -2
  335. package/lib/module/main.js.map +1 -1
  336. package/lib/module/networking/api-requests/auth.api.js +131 -59
  337. package/lib/module/networking/api-requests/auth.api.js.map +1 -1
  338. package/lib/module/networking/api-requests/roomMembers.api.js +1 -1
  339. package/lib/module/networking/api-requests/roomMembers.api.js.map +1 -1
  340. package/lib/module/networking/api-requests/rooms.api.js +9 -9
  341. package/lib/module/networking/api-requests/rooms.api.js.map +1 -1
  342. package/lib/module/networking/api-requests/user.api.js +64 -7
  343. package/lib/module/networking/api-requests/user.api.js.map +1 -1
  344. package/lib/module/networking/apiClient.js +61 -113
  345. package/lib/module/networking/apiClient.js.map +1 -1
  346. package/lib/module/networking/authRefresh.js +321 -0
  347. package/lib/module/networking/authRefresh.js.map +1 -0
  348. package/lib/module/networking/stanzaHandlers.js +41 -28
  349. package/lib/module/networking/stanzaHandlers.js.map +1 -1
  350. package/lib/module/networking/xmpp/flushLastViewedToPrivateStore.js +46 -8
  351. package/lib/module/networking/xmpp/flushLastViewedToPrivateStore.js.map +1 -1
  352. package/lib/module/networking/xmpp/presenceInRoom.xmpp.js +8 -1
  353. package/lib/module/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
  354. package/lib/module/networking/xmpp/subscribeToRoomMessages.xmpp.js +5 -1
  355. package/lib/module/networking/xmpp/subscribeToRoomMessages.xmpp.js.map +1 -1
  356. package/lib/module/networking/xmppClient.js +124 -8
  357. package/lib/module/networking/xmppClient.js.map +1 -1
  358. package/lib/module/roomStore/chatSettingsSlice.js +26 -7
  359. package/lib/module/roomStore/chatSettingsSlice.js.map +1 -1
  360. package/lib/module/roomStore/index.js +37 -4
  361. package/lib/module/roomStore/index.js.map +1 -1
  362. package/lib/module/roomStore/persistence.js +223 -22
  363. package/lib/module/roomStore/persistence.js.map +1 -1
  364. package/lib/module/roomStore/roomsSlice.js +139 -34
  365. package/lib/module/roomStore/roomsSlice.js.map +1 -1
  366. package/lib/module/services/pushSubscriptionService.js +15 -13
  367. package/lib/module/services/pushSubscriptionService.js.map +1 -1
  368. package/lib/module/version.js +1 -1
  369. package/lib/typescript/assets/icons.d.ts +16 -0
  370. package/lib/typescript/assets/icons.d.ts.map +1 -1
  371. package/lib/typescript/components/AuthForms/Login.d.ts.map +1 -1
  372. package/lib/typescript/components/Header/HeaderRoomList.d.ts.map +1 -1
  373. package/lib/typescript/components/MainComponents/ChatHeader.d.ts.map +1 -1
  374. package/lib/typescript/components/MainComponents/ChatRoom.d.ts.map +1 -1
  375. package/lib/typescript/components/MainComponents/ChatWrapper.d.ts.map +1 -1
  376. package/lib/typescript/components/MainComponents/LoginWrapper.d.ts.map +1 -1
  377. package/lib/typescript/components/MainComponents/MediaMessage.d.ts.map +1 -1
  378. package/lib/typescript/components/MainComponents/MessageContainer.d.ts.map +1 -1
  379. package/lib/typescript/components/MainComponents/MessageList.d.ts +10 -1
  380. package/lib/typescript/components/MainComponents/MessageList.d.ts.map +1 -1
  381. package/lib/typescript/components/MainComponents/ProfileImagePlaceholder.d.ts.map +1 -1
  382. package/lib/typescript/components/MainComponents/RoomList.d.ts +7 -0
  383. package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
  384. package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts +3 -0
  385. package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts.map +1 -1
  386. package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts +9 -0
  387. package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts.map +1 -1
  388. package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts +10 -0
  389. package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
  390. package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts +9 -0
  391. package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts.map +1 -0
  392. package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts.map +1 -1
  393. package/lib/typescript/components/Modals/FilePreviewModal/PdfView.d.ts.map +1 -1
  394. package/lib/typescript/components/Modals/Modal/Modal.d.ts.map +1 -1
  395. package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts +4 -2
  396. package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts.map +1 -1
  397. package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts +1 -1
  398. package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts.map +1 -1
  399. package/lib/typescript/components/Modals/NewChatModal/UpdNewChatModal.d.ts.map +1 -1
  400. package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts +75 -0
  401. package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts.map +1 -0
  402. package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts +25 -0
  403. package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts.map +1 -0
  404. package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts +6 -1
  405. package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts.map +1 -1
  406. package/lib/typescript/components/Modals/UserProfileModal/EditUserModal.d.ts.map +1 -1
  407. package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts +16 -0
  408. package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts.map +1 -1
  409. package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts +1 -0
  410. package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts.map +1 -1
  411. package/lib/typescript/components/Modals/styledModalComponents.d.ts.map +1 -1
  412. package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts.map +1 -1
  413. package/lib/typescript/components/RoomComponents/styled/LastMessageFile.d.ts +1 -1
  414. package/lib/typescript/components/RoomComponents/styled/LastMessageFile.d.ts.map +1 -1
  415. package/lib/typescript/components/RoomComponents/styled/LastMessagePhoto.d.ts +1 -1
  416. package/lib/typescript/components/RoomComponents/styled/LastMessagePhoto.d.ts.map +1 -1
  417. package/lib/typescript/components/RoomComponents/styled/LastMessageVideo.d.ts +1 -1
  418. package/lib/typescript/components/RoomComponents/styled/LastMessageVideo.d.ts.map +1 -1
  419. package/lib/typescript/components/VideoCalls/VideoCallSession.d.ts.map +1 -1
  420. package/lib/typescript/components/styled/AudioMessage.d.ts.map +1 -1
  421. package/lib/typescript/components/styled/MessageImage.d.ts +14 -0
  422. package/lib/typescript/components/styled/MessageImage.d.ts.map +1 -1
  423. package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
  424. package/lib/typescript/components/styled/StyledComponents.d.ts.map +1 -1
  425. package/lib/typescript/components/styled/StyledInputComponents/StyledInputComponents.d.ts.map +1 -1
  426. package/lib/typescript/components/styled/UnsupportedType.d.ts.map +1 -1
  427. package/lib/typescript/components/styled/VideoMessage.d.ts +8 -0
  428. package/lib/typescript/components/styled/VideoMessage.d.ts.map +1 -1
  429. package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
  430. package/lib/typescript/helpers/createMessageFromXml.d.ts.map +1 -1
  431. package/lib/typescript/helpers/getChatBackground.d.ts +15 -0
  432. package/lib/typescript/helpers/getChatBackground.d.ts.map +1 -0
  433. package/lib/typescript/helpers/getDisplayFileName.d.ts +49 -0
  434. package/lib/typescript/helpers/getDisplayFileName.d.ts.map +1 -0
  435. package/lib/typescript/helpers/getServerReadTimestamp.d.ts +108 -0
  436. package/lib/typescript/helpers/getServerReadTimestamp.d.ts.map +1 -0
  437. package/lib/typescript/helpers/historyPreloadScheduler.d.ts.map +1 -1
  438. package/lib/typescript/helpers/initXmppRooms.d.ts.map +1 -1
  439. package/lib/typescript/helpers/insertMessageWithDelimiter.d.ts +1 -1
  440. package/lib/typescript/helpers/insertMessageWithDelimiter.d.ts.map +1 -1
  441. package/lib/typescript/helpers/isOwnMessage.d.ts +36 -0
  442. package/lib/typescript/helpers/isOwnMessage.d.ts.map +1 -0
  443. package/lib/typescript/helpers/keyboardLayout.d.ts +5 -1
  444. package/lib/typescript/helpers/keyboardLayout.d.ts.map +1 -1
  445. package/lib/typescript/helpers/mediaLibraryRuntime.d.ts +3 -0
  446. package/lib/typescript/helpers/mediaLibraryRuntime.d.ts.map +1 -0
  447. package/lib/typescript/helpers/mimeToExtension.d.ts +0 -15
  448. package/lib/typescript/helpers/mimeToExtension.d.ts.map +1 -1
  449. package/lib/typescript/helpers/msgSortableMs.d.ts +2 -0
  450. package/lib/typescript/helpers/msgSortableMs.d.ts.map +1 -0
  451. package/lib/typescript/helpers/persistCrypto.d.ts +13 -0
  452. package/lib/typescript/helpers/persistCrypto.d.ts.map +1 -0
  453. package/lib/typescript/helpers/pickImageAsset.d.ts +27 -0
  454. package/lib/typescript/helpers/pickImageAsset.d.ts.map +1 -0
  455. package/lib/typescript/helpers/pushPayload.d.ts +7 -0
  456. package/lib/typescript/helpers/pushPayload.d.ts.map +1 -0
  457. package/lib/typescript/helpers/resolveInitBeforeLoadUser.d.ts.map +1 -1
  458. package/lib/typescript/helpers/secureFileUrl.d.ts +7 -0
  459. package/lib/typescript/helpers/secureFileUrl.d.ts.map +1 -0
  460. package/lib/typescript/helpers/secureKeyValue.d.ts +13 -0
  461. package/lib/typescript/helpers/secureKeyValue.d.ts.map +1 -0
  462. package/lib/typescript/helpers/secureStoreRuntime.d.ts +29 -0
  463. package/lib/typescript/helpers/secureStoreRuntime.d.ts.map +1 -0
  464. package/lib/typescript/helpers/secureUserStorage.d.ts +23 -0
  465. package/lib/typescript/helpers/secureUserStorage.d.ts.map +1 -0
  466. package/lib/typescript/helpers/shallowEqual.d.ts +11 -0
  467. package/lib/typescript/helpers/shallowEqual.d.ts.map +1 -0
  468. package/lib/typescript/helpers/sheetGestures.d.ts +20 -0
  469. package/lib/typescript/helpers/sheetGestures.d.ts.map +1 -0
  470. package/lib/typescript/hooks/useChatRoomFocus.d.ts +4 -1
  471. package/lib/typescript/hooks/useChatRoomFocus.d.ts.map +1 -1
  472. package/lib/typescript/hooks/useChatWrapperInit.d.ts.map +1 -1
  473. package/lib/typescript/hooks/useComposing.d.ts.map +1 -1
  474. package/lib/typescript/hooks/useFileToken.d.ts +2 -0
  475. package/lib/typescript/hooks/useFileToken.d.ts.map +1 -0
  476. package/lib/typescript/hooks/useLogout.d.ts.map +1 -1
  477. package/lib/typescript/hooks/usePendingNotification.d.ts.map +1 -1
  478. package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
  479. package/lib/typescript/hooks/useUnreadMessagesCounter.d.ts +1 -0
  480. package/lib/typescript/hooks/useUnreadMessagesCounter.d.ts.map +1 -1
  481. package/lib/typescript/i18n/strings.d.ts.map +1 -1
  482. package/lib/typescript/main.d.ts +9 -2
  483. package/lib/typescript/main.d.ts.map +1 -1
  484. package/lib/typescript/networking/api-requests/auth.api.d.ts +3 -1
  485. package/lib/typescript/networking/api-requests/auth.api.d.ts.map +1 -1
  486. package/lib/typescript/networking/api-requests/user.api.d.ts +27 -0
  487. package/lib/typescript/networking/api-requests/user.api.d.ts.map +1 -1
  488. package/lib/typescript/networking/apiClient.d.ts +12 -6
  489. package/lib/typescript/networking/apiClient.d.ts.map +1 -1
  490. package/lib/typescript/networking/authRefresh.d.ts +95 -0
  491. package/lib/typescript/networking/authRefresh.d.ts.map +1 -0
  492. package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
  493. package/lib/typescript/networking/xmpp/flushLastViewedToPrivateStore.d.ts +10 -2
  494. package/lib/typescript/networking/xmpp/flushLastViewedToPrivateStore.d.ts.map +1 -1
  495. package/lib/typescript/networking/xmpp/presenceInRoom.xmpp.d.ts.map +1 -1
  496. package/lib/typescript/networking/xmpp/subscribeToRoomMessages.xmpp.d.ts.map +1 -1
  497. package/lib/typescript/networking/xmppClient.d.ts +14 -0
  498. package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
  499. package/lib/typescript/roomStore/chatSettingsSlice.d.ts +16 -0
  500. package/lib/typescript/roomStore/chatSettingsSlice.d.ts.map +1 -1
  501. package/lib/typescript/roomStore/index.d.ts.map +1 -1
  502. package/lib/typescript/roomStore/persistence.d.ts +18 -1
  503. package/lib/typescript/roomStore/persistence.d.ts.map +1 -1
  504. package/lib/typescript/roomStore/roomsSlice.d.ts +43 -3
  505. package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
  506. package/lib/typescript/services/pushSubscriptionService.d.ts +1 -1
  507. package/lib/typescript/services/pushSubscriptionService.d.ts.map +1 -1
  508. package/lib/typescript/types/types.d.ts +50 -5
  509. package/lib/typescript/types/types.d.ts.map +1 -1
  510. package/lib/typescript/version.d.ts +1 -1
  511. package/package.json +41 -28
  512. package/src/assets/icons.tsx +48 -9
  513. package/src/components/AuthForms/Login.tsx +3 -3
  514. package/src/components/Header/HeaderRoomList.tsx +29 -7
  515. package/src/components/MainComponents/ChatHeader.tsx +9 -3
  516. package/src/components/MainComponents/ChatRoom.tsx +161 -15
  517. package/src/components/MainComponents/ChatWrapper.tsx +36 -20
  518. package/src/components/MainComponents/LoginWrapper.tsx +1 -0
  519. package/src/components/MainComponents/MediaMessage.tsx +26 -8
  520. package/src/components/MainComponents/MessageContainer.tsx +5 -1
  521. package/src/components/MainComponents/MessageList.tsx +23 -4
  522. package/src/components/MainComponents/ProfileImagePlaceholder.tsx +21 -14
  523. package/src/components/MainComponents/RoomList.tsx +236 -39
  524. package/src/components/Menu/HeaderRoomListMenu.tsx +328 -75
  525. package/src/components/Modals/AttachSheet/AttachSheet.tsx +333 -97
  526. package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +600 -282
  527. package/src/components/Modals/ChatProfileModal/ReportChatModal.tsx +244 -0
  528. package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +79 -38
  529. package/src/components/Modals/FilePreviewModal/PdfView.tsx +2 -1
  530. package/src/components/Modals/Modal/Modal.tsx +7 -0
  531. package/src/components/Modals/NewChatModal/ModalContent.tsx +6 -3
  532. package/src/components/Modals/NewChatModal/NewChatModal.tsx +219 -119
  533. package/src/components/Modals/NewChatModal/UpdNewChatModal.tsx +12 -1
  534. package/src/components/Modals/ProfileHeader/ProfileHeader.tsx +624 -0
  535. package/src/components/Modals/ProfileHeader/ProfileMenu.tsx +217 -0
  536. package/src/components/Modals/SelectUsersModal/SelectUsersModal.tsx +14 -4
  537. package/src/components/Modals/UserProfileModal/EditUserModal.tsx +9 -25
  538. package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +617 -307
  539. package/src/components/Modals/UserSettingsModal/UserSettingsModal.tsx +75 -58
  540. package/src/components/Modals/styledModalComponents.tsx +9 -2
  541. package/src/components/RoomComponents/ChatRoomItem.tsx +18 -3
  542. package/src/components/RoomComponents/styled/LastMessageFile.tsx +28 -4
  543. package/src/components/RoomComponents/styled/LastMessagePhoto.tsx +18 -3
  544. package/src/components/RoomComponents/styled/LastMessageVideo.tsx +18 -3
  545. package/src/components/VideoCalls/VideoCallSession.tsx +8 -3
  546. package/src/components/styled/AudioMessage.tsx +2 -1
  547. package/src/components/styled/MessageImage.tsx +53 -7
  548. package/src/components/styled/SendInput.tsx +83 -12
  549. package/src/components/styled/StyledComponents.ts +9 -3
  550. package/src/components/styled/StyledInputComponents/StyledInputComponents.tsx +11 -4
  551. package/src/components/styled/UnsupportedType.tsx +14 -4
  552. package/src/components/styled/VideoMessage.tsx +131 -54
  553. package/src/context/xmppProvider.tsx +216 -57
  554. package/src/helpers/createMessageFromXml.ts +20 -1
  555. package/src/helpers/ensureScopedChatCache.ts +2 -2
  556. package/src/helpers/getChatBackground.ts +18 -0
  557. package/src/helpers/getDisplayFileName.ts +87 -0
  558. package/src/helpers/getServerReadTimestamp.ts +197 -0
  559. package/src/helpers/historyPreloadScheduler.ts +80 -3
  560. package/src/helpers/initXmppRooms.tsx +14 -10
  561. package/src/helpers/insertMessageWithDelimiter.ts +55 -19
  562. package/src/helpers/isOwnMessage.ts +90 -0
  563. package/src/helpers/keyboardLayout.ts +23 -2
  564. package/src/helpers/mediaLibraryRuntime.ts +25 -0
  565. package/src/helpers/mimeToExtension.ts +6 -22
  566. package/src/helpers/msgSortableMs.ts +25 -0
  567. package/src/helpers/persistCrypto.ts +127 -0
  568. package/src/helpers/pickImageAsset.ts +68 -0
  569. package/src/helpers/pushPayload.ts +62 -0
  570. package/src/helpers/resolveInitBeforeLoadUser.ts +125 -18
  571. package/src/helpers/secureFileUrl.ts +103 -0
  572. package/src/helpers/secureKeyValue.ts +80 -0
  573. package/src/helpers/secureStoreRuntime.ts +62 -0
  574. package/src/helpers/secureUserStorage.ts +80 -0
  575. package/src/helpers/shallowEqual.ts +33 -0
  576. package/src/helpers/sheetGestures.ts +25 -0
  577. package/src/hooks/useChatRoomFocus.ts +49 -9
  578. package/src/hooks/useChatWrapperInit.ts +30 -10
  579. package/src/hooks/useComposing.tsx +37 -1
  580. package/src/hooks/useFileToken.ts +7 -0
  581. package/src/hooks/useLogout.tsx +29 -9
  582. package/src/hooks/usePendingNotification.ts +5 -11
  583. package/src/hooks/useSendMessage.tsx +60 -15
  584. package/src/hooks/useUnreadMessagesCounter.ts +11 -0
  585. package/src/i18n/strings.ts +145 -37
  586. package/src/main.ts +26 -2
  587. package/src/networking/api-requests/auth.api.ts +156 -48
  588. package/src/networking/api-requests/roomMembers.api.ts +1 -1
  589. package/src/networking/api-requests/rooms.api.ts +9 -9
  590. package/src/networking/api-requests/user.api.ts +79 -7
  591. package/src/networking/apiClient.ts +68 -123
  592. package/src/networking/authRefresh.ts +451 -0
  593. package/src/networking/stanzaHandlers.ts +44 -28
  594. package/src/networking/xmpp/flushLastViewedToPrivateStore.ts +71 -10
  595. package/src/networking/xmpp/presenceInRoom.xmpp.ts +6 -1
  596. package/src/networking/xmpp/subscribeToRoomMessages.xmpp.ts +12 -1
  597. package/src/networking/xmppClient.ts +141 -9
  598. package/src/roomStore/chatSettingsSlice.ts +34 -10
  599. package/src/roomStore/index.ts +40 -4
  600. package/src/roomStore/persistence.ts +234 -24
  601. package/src/roomStore/roomsSlice.ts +161 -29
  602. package/src/services/pushSubscriptionService.ts +18 -13
  603. package/src/types/types.ts +72 -5
  604. package/src/version.ts +1 -1
@@ -1,48 +1,98 @@
1
- import React, { useCallback, useEffect, useMemo, useState } from 'react';
1
+ /** @format */
2
+
3
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
4
+ import {
5
+ ActivityIndicator,
6
+ Animated,
7
+ Image,
8
+ Share,
9
+ StyleSheet,
10
+ Text,
11
+ TouchableOpacity,
12
+ View,
13
+ } from 'react-native';
14
+ import { ModalContainerFullScreen } from '../styledModalComponents';
2
15
  import {
3
- CenterContainer,
4
- UserInfo,
5
- UserName,
6
- UserStatus,
7
- ModalContainerFullScreen,
8
- ActionButton,
9
- Label,
10
- BorderedContainer,
11
- LabelData,
12
- ModalBackground,
13
- ModalContainer,
14
- CloseButton,
15
- ModalTitle,
16
- GroupContainer,
17
- } from '../styledModalComponents';
18
- import { ChatIcon, DeleteIcon, DownloadIcon, EditIcon, IconDoc, LeaveIcon, MoreIcon } from '../../../assets/icons';
19
- import ModalHeaderComponent from '../ModalHeaderComponent';
20
- import { useSelector } from 'react-redux';
21
- import { RootState } from '../../../roomStore';
22
- import { ProfileImagePlaceholder } from '../../MainComponents/ProfileImagePlaceholder';
23
- import Button from '../../styled/Button';
24
- import DropdownMenu from '../../DropdownMenu/DropdownMenu';
16
+ ChatIcon,
17
+ EditIcon,
18
+ IconDoc,
19
+ LeaveIcon,
20
+ LogoutIcon,
21
+ ProfileIcon,
22
+ ShareIcon,
23
+ } from '../../../assets/icons';
24
+ import { useAppDispatch } from '../../../hooks/hooks';
25
+ import { useChatSettingState } from '../../../hooks/useChatSettingState';
26
+ import { useXmppClient } from '../../../context/xmppProvider';
27
+ import { useToast } from '../../../context/ToastContext';
28
+ import { useT } from '../../../i18n/useT';
29
+ import { useFileToken } from '../../../hooks/useFileToken';
30
+ import { appendFileToken } from '../../../helpers/secureFileUrl';
31
+ import { getIconColor } from '../../../helpers/getIconColor';
32
+ import { chatTextStyle } from '../../../helpers/typography';
33
+ import { getElementFont } from '../../../helpers/getElementFont';
34
+ import { LANGUAGE_OPTIONS } from '../../../helpers/constants/LANGUAGE_OPTIONS';
35
+ import { MODAL_TYPES } from '../../../helpers/constants/MODAL_TYPES';
25
36
  import {
26
- logout,
37
+ setActiveFile,
27
38
  setActiveModal,
28
39
  setLangSource,
29
40
  setSelectedUser,
30
41
  } from '../../../roomStore/chatSettingsSlice';
31
- import { addRoomViaApi, setCurrentRoom, setLogoutState } from '../../../roomStore/roomsSlice';
32
- import EditUserModal from './EditUserModal';
33
- import { walletToUsername } from '../../../helpers/walletUsername';
34
- import { useXmppClient } from '../../../context/xmppProvider';
35
- import Loader from '../../styled/Loader';
36
- import { IRoom, Iso639_1Codes } from '../../../types/types';
37
- import Select from '../../MainComponents/Select';
38
- import { useAppDispatch, useAppSelector } from '../../../hooks/hooks';
39
- import { ScrollView, Text, View } from 'react-native';
42
+ import { addRoomViaApi, setCurrentRoom } from '../../../roomStore/roomsSlice';
43
+ import { runLogoutFlow } from '../../Menu/HeaderRoomListMenu';
44
+ import { useLogout } from '../../../hooks/useLogout';
40
45
  import { ApiRoom, postPrivateRoom } from '../../../networking/api-requests/rooms.api';
46
+ import {
47
+ getUserFiles,
48
+ isMediaFile,
49
+ UserFile,
50
+ } from '../../../networking/api-requests/user.api';
41
51
  import { createRoomFromApi } from '../../../helpers/createRoomFromApi';
42
- import { useToast } from '../../../context/ToastContext';
43
- import { LANGUAGE_OPTIONS } from '../../../helpers/constants/LANGUAGE_OPTIONS';
44
- import { deleteDocument, getDocuments } from '../../../networking/api-requests/user.api';
45
- import { useChatSettingState } from '../../../hooks/useChatSettingState';
52
+ import { walletToUsername } from '../../../helpers/walletUsername';
53
+ import { Iso639_1Codes } from '../../../types/types';
54
+ import {
55
+ ProfileHero,
56
+ ProfileTopBar,
57
+ HeroAction,
58
+ useHeaderMetrics,
59
+ } from '../ProfileHeader/ProfileHeader';
60
+ import ProfileMenu, { ProfileMenuItem } from '../ProfileHeader/ProfileMenu';
61
+ import EditUserModal from './EditUserModal';
62
+
63
+ const PREFIX = 'user-profile';
64
+
65
+ type TabKey = 'language' | 'media' | 'documents';
66
+
67
+ /** Two uppercase letters for a person without a picture. */
68
+ export const userInitials = (name?: string | null): string => {
69
+ const words = (name || '').trim().split(/\s+/).filter(Boolean);
70
+ const letters = (words.length >= 2
71
+ ? [words[0][0], words[1][0]]
72
+ : [words[0]?.[0], words[0]?.[1]]
73
+ ).filter((c) => !!c && /[\p{L}\p{N}]/u.test(c));
74
+ return letters.join('').toUpperCase();
75
+ };
76
+
77
+ /**
78
+ * Which tabs a profile shows. Only the signed-in user has tabs at all:
79
+ * `GET /v2/files/` returns the JWT owner's files, so there is nothing to
80
+ * put under Media/Documents for anybody else, and the language picker is
81
+ * a personal setting.
82
+ */
83
+ export const profileTabs = (opts: {
84
+ isOwnProfile: boolean;
85
+ translatesEnabled: boolean;
86
+ hasMedia: boolean;
87
+ hasDocuments: boolean;
88
+ }): TabKey[] => {
89
+ if (!opts.isOwnProfile) {return [];}
90
+ const tabs: TabKey[] = [];
91
+ if (opts.translatesEnabled) {tabs.push('language');}
92
+ if (opts.hasMedia) {tabs.push('media');}
93
+ if (opts.hasDocuments) {tabs.push('documents');}
94
+ return tabs;
95
+ };
46
96
 
47
97
  interface UserProfileModalProps {
48
98
  handleCloseModal: any;
@@ -51,89 +101,111 @@ interface UserProfileModalProps {
51
101
  const UserProfileModal: React.FC<UserProfileModalProps> = ({
52
102
  handleCloseModal,
53
103
  }) => {
104
+ const t = useT();
54
105
  const dispatch = useAppDispatch();
55
-
56
106
  const { client } = useXmppClient();
57
107
  const { showToast } = useToast();
58
-
59
108
  const { config, user, selectedUser, langSource } = useChatSettingState();
109
+ const fileToken = useFileToken();
110
+
111
+ const [isEditing, setIsEditing] = useState(false);
112
+ const [files, setFiles] = useState<UserFile[]>([]);
113
+ const [loadingFiles, setLoadingFiles] = useState(false);
114
+ const [activeTab, setActiveTab] = useState<TabKey | null>(null);
115
+
116
+ const scrollY = useRef(new Animated.Value(0)).current;
117
+ const scrollRef = useRef<any>(null);
118
+ const { collapseDistance } = useHeaderMetrics();
119
+ const [viewportHeight, setViewportHeight] = useState(0);
120
+ // `scrollY` is driven natively, so its value can't be read back with
121
+ // addListener; the Animated.event's JS `listener` still fires, which is
122
+ // enough to know which state the header is in.
123
+ const [isCollapsed, setIsCollapsed] = useState(false);
124
+
125
+ const isOwnProfile = !selectedUser;
126
+ const profileUser: any = selectedUser ?? user;
127
+
128
+ const media = useMemo(() => files.filter(isMediaFile), [files]);
129
+ const documents = useMemo(
130
+ () => files.filter((file) => !isMediaFile(file)),
131
+ [files]
132
+ );
60
133
 
61
- const [isEditing, setIsEditing] = useState<boolean>(false);
62
- const [documents, setDocuments] = useState<any[]>([]);
63
- const [deleteDocumentId, setDeleteDocumentId] = useState<string>('');
64
- const [showDelete, setShowDelete] = useState<boolean>(false);
65
-
66
- const handleDeleteDocument = async () => {
67
- try {
68
- await deleteDocument(deleteDocumentId);
69
- setDocuments(documents.filter((doc) => doc._id !== deleteDocumentId));
70
- showToast({
71
- id: Date.now().toString(),
72
- title: 'Success',
73
- message: 'Document deleted successfully',
74
- type: 'success',
75
- });
76
- // handleGetDocs();
77
- } catch (error) {
78
- console.error('Error deleting document', error);
79
- showToast({
80
- id: Date.now().toString(),
81
- title: 'Error',
82
- message: 'Failed to delete document',
83
- type: 'error',
84
- });
85
- } finally {
86
- setShowDelete(false);
87
- }
88
- };
89
-
90
- const handleGetDocs = async () => {
91
- try {
92
- const { data } = await getDocuments(user?.defaultWallet?.walletAddress);
93
- const items = data.results.filter((el: {locations: unknown[]}) => el.locations[0]);
134
+ const tabs = useMemo(
135
+ () =>
136
+ profileTabs({
137
+ isOwnProfile,
138
+ translatesEnabled: !!config?.translates?.enabled,
139
+ hasMedia: media.length > 0,
140
+ hasDocuments: documents.length > 0,
141
+ }),
142
+ [isOwnProfile, config?.translates?.enabled, media.length, documents.length]
143
+ );
94
144
 
95
- setDocuments(items);
96
- } catch (error) {
97
- console.error('Error getting docs', error);
145
+ // Keep the selected tab valid as the lists load in.
146
+ useEffect(() => {
147
+ if (tabs.length === 0) {
148
+ setActiveTab(null);
149
+ return;
98
150
  }
99
- };
100
-
151
+ setActiveTab((current) =>
152
+ current && tabs.includes(current) ? current : tabs[0]
153
+ );
154
+ }, [tabs]);
155
+
156
+ // One request per visit, and only for one's own profile — the endpoint
157
+ // is scoped to the JWT owner, so it would return *our* files while
158
+ // looking at somebody else's page.
101
159
  useEffect(() => {
102
- handleGetDocs();
103
- }, []);
160
+ if (!isOwnProfile) {
161
+ setFiles([]);
162
+ return;
163
+ }
164
+ let cancelled = false;
165
+ setLoadingFiles(true);
166
+ getUserFiles()
167
+ .then((rows) => {
168
+ if (!cancelled) {setFiles(rows);}
169
+ })
170
+ .catch((error) => {
171
+ console.warn('Could not load user files:', error);
172
+ if (!cancelled) {setFiles([]);}
173
+ })
174
+ .finally(() => {
175
+ if (!cancelled) {setLoadingFiles(false);}
176
+ });
177
+ return () => {
178
+ cancelled = true;
179
+ };
180
+ }, [isOwnProfile, user?.token]);
104
181
 
105
182
  const handleBackClick = useCallback(() => {
106
183
  dispatch(setSelectedUser(undefined));
107
184
  handleCloseModal();
108
- }, []);
185
+ }, [dispatch, handleCloseModal]);
109
186
 
187
+ // Same teardown the room-list menu runs (XMPP, redux, persisted slices,
188
+ // AsyncStorage), including the host's confirm copy and callbacks.
189
+ const performLogout = useLogout();
110
190
  const handleLogout = useCallback(() => {
111
- dispatch(logout());
112
- dispatch(setLogoutState());
113
- }, []);
114
-
115
- const menuOptions = useMemo(
116
- () => [
117
- {
118
- label: 'Log Out',
119
- icon: <LeaveIcon />,
120
- onClick: () => {
121
- handleLogout();
122
- },
123
- styles: { color: 'red' },
124
- },
125
- ],
126
- []
127
- );
128
-
129
- const handleSelect = (selected: { name: string; id: Iso639_1Codes }) => {
130
- dispatch(setLangSource(selected.id));
131
- };
132
-
133
- const EditClick = useCallback(() => {
134
- setIsEditing(true);
135
- }, []);
136
-
191
+ runLogoutFlow(config?.logout ?? { enabled: true }, performLogout).catch(() => {});
192
+ }, [config?.logout, performLogout]);
193
+
194
+ const handleShare = useCallback(async () => {
195
+ const name =
196
+ profileUser?.name ||
197
+ `${profileUser?.firstName ?? ''} ${profileUser?.lastName ?? ''}`.trim();
198
+ const id =
199
+ profileUser?.userJID ||
200
+ profileUser?.defaultWallet?.walletAddress ||
201
+ profileUser?.id ||
202
+ '';
203
+ try {
204
+ await Share.share({ message: id ? `${name}\n${id}` : name });
205
+ } catch (error) {
206
+ console.warn('Could not share the profile:', error);
207
+ }
208
+ }, [profileUser]);
137
209
 
138
210
  const handleRoomCreation = async (
139
211
  newChat: ApiRoom,
@@ -146,15 +218,9 @@ const UserProfileModal: React.FC<UserProfileModalProps> = ({
146
218
  usersArrayLength
147
219
  );
148
220
 
149
- if (!normalizedChat || !client) return;
150
-
151
- dispatch(
152
- addRoomViaApi({
153
- room: normalizedChat,
154
- xmpp: client,
155
- })
156
- );
221
+ if (!normalizedChat || !client) {return;}
157
222
 
223
+ dispatch(addRoomViaApi({ room: normalizedChat, xmpp: client }));
158
224
  dispatch(setCurrentRoom({ roomJID: normalizedChat?.jid || '' }));
159
225
 
160
226
  showToast({
@@ -177,22 +243,19 @@ const UserProfileModal: React.FC<UserProfileModalProps> = ({
177
243
  type: 'info',
178
244
  duration: 3000,
179
245
  });
180
- let newRoomJid = '';
181
246
  if (config?.newArch) {
182
247
  const newRoom = await postPrivateRoom(
183
248
  selectedUser?.userJID ?? (selectedUser?.id || '')
184
249
  );
185
250
  handleRoomCreation(newRoom, 2);
186
- newRoomJid = newRoom.name;
187
251
  } else {
188
252
  const selectedUserUsername = walletToUsername(selectedUser?.id || '');
189
253
  const myUsername = walletToUsername(user.defaultWallet.walletAddress);
190
254
 
191
- const combinedWalletAddress = [myUsername, selectedUserUsername]
255
+ const roomJid = [myUsername, selectedUserUsername]
192
256
  .sort()
193
- .join('.');
194
-
195
- const roomJid = combinedWalletAddress.toLowerCase();
257
+ .join('.')
258
+ .toLowerCase();
196
259
 
197
260
  const combinedUsersName = [
198
261
  user.firstName,
@@ -201,11 +264,12 @@ const UserProfileModal: React.FC<UserProfileModalProps> = ({
201
264
  .sort()
202
265
  .join(' and ');
203
266
 
204
- newRoomJid = (await client?.createPrivateRoomStanza(
205
- combinedUsersName,
206
- `Private chat ${combinedUsersName}`,
207
- roomJid
208
- )) || '';
267
+ const newRoomJid =
268
+ (await client?.createPrivateRoomStanza(
269
+ combinedUsersName,
270
+ `Private chat ${combinedUsersName}`,
271
+ roomJid
272
+ )) || '';
209
273
 
210
274
  if (newRoomJid) {
211
275
  await client?.inviteRoomRequestStanza(selectedUserUsername, newRoomJid);
@@ -214,202 +278,448 @@ const UserProfileModal: React.FC<UserProfileModalProps> = ({
214
278
  }
215
279
 
216
280
  dispatch(setActiveModal(undefined));
217
- }, [selectedUser]);
281
+ }, [selectedUser]); // eslint-disable-line react-hooks/exhaustive-deps
282
+
283
+ const openFile = (file: UserFile) => {
284
+ dispatch(
285
+ setActiveFile({
286
+ fileName: file.name,
287
+ fileURL: file.url,
288
+ mimetype: file.mimetype,
289
+ })
290
+ );
291
+ dispatch(setActiveModal(MODAL_TYPES.FILE_PREVIEW));
292
+ };
293
+
294
+ const heroActions: HeroAction[] = useMemo(
295
+ () =>
296
+ isOwnProfile
297
+ ? [
298
+ {
299
+ key: 'account',
300
+ label: t('action.account'),
301
+ icon: (color: string) => <ProfileIcon color={color} />,
302
+ onPress: () => dispatch(setActiveModal(MODAL_TYPES.SETTINGS)),
303
+ },
304
+ {
305
+ key: 'share',
306
+ label: t('action.share'),
307
+ icon: (color: string) => <ShareIcon color={color} />,
308
+ onPress: handleShare,
309
+ },
310
+ {
311
+ key: 'edit',
312
+ label: t('action.edit'),
313
+ icon: (color: string) => <EditIcon color={color} />,
314
+ onPress: () => setIsEditing(true),
315
+ },
316
+ {
317
+ key: 'logout',
318
+ label: t('action.logOut'),
319
+ icon: (color: string) => <LogoutIcon color={color} />,
320
+ onPress: handleLogout,
321
+ },
322
+ ]
323
+ : [
324
+ ...(config?.hideMemberSendMessageAction
325
+ ? []
326
+ : [
327
+ {
328
+ key: 'message',
329
+ label: t('action.message'),
330
+ icon: (color: string) => <ChatIcon color={color} />,
331
+ onPress: handlePrivateMessage,
332
+ },
333
+ ]),
334
+ {
335
+ key: 'share',
336
+ label: t('action.share'),
337
+ icon: (color: string) => <ShareIcon color={color} />,
338
+ onPress: handleShare,
339
+ },
340
+ ],
341
+ [isOwnProfile, t, handleShare, handlePrivateMessage, handleLogout] // eslint-disable-line react-hooks/exhaustive-deps
342
+ );
218
343
 
219
- const modalUser: any = selectedUser ?? user;
344
+ // Collapsed, the hero's round buttons are gone — the "…" menu carries
345
+ // exactly the same actions so nothing becomes unreachable.
346
+ const menuItems: ProfileMenuItem[] = useMemo(
347
+ () =>
348
+ isCollapsed
349
+ ? heroActions.map((action) => ({
350
+ key: action.key,
351
+ label: action.label,
352
+ icon: action.icon('#141414'),
353
+ destructive: action.key === 'logout',
354
+ onPress: action.onPress,
355
+ }))
356
+ : [],
357
+ [isCollapsed, heroActions]
358
+ );
220
359
 
221
- const findLanguage = () => {
222
- if(!langSource) {return null;}
360
+ if (isEditing) {
361
+ return (
362
+ <ModalContainerFullScreen>
363
+ <EditUserModal
364
+ setIsEditing={setIsEditing}
365
+ modalUser={profileUser}
366
+ config={config}
367
+ />
368
+ </ModalContainerFullScreen>
369
+ );
370
+ }
371
+
372
+ const displayName =
373
+ profileUser?.name ||
374
+ `${profileUser?.firstName ?? ''} ${profileUser?.lastName ?? ''}`.trim() ||
375
+ t('modal.profile.title');
376
+ const heroImage =
377
+ appendFileToken(profileUser?.profileImage, fileToken) || null;
378
+ const heroColor = config?.colors?.avatar || getIconColor(config);
379
+ const description = profileUser?.description;
380
+
381
+ const renderTabBody = () => {
382
+ if (activeTab === 'language') {
383
+ return (
384
+ <View>
385
+ {LANGUAGE_OPTIONS.map((option) => {
386
+ const selected = langSource === option.id;
387
+ return (
388
+ <TouchableOpacity
389
+ key={option.id}
390
+ testID={`${PREFIX}-language-${option.id}`}
391
+ activeOpacity={0.7}
392
+ style={styles.languageRow}
393
+ onPress={() =>
394
+ dispatch(setLangSource(option.id as Iso639_1Codes))
395
+ }
396
+ >
397
+ <Text style={styles.languageLabel}>{option.name}</Text>
398
+ {selected && (
399
+ <Text style={[styles.check, { color: getIconColor(config) }]}>
400
+ ✓
401
+ </Text>
402
+ )}
403
+ </TouchableOpacity>
404
+ );
405
+ })}
406
+ </View>
407
+ );
408
+ }
223
409
 
224
- const language = LANGUAGE_OPTIONS.find((lang) => lang.id === langSource);
225
- return language || null;
226
- };
410
+ if (activeTab === 'media') {
411
+ return (
412
+ <View style={styles.mediaGrid}>
413
+ {media.map((file) => (
414
+ <TouchableOpacity
415
+ key={file.id}
416
+ testID={`${PREFIX}-media-${file.id}`}
417
+ activeOpacity={0.8}
418
+ style={styles.mediaTile}
419
+ onPress={() => openFile(file)}
420
+ >
421
+ <Image
422
+ source={{ uri: appendFileToken(file.url, fileToken) || file.url }}
423
+ style={styles.mediaImage}
424
+ resizeMode="cover"
425
+ />
426
+ </TouchableOpacity>
427
+ ))}
428
+ </View>
429
+ );
430
+ }
227
431
 
228
- const showDeleteModal = (docId: string) => {
229
- setDeleteDocumentId(docId);
230
- setShowDelete(true);
432
+ return (
433
+ <View>
434
+ {documents.map((file) => (
435
+ <TouchableOpacity
436
+ key={file.id}
437
+ testID={`${PREFIX}-document-${file.id}`}
438
+ activeOpacity={0.7}
439
+ style={styles.documentRow}
440
+ onPress={() => openFile(file)}
441
+ >
442
+ <IconDoc />
443
+ <View style={styles.documentText}>
444
+ <Text numberOfLines={1} style={styles.documentName}>
445
+ {file.name}
446
+ </Text>
447
+ {!!file.createdAt && (
448
+ <Text style={styles.documentDate}>
449
+ {new Date(file.createdAt).toLocaleDateString()}
450
+ </Text>
451
+ )}
452
+ </View>
453
+ </TouchableOpacity>
454
+ ))}
455
+ </View>
456
+ );
231
457
  };
232
458
 
233
- const DefaultBody = useMemo(
234
- () => (
235
- <>
236
- <ModalHeaderComponent
237
- handleCloseModal={handleBackClick}
238
- headerTitle={'Profile'}
239
- rightMenu={
240
- !selectedUser && (
241
- <>
242
- <Button onPress={EditClick}>
243
- <EditIcon color="#8C8C8C" />
244
- </Button>
245
- <DropdownMenu
246
- options={menuOptions}
247
- position="right"
248
- menuIcon={<MoreIcon />}
249
- />
250
- </>
251
- )
459
+ return (
460
+ <ModalContainerFullScreen style={styles.screen}>
461
+ <Animated.ScrollView
462
+ ref={scrollRef}
463
+ style={styles.scroll}
464
+ contentContainerStyle={[
465
+ styles.scrollContent,
466
+ viewportHeight > 0 && {
467
+ minHeight: viewportHeight + collapseDistance,
468
+ },
469
+ ]}
470
+ onLayout={(e) => setViewportHeight(e.nativeEvent.layout.height)}
471
+ showsVerticalScrollIndicator={false}
472
+ scrollEventThrottle={16}
473
+ onScroll={Animated.event(
474
+ [{ nativeEvent: { contentOffset: { y: scrollY } } }],
475
+ {
476
+ useNativeDriver: true,
477
+ listener: (e: any) => {
478
+ const y = e?.nativeEvent?.contentOffset?.y ?? 0;
479
+ setIsCollapsed(y >= collapseDistance - 8);
480
+ },
481
+ }
482
+ )}
483
+ >
484
+ <ProfileHero
485
+ testIDPrefix={PREFIX}
486
+ title={displayName}
487
+ imageUri={heroImage}
488
+ fallbackColor={heroColor}
489
+ initials={userInitials(displayName)}
490
+ scrollY={scrollY}
491
+ actions={heroActions}
492
+ titleStyle={chatTextStyle(config?.typography?.profile?.title)}
493
+ titleAccessory={
494
+ isOwnProfile ? (
495
+ <TouchableOpacity
496
+ testID={`${PREFIX}-logout`}
497
+ activeOpacity={0.7}
498
+ style={styles.leaveButton}
499
+ onPress={handleLogout}
500
+ >
501
+ <LeaveIcon color="#FFFFFF" width={18} height={18} />
502
+ <Text style={styles.leaveLabel}>{t('action.leave')}</Text>
503
+ </TouchableOpacity>
504
+ ) : undefined
252
505
  }
253
506
  />
254
- <CenterContainer>
255
- <ProfileImagePlaceholder
256
- icon={modalUser?.profileImage ?? null}
257
- name={modalUser?.name ?? modalUser?.firstName}
258
- size={120}
259
- />
260
- <UserInfo>
261
- <UserName>
262
- {modalUser?.name
263
- ? `${modalUser?.name}`
264
- : `${modalUser?.firstName} ${modalUser?.lastName}`}
265
- </UserName>
266
- {/* <UserStatus>Status</UserStatus> */}
267
- </UserInfo>
268
- {!selectedUser && config?.translates?.enabled && (
269
- <BorderedContainer>
270
- <Select
271
- options={LANGUAGE_OPTIONS}
272
- placeholder={'Select your language'}
273
- onSelect={handleSelect}
274
- accentColor={config?.colors?.primary}
275
- selectedValue={findLanguage()}
276
- />
277
- </BorderedContainer>
278
- )}
279
- <BorderedContainer>
280
- <Label>About</Label>
281
- <LabelData>
282
- {modalUser?.description && modalUser?.description?.length > 4
283
- ? modalUser.description
284
- : 'No description'}
285
- </LabelData>
286
- </BorderedContainer>
287
-
288
- {selectedUser && !config?.disableMemberProfileActions && (
289
- <>
290
- {!config?.hideMemberSendMessageAction && (
291
- <ActionButton
292
- StartIcon={<ChatIcon />}
293
- onPress={handlePrivateMessage}
294
- variant="filled"
295
- >
296
- <Text style={{ color: '#ffffff' }}>Message</Text>
297
- </ActionButton>
298
- )}
299
- {!config?.hideMemberCopyIdAction && (
300
- <ActionButton
301
- onPress={() => {}}
302
- // onPress={() => handleCopyClick(selectedUser.id)}
303
- variant="filled"
304
- >
305
- <Text style={{ color: '#ffffff' }}>Copy User Id</Text>
306
- </ActionButton>
307
- )}
308
- </>
309
- )}
310
507
 
311
- <BorderedContainer>
312
- <ScrollView
313
- style={{ maxHeight: 400 }}
314
- showsVerticalScrollIndicator={true}
315
- nestedScrollEnabled={true}
508
+ <View style={styles.body}>
509
+ <View style={styles.card}>
510
+ <Text
511
+ style={[
512
+ styles.cardLabel,
513
+ getElementFont(config, 'profileSectionLabel'),
514
+ ]}
316
515
  >
317
- {documents.map((doc) => (
318
- <View
319
- key={doc._id}
320
- style={{
321
- flexDirection: 'row',
322
- alignItems: 'center',
323
- justifyContent: 'space-between',
324
- gap: 24,
325
- backgroundColor: '#F3F6FC',
326
- marginBottom: 8,
327
- paddingVertical: 8,
328
- paddingHorizontal: 16,
329
- borderRadius: 8,
330
- }}
331
- >
332
- <View style={{
333
- flexDirection: 'row',
334
- alignItems: 'center',
335
- gap: 24,
336
- }}>
337
- <View><IconDoc/></View>
338
- <View>
339
- <Label style={{ paddingBottom: 4 }}>{doc.documentName}</Label>
340
- <LabelData>
341
- {new Date(doc.createdAt).toLocaleDateString('en-GB', { day: '2-digit', month: 'short', year: 'numeric' }) + ' ' + new Date(doc.createdAt).toLocaleTimeString('en-GB', { hour: '2-digit', minute: '2-digit' })}
342
- </LabelData>
343
- </View>
344
- </View>
345
- <Button onPress={() => showDeleteModal(doc._id)}>
346
- <DeleteIcon/>
347
- </Button>
516
+ {t('modal.profile.about')}
517
+ </Text>
518
+ <Text style={styles.cardValue}>
519
+ {description && description.length > 4
520
+ ? description
521
+ : t('modal.profile.noDescription')}
522
+ </Text>
523
+ </View>
524
+
525
+ {tabs.length > 0 && (
526
+ <View style={styles.card}>
527
+ <View style={styles.tabsRow}>
528
+ {tabs.map((tab) => {
529
+ const active = tab === activeTab;
530
+ const count =
531
+ tab === 'media'
532
+ ? media.length
533
+ : tab === 'documents'
534
+ ? documents.length
535
+ : 0;
536
+ return (
537
+ <TouchableOpacity
538
+ key={tab}
539
+ testID={`${PREFIX}-tab-${tab}`}
540
+ activeOpacity={0.7}
541
+ style={[
542
+ styles.tab,
543
+ active && { borderBottomColor: getIconColor(config) },
544
+ ]}
545
+ onPress={() => setActiveTab(tab)}
546
+ >
547
+ <Text
548
+ style={[
549
+ styles.tabLabel,
550
+ active && { color: getIconColor(config) },
551
+ ]}
552
+ >
553
+ {t(`modal.profile.${tab}`)}
554
+ </Text>
555
+ {count > 0 && (
556
+ <View
557
+ style={[
558
+ styles.tabBadge,
559
+ { backgroundColor: getIconColor(config) },
560
+ ]}
561
+ >
562
+ <Text style={styles.tabBadgeText}>{count}</Text>
563
+ </View>
564
+ )}
565
+ </TouchableOpacity>
566
+ );
567
+ })}
348
568
  </View>
349
- ))}
350
- </ScrollView>
351
- </BorderedContainer>
352
-
353
-
354
- {/* <EmptySection /> */}
355
- </CenterContainer>
356
- </>
357
- ),
358
- [modalUser, documents]
359
- );
569
+ {renderTabBody()}
570
+ </View>
571
+ )}
360
572
 
361
- const EditingBody = useMemo(
362
- () => (
363
- <EditUserModal
364
- setIsEditing={setIsEditing}
365
- modalUser={modalUser}
366
- config={config}
573
+ {isOwnProfile && loadingFiles && files.length === 0 && (
574
+ <ActivityIndicator testID={`${PREFIX}-files-loading`} />
575
+ )}
576
+ </View>
577
+ </Animated.ScrollView>
578
+
579
+ <ProfileTopBar
580
+ testIDPrefix={PREFIX}
581
+ title={displayName}
582
+ imageUri={heroImage}
583
+ fallbackColor={heroColor}
584
+ initials={userInitials(displayName)}
585
+ scrollY={scrollY}
586
+ onBack={handleBackClick}
587
+ titleStyle={chatTextStyle(config?.typography?.profile?.screenTitle)}
588
+ menu={<ProfileMenu testIDPrefix={PREFIX} items={menuItems} />}
367
589
  />
368
- ),
369
- [modalUser]
370
- );
371
-
372
- return (
373
- <>
374
- <ModalContainerFullScreen>
375
- {!isEditing ? DefaultBody : EditingBody}
376
- </ModalContainerFullScreen>
377
-
378
- {showDelete && (
379
- <ModalBackground style={{ position: 'absolute', zIndex: 9999 }}>
380
- <ModalContainer>
381
- <CloseButton onPress={() => setShowDelete(false)}>
382
- <Text style={{ fontSize: 24 }}>&times;</Text>
383
- </CloseButton>
384
- <ModalTitle>Delete this document?</ModalTitle>
385
-
386
- <GroupContainer>
387
- <Button
388
- onPress={() => setShowDelete(false)}
389
- text={'Cancel'}
390
- style={{ width: '100%' }}
391
- unstyled
392
- variant="filled"
393
- color="white"
394
- />
395
- <Button
396
- onPress={handleDeleteDocument}
397
- text={'Delete'}
398
- style={{
399
- width: '100%',
400
- borderWidth: 1,
401
- borderColor: 'red',
402
- }}
403
- color="red"
404
- unstyled
405
- variant="outlined"
406
- />
407
- </GroupContainer>
408
- </ModalContainer>
409
- </ModalBackground>
410
- )}
411
- </>
590
+ </ModalContainerFullScreen>
412
591
  );
413
592
  };
414
593
 
594
+ const styles = StyleSheet.create({
595
+ screen: {
596
+ position: 'relative',
597
+ backgroundColor: '#F2F3F5',
598
+ },
599
+ scroll: {
600
+ width: '100%',
601
+ flex: 1,
602
+ },
603
+ scrollContent: {
604
+ paddingBottom: 32,
605
+ },
606
+ body: {
607
+ padding: 12,
608
+ gap: 12,
609
+ },
610
+ card: {
611
+ backgroundColor: '#FFFFFF',
612
+ borderRadius: 14,
613
+ padding: 16,
614
+ shadowColor: '#000',
615
+ shadowOffset: { width: 0, height: 1 },
616
+ shadowOpacity: 0.05,
617
+ shadowRadius: 4,
618
+ elevation: 1,
619
+ },
620
+ cardLabel: {
621
+ color: '#8C8C8C',
622
+ fontSize: 14,
623
+ },
624
+ cardValue: {
625
+ color: '#141414',
626
+ fontSize: 16,
627
+ marginTop: 4,
628
+ },
629
+ leaveButton: {
630
+ flexDirection: 'row',
631
+ alignItems: 'center',
632
+ gap: 6,
633
+ paddingHorizontal: 12,
634
+ paddingVertical: 7,
635
+ borderRadius: 18,
636
+ backgroundColor: 'rgba(0,0,0,0.35)',
637
+ },
638
+ leaveLabel: {
639
+ color: '#FFFFFF',
640
+ fontSize: 14,
641
+ fontWeight: '500',
642
+ },
643
+ tabsRow: {
644
+ flexDirection: 'row',
645
+ gap: 20,
646
+ borderBottomWidth: StyleSheet.hairlineWidth,
647
+ borderBottomColor: '#EFEFF2',
648
+ marginBottom: 12,
649
+ },
650
+ tab: {
651
+ flexDirection: 'row',
652
+ alignItems: 'center',
653
+ gap: 6,
654
+ paddingBottom: 10,
655
+ borderBottomWidth: 2,
656
+ borderBottomColor: 'transparent',
657
+ },
658
+ tabLabel: {
659
+ fontSize: 15,
660
+ fontWeight: '500',
661
+ color: '#8C8C8C',
662
+ },
663
+ tabBadge: {
664
+ minWidth: 20,
665
+ paddingHorizontal: 5,
666
+ paddingVertical: 1,
667
+ borderRadius: 10,
668
+ alignItems: 'center',
669
+ },
670
+ tabBadgeText: {
671
+ color: '#FFFFFF',
672
+ fontSize: 11,
673
+ fontWeight: '600',
674
+ },
675
+ languageRow: {
676
+ flexDirection: 'row',
677
+ alignItems: 'center',
678
+ justifyContent: 'space-between',
679
+ paddingVertical: 12,
680
+ },
681
+ languageLabel: {
682
+ fontSize: 16,
683
+ color: '#141414',
684
+ },
685
+ check: {
686
+ fontSize: 16,
687
+ fontWeight: '700',
688
+ },
689
+ mediaGrid: {
690
+ flexDirection: 'row',
691
+ flexWrap: 'wrap',
692
+ gap: 6,
693
+ },
694
+ mediaTile: {
695
+ width: '31.8%',
696
+ aspectRatio: 1,
697
+ borderRadius: 10,
698
+ overflow: 'hidden',
699
+ backgroundColor: '#EFEFF2',
700
+ },
701
+ mediaImage: {
702
+ width: '100%',
703
+ height: '100%',
704
+ },
705
+ documentRow: {
706
+ flexDirection: 'row',
707
+ alignItems: 'center',
708
+ gap: 14,
709
+ paddingVertical: 12,
710
+ },
711
+ documentText: {
712
+ flex: 1,
713
+ },
714
+ documentName: {
715
+ fontSize: 16,
716
+ color: '#141414',
717
+ },
718
+ documentDate: {
719
+ fontSize: 13,
720
+ color: '#8C8C8C',
721
+ marginTop: 2,
722
+ },
723
+ });
724
+
415
725
  export default UserProfileModal;