@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,42 +1,78 @@
1
- import React, { useEffect, useMemo, useState } from 'react';
1
+ /** @format */
2
+
3
+ import React, { useEffect, useMemo, useRef, useState } from 'react';
2
4
  import {
3
- CenterContainer,
4
- UserInfo,
5
- UserName,
6
- UserStatus,
7
- ModalContainerFullScreen,
8
- Label,
9
- BorderedContainer,
10
- LabelData,
11
- Viewider,
12
- Divider,
13
- } from '../styledModalComponents';
14
- import { Pressable, View, Text, ScrollView, Alert, Linking } from 'react-native';
15
- import ModalHeaderComponent from '../ModalHeaderComponent';
16
- import { ProfileImagePlaceholder } from '../../MainComponents/ProfileImagePlaceholder';
5
+ Alert,
6
+ Animated,
7
+ Keyboard,
8
+ Linking,
9
+ Pressable,
10
+ StyleSheet,
11
+ Text,
12
+ TextInput,
13
+ TouchableOpacity,
14
+ View,
15
+ } from 'react-native';
17
16
  import { useDispatch, useSelector } from 'react-redux';
17
+ import * as ImagePicker from 'expo-image-picker';
18
+ import { useFileToken } from '../../../hooks/useFileToken';
19
+ import { appendFileToken } from '../../../helpers/secureFileUrl';
20
+ import { ModalContainerFullScreen } from '../styledModalComponents';
21
+ import { ProfileImagePlaceholder } from '../../MainComponents/ProfileImagePlaceholder';
18
22
  import { RootState, getActiveRoom } from '../../../roomStore';
19
23
  import { uploadFile } from '../../../networking/api-requests/auth.api';
20
24
  import { useXmppClient } from '../../../context/xmppProvider';
21
- import { updateRoom } from '../../../roomStore/roomsSlice';
22
- import * as ImagePicker from 'expo-image-picker';
25
+ import { deleteRoom, updateRoom } from '../../../roomStore/roomsSlice';
23
26
  import Loader from '../../styled/Loader';
24
- import Button from '../../styled/Button';
25
- import { DeleteIcon, MoreIcon, QrIcon } from '../../../assets/icons';
26
- import Switch from '../../MainComponents/Switch';
27
+ import {
28
+ AddNewIcon,
29
+ DeleteIcon,
30
+ EditIcon,
31
+ LeaveIcon,
32
+ ReportIcon,
33
+ SearchIcon,
34
+ } from '../../../assets/icons';
27
35
  import { useChatSettingState } from '../../../hooks/useChatSettingState';
28
36
  import { chatTextStyle } from '../../../helpers/typography';
29
- import { useT } from '../../../i18n/useT';
30
37
  import { getElementFont } from '../../../helpers/getElementFont';
38
+ import { getIconColor } from '../../../helpers/getIconColor';
31
39
  import { deleteRoomMember } from '../../../networking/api-requests/rooms.api';
32
40
  import { RoomMember } from '../../../types/models/room.model';
33
41
  import { setActiveModal, setSelectedUser } from '../../../roomStore/chatSettingsSlice';
34
42
  import { MODAL_TYPES } from '../../../helpers/constants/MODAL_TYPES';
35
- import DropdownMenu, { MenuOption } from '../../DropdownMenu/DropdownMenu';
36
43
  import SelectUsersModal from '../SelectUsersModal/SelectUsersModal';
37
44
  import { useToast } from '../../../context/ToastContext';
45
+ import { useT } from '../../../i18n/useT';
38
46
  import DeleteChatModal from './DeleteChatModal';
47
+ import ReportChatModal from './ReportChatModal';
48
+ import {
49
+ ProfileHero,
50
+ ProfileTopBar,
51
+ HeroAction,
52
+ useHeaderMetrics,
53
+ } from '../ProfileHeader/ProfileHeader';
54
+ import ProfileMenu, { ProfileMenuItem } from '../ProfileHeader/ProfileMenu';
39
55
 
56
+ /**
57
+ * Where the header should sit when search opens: tucked away at the
58
+ * collapsed offset when the picture is still expanded, and left exactly
59
+ * where it is when the user already scrolled it away.
60
+ */
61
+ export const searchScrollTarget = (
62
+ isCollapsed: boolean,
63
+ collapseDistance: number
64
+ ): number | null => (isCollapsed ? null : collapseDistance);
65
+
66
+ /** Two uppercase letters for a chat without a picture, same rule the
67
+ * avatar placeholder uses for people. */
68
+ export const chatInitials = (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
+ };
40
76
 
41
77
  interface ChatProfileModalProps {
42
78
  handleCloseModal: any;
@@ -45,32 +81,37 @@ interface ChatProfileModalProps {
45
81
  const ChatProfileModal: React.FC<ChatProfileModalProps> = ({
46
82
  handleCloseModal,
47
83
  }) => {
84
+ const t = useT();
48
85
  const [loading, setLoading] = useState<boolean>(false);
49
- const [visible, setVisible] = useState<boolean>(false);
50
- const [isModalOpen, setIsModalOpen] = useState(false);
86
+ const [isDeleteOpen, setIsDeleteOpen] = useState(false);
87
+ const [isReportOpen, setIsReportOpen] = useState(false);
88
+ const [memberQuery, setMemberQuery] = useState('');
89
+ const [isSearchOpen, setIsSearchOpen] = useState(false);
90
+ // Measured, not guessed: this screen renders inside whatever frame the
91
+ // host gives it (the demo app keeps its own tab bar above), so the
92
+ // window height would overshoot.
93
+ const [viewportHeight, setViewportHeight] = useState(0);
51
94
 
52
95
  const { showToast } = useToast();
53
- const t = useT();
54
-
55
- const chatMenuOptions = useMemo(
56
- () => [
57
- {
58
- label: t('action.deleteChat'),
59
- icon: <DeleteIcon />,
60
- onClick: () => {
61
- setIsModalOpen(true);
62
- },
63
- styles: { color: 'red' },
64
- },
65
- ],
66
- [t]
67
- );
68
-
69
96
  const dispatch = useDispatch();
70
-
71
97
  const { client } = useXmppClient();
72
98
  const { user: stateUser, config } = useChatSettingState();
73
99
  const activeRoom = useSelector((state: RootState) => getActiveRoom(state));
100
+ const fileToken = useFileToken();
101
+
102
+ // Drives both the hero's parallax and the collapsed bar's fade-in. One
103
+ // shared value, written natively by the ScrollView.
104
+ const scrollY = useRef(new Animated.Value(0)).current;
105
+ const scrollRef = useRef<any>(null);
106
+ const searchInputRef = useRef<TextInput>(null);
107
+ const { collapseDistance } = useHeaderMetrics();
108
+ // `scrollY` is driven natively, so its value can't be read back with
109
+ // addListener. The Animated.event's `listener` still fires on the JS
110
+ // side, which is enough to know which state the header is in.
111
+ const [isCollapsed, setIsCollapsed] = useState(false);
112
+ // Set when search collapsed the header itself, so only then does
113
+ // dismissing search (or the keyboard) expand it again.
114
+ const collapsedForSearchRef = useRef(false);
74
115
 
75
116
  // Pull live member list from the MUC when the modal opens — REST
76
117
  // hydration only fills the *count* (item.participants /
@@ -86,6 +127,12 @@ const ChatProfileModal: React.FC<ChatProfileModalProps> = ({
86
127
  }
87
128
  }, [client, activeRoom?.jid]);
88
129
 
130
+ useEffect(() => {
131
+ if (!activeRoom) {
132
+ dispatch(setActiveModal(undefined));
133
+ }
134
+ }, [activeRoom, dispatch]);
135
+
89
136
  const onUpload = async () => {
90
137
  let loadingSet = false;
91
138
  try {
@@ -171,7 +218,13 @@ const ChatProfileModal: React.FC<ChatProfileModalProps> = ({
171
218
  }
172
219
  };
173
220
 
174
- const handleDeleteUser = async (userId: string) => {
221
+ const onRemoveIcon = () => {
222
+ client?.setRoomImageStanza(activeRoom?.jid || '', '', 'icon', 'none');
223
+ dispatch(updateRoom({ jid: activeRoom?.jid || '', updates: { icon: null } }));
224
+ };
225
+
226
+ const handleDeleteUser = async (user: RoomMember) => {
227
+ const userId = user.xmppUsername;
175
228
  try {
176
229
  await deleteRoomMember({
177
230
  roomId: activeRoom?.jid?.split('@')[0] || '',
@@ -183,7 +236,7 @@ const ChatProfileModal: React.FC<ChatProfileModalProps> = ({
183
236
  jid: activeRoom?.jid || '',
184
237
  updates: {
185
238
  roomMembers: activeRoom?.roomMembers?.filter(
186
- (user) => user.xmppUsername !== userId
239
+ (member) => member.xmppUsername !== userId
187
240
  ),
188
241
  },
189
242
  })
@@ -206,9 +259,19 @@ const ChatProfileModal: React.FC<ChatProfileModalProps> = ({
206
259
  }
207
260
  };
208
261
 
209
- const onRemoveClick = async () => {
210
- client?.setRoomImageStanza(activeRoom?.jid || '', '', 'icon', 'none');
211
- dispatch(updateRoom({ jid: activeRoom?.jid || '', updates: { icon: null } }));
262
+ const confirmRemoveMember = (user: RoomMember) => {
263
+ Alert.alert(
264
+ t('modal.chatProfile.removeMember'),
265
+ `${user.firstName} ${user.lastName}`.trim(),
266
+ [
267
+ { text: t('action.cancel'), style: 'cancel' },
268
+ {
269
+ text: t('action.delete'),
270
+ style: 'destructive',
271
+ onPress: () => handleDeleteUser(user),
272
+ },
273
+ ]
274
+ );
212
275
  };
213
276
 
214
277
  const handleUserAvatarClick = (user: RoomMember): void => {
@@ -226,272 +289,527 @@ const ChatProfileModal: React.FC<ChatProfileModalProps> = ({
226
289
  );
227
290
  };
228
291
 
229
- const menuOptions = useMemo(
230
- () => (userId: string) => [
292
+ // Leaving is XMPP-side (an unavailable presence to the MUC); dropping the
293
+ // room from the store is what actually takes the user out of the chat in
294
+ // the UI, and the `!activeRoom` effect above then closes this modal.
295
+ const handleLeave = () => {
296
+ Alert.alert(t('modal.leaveChat.title'), t('modal.leaveChat.description'), [
297
+ { text: t('action.cancel'), style: 'cancel' },
231
298
  {
232
- label: t('action.appointAsAdmin'),
233
- icon: null,
234
- onClick: () => {
235
- dispatch(setActiveModal(MODAL_TYPES.PROFILE));
236
- console.log('Profile clicked');
299
+ text: t('action.leave'),
300
+ style: 'destructive',
301
+ onPress: () => {
302
+ try {
303
+ client?.leaveTheRoomStanza?.(activeRoom?.jid || '');
304
+ } catch (error) {
305
+ console.error('Failed to leave the room:', error);
306
+ }
307
+ dispatch(deleteRoom({ jid: activeRoom?.jid || '' }));
308
+ handleCloseModal?.();
237
309
  },
238
310
  },
311
+ ]);
312
+ };
313
+
314
+ const isModerator = activeRoom?.role === 'moderator';
315
+ const canEditIcon =
316
+ !config?.disableChatInfo?.disableIconEdit && activeRoom?.role !== 'participant';
317
+ const canAddMembers = isModerator && activeRoom?.type === 'group';
318
+ const canDeleteChat = isModerator && activeRoom?.type !== 'private';
319
+ const hasIcon = !!activeRoom?.icon;
320
+
321
+ const scrollHeaderTo = (y: number) =>
322
+ scrollRef.current?.scrollTo?.({ y, animated: true });
323
+
324
+ // Opening search from an expanded header tucks the picture away so the
325
+ // results and the keyboard have room; from an already-collapsed header
326
+ // it just opens the field. Whatever it collapsed, it puts back.
327
+ const openMemberSearch = () => {
328
+ const target = searchScrollTarget(isCollapsed, collapseDistance);
329
+ if (target !== null) {
330
+ collapsedForSearchRef.current = true;
331
+ scrollHeaderTo(target);
332
+ }
333
+ setIsSearchOpen(true);
334
+ setTimeout(() => searchInputRef.current?.focus(), 50);
335
+ };
336
+
337
+ const restoreHeader = () => {
338
+ if (!collapsedForSearchRef.current) {return;}
339
+ collapsedForSearchRef.current = false;
340
+ scrollHeaderTo(0);
341
+ };
342
+
343
+ const closeMemberSearch = () => {
344
+ setMemberQuery('');
345
+ setIsSearchOpen(false);
346
+ Keyboard.dismiss();
347
+ restoreHeader();
348
+ };
349
+
350
+ // Putting the keyboard away is the other way out of search, so it
351
+ // restores the header too — the field stays, results and all.
352
+ useEffect(() => {
353
+ if (!isSearchOpen) {return undefined;}
354
+ const sub = Keyboard.addListener('keyboardDidHide', restoreHeader);
355
+ return () => sub.remove();
356
+ }, [isSearchOpen]); // eslint-disable-line react-hooks/exhaustive-deps
357
+
358
+ const heroActions: HeroAction[] = useMemo(
359
+ () => [
239
360
  {
240
- label: t('action.unban'),
241
- icon: null,
242
- onClick: () => {
243
- dispatch(setActiveModal(MODAL_TYPES.SETTINGS));
244
- console.log('Settings clicked');
245
- },
361
+ key: 'search',
362
+ label: t('action.search'),
363
+ icon: (color: string) => <SearchIcon color={color} />,
364
+ onPress: openMemberSearch,
246
365
  },
247
366
  {
248
- label: t('action.delete'),
249
- icon: null,
250
- onClick: (e: any) => {
251
- e?.preventDefault();
252
- handleDeleteUser(userId);
253
- },
367
+ key: 'leave',
368
+ label: t('action.leave'),
369
+ icon: (color: string) => <LeaveIcon color={color} />,
370
+ onPress: handleLeave,
371
+ },
372
+ {
373
+ key: 'report',
374
+ label: t('action.report'),
375
+ icon: (color: string) => <ReportIcon color={color} />,
376
+ onPress: () => setIsReportOpen(true),
254
377
  },
255
378
  ],
256
- [t]
379
+ [t, activeRoom?.jid] // eslint-disable-line react-hooks/exhaustive-deps
257
380
  );
258
381
 
259
- useEffect(() => {
260
- if (!activeRoom) {
261
- dispatch(setActiveModal(undefined));
382
+ // "…" menu. Edit is the chat picture — the only chat detail this SDK can
383
+ // actually change (there is no update-chat endpoint for title/description),
384
+ // so it is only offered when the picture is editable.
385
+ const menuItems: ProfileMenuItem[] = useMemo(() => {
386
+ const items: ProfileMenuItem[] = [];
387
+ if (canEditIcon) {
388
+ items.push({
389
+ key: 'edit',
390
+ label: t('action.edit'),
391
+ icon: <EditIcon color="#141414" width={18} height={18} />,
392
+ onPress: onUpload,
393
+ });
394
+ if (hasIcon) {
395
+ items.push({
396
+ key: 'remove-photo',
397
+ label: t('modal.chatProfile.removePhoto'),
398
+ icon: <DeleteIcon width={18} height={18} />,
399
+ onPress: onRemoveIcon,
400
+ });
401
+ }
262
402
  }
263
- }, [activeRoom, dispatch]);
403
+ // The hero's Search button is off-screen once collapsed, so the menu
404
+ // carries it — the design's collapsed menu does the same.
405
+ if (isCollapsed) {
406
+ items.push({
407
+ key: 'search',
408
+ label: t('action.search'),
409
+ icon: <SearchIcon color="#141414" width={18} height={18} />,
410
+ onPress: openMemberSearch,
411
+ });
412
+ }
413
+ items.push({
414
+ key: 'report',
415
+ label: t('action.report'),
416
+ icon: <ReportIcon color="#141414" width={18} height={18} />,
417
+ onPress: () => setIsReportOpen(true),
418
+ });
419
+ if (canDeleteChat) {
420
+ items.push({
421
+ key: 'delete-and-leave',
422
+ label: t('action.deleteAndLeave'),
423
+ icon: <DeleteIcon width={18} height={18} />,
424
+ destructive: true,
425
+ onPress: () => setIsDeleteOpen(true),
426
+ });
427
+ }
428
+ return items;
429
+ }, [canEditIcon, canDeleteChat, hasIcon, isCollapsed, t]); // eslint-disable-line react-hooks/exhaustive-deps
264
430
 
265
431
  if (!activeRoom) {
266
432
  return null;
267
433
  }
268
434
 
435
+ const title = activeRoom.title || activeRoom.name;
436
+ const memberCount = activeRoom.usersCnt ?? 0;
437
+ const subtitle = t(
438
+ memberCount === 1
439
+ ? 'modal.chatProfile.memberCountSingular'
440
+ : 'modal.chatProfile.memberCountPlural',
441
+ { count: memberCount }
442
+ );
443
+ const heroImage = appendFileToken(activeRoom.icon, fileToken) || null;
444
+ // A single flat colour behind the initials — the config's avatar colour
445
+ // when set, otherwise the primary. (The old per-name hash colour is what
446
+ // made the header read as two different greens next to the members' own
447
+ // avatars.)
448
+ const heroColor = config?.colors?.avatar || getIconColor(config);
449
+ const members = activeRoom.roomMembers ?? [];
450
+ const query = memberQuery.trim().toLowerCase();
451
+ const visibleMembers = query
452
+ ? members.filter((user) =>
453
+ `${user.firstName ?? ''} ${user.lastName ?? ''}`
454
+ .toLowerCase()
455
+ .includes(query)
456
+ )
457
+ : members;
458
+
269
459
  return (
270
- <ModalContainerFullScreen style={{ position: 'relative' }}>
271
- <ModalHeaderComponent
272
- handleCloseModal={handleCloseModal}
273
- headerTitle={t('modal.chatProfile.title')}
274
- titleStyle={chatTextStyle(config?.typography?.profile?.screenTitle)}
275
- rightMenu={
276
- <>
277
- {activeRoom?.type === 'public' && (
278
- <Button EndIcon={<QrIcon />} onPress={() => setVisible(true)} />
279
- )}
280
- {activeRoom.role === 'moderator' &&
281
- activeRoom.type !== 'private' && (
282
- <DropdownMenu
283
- position="right"
284
- options={chatMenuOptions}
285
- openButton={
286
- <Button
287
- style={{ padding: 8, height: 40 }}
288
- EndIcon={<MoreIcon />}
289
- unstyled
290
- />
291
- }
460
+ <ModalContainerFullScreen style={styles.screen}>
461
+ <Animated.ScrollView
462
+ ref={scrollRef}
463
+ style={styles.scroll}
464
+ // The collapsed state has to be reachable even when the member list
465
+ // is short: without this the content was shorter than the viewport,
466
+ // so the scroll had nowhere to go and simply bounced back.
467
+ contentContainerStyle={[
468
+ styles.scrollContent,
469
+ viewportHeight > 0 && {
470
+ minHeight: viewportHeight + collapseDistance,
471
+ },
472
+ ]}
473
+ onLayout={(e) => setViewportHeight(e.nativeEvent.layout.height)}
474
+ showsVerticalScrollIndicator={false}
475
+ keyboardShouldPersistTaps="handled"
476
+ scrollEventThrottle={16}
477
+ onScroll={Animated.event(
478
+ [{ nativeEvent: { contentOffset: { y: scrollY } } }],
479
+ {
480
+ useNativeDriver: true,
481
+ listener: (e: any) => {
482
+ const y = e?.nativeEvent?.contentOffset?.y ?? 0;
483
+ setIsCollapsed(y >= collapseDistance - 8);
484
+ },
485
+ }
486
+ )}
487
+ >
488
+ <ProfileHero
489
+ title={title}
490
+ subtitle={subtitle}
491
+ imageUri={heroImage}
492
+ fallbackColor={heroColor}
493
+ initials={chatInitials(title)}
494
+ scrollY={scrollY}
495
+ actions={heroActions}
496
+ titleStyle={chatTextStyle(config?.typography?.profile?.title)}
497
+ subtitleStyle={getElementFont(config, 'profileStatus')}
498
+ />
499
+
500
+ <View style={styles.body}>
501
+ {!config?.disableChatInfo?.disableDescription && (
502
+ <View style={styles.card}>
503
+ <Text style={[styles.cardLabel, getElementFont(config, 'profileSectionLabel')]}>
504
+ {t('modal.chatProfile.description')}
505
+ </Text>
506
+ <Text style={styles.cardValue}>{activeRoom.description || '—'}</Text>
507
+ </View>
508
+ )}
509
+
510
+ {!config?.disableChatInfo?.disableType && (
511
+ <View style={styles.card}>
512
+ <Text style={[styles.cardLabel, getElementFont(config, 'profileSectionLabel')]}>
513
+ {t('modal.chatProfile.chatType')}
514
+ </Text>
515
+ <Text style={styles.cardValue}>{activeRoom.type || '—'}</Text>
516
+ </View>
517
+ )}
518
+
519
+ {!config?.disableChatInfo?.hideMembers && (
520
+ <View style={styles.card}>
521
+ {canAddMembers && (
522
+ <SelectUsersModal
523
+ trigger={(open) => (
524
+ <TouchableOpacity
525
+ testID="chat-profile-add-members"
526
+ activeOpacity={0.7}
527
+ style={styles.addMembersRow}
528
+ onPress={open}
529
+ >
530
+ <AddNewIcon color={getIconColor(config)} />
531
+ <Text style={styles.addMembersLabel}>
532
+ {t('modal.chatProfile.addMembers')}
533
+ </Text>
534
+ </TouchableOpacity>
535
+ )}
292
536
  />
293
537
  )}
294
- </>
295
- }
296
- />
297
- <CenterContainer>
298
- <ProfileImagePlaceholder
299
- name={activeRoom.title || activeRoom.name}
300
- icon={activeRoom.icon}
301
- // Two gates control whether the icon is editable:
302
- // 1. role — only non-participants could edit before.
303
- // 2. NEW: `disableChatInfo.disableIconEdit` — hard kill from
304
- // config so a consumer can make the icon read-only for
305
- // everyone (e.g. branded rooms, patient-facing apps).
306
- // Both must allow it for the picker/remove affordances to show.
307
- upload={{
308
- onUpload,
309
- active:
310
- !config?.disableChatInfo?.disableIconEdit &&
311
- activeRoom?.role !== 'participant',
312
- }}
313
- remove={{
314
- enabled: !config?.disableChatInfo?.disableIconEdit,
315
- onRemoveClick,
316
- }}
317
- role={activeRoom?.role}
318
- size={128}
319
- />
320
- <UserInfo>
321
- <UserName
322
- fontSize={config?.typography?.profile?.title?.fontSize}
323
- fontWeight={config?.typography?.profile?.title?.fontWeight as any}
324
- >
325
- {activeRoom.title || activeRoom.name}
326
- </UserName>
327
- <UserStatus style={getElementFont(config, 'profileStatus')}>
328
- {t(
329
- activeRoom.usersCnt > 1
330
- ? 'modal.chatProfile.memberCountPlural'
331
- : 'modal.chatProfile.memberCountSingular',
332
- { count: activeRoom.usersCnt }
333
- )}
334
- </UserStatus>
335
- </UserInfo>
336
- {activeRoom.role === 'moderator' && activeRoom.type === 'group' && (
337
- <>
338
- {/* <AddMembersModal /> */}
339
- <SelectUsersModal />
340
- </>
341
- )}
342
- {!config?.disableChatInfo?.disableDescription && (
343
- <BorderedContainer>
344
- <LabelData style={getElementFont(config, 'profileSectionLabel')}>
345
- {t('modal.chatProfile.description')}
346
- </LabelData>
347
- <Label>{activeRoom?.description || '—'}</Label>
348
- </BorderedContainer>
349
- )}
350
- {!config?.disableChatInfo?.disableType && (
351
- <BorderedContainer>
352
- <LabelData style={getElementFont(config, 'profileSectionLabel')}>
353
- {t('modal.chatProfile.chatType')}
354
- </LabelData>
355
- <Label>{activeRoom.type || '—'}</Label>
356
- </BorderedContainer>
357
- )}
358
- {/* <BorderedContainer
359
- style={{
360
- justifyContent: 'space-between',
361
- flexDirection: 'row',
362
- alignItems: 'center',
363
- }}
364
- >
365
- <Label>Notifications</Label>
366
- <Label>
367
- <Switch
368
- onToggle={function (isOn: boolean): void {
369
- throw new Error('Function not implemented.');
370
- }}
371
- bgColor={config?.colors?.primary}
372
- />
373
- </Label>
374
- </BorderedContainer> */}
375
- {!config?.disableChatInfo?.hideMembers && (
376
- <BorderedContainer style={{ paddingHorizontal: 16, paddingVertical: 8 }}>
377
- {loading ? (
378
- <Loader />
379
- ) : (activeRoom?.roomMembers?.length ?? 0) === 0 ? (
380
- <Label style={{ opacity: 0.6, textAlign: 'center', paddingVertical: 8 }}>
381
- {t('modal.chatProfile.memberListUnavailable')}
382
- </Label>
383
- ) : (
384
- <ScrollView
385
- style={{ maxHeight: 400 }}
386
- showsVerticalScrollIndicator={true}
387
- nestedScrollEnabled={true}
388
- >
389
- {activeRoom?.roomMembers?.map((user, index) => (
390
- <View
391
- key={user.xmppUsername}
392
- style={{
393
- flexDirection: 'column',
394
- alignItems: 'flex-start',
395
- }}
396
- >
397
- <View
398
- style={{
399
- flexDirection: 'row',
400
- justifyContent: 'flex-start',
401
- paddingHorizontal: 8,
402
- paddingVertical: 0,
403
- alignItems: 'center',
404
- width: '100%',
405
- }}
538
+
539
+ <Text
540
+ style={[
541
+ styles.cardLabel,
542
+ getElementFont(config, 'profileSectionLabel'),
543
+ ]}
544
+ >
545
+ {t('modal.chatProfile.membersLabel', { count: memberCount })}
546
+ </Text>
547
+
548
+ {isSearchOpen && (
549
+ <View style={styles.searchRow}>
550
+ <SearchIcon color="#8C8C8C" width={18} height={18} />
551
+ <TextInput
552
+ testID="chat-profile-member-search"
553
+ ref={searchInputRef}
554
+ style={styles.searchInput}
555
+ value={memberQuery}
556
+ onChangeText={setMemberQuery}
557
+ placeholder={t('search.members')}
558
+ placeholderTextColor="#8C8C8C"
559
+ autoCorrect={false}
560
+ returnKeyType="search"
561
+ />
562
+ <TouchableOpacity
563
+ testID="chat-profile-search-close"
564
+ activeOpacity={0.7}
565
+ hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
566
+ onPress={closeMemberSearch}
406
567
  >
407
- <Pressable
408
- style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start', gap: 16 }}
409
- // `disableChatInfo.disableMemberTap` blocks the
410
- // tap entirely so the user-profile popup never
411
- // opens. `disableMemberProfileActions` only hid
412
- // the action buttons INSIDE that popup, leaving
413
- // the popup itself to open on tap — this gate
414
- // closes the door. Customer-reported #16.
415
- onPress={
416
- config?.disableChatInfo?.disableMemberTap
417
- ? undefined
418
- : () => handleUserAvatarClick(user)
419
- }
420
- disabled={!!config?.disableChatInfo?.disableMemberTap}
568
+ <Text style={styles.searchClose}>×</Text>
569
+ </TouchableOpacity>
570
+ </View>
571
+ )}
572
+
573
+ {loading ? (
574
+ <Loader />
575
+ ) : visibleMembers.length === 0 ? (
576
+ <Text testID="chat-profile-members-empty" style={styles.emptyMembers}>
577
+ {members.length === 0
578
+ ? t('modal.chatProfile.membersUnavailable')
579
+ : t('search.noResults')}
580
+ </Text>
581
+ ) : (
582
+ visibleMembers.map((user, index) => {
583
+ const banned = user.ban_status === 'banned';
584
+ const roleLabel =
585
+ user.role && user.role !== 'none' && user.role !== 'participant'
586
+ ? user.role
587
+ : null;
588
+ return (
589
+ <View
590
+ key={user.xmppUsername}
591
+ style={[styles.memberRow, index > 0 && styles.memberDivider]}
421
592
  >
422
- <ProfileImagePlaceholder
423
- name={`${user.firstName} ${user.lastName}`}
424
- size={40}
425
- />
426
- <View
427
- style={{
428
- flexDirection: 'column',
429
- gap: 2,
430
- alignItems: 'flex-start',
431
- justifyContent: 'center',
432
- }}
593
+ <Pressable
594
+ style={styles.memberMain}
595
+ // `disableChatInfo.disableMemberTap` blocks the tap
596
+ // entirely so the user-profile popup never opens.
597
+ // `disableMemberProfileActions` only hid the action
598
+ // buttons INSIDE that popup, leaving the popup itself
599
+ // to open on tap — this gate closes the door.
600
+ // Customer-reported #16.
601
+ onPress={
602
+ config?.disableChatInfo?.disableMemberTap
603
+ ? undefined
604
+ : () => handleUserAvatarClick(user)
605
+ }
606
+ disabled={!!config?.disableChatInfo?.disableMemberTap}
433
607
  >
434
- <Label
435
- style={[
436
- { fontSize: 16, fontWeight: 600 },
437
- chatTextStyle(config?.typography?.profile?.memberName),
438
- ]}
439
- >
440
- {user.firstName} {user.lastName}
441
- </Label>
442
- {user.last_active && (
443
- <LabelData style={getElementFont(config, 'profileSectionLabel')}>
444
- {new Date(user.last_active * 1000).toLocaleString()}
445
- </LabelData>
446
- )}
447
- </View>
448
- </Pressable>
449
- {user.role && user.role !== 'none' && (
450
- <Text
451
- style={{
452
- backgroundColor:
453
- user.ban_status !== 'banned' ? '#F3F6FC' : '#FFEBEE',
454
- color:
455
- user.ban_status !== 'banned' ? '#0052CD' : '#F44336',
456
- padding: 5,
457
- borderRadius: 16,
458
- fontSize: 12,
459
- }}
460
- >
461
- {user.role}
462
- </Text>
463
- )}
464
- {stateUser.xmppUsername !== user.xmppUsername &&
465
- activeRoom.role === 'moderator' &&
466
- activeRoom.type !== 'private' && (
467
- <DropdownMenu
468
- options={menuOptions(user.xmppUsername) as MenuOption[]}
469
- openButton={
470
- <Button
471
- onPress={() => {}}
472
- >
473
- <Text>{t('action.moreOptions')}</Text>
474
- </Button>
475
- }
476
- onClose={() => console.log('Dropdown closed')}
608
+ <ProfileImagePlaceholder
609
+ name={`${user.firstName} ${user.lastName}`}
610
+ size={40}
477
611
  />
612
+ <View style={styles.memberText}>
613
+ <Text
614
+ numberOfLines={1}
615
+ style={[
616
+ styles.memberName,
617
+ chatTextStyle(config?.typography?.profile?.memberName),
618
+ ]}
619
+ >
620
+ {user.firstName} {user.lastName}
621
+ </Text>
622
+ {!!user.last_active && (
623
+ <Text
624
+ numberOfLines={1}
625
+ style={[
626
+ styles.memberStatus,
627
+ getElementFont(config, 'profileSectionLabel'),
628
+ ]}
629
+ >
630
+ {new Date(user.last_active * 1000).toLocaleString()}
631
+ </Text>
632
+ )}
633
+ </View>
634
+ </Pressable>
635
+
636
+ {(banned || roleLabel) && (
637
+ <Text
638
+ style={[styles.memberRole, banned && styles.memberBanned]}
639
+ >
640
+ {banned ? t('status.banned') : roleLabel}
641
+ </Text>
478
642
  )}
479
- </View>
480
- {index < (activeRoom?.roomMembers?.length || 0) - 1 && <Divider />}
481
- </View>
482
- ))}
483
- </ScrollView>
643
+
644
+ {isModerator &&
645
+ activeRoom.type !== 'private' &&
646
+ stateUser.xmppUsername !== user.xmppUsername && (
647
+ <TouchableOpacity
648
+ testID={`chat-profile-remove-${user.xmppUsername}`}
649
+ activeOpacity={0.7}
650
+ hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
651
+ style={styles.memberRemove}
652
+ onPress={() => confirmRemoveMember(user)}
653
+ >
654
+ <DeleteIcon width={20} height={20} />
655
+ </TouchableOpacity>
656
+ )}
657
+ </View>
658
+ );
659
+ })
660
+ )}
661
+ </View>
484
662
  )}
485
- </BorderedContainer>
486
- )}
487
- </CenterContainer>
663
+ </View>
664
+ </Animated.ScrollView>
665
+
666
+ <ProfileTopBar
667
+ title={title}
668
+ subtitle={subtitle}
669
+ imageUri={heroImage}
670
+ fallbackColor={heroColor}
671
+ initials={chatInitials(title)}
672
+ scrollY={scrollY}
673
+ onBack={handleCloseModal}
674
+ titleStyle={chatTextStyle(config?.typography?.profile?.screenTitle)}
675
+ menu={<ProfileMenu items={menuItems} />}
676
+ />
488
677
 
489
678
  <DeleteChatModal
490
- isModalOpen={isModalOpen}
491
- setIsModalOpen={setIsModalOpen}
679
+ isModalOpen={isDeleteOpen}
680
+ setIsModalOpen={setIsDeleteOpen}
681
+ />
682
+ <ReportChatModal
683
+ visible={isReportOpen}
684
+ onClose={() => setIsReportOpen(false)}
492
685
  />
493
686
  </ModalContainerFullScreen>
494
687
  );
495
688
  };
496
689
 
690
+ const styles = StyleSheet.create({
691
+ screen: {
692
+ position: 'relative',
693
+ backgroundColor: '#F2F3F5',
694
+ },
695
+ scroll: {
696
+ width: '100%',
697
+ flex: 1,
698
+ },
699
+ scrollContent: {
700
+ paddingBottom: 32,
701
+ },
702
+ body: {
703
+ padding: 12,
704
+ gap: 12,
705
+ },
706
+ card: {
707
+ backgroundColor: '#FFFFFF',
708
+ borderRadius: 14,
709
+ padding: 16,
710
+ shadowColor: '#000',
711
+ shadowOffset: { width: 0, height: 1 },
712
+ shadowOpacity: 0.05,
713
+ shadowRadius: 4,
714
+ elevation: 1,
715
+ },
716
+ cardLabel: {
717
+ color: '#8C8C8C',
718
+ fontSize: 14,
719
+ },
720
+ cardValue: {
721
+ color: '#141414',
722
+ fontSize: 16,
723
+ marginTop: 4,
724
+ },
725
+ addMembersRow: {
726
+ flexDirection: 'row',
727
+ alignItems: 'center',
728
+ gap: 12,
729
+ paddingBottom: 14,
730
+ marginBottom: 10,
731
+ borderBottomWidth: StyleSheet.hairlineWidth,
732
+ borderBottomColor: '#EFEFF2',
733
+ },
734
+ addMembersLabel: {
735
+ fontSize: 16,
736
+ fontWeight: '500',
737
+ color: '#141414',
738
+ },
739
+ searchRow: {
740
+ flexDirection: 'row',
741
+ alignItems: 'center',
742
+ gap: 8,
743
+ marginTop: 10,
744
+ paddingHorizontal: 12,
745
+ height: 40,
746
+ borderRadius: 12,
747
+ backgroundColor: '#F2F3F5',
748
+ },
749
+ searchInput: {
750
+ flex: 1,
751
+ fontSize: 15,
752
+ color: '#141414',
753
+ padding: 0,
754
+ },
755
+ searchClose: {
756
+ fontSize: 22,
757
+ lineHeight: 24,
758
+ color: '#8C8C8C',
759
+ },
760
+ emptyMembers: {
761
+ opacity: 0.6,
762
+ textAlign: 'center',
763
+ paddingVertical: 8,
764
+ color: '#141414',
765
+ },
766
+ memberRow: {
767
+ flexDirection: 'row',
768
+ alignItems: 'center',
769
+ paddingVertical: 10,
770
+ },
771
+ memberDivider: {
772
+ borderTopWidth: StyleSheet.hairlineWidth,
773
+ borderTopColor: '#EFEFF2',
774
+ },
775
+ memberMain: {
776
+ flex: 1,
777
+ flexDirection: 'row',
778
+ alignItems: 'center',
779
+ gap: 12,
780
+ },
781
+ memberText: {
782
+ flex: 1,
783
+ },
784
+ memberName: {
785
+ fontSize: 16,
786
+ fontWeight: '600',
787
+ color: '#141414',
788
+ },
789
+ memberStatus: {
790
+ fontSize: 13,
791
+ color: '#8C8C8C',
792
+ marginTop: 2,
793
+ },
794
+ memberRole: {
795
+ fontSize: 13,
796
+ color: '#8C8C8C',
797
+ marginLeft: 8,
798
+ },
799
+ memberBanned: {
800
+ color: '#E53935',
801
+ },
802
+ memberRemove: {
803
+ marginLeft: 12,
804
+ },
805
+ menuButton: {
806
+ width: 40,
807
+ height: 40,
808
+ borderRadius: 20,
809
+ backgroundColor: 'rgba(0,0,0,0.28)',
810
+ alignItems: 'center',
811
+ justifyContent: 'center',
812
+ },
813
+ });
814
+
497
815
  export default ChatProfileModal;