@ethora/chat-component-rn 26.7.10 → 26.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (667) hide show
  1. package/CHANGELOG.md +0 -96
  2. package/README.md +10 -43
  3. package/lib/commonjs/assets/icons.js +2 -7
  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 +7 -26
  8. package/lib/commonjs/components/Header/HeaderRoomList.js.map +1 -1
  9. package/lib/commonjs/components/MainComponents/ChatHeader.js +3 -9
  10. package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
  11. package/lib/commonjs/components/MainComponents/ChatRoom.js +14 -150
  12. package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
  13. package/lib/commonjs/components/MainComponents/ChatWrapper.js +38 -34
  14. package/lib/commonjs/components/MainComponents/ChatWrapper.js.map +1 -1
  15. package/lib/commonjs/components/MainComponents/LoginWrapper.js +1 -2
  16. package/lib/commonjs/components/MainComponents/LoginWrapper.js.map +1 -1
  17. package/lib/commonjs/components/MainComponents/MediaMessage.js +9 -29
  18. package/lib/commonjs/components/MainComponents/MediaMessage.js.map +1 -1
  19. package/lib/commonjs/components/MainComponents/MessageContainer.js +1 -5
  20. package/lib/commonjs/components/MainComponents/MessageContainer.js.map +1 -1
  21. package/lib/commonjs/components/MainComponents/MessageList.js +5 -13
  22. package/lib/commonjs/components/MainComponents/MessageList.js.map +1 -1
  23. package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js +13 -14
  24. package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
  25. package/lib/commonjs/components/MainComponents/ReduxWrapper.js +24 -3
  26. package/lib/commonjs/components/MainComponents/ReduxWrapper.js.map +1 -1
  27. package/lib/commonjs/components/MainComponents/RoomList.js +35 -208
  28. package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
  29. package/lib/commonjs/components/Menu/HeaderRoomListMenu.js +98 -317
  30. package/lib/commonjs/components/Menu/HeaderRoomListMenu.js.map +1 -1
  31. package/lib/commonjs/components/MessageBubble/MessageTranslate.js +16 -7
  32. package/lib/commonjs/components/MessageBubble/MessageTranslate.js.map +1 -1
  33. package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js +112 -320
  34. package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
  35. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +215 -556
  36. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  37. package/lib/commonjs/components/Modals/ChatProfileModal/DeleteChatModal.js +9 -7
  38. package/lib/commonjs/components/Modals/ChatProfileModal/DeleteChatModal.js.map +1 -1
  39. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +27 -69
  40. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  41. package/lib/commonjs/components/Modals/FilePreviewModal/PdfView.js +1 -2
  42. package/lib/commonjs/components/Modals/FilePreviewModal/PdfView.js.map +1 -1
  43. package/lib/commonjs/components/Modals/Modal/Modal.js +0 -8
  44. package/lib/commonjs/components/Modals/Modal/Modal.js.map +1 -1
  45. package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js +1 -2
  46. package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js.map +1 -1
  47. package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js +109 -205
  48. package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
  49. package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js +0 -8
  50. package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
  51. package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js +2 -4
  52. package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
  53. package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js +21 -7
  54. package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
  55. package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js +244 -507
  56. package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
  57. package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js +46 -74
  58. package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
  59. package/lib/commonjs/components/Modals/styledModalComponents.js +2 -9
  60. package/lib/commonjs/components/Modals/styledModalComponents.js.map +1 -1
  61. package/lib/commonjs/components/RoomComponents/ChatRoomItem.js +39 -23
  62. package/lib/commonjs/components/RoomComponents/ChatRoomItem.js.map +1 -1
  63. package/lib/commonjs/components/RoomComponents/styled/LastMessageFile.js +3 -22
  64. package/lib/commonjs/components/RoomComponents/styled/LastMessageFile.js.map +1 -1
  65. package/lib/commonjs/components/RoomComponents/styled/LastMessagePhoto.js +3 -17
  66. package/lib/commonjs/components/RoomComponents/styled/LastMessagePhoto.js.map +1 -1
  67. package/lib/commonjs/components/RoomComponents/styled/LastMessageVideo.js +3 -17
  68. package/lib/commonjs/components/RoomComponents/styled/LastMessageVideo.js.map +1 -1
  69. package/lib/commonjs/components/VideoCalls/VideoCallSession.js +3 -6
  70. package/lib/commonjs/components/VideoCalls/VideoCallSession.js.map +1 -1
  71. package/lib/commonjs/components/styled/AudioMessage.js +1 -2
  72. package/lib/commonjs/components/styled/AudioMessage.js.map +1 -1
  73. package/lib/commonjs/components/styled/DateLabel.js +10 -3
  74. package/lib/commonjs/components/styled/DateLabel.js.map +1 -1
  75. package/lib/commonjs/components/styled/MessageImage.js +9 -37
  76. package/lib/commonjs/components/styled/MessageImage.js.map +1 -1
  77. package/lib/commonjs/components/styled/NewMessageLabel.js +3 -1
  78. package/lib/commonjs/components/styled/NewMessageLabel.js.map +1 -1
  79. package/lib/commonjs/components/styled/SendInput.js +17 -86
  80. package/lib/commonjs/components/styled/SendInput.js.map +1 -1
  81. package/lib/commonjs/components/styled/StyledComponents.js +3 -9
  82. package/lib/commonjs/components/styled/StyledComponents.js.map +1 -1
  83. package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js +4 -11
  84. package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
  85. package/lib/commonjs/components/styled/UnsupportedType.js +4 -14
  86. package/lib/commonjs/components/styled/UnsupportedType.js.map +1 -1
  87. package/lib/commonjs/components/styled/VideoMessage.js +61 -119
  88. package/lib/commonjs/components/styled/VideoMessage.js.map +1 -1
  89. package/lib/commonjs/context/xmppProvider.js +59 -177
  90. package/lib/commonjs/context/xmppProvider.js.map +1 -1
  91. package/lib/commonjs/helpers/createMessageFromXml.js +1 -19
  92. package/lib/commonjs/helpers/createMessageFromXml.js.map +1 -1
  93. package/lib/commonjs/helpers/ensureScopedChatCache.js +2 -2
  94. package/lib/commonjs/helpers/ensureScopedChatCache.js.map +1 -1
  95. package/lib/commonjs/helpers/getDataFromXml.js +24 -1
  96. package/lib/commonjs/helpers/getDataFromXml.js.map +1 -1
  97. package/lib/commonjs/helpers/historyPreloadScheduler.js +2 -65
  98. package/lib/commonjs/helpers/historyPreloadScheduler.js.map +1 -1
  99. package/lib/commonjs/helpers/initXmppRooms.js +8 -14
  100. package/lib/commonjs/helpers/initXmppRooms.js.map +1 -1
  101. package/lib/commonjs/helpers/insertMessageWithDelimiter.js +22 -51
  102. package/lib/commonjs/helpers/insertMessageWithDelimiter.js.map +1 -1
  103. package/lib/commonjs/helpers/isUnresolvedSenderId.js +6 -1
  104. package/lib/commonjs/helpers/isUnresolvedSenderId.js.map +1 -1
  105. package/lib/commonjs/helpers/keyboardLayout.js +2 -12
  106. package/lib/commonjs/helpers/keyboardLayout.js.map +1 -1
  107. package/lib/commonjs/helpers/mimeToExtension.js +14 -6
  108. package/lib/commonjs/helpers/mimeToExtension.js.map +1 -1
  109. package/lib/commonjs/helpers/resolveInitBeforeLoadUser.js +17 -130
  110. package/lib/commonjs/helpers/resolveInitBeforeLoadUser.js.map +1 -1
  111. package/lib/commonjs/helpers/resolveLangSource.js +38 -0
  112. package/lib/commonjs/helpers/resolveLangSource.js.map +1 -0
  113. package/lib/commonjs/helpers/xmppUsername.js +39 -0
  114. package/lib/commonjs/helpers/xmppUsername.js.map +1 -0
  115. package/lib/commonjs/hooks/useChatRoomFocus.js +12 -45
  116. package/lib/commonjs/hooks/useChatRoomFocus.js.map +1 -1
  117. package/lib/commonjs/hooks/useChatWrapperInit.js +14 -32
  118. package/lib/commonjs/hooks/useChatWrapperInit.js.map +1 -1
  119. package/lib/commonjs/hooks/useComposing.js +0 -27
  120. package/lib/commonjs/hooks/useComposing.js.map +1 -1
  121. package/lib/commonjs/hooks/useLogout.js +7 -23
  122. package/lib/commonjs/hooks/useLogout.js.map +1 -1
  123. package/lib/commonjs/hooks/usePendingNotification.js +11 -8
  124. package/lib/commonjs/hooks/usePendingNotification.js.map +1 -1
  125. package/lib/commonjs/hooks/useSendMessage.js +14 -50
  126. package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
  127. package/lib/commonjs/hooks/useUnreadMessagesCounter.js +1 -6
  128. package/lib/commonjs/hooks/useUnreadMessagesCounter.js.map +1 -1
  129. package/lib/commonjs/i18n/strings.js +133 -121
  130. package/lib/commonjs/i18n/strings.js.map +1 -1
  131. package/lib/commonjs/i18n/useT.js +1 -1
  132. package/lib/commonjs/main.js +0 -44
  133. package/lib/commonjs/main.js.map +1 -1
  134. package/lib/commonjs/networking/api-requests/auth.api.js +60 -134
  135. package/lib/commonjs/networking/api-requests/auth.api.js.map +1 -1
  136. package/lib/commonjs/networking/api-requests/roomMembers.api.js +1 -1
  137. package/lib/commonjs/networking/api-requests/roomMembers.api.js.map +1 -1
  138. package/lib/commonjs/networking/api-requests/rooms.api.js +9 -9
  139. package/lib/commonjs/networking/api-requests/rooms.api.js.map +1 -1
  140. package/lib/commonjs/networking/api-requests/user.api.js +9 -68
  141. package/lib/commonjs/networking/api-requests/user.api.js.map +1 -1
  142. package/lib/commonjs/networking/apiClient.js +112 -62
  143. package/lib/commonjs/networking/apiClient.js.map +1 -1
  144. package/lib/commonjs/networking/stanzaHandlers.js +51 -93
  145. package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
  146. package/lib/commonjs/networking/xmpp/flushLastViewedToPrivateStore.js +8 -46
  147. package/lib/commonjs/networking/xmpp/flushLastViewedToPrivateStore.js.map +1 -1
  148. package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js +1 -8
  149. package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
  150. package/lib/commonjs/networking/xmpp/subscribeToRoomMessages.xmpp.js +1 -5
  151. package/lib/commonjs/networking/xmpp/subscribeToRoomMessages.xmpp.js.map +1 -1
  152. package/lib/commonjs/networking/xmppClient.js +8 -124
  153. package/lib/commonjs/networking/xmppClient.js.map +1 -1
  154. package/lib/commonjs/roomStore/chatSettingsSlice.js +7 -26
  155. package/lib/commonjs/roomStore/chatSettingsSlice.js.map +1 -1
  156. package/lib/commonjs/roomStore/index.js +2 -35
  157. package/lib/commonjs/roomStore/index.js.map +1 -1
  158. package/lib/commonjs/roomStore/persistence.js +39 -226
  159. package/lib/commonjs/roomStore/persistence.js.map +1 -1
  160. package/lib/commonjs/roomStore/roomsSlice.js +38 -151
  161. package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
  162. package/lib/commonjs/services/pushSubscriptionService.js +13 -15
  163. package/lib/commonjs/services/pushSubscriptionService.js.map +1 -1
  164. package/lib/commonjs/version.js +3 -1
  165. package/lib/commonjs/version.js.map +1 -1
  166. package/lib/module/assets/icons.js +1 -6
  167. package/lib/module/assets/icons.js.map +1 -1
  168. package/lib/module/components/AuthForms/Login.js +4 -4
  169. package/lib/module/components/AuthForms/Login.js.map +1 -1
  170. package/lib/module/components/Header/HeaderRoomList.js +7 -26
  171. package/lib/module/components/Header/HeaderRoomList.js.map +1 -1
  172. package/lib/module/components/MainComponents/ChatHeader.js +3 -9
  173. package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
  174. package/lib/module/components/MainComponents/ChatRoom.js +16 -152
  175. package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
  176. package/lib/module/components/MainComponents/ChatWrapper.js +40 -36
  177. package/lib/module/components/MainComponents/ChatWrapper.js.map +1 -1
  178. package/lib/module/components/MainComponents/LoginWrapper.js +1 -2
  179. package/lib/module/components/MainComponents/LoginWrapper.js.map +1 -1
  180. package/lib/module/components/MainComponents/MediaMessage.js +10 -30
  181. package/lib/module/components/MainComponents/MediaMessage.js.map +1 -1
  182. package/lib/module/components/MainComponents/MessageContainer.js +1 -5
  183. package/lib/module/components/MainComponents/MessageContainer.js.map +1 -1
  184. package/lib/module/components/MainComponents/MessageList.js +5 -13
  185. package/lib/module/components/MainComponents/MessageList.js.map +1 -1
  186. package/lib/module/components/MainComponents/ProfileImagePlaceholder.js +13 -14
  187. package/lib/module/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
  188. package/lib/module/components/MainComponents/ReduxWrapper.js +26 -5
  189. package/lib/module/components/MainComponents/ReduxWrapper.js.map +1 -1
  190. package/lib/module/components/MainComponents/RoomList.js +35 -207
  191. package/lib/module/components/MainComponents/RoomList.js.map +1 -1
  192. package/lib/module/components/Menu/HeaderRoomListMenu.js +101 -319
  193. package/lib/module/components/Menu/HeaderRoomListMenu.js.map +1 -1
  194. package/lib/module/components/MessageBubble/MessageTranslate.js +16 -7
  195. package/lib/module/components/MessageBubble/MessageTranslate.js.map +1 -1
  196. package/lib/module/components/Modals/AttachSheet/AttachSheet.js +115 -311
  197. package/lib/module/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
  198. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +219 -559
  199. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  200. package/lib/module/components/Modals/ChatProfileModal/DeleteChatModal.js +9 -7
  201. package/lib/module/components/Modals/ChatProfileModal/DeleteChatModal.js.map +1 -1
  202. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +28 -70
  203. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  204. package/lib/module/components/Modals/FilePreviewModal/PdfView.js +1 -2
  205. package/lib/module/components/Modals/FilePreviewModal/PdfView.js.map +1 -1
  206. package/lib/module/components/Modals/Modal/Modal.js +1 -9
  207. package/lib/module/components/Modals/Modal/Modal.js.map +1 -1
  208. package/lib/module/components/Modals/NewChatModal/ModalContent.js +1 -2
  209. package/lib/module/components/Modals/NewChatModal/ModalContent.js.map +1 -1
  210. package/lib/module/components/Modals/NewChatModal/NewChatModal.js +111 -208
  211. package/lib/module/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
  212. package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js +0 -8
  213. package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
  214. package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js +2 -4
  215. package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
  216. package/lib/module/components/Modals/UserProfileModal/EditUserModal.js +23 -9
  217. package/lib/module/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
  218. package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js +248 -509
  219. package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
  220. package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js +48 -76
  221. package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
  222. package/lib/module/components/Modals/styledModalComponents.js +2 -9
  223. package/lib/module/components/Modals/styledModalComponents.js.map +1 -1
  224. package/lib/module/components/RoomComponents/ChatRoomItem.js +40 -24
  225. package/lib/module/components/RoomComponents/ChatRoomItem.js.map +1 -1
  226. package/lib/module/components/RoomComponents/styled/LastMessageFile.js +3 -22
  227. package/lib/module/components/RoomComponents/styled/LastMessageFile.js.map +1 -1
  228. package/lib/module/components/RoomComponents/styled/LastMessagePhoto.js +3 -17
  229. package/lib/module/components/RoomComponents/styled/LastMessagePhoto.js.map +1 -1
  230. package/lib/module/components/RoomComponents/styled/LastMessageVideo.js +3 -17
  231. package/lib/module/components/RoomComponents/styled/LastMessageVideo.js.map +1 -1
  232. package/lib/module/components/VideoCalls/VideoCallSession.js +3 -6
  233. package/lib/module/components/VideoCalls/VideoCallSession.js.map +1 -1
  234. package/lib/module/components/styled/AudioMessage.js +1 -2
  235. package/lib/module/components/styled/AudioMessage.js.map +1 -1
  236. package/lib/module/components/styled/DateLabel.js +10 -3
  237. package/lib/module/components/styled/DateLabel.js.map +1 -1
  238. package/lib/module/components/styled/MessageImage.js +9 -37
  239. package/lib/module/components/styled/MessageImage.js.map +1 -1
  240. package/lib/module/components/styled/NewMessageLabel.js +3 -1
  241. package/lib/module/components/styled/NewMessageLabel.js.map +1 -1
  242. package/lib/module/components/styled/SendInput.js +18 -87
  243. package/lib/module/components/styled/SendInput.js.map +1 -1
  244. package/lib/module/components/styled/StyledComponents.js +3 -9
  245. package/lib/module/components/styled/StyledComponents.js.map +1 -1
  246. package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js +4 -11
  247. package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
  248. package/lib/module/components/styled/UnsupportedType.js +4 -14
  249. package/lib/module/components/styled/UnsupportedType.js.map +1 -1
  250. package/lib/module/components/styled/VideoMessage.js +62 -120
  251. package/lib/module/components/styled/VideoMessage.js.map +1 -1
  252. package/lib/module/context/xmppProvider.js +60 -177
  253. package/lib/module/context/xmppProvider.js.map +1 -1
  254. package/lib/module/helpers/createMessageFromXml.js +1 -19
  255. package/lib/module/helpers/createMessageFromXml.js.map +1 -1
  256. package/lib/module/helpers/ensureScopedChatCache.js +2 -2
  257. package/lib/module/helpers/ensureScopedChatCache.js.map +1 -1
  258. package/lib/module/helpers/getDataFromXml.js +23 -1
  259. package/lib/module/helpers/getDataFromXml.js.map +1 -1
  260. package/lib/module/helpers/historyPreloadScheduler.js +3 -66
  261. package/lib/module/helpers/historyPreloadScheduler.js.map +1 -1
  262. package/lib/module/helpers/initXmppRooms.js +8 -14
  263. package/lib/module/helpers/initXmppRooms.js.map +1 -1
  264. package/lib/module/helpers/insertMessageWithDelimiter.js +22 -52
  265. package/lib/module/helpers/insertMessageWithDelimiter.js.map +1 -1
  266. package/lib/module/helpers/isUnresolvedSenderId.js +6 -1
  267. package/lib/module/helpers/isUnresolvedSenderId.js.map +1 -1
  268. package/lib/module/helpers/keyboardLayout.js +2 -12
  269. package/lib/module/helpers/keyboardLayout.js.map +1 -1
  270. package/lib/module/helpers/mimeToExtension.js +13 -6
  271. package/lib/module/helpers/mimeToExtension.js.map +1 -1
  272. package/lib/module/helpers/resolveInitBeforeLoadUser.js +16 -130
  273. package/lib/module/helpers/resolveInitBeforeLoadUser.js.map +1 -1
  274. package/lib/module/helpers/resolveLangSource.js +32 -0
  275. package/lib/module/helpers/resolveLangSource.js.map +1 -0
  276. package/lib/module/helpers/xmppUsername.js +35 -0
  277. package/lib/module/helpers/xmppUsername.js.map +1 -0
  278. package/lib/module/hooks/useChatRoomFocus.js +13 -46
  279. package/lib/module/hooks/useChatRoomFocus.js.map +1 -1
  280. package/lib/module/hooks/useChatWrapperInit.js +14 -32
  281. package/lib/module/hooks/useChatWrapperInit.js.map +1 -1
  282. package/lib/module/hooks/useComposing.js +1 -28
  283. package/lib/module/hooks/useComposing.js.map +1 -1
  284. package/lib/module/hooks/useLogout.js +7 -23
  285. package/lib/module/hooks/useLogout.js.map +1 -1
  286. package/lib/module/hooks/usePendingNotification.js +11 -8
  287. package/lib/module/hooks/usePendingNotification.js.map +1 -1
  288. package/lib/module/hooks/useSendMessage.js +16 -52
  289. package/lib/module/hooks/useSendMessage.js.map +1 -1
  290. package/lib/module/hooks/useUnreadMessagesCounter.js +1 -6
  291. package/lib/module/hooks/useUnreadMessagesCounter.js.map +1 -1
  292. package/lib/module/i18n/strings.js +133 -121
  293. package/lib/module/i18n/strings.js.map +1 -1
  294. package/lib/module/i18n/useT.js +1 -1
  295. package/lib/module/main.js +2 -14
  296. package/lib/module/main.js.map +1 -1
  297. package/lib/module/networking/api-requests/auth.api.js +59 -131
  298. package/lib/module/networking/api-requests/auth.api.js.map +1 -1
  299. package/lib/module/networking/api-requests/roomMembers.api.js +1 -1
  300. package/lib/module/networking/api-requests/roomMembers.api.js.map +1 -1
  301. package/lib/module/networking/api-requests/rooms.api.js +9 -9
  302. package/lib/module/networking/api-requests/rooms.api.js.map +1 -1
  303. package/lib/module/networking/api-requests/user.api.js +7 -64
  304. package/lib/module/networking/api-requests/user.api.js.map +1 -1
  305. package/lib/module/networking/apiClient.js +113 -61
  306. package/lib/module/networking/apiClient.js.map +1 -1
  307. package/lib/module/networking/stanzaHandlers.js +52 -94
  308. package/lib/module/networking/stanzaHandlers.js.map +1 -1
  309. package/lib/module/networking/xmpp/flushLastViewedToPrivateStore.js +8 -46
  310. package/lib/module/networking/xmpp/flushLastViewedToPrivateStore.js.map +1 -1
  311. package/lib/module/networking/xmpp/presenceInRoom.xmpp.js +1 -8
  312. package/lib/module/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
  313. package/lib/module/networking/xmpp/subscribeToRoomMessages.xmpp.js +1 -5
  314. package/lib/module/networking/xmpp/subscribeToRoomMessages.xmpp.js.map +1 -1
  315. package/lib/module/networking/xmppClient.js +8 -124
  316. package/lib/module/networking/xmppClient.js.map +1 -1
  317. package/lib/module/roomStore/chatSettingsSlice.js +7 -26
  318. package/lib/module/roomStore/chatSettingsSlice.js.map +1 -1
  319. package/lib/module/roomStore/index.js +4 -37
  320. package/lib/module/roomStore/index.js.map +1 -1
  321. package/lib/module/roomStore/persistence.js +38 -223
  322. package/lib/module/roomStore/persistence.js.map +1 -1
  323. package/lib/module/roomStore/roomsSlice.js +34 -139
  324. package/lib/module/roomStore/roomsSlice.js.map +1 -1
  325. package/lib/module/services/pushSubscriptionService.js +13 -15
  326. package/lib/module/services/pushSubscriptionService.js.map +1 -1
  327. package/lib/module/version.js +3 -1
  328. package/lib/module/version.js.map +1 -1
  329. package/lib/typescript/assets/icons.d.ts +0 -16
  330. package/lib/typescript/assets/icons.d.ts.map +1 -1
  331. package/lib/typescript/components/AuthForms/Login.d.ts.map +1 -1
  332. package/lib/typescript/components/Header/HeaderRoomList.d.ts.map +1 -1
  333. package/lib/typescript/components/MainComponents/ChatHeader.d.ts.map +1 -1
  334. package/lib/typescript/components/MainComponents/ChatRoom.d.ts.map +1 -1
  335. package/lib/typescript/components/MainComponents/ChatWrapper.d.ts.map +1 -1
  336. package/lib/typescript/components/MainComponents/LoginWrapper.d.ts.map +1 -1
  337. package/lib/typescript/components/MainComponents/MediaMessage.d.ts.map +1 -1
  338. package/lib/typescript/components/MainComponents/MessageContainer.d.ts.map +1 -1
  339. package/lib/typescript/components/MainComponents/MessageList.d.ts +1 -10
  340. package/lib/typescript/components/MainComponents/MessageList.d.ts.map +1 -1
  341. package/lib/typescript/components/MainComponents/ProfileImagePlaceholder.d.ts.map +1 -1
  342. package/lib/typescript/components/MainComponents/ReduxWrapper.d.ts.map +1 -1
  343. package/lib/typescript/components/MainComponents/RoomList.d.ts +0 -7
  344. package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
  345. package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts +0 -3
  346. package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts.map +1 -1
  347. package/lib/typescript/components/MessageBubble/MessageTranslate.d.ts.map +1 -1
  348. package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts +0 -9
  349. package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts.map +1 -1
  350. package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts +0 -10
  351. package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
  352. package/lib/typescript/components/Modals/ChatProfileModal/DeleteChatModal.d.ts.map +1 -1
  353. package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts.map +1 -1
  354. package/lib/typescript/components/Modals/FilePreviewModal/PdfView.d.ts.map +1 -1
  355. package/lib/typescript/components/Modals/Modal/Modal.d.ts.map +1 -1
  356. package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts +2 -4
  357. package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts.map +1 -1
  358. package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts +1 -1
  359. package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts.map +1 -1
  360. package/lib/typescript/components/Modals/NewChatModal/UpdNewChatModal.d.ts.map +1 -1
  361. package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts +1 -6
  362. package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts.map +1 -1
  363. package/lib/typescript/components/Modals/UserProfileModal/EditUserModal.d.ts.map +1 -1
  364. package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts +0 -16
  365. package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts.map +1 -1
  366. package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts +0 -1
  367. package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts.map +1 -1
  368. package/lib/typescript/components/Modals/styledModalComponents.d.ts.map +1 -1
  369. package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts.map +1 -1
  370. package/lib/typescript/components/RoomComponents/styled/LastMessageFile.d.ts +1 -1
  371. package/lib/typescript/components/RoomComponents/styled/LastMessageFile.d.ts.map +1 -1
  372. package/lib/typescript/components/RoomComponents/styled/LastMessagePhoto.d.ts +1 -1
  373. package/lib/typescript/components/RoomComponents/styled/LastMessagePhoto.d.ts.map +1 -1
  374. package/lib/typescript/components/RoomComponents/styled/LastMessageVideo.d.ts +1 -1
  375. package/lib/typescript/components/RoomComponents/styled/LastMessageVideo.d.ts.map +1 -1
  376. package/lib/typescript/components/VideoCalls/VideoCallSession.d.ts.map +1 -1
  377. package/lib/typescript/components/styled/AudioMessage.d.ts.map +1 -1
  378. package/lib/typescript/components/styled/DateLabel.d.ts.map +1 -1
  379. package/lib/typescript/components/styled/MessageImage.d.ts +0 -14
  380. package/lib/typescript/components/styled/MessageImage.d.ts.map +1 -1
  381. package/lib/typescript/components/styled/NewMessageLabel.d.ts.map +1 -1
  382. package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
  383. package/lib/typescript/components/styled/StyledComponents.d.ts.map +1 -1
  384. package/lib/typescript/components/styled/StyledInputComponents/StyledInputComponents.d.ts.map +1 -1
  385. package/lib/typescript/components/styled/UnsupportedType.d.ts.map +1 -1
  386. package/lib/typescript/components/styled/VideoMessage.d.ts +0 -8
  387. package/lib/typescript/components/styled/VideoMessage.d.ts.map +1 -1
  388. package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
  389. package/lib/typescript/helpers/createMessageFromXml.d.ts.map +1 -1
  390. package/lib/typescript/helpers/getDataFromXml.d.ts.map +1 -1
  391. package/lib/typescript/helpers/historyPreloadScheduler.d.ts.map +1 -1
  392. package/lib/typescript/helpers/initXmppRooms.d.ts.map +1 -1
  393. package/lib/typescript/helpers/insertMessageWithDelimiter.d.ts +1 -1
  394. package/lib/typescript/helpers/insertMessageWithDelimiter.d.ts.map +1 -1
  395. package/lib/typescript/helpers/isUnresolvedSenderId.d.ts.map +1 -1
  396. package/lib/typescript/helpers/keyboardLayout.d.ts +1 -5
  397. package/lib/typescript/helpers/keyboardLayout.d.ts.map +1 -1
  398. package/lib/typescript/helpers/mimeToExtension.d.ts +15 -0
  399. package/lib/typescript/helpers/mimeToExtension.d.ts.map +1 -1
  400. package/lib/typescript/helpers/resolveInitBeforeLoadUser.d.ts.map +1 -1
  401. package/lib/typescript/helpers/resolveLangSource.d.ts +30 -0
  402. package/lib/typescript/helpers/resolveLangSource.d.ts.map +1 -0
  403. package/lib/typescript/helpers/xmppUsername.d.ts +13 -0
  404. package/lib/typescript/helpers/xmppUsername.d.ts.map +1 -0
  405. package/lib/typescript/hooks/useChatRoomFocus.d.ts +1 -4
  406. package/lib/typescript/hooks/useChatRoomFocus.d.ts.map +1 -1
  407. package/lib/typescript/hooks/useChatWrapperInit.d.ts.map +1 -1
  408. package/lib/typescript/hooks/useComposing.d.ts.map +1 -1
  409. package/lib/typescript/hooks/useLogout.d.ts.map +1 -1
  410. package/lib/typescript/hooks/usePendingNotification.d.ts.map +1 -1
  411. package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
  412. package/lib/typescript/hooks/useUnreadMessagesCounter.d.ts +0 -1
  413. package/lib/typescript/hooks/useUnreadMessagesCounter.d.ts.map +1 -1
  414. package/lib/typescript/i18n/strings.d.ts.map +1 -1
  415. package/lib/typescript/i18n/useT.d.ts +1 -1
  416. package/lib/typescript/main.d.ts +2 -9
  417. package/lib/typescript/main.d.ts.map +1 -1
  418. package/lib/typescript/networking/api-requests/auth.api.d.ts +1 -3
  419. package/lib/typescript/networking/api-requests/auth.api.d.ts.map +1 -1
  420. package/lib/typescript/networking/api-requests/user.api.d.ts +0 -27
  421. package/lib/typescript/networking/api-requests/user.api.d.ts.map +1 -1
  422. package/lib/typescript/networking/apiClient.d.ts +6 -12
  423. package/lib/typescript/networking/apiClient.d.ts.map +1 -1
  424. package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
  425. package/lib/typescript/networking/xmpp/flushLastViewedToPrivateStore.d.ts +2 -10
  426. package/lib/typescript/networking/xmpp/flushLastViewedToPrivateStore.d.ts.map +1 -1
  427. package/lib/typescript/networking/xmpp/presenceInRoom.xmpp.d.ts.map +1 -1
  428. package/lib/typescript/networking/xmpp/subscribeToRoomMessages.xmpp.d.ts.map +1 -1
  429. package/lib/typescript/networking/xmppClient.d.ts +0 -14
  430. package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
  431. package/lib/typescript/roomStore/chatSettingsSlice.d.ts +0 -16
  432. package/lib/typescript/roomStore/chatSettingsSlice.d.ts.map +1 -1
  433. package/lib/typescript/roomStore/index.d.ts.map +1 -1
  434. package/lib/typescript/roomStore/persistence.d.ts +1 -18
  435. package/lib/typescript/roomStore/persistence.d.ts.map +1 -1
  436. package/lib/typescript/roomStore/roomsSlice.d.ts +3 -43
  437. package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
  438. package/lib/typescript/services/pushSubscriptionService.d.ts +1 -1
  439. package/lib/typescript/services/pushSubscriptionService.d.ts.map +1 -1
  440. package/lib/typescript/types/types.d.ts +5 -50
  441. package/lib/typescript/types/types.d.ts.map +1 -1
  442. package/lib/typescript/version.d.ts +1 -1
  443. package/lib/typescript/version.d.ts.map +1 -1
  444. package/package.json +29 -41
  445. package/src/assets/icons.tsx +9 -48
  446. package/src/components/AuthForms/Login.tsx +3 -3
  447. package/src/components/Header/HeaderRoomList.tsx +6 -24
  448. package/src/components/MainComponents/ChatHeader.tsx +3 -9
  449. package/src/components/MainComponents/ChatRoom.tsx +15 -161
  450. package/src/components/MainComponents/ChatWrapper.tsx +53 -36
  451. package/src/components/MainComponents/LoginWrapper.tsx +0 -1
  452. package/src/components/MainComponents/MediaMessage.tsx +8 -26
  453. package/src/components/MainComponents/MessageContainer.tsx +1 -5
  454. package/src/components/MainComponents/MessageList.tsx +4 -23
  455. package/src/components/MainComponents/ProfileImagePlaceholder.tsx +14 -21
  456. package/src/components/MainComponents/ReduxWrapper.tsx +18 -1
  457. package/src/components/MainComponents/RoomList.tsx +39 -236
  458. package/src/components/Menu/HeaderRoomListMenu.tsx +75 -328
  459. package/src/components/MessageBubble/MessageTranslate.tsx +17 -12
  460. package/src/components/Modals/AttachSheet/AttachSheet.tsx +99 -331
  461. package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +293 -611
  462. package/src/components/Modals/ChatProfileModal/DeleteChatModal.tsx +9 -7
  463. package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +38 -79
  464. package/src/components/Modals/FilePreviewModal/PdfView.tsx +1 -2
  465. package/src/components/Modals/Modal/Modal.tsx +0 -7
  466. package/src/components/Modals/NewChatModal/ModalContent.tsx +3 -6
  467. package/src/components/Modals/NewChatModal/NewChatModal.tsx +126 -223
  468. package/src/components/Modals/NewChatModal/UpdNewChatModal.tsx +1 -12
  469. package/src/components/Modals/SelectUsersModal/SelectUsersModal.tsx +4 -14
  470. package/src/components/Modals/UserProfileModal/EditUserModal.tsx +25 -9
  471. package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +307 -617
  472. package/src/components/Modals/UserSettingsModal/UserSettingsModal.tsx +58 -75
  473. package/src/components/Modals/styledModalComponents.tsx +2 -9
  474. package/src/components/RoomComponents/ChatRoomItem.tsx +50 -21
  475. package/src/components/RoomComponents/styled/LastMessageFile.tsx +4 -28
  476. package/src/components/RoomComponents/styled/LastMessagePhoto.tsx +3 -18
  477. package/src/components/RoomComponents/styled/LastMessageVideo.tsx +3 -18
  478. package/src/components/VideoCalls/VideoCallSession.tsx +3 -8
  479. package/src/components/styled/AudioMessage.tsx +1 -2
  480. package/src/components/styled/DateLabel.tsx +10 -3
  481. package/src/components/styled/MessageImage.tsx +7 -53
  482. package/src/components/styled/NewMessageLabel.tsx +3 -1
  483. package/src/components/styled/SendInput.tsx +18 -91
  484. package/src/components/styled/StyledComponents.ts +3 -9
  485. package/src/components/styled/StyledInputComponents/StyledInputComponents.tsx +4 -11
  486. package/src/components/styled/UnsupportedType.tsx +4 -14
  487. package/src/components/styled/VideoMessage.tsx +54 -131
  488. package/src/context/xmppProvider.tsx +57 -209
  489. package/src/helpers/createMessageFromXml.ts +1 -20
  490. package/src/helpers/ensureScopedChatCache.ts +2 -2
  491. package/src/helpers/getDataFromXml.ts +25 -1
  492. package/src/helpers/historyPreloadScheduler.ts +3 -80
  493. package/src/helpers/initXmppRooms.tsx +10 -14
  494. package/src/helpers/insertMessageWithDelimiter.ts +32 -55
  495. package/src/helpers/isUnresolvedSenderId.ts +9 -1
  496. package/src/helpers/keyboardLayout.ts +2 -23
  497. package/src/helpers/mimeToExtension.ts +22 -6
  498. package/src/helpers/resolveInitBeforeLoadUser.ts +18 -125
  499. package/src/helpers/resolveLangSource.ts +40 -0
  500. package/src/helpers/xmppUsername.ts +38 -0
  501. package/src/hooks/useChatRoomFocus.ts +9 -49
  502. package/src/hooks/useChatWrapperInit.ts +16 -32
  503. package/src/hooks/useComposing.tsx +1 -37
  504. package/src/hooks/useLogout.tsx +9 -29
  505. package/src/hooks/usePendingNotification.ts +11 -5
  506. package/src/hooks/useSendMessage.tsx +15 -60
  507. package/src/hooks/useUnreadMessagesCounter.ts +0 -11
  508. package/src/i18n/strings.ts +133 -121
  509. package/src/i18n/useT.ts +1 -1
  510. package/src/main.ts +2 -26
  511. package/src/networking/api-requests/auth.api.ts +48 -156
  512. package/src/networking/api-requests/roomMembers.api.ts +1 -1
  513. package/src/networking/api-requests/rooms.api.ts +9 -9
  514. package/src/networking/api-requests/user.api.ts +7 -79
  515. package/src/networking/apiClient.ts +123 -68
  516. package/src/networking/stanzaHandlers.ts +51 -92
  517. package/src/networking/xmpp/flushLastViewedToPrivateStore.ts +10 -71
  518. package/src/networking/xmpp/presenceInRoom.xmpp.ts +1 -6
  519. package/src/networking/xmpp/subscribeToRoomMessages.xmpp.ts +1 -12
  520. package/src/networking/xmppClient.ts +9 -141
  521. package/src/roomStore/chatSettingsSlice.ts +10 -34
  522. package/src/roomStore/index.ts +4 -40
  523. package/src/roomStore/persistence.ts +40 -234
  524. package/src/roomStore/roomsSlice.ts +29 -161
  525. package/src/services/pushSubscriptionService.ts +13 -18
  526. package/src/types/types.ts +5 -72
  527. package/src/version.ts +3 -1
  528. package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js +0 -226
  529. package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js.map +0 -1
  530. package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js +0 -556
  531. package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js.map +0 -1
  532. package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js +0 -210
  533. package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js.map +0 -1
  534. package/lib/commonjs/helpers/getChatBackground.js +0 -23
  535. package/lib/commonjs/helpers/getChatBackground.js.map +0 -1
  536. package/lib/commonjs/helpers/getDisplayFileName.js +0 -79
  537. package/lib/commonjs/helpers/getDisplayFileName.js.map +0 -1
  538. package/lib/commonjs/helpers/getServerReadTimestamp.js +0 -188
  539. package/lib/commonjs/helpers/getServerReadTimestamp.js.map +0 -1
  540. package/lib/commonjs/helpers/isOwnMessage.js +0 -75
  541. package/lib/commonjs/helpers/isOwnMessage.js.map +0 -1
  542. package/lib/commonjs/helpers/mediaLibraryRuntime.js +0 -31
  543. package/lib/commonjs/helpers/mediaLibraryRuntime.js.map +0 -1
  544. package/lib/commonjs/helpers/msgSortableMs.js +0 -37
  545. package/lib/commonjs/helpers/msgSortableMs.js.map +0 -1
  546. package/lib/commonjs/helpers/persistCrypto.js +0 -122
  547. package/lib/commonjs/helpers/persistCrypto.js.map +0 -1
  548. package/lib/commonjs/helpers/pickImageAsset.js +0 -68
  549. package/lib/commonjs/helpers/pickImageAsset.js.map +0 -1
  550. package/lib/commonjs/helpers/pushPayload.js +0 -71
  551. package/lib/commonjs/helpers/pushPayload.js.map +0 -1
  552. package/lib/commonjs/helpers/secureFileUrl.js +0 -101
  553. package/lib/commonjs/helpers/secureFileUrl.js.map +0 -1
  554. package/lib/commonjs/helpers/secureKeyValue.js +0 -83
  555. package/lib/commonjs/helpers/secureKeyValue.js.map +0 -1
  556. package/lib/commonjs/helpers/secureStoreRuntime.js +0 -59
  557. package/lib/commonjs/helpers/secureStoreRuntime.js.map +0 -1
  558. package/lib/commonjs/helpers/secureUserStorage.js +0 -75
  559. package/lib/commonjs/helpers/secureUserStorage.js.map +0 -1
  560. package/lib/commonjs/helpers/shallowEqual.js +0 -36
  561. package/lib/commonjs/helpers/shallowEqual.js.map +0 -1
  562. package/lib/commonjs/helpers/sheetGestures.js +0 -32
  563. package/lib/commonjs/helpers/sheetGestures.js.map +0 -1
  564. package/lib/commonjs/hooks/useFileToken.js +0 -10
  565. package/lib/commonjs/hooks/useFileToken.js.map +0 -1
  566. package/lib/commonjs/networking/authRefresh.js +0 -332
  567. package/lib/commonjs/networking/authRefresh.js.map +0 -1
  568. package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js +0 -223
  569. package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js.map +0 -1
  570. package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js +0 -548
  571. package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js.map +0 -1
  572. package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js +0 -205
  573. package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js.map +0 -1
  574. package/lib/module/helpers/getChatBackground.js +0 -18
  575. package/lib/module/helpers/getChatBackground.js.map +0 -1
  576. package/lib/module/helpers/getDisplayFileName.js +0 -73
  577. package/lib/module/helpers/getDisplayFileName.js.map +0 -1
  578. package/lib/module/helpers/getServerReadTimestamp.js +0 -181
  579. package/lib/module/helpers/getServerReadTimestamp.js.map +0 -1
  580. package/lib/module/helpers/isOwnMessage.js +0 -70
  581. package/lib/module/helpers/isOwnMessage.js.map +0 -1
  582. package/lib/module/helpers/mediaLibraryRuntime.js +0 -25
  583. package/lib/module/helpers/mediaLibraryRuntime.js.map +0 -1
  584. package/lib/module/helpers/msgSortableMs.js +0 -32
  585. package/lib/module/helpers/msgSortableMs.js.map +0 -1
  586. package/lib/module/helpers/persistCrypto.js +0 -115
  587. package/lib/module/helpers/persistCrypto.js.map +0 -1
  588. package/lib/module/helpers/pickImageAsset.js +0 -63
  589. package/lib/module/helpers/pickImageAsset.js.map +0 -1
  590. package/lib/module/helpers/pushPayload.js +0 -63
  591. package/lib/module/helpers/pushPayload.js.map +0 -1
  592. package/lib/module/helpers/secureFileUrl.js +0 -91
  593. package/lib/module/helpers/secureFileUrl.js.map +0 -1
  594. package/lib/module/helpers/secureKeyValue.js +0 -75
  595. package/lib/module/helpers/secureKeyValue.js.map +0 -1
  596. package/lib/module/helpers/secureStoreRuntime.js +0 -52
  597. package/lib/module/helpers/secureStoreRuntime.js.map +0 -1
  598. package/lib/module/helpers/secureUserStorage.js +0 -72
  599. package/lib/module/helpers/secureUserStorage.js.map +0 -1
  600. package/lib/module/helpers/shallowEqual.js +0 -31
  601. package/lib/module/helpers/shallowEqual.js.map +0 -1
  602. package/lib/module/helpers/sheetGestures.js +0 -26
  603. package/lib/module/helpers/sheetGestures.js.map +0 -1
  604. package/lib/module/hooks/useFileToken.js +0 -5
  605. package/lib/module/hooks/useFileToken.js.map +0 -1
  606. package/lib/module/networking/authRefresh.js +0 -321
  607. package/lib/module/networking/authRefresh.js.map +0 -1
  608. package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts +0 -9
  609. package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts.map +0 -1
  610. package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts +0 -75
  611. package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts.map +0 -1
  612. package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts +0 -25
  613. package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts.map +0 -1
  614. package/lib/typescript/helpers/getChatBackground.d.ts +0 -15
  615. package/lib/typescript/helpers/getChatBackground.d.ts.map +0 -1
  616. package/lib/typescript/helpers/getDisplayFileName.d.ts +0 -49
  617. package/lib/typescript/helpers/getDisplayFileName.d.ts.map +0 -1
  618. package/lib/typescript/helpers/getServerReadTimestamp.d.ts +0 -108
  619. package/lib/typescript/helpers/getServerReadTimestamp.d.ts.map +0 -1
  620. package/lib/typescript/helpers/isOwnMessage.d.ts +0 -36
  621. package/lib/typescript/helpers/isOwnMessage.d.ts.map +0 -1
  622. package/lib/typescript/helpers/mediaLibraryRuntime.d.ts +0 -3
  623. package/lib/typescript/helpers/mediaLibraryRuntime.d.ts.map +0 -1
  624. package/lib/typescript/helpers/msgSortableMs.d.ts +0 -2
  625. package/lib/typescript/helpers/msgSortableMs.d.ts.map +0 -1
  626. package/lib/typescript/helpers/persistCrypto.d.ts +0 -13
  627. package/lib/typescript/helpers/persistCrypto.d.ts.map +0 -1
  628. package/lib/typescript/helpers/pickImageAsset.d.ts +0 -27
  629. package/lib/typescript/helpers/pickImageAsset.d.ts.map +0 -1
  630. package/lib/typescript/helpers/pushPayload.d.ts +0 -7
  631. package/lib/typescript/helpers/pushPayload.d.ts.map +0 -1
  632. package/lib/typescript/helpers/secureFileUrl.d.ts +0 -7
  633. package/lib/typescript/helpers/secureFileUrl.d.ts.map +0 -1
  634. package/lib/typescript/helpers/secureKeyValue.d.ts +0 -13
  635. package/lib/typescript/helpers/secureKeyValue.d.ts.map +0 -1
  636. package/lib/typescript/helpers/secureStoreRuntime.d.ts +0 -29
  637. package/lib/typescript/helpers/secureStoreRuntime.d.ts.map +0 -1
  638. package/lib/typescript/helpers/secureUserStorage.d.ts +0 -23
  639. package/lib/typescript/helpers/secureUserStorage.d.ts.map +0 -1
  640. package/lib/typescript/helpers/shallowEqual.d.ts +0 -11
  641. package/lib/typescript/helpers/shallowEqual.d.ts.map +0 -1
  642. package/lib/typescript/helpers/sheetGestures.d.ts +0 -20
  643. package/lib/typescript/helpers/sheetGestures.d.ts.map +0 -1
  644. package/lib/typescript/hooks/useFileToken.d.ts +0 -2
  645. package/lib/typescript/hooks/useFileToken.d.ts.map +0 -1
  646. package/lib/typescript/networking/authRefresh.d.ts +0 -95
  647. package/lib/typescript/networking/authRefresh.d.ts.map +0 -1
  648. package/src/components/Modals/ChatProfileModal/ReportChatModal.tsx +0 -244
  649. package/src/components/Modals/ProfileHeader/ProfileHeader.tsx +0 -615
  650. package/src/components/Modals/ProfileHeader/ProfileMenu.tsx +0 -217
  651. package/src/helpers/getChatBackground.ts +0 -18
  652. package/src/helpers/getDisplayFileName.ts +0 -87
  653. package/src/helpers/getServerReadTimestamp.ts +0 -197
  654. package/src/helpers/isOwnMessage.ts +0 -90
  655. package/src/helpers/mediaLibraryRuntime.ts +0 -25
  656. package/src/helpers/msgSortableMs.ts +0 -25
  657. package/src/helpers/persistCrypto.ts +0 -127
  658. package/src/helpers/pickImageAsset.ts +0 -68
  659. package/src/helpers/pushPayload.ts +0 -62
  660. package/src/helpers/secureFileUrl.ts +0 -103
  661. package/src/helpers/secureKeyValue.ts +0 -80
  662. package/src/helpers/secureStoreRuntime.ts +0 -62
  663. package/src/helpers/secureUserStorage.ts +0 -80
  664. package/src/helpers/shallowEqual.ts +0 -33
  665. package/src/helpers/sheetGestures.ts +0 -25
  666. package/src/hooks/useFileToken.ts +0 -7
  667. package/src/networking/authRefresh.ts +0 -451
@@ -1,8 +1,6 @@
1
1
  import AsyncStorage from '@react-native-async-storage/async-storage';
2
2
  import { Middleware } from '@reduxjs/toolkit';
3
3
  import { IMessage, IRoom, User } from '../types/types';
4
- import { encryptForPersist, decryptFromPersist } from '../helpers/persistCrypto';
5
- import type { FailedMessagePayload } from './roomHeapSlice';
6
4
 
7
5
  // -------------------------------------------------------------------
8
6
  // Lightweight RN persistence layer. Mirrors what redux-persist gives
@@ -13,33 +11,17 @@ import type { FailedMessagePayload } from './roomHeapSlice';
13
11
  // - cap each room's messages to the most recent MESSAGE_LIMIT (100)
14
12
  // - debounced writes (200ms) on relevant action types
15
13
  //
16
- // AES-256-CBC at rest (see `helpers/persistCrypto.ts`): the JSON blob
17
- // under each key below is encrypted before it reaches AsyncStorage, with
18
- // the symmetric key held in the platform Keychain/Keystore. `user` here
19
- // is already secret-free (see `sanitizeUser`) — the encryption is for
20
- // the message bodies in `rooms`, which aren't.
14
+ // Not encrypted. We rely on AsyncStorage's per-app sandbox.
21
15
  // -------------------------------------------------------------------
22
16
 
23
17
  const KEY_CHAT = '@ethora/persist:chatSettingStore';
24
18
  const KEY_ROOMS = '@ethora/persist:rooms';
25
- // bug #39: a failed send needs to survive a relaunch as "failed / tap
26
- // to retry", not silently render as delivered. `roomHeapStore.failedMessages`
27
- // is the map the bubble reads (`isFailed = failedMessages[id]`, see
28
- // Message.tsx / useMessageHeapState): it lives in a separate, previously
29
- // non-persisted slice from `rooms`, so it gets its own key here.
30
- const KEY_HEAP = '@ethora/persist:roomHeap';
31
19
 
32
20
  // Per-room message cap on disk. Mirror this value in `roomsSlice`'s
33
21
  // in-memory cap (see `enforceMessageCap`) so the runtime and persisted
34
22
  // shapes stay aligned.
35
23
  export const MESSAGE_LIMIT = 100;
36
24
 
37
- // Defensive cap on the number of failed-message payloads written to
38
- // disk. In practice this map only grows while the user is actively
39
- // sending offline, but a runaway sender (or a bug that never clears an
40
- // entry) must not turn this key into an unbounded write.
41
- export const MAX_PERSISTED_FAILED_MESSAGES = 200;
42
-
43
25
  interface PersistedChatState {
44
26
  user: User;
45
27
  }
@@ -49,14 +31,6 @@ interface PersistedRoomsState {
49
31
  // intentionally NOT persisted: activeRoomJID, editAction, isLoading
50
32
  }
51
33
 
52
- interface PersistedHeapState {
53
- failedMessages: Record<string, FailedMessagePayload>;
54
- // intentionally NOT persisted: messageHeap, a process-lifetime
55
- // "in flight" buffer (see roomHeapSlice.ts); anything still in it when
56
- // the app dies is handled by the boot-time pending->failed scan below,
57
- // not by replaying the heap itself.
58
- }
59
-
60
34
  const sanitizeUser = (user?: User): User | null => {
61
35
  if (!user) {return null;}
62
36
  // Drop secrets we don't want at rest — destructure to omit, then
@@ -101,14 +75,23 @@ const PERSISTED_MESSAGE_FIELDS: (keyof IMessage)[] = [
101
75
  'originalName',
102
76
  'size',
103
77
  'langSource',
78
+ // `translations` MUST be here. A previous version of this list dropped
79
+ // it, on the theory that it mirrored the web SDK's persist contract —
80
+ // it doesn't: web's redux-persist config (web/src/roomStore/index.ts)
81
+ // has no per-field message whitelist at all, it persists whatever is in
82
+ // `room.messages` (capped to the last 50) and that includes
83
+ // `translations` verbatim. Field-picking is an RN-only mechanism, so
84
+ // "same as web" was never true for this key.
85
+ //
86
+ // Dropping it meant every cold start painted the cached transcript in
87
+ // the ORIGINAL language and only flipped to the translation once MAM
88
+ // re-sent the history a few seconds later (onMessageHistory re-parses
89
+ // <translations> off the wire) — visible on every launch, for every
90
+ // translated message, since the cache never had a translation to show
91
+ // in the first place. Persisting it here is what lets the very first
92
+ // paint already be translated, the way the live path already is.
93
+ 'translations',
104
94
  'callLog',
105
- // bug #39: without this, a message that was still in flight (no
106
- // server echo yet) at kill time comes back from disk indistinguishable
107
- // from a normal delivered message, so the bubble renders it as sent.
108
- // Persisting `pending` lets the boot-time scan (see
109
- // computeBootTimeFailures below) find exactly the messages that never
110
- // got confirmed and flip them to failed instead.
111
- 'pending',
112
95
  ];
113
96
 
114
97
  // The sender identity that rides along on every message over the wire
@@ -208,154 +191,6 @@ const sanitizeRooms = (
208
191
  return out;
209
192
  };
210
193
 
211
- // Only the fields retryMessage actually needs to replay the send (see
212
- // FailedMessagePayload / useSendMessage.retryMessage). In particular, the
213
- // media `data` blob is trimmed to `uri/type/name/size` (the picker never
214
- // hands us auth material, but this stays defensive against a future
215
- // picker change smuggling extra fields, or a huge inline payload, into
216
- // `data`).
217
- const sanitizeMediaData = (
218
- data: any
219
- ): { uri?: string; type?: string; name?: string; size?: number } => {
220
- if (!data || typeof data !== 'object') {return {};}
221
- const out: { uri?: string; type?: string; name?: string; size?: number } = {};
222
- if (typeof data.uri === 'string') {out.uri = data.uri;}
223
- if (typeof data.type === 'string') {out.type = data.type;}
224
- if (typeof data.name === 'string') {out.name = data.name;}
225
- if (typeof data.size === 'number') {out.size = data.size;}
226
- return out;
227
- };
228
-
229
- const sanitizeFailedMessagePayload = (
230
- payload: FailedMessagePayload
231
- ): FailedMessagePayload | null => {
232
- if (!payload || typeof payload !== 'object') {return null;}
233
- if (!payload.id || typeof payload.id !== 'string') {return null;}
234
- if (!payload.roomJID || typeof payload.roomJID !== 'string') {return null;}
235
- if (payload.kind === 'media') {
236
- return {
237
- kind: 'media',
238
- id: payload.id,
239
- roomJID: payload.roomJID,
240
- data: sanitizeMediaData(payload.data),
241
- type: typeof payload.type === 'string' ? payload.type : '',
242
- isReply: payload.isReply,
243
- isChecked: payload.isChecked,
244
- mainMessage: payload.mainMessage,
245
- };
246
- }
247
- if (payload.kind === 'text') {
248
- return {
249
- kind: 'text',
250
- id: payload.id,
251
- roomJID: payload.roomJID,
252
- body: typeof payload.body === 'string' ? payload.body : '',
253
- isReply: payload.isReply,
254
- isChecked: payload.isChecked,
255
- mainMessage: payload.mainMessage,
256
- };
257
- }
258
- return null;
259
- };
260
-
261
- const sanitizeFailedMessages = (
262
- failedMessages: Record<string, FailedMessagePayload> | undefined
263
- ): Record<string, FailedMessagePayload> => {
264
- if (!failedMessages || typeof failedMessages !== 'object') {return {};}
265
- const out: Record<string, FailedMessagePayload> = {};
266
- let count = 0;
267
- for (const [id, payload] of Object.entries(failedMessages)) {
268
- if (count >= MAX_PERSISTED_FAILED_MESSAGES) {break;}
269
- const clean = sanitizeFailedMessagePayload(payload);
270
- if (clean) {
271
- out[id] = clean;
272
- count++;
273
- }
274
- }
275
- return out;
276
- };
277
-
278
- // -------------------------------------------------------------------
279
- // Boot-time pending -> failed conversion (bug #39).
280
- //
281
- // `messageHeap` (the "still sending" buffer) is intentionally NOT
282
- // persisted: it's a process-lifetime thing. That means on a cold start
283
- // there is no such thing as "still sending": a persisted message that
284
- // carries `pending: true` never got a server echo NOR got the chance to
285
- // trip the in-session watchdog (see PENDING_WATCHDOG_MS in
286
- // useSendMessage.tsx) before the process died. It must render as failed
287
- // with a working retry, not as delivered and not as stuck "sending...".
288
- //
289
- // Reconstructs the same FailedMessagePayload shape the live send path
290
- // builds in useSendMessage (markMessageFailed calls), from the fields we
291
- // persist per message.
292
- // -------------------------------------------------------------------
293
-
294
- export function reconstructFailedMessagePayload(
295
- message: IMessage,
296
- roomJID: string
297
- ): FailedMessagePayload | null {
298
- if (!message?.id || !roomJID) {return null;}
299
- const isReply = !!message.isReply;
300
- const isChecked = message.showInChannel === 'true';
301
- const mainMessage = message.mainMessage;
302
- if (message.isMediafile === 'true') {
303
- return {
304
- kind: 'media',
305
- id: message.id,
306
- roomJID,
307
- data: sanitizeMediaData({
308
- uri: message.location,
309
- name: message.fileName,
310
- type: message.mimetype,
311
- size:
312
- message.size !== undefined && message.size !== null
313
- ? Number(message.size)
314
- : undefined,
315
- }),
316
- type: message.mimetype || '',
317
- isReply,
318
- isChecked,
319
- mainMessage,
320
- };
321
- }
322
- return {
323
- kind: 'text',
324
- id: message.id,
325
- roomJID,
326
- body: message.body || '',
327
- isReply,
328
- isChecked,
329
- mainMessage,
330
- };
331
- }
332
-
333
- /**
334
- * Scan every persisted room for messages still `pending: true` that
335
- * DON'T already have a restored failure entry (those are handled by the
336
- * caller separately, from the persisted `failedMessages` map), and
337
- * synthesize a retry-able FailedMessagePayload for each. Pure function:
338
- * the caller (roomStore/index.ts) is responsible for dispatching
339
- * `markMessageFailed` for the results.
340
- */
341
- export function computeBootTimeFailures(
342
- rooms: Record<string, IRoom> | null | undefined,
343
- alreadyFailed: Record<string, FailedMessagePayload> | null | undefined
344
- ): FailedMessagePayload[] {
345
- if (!rooms || typeof rooms !== 'object') {return [];}
346
- const out: FailedMessagePayload[] = [];
347
- for (const [jid, room] of Object.entries(rooms)) {
348
- const messages = Array.isArray(room?.messages) ? room.messages : [];
349
- for (const message of messages) {
350
- if (!message || !message.pending) {continue;}
351
- if (alreadyFailed && alreadyFailed[message.id]) {continue;}
352
- const payload = reconstructFailedMessagePayload(message, jid);
353
- if (payload) {out.push(payload);}
354
- }
355
- }
356
- return out;
357
- }
358
-
359
194
  let writeTimer: ReturnType<typeof setTimeout> | null = null;
360
195
 
361
196
  /**
@@ -370,7 +205,6 @@ export const persistenceMiddleware: Middleware = (storeAPI) => (next) => (
370
205
  const type: string = action?.type || '';
371
206
  if (
372
207
  !type.startsWith('roomMessages/') &&
373
- !type.startsWith('roomHeapStore/') &&
374
208
  !type.startsWith('chat/setUser') &&
375
209
  !type.startsWith('chat/updateUser') &&
376
210
  !type.startsWith('chat/refreshTokens') &&
@@ -381,34 +215,21 @@ export const persistenceMiddleware: Middleware = (storeAPI) => (next) => (
381
215
 
382
216
  if (writeTimer) {clearTimeout(writeTimer);}
383
217
  writeTimer = setTimeout(() => {
384
- (async () => {
385
- try {
386
- const state = storeAPI.getState();
387
- const chatPayload: PersistedChatState = {
388
- user: sanitizeUser(state.chatSettingStore?.user) as User,
389
- };
390
- const roomsPayload: PersistedRoomsState = {
391
- rooms: sanitizeRooms(state.rooms?.rooms || {}),
392
- };
393
- const heapPayload: PersistedHeapState = {
394
- failedMessages: sanitizeFailedMessages(
395
- state.roomHeapSlice?.failedMessages
396
- ),
397
- };
398
- const [chatCipher, roomsCipher, heapCipher] = await Promise.all([
399
- encryptForPersist(JSON.stringify(chatPayload)),
400
- encryptForPersist(JSON.stringify(roomsPayload)),
401
- encryptForPersist(JSON.stringify(heapPayload)),
402
- ]);
403
- await AsyncStorage.multiSet([
404
- [KEY_CHAT, chatCipher],
405
- [KEY_ROOMS, roomsCipher],
406
- [KEY_HEAP, heapCipher],
407
- ]);
408
- } catch (e) {
409
- console.warn('persist write failed', e);
410
- }
411
- })();
218
+ try {
219
+ const state = storeAPI.getState();
220
+ const chatPayload: PersistedChatState = {
221
+ user: sanitizeUser(state.chatSettingStore?.user) as User,
222
+ };
223
+ const roomsPayload: PersistedRoomsState = {
224
+ rooms: sanitizeRooms(state.rooms?.rooms || {}),
225
+ };
226
+ AsyncStorage.multiSet([
227
+ [KEY_CHAT, JSON.stringify(chatPayload)],
228
+ [KEY_ROOMS, JSON.stringify(roomsPayload)],
229
+ ]).catch((e) => console.warn('persist write failed', e));
230
+ } catch (e) {
231
+ console.warn('persist serialize failed', e);
232
+ }
412
233
  }, 200);
413
234
 
414
235
  return result;
@@ -422,44 +243,29 @@ export const persistenceMiddleware: Middleware = (storeAPI) => (next) => (
422
243
  export async function readPersistedState(): Promise<{
423
244
  chat: PersistedChatState | null;
424
245
  rooms: PersistedRoomsState | null;
425
- heap: PersistedHeapState | null;
426
246
  }> {
427
247
  try {
428
- const [chatRaw, roomsRaw, heapRaw] = await AsyncStorage.multiGet([
248
+ const [chatRaw, roomsRaw] = await AsyncStorage.multiGet([
429
249
  KEY_CHAT,
430
250
  KEY_ROOMS,
431
- KEY_HEAP,
432
251
  ]);
433
- const [chatPlain, roomsPlain, heapPlain] = await Promise.all([
434
- chatRaw[1] ? decryptFromPersist(chatRaw[1]) : Promise.resolve(null),
435
- roomsRaw[1] ? decryptFromPersist(roomsRaw[1]) : Promise.resolve(null),
436
- heapRaw[1] ? decryptFromPersist(heapRaw[1]) : Promise.resolve(null),
437
- ]);
438
- // `decryptFromPersist` returns null both for "nothing stored" and
439
- // for "stored value isn't a valid envelope for the current key" —
440
- // notably a plaintext blob left over from a pre-encryption install.
441
- // Either way there is nothing safe to parse, so the caller treats it
442
- // as a cold start and re-hydrates from the server.
443
- const chat = chatPlain ? (JSON.parse(chatPlain) as PersistedChatState) : null;
444
- const rooms = roomsPlain
445
- ? (JSON.parse(roomsPlain) as PersistedRoomsState)
446
- : null;
447
- const heap = heapPlain
448
- ? (JSON.parse(heapPlain) as PersistedHeapState)
252
+ const chat = chatRaw[1] ? (JSON.parse(chatRaw[1]) as PersistedChatState) : null;
253
+ const rooms = roomsRaw[1]
254
+ ? (JSON.parse(roomsRaw[1]) as PersistedRoomsState)
449
255
  : null;
450
- return { chat, rooms, heap };
256
+ return { chat, rooms };
451
257
  } catch (e) {
452
258
  console.warn('persist read failed', e);
453
- return { chat: null, rooms: null, heap: null };
259
+ return { chat: null, rooms: null };
454
260
  }
455
261
  }
456
262
 
457
263
  export async function clearPersistedState(): Promise<void> {
458
264
  try {
459
- await AsyncStorage.multiRemove([KEY_CHAT, KEY_ROOMS, KEY_HEAP]);
265
+ await AsyncStorage.multiRemove([KEY_CHAT, KEY_ROOMS]);
460
266
  } catch (e) {
461
267
  console.warn('persist clear failed', e);
462
268
  }
463
269
  }
464
270
 
465
- export const PERSIST_KEYS = { KEY_CHAT, KEY_ROOMS, KEY_HEAP };
271
+ export const PERSIST_KEYS = { KEY_CHAT, KEY_ROOMS };
@@ -2,7 +2,6 @@ import { createAsyncThunk, createSlice, PayloadAction, type Slice } from '@redux
2
2
  import type { WritableDraft } from 'immer';
3
3
  import { EditAction, HistoryPreloadState, IMessage, IRoom } from '../types/types';
4
4
  import { insertMessageWithDelimiter } from '../helpers/insertMessageWithDelimiter';
5
- import { msgSortableMs } from '../helpers/msgSortableMs';
6
5
  import type XmppClient from '../networking/xmppClient';
7
6
 
8
7
  // Per-room runtime message cap. Mirrors the persistence layer's
@@ -14,7 +13,7 @@ import type XmppClient from '../networking/xmppClient';
14
13
  // older history added via unshift/splice is exempt, so the user can
15
14
  // page backward arbitrarily far without instantly losing what they
16
15
  // just fetched. After cap eviction we drop from the head (oldest).
17
- export const RUNTIME_MESSAGE_LIMIT = 100;
16
+ const RUNTIME_MESSAGE_LIMIT = 100;
18
17
 
19
18
  // Body strings the server uses for call signaling broadcasts (call-token,
20
19
  // call-state ringing/ended, etc). These should never reach the chat
@@ -143,6 +142,7 @@ function mergeHistoryIntoCache(
143
142
  const ex = stripCallSignals(existing);
144
143
  const fe = stripCallSignals(fetched);
145
144
 
145
+ const pending = ex.filter((m) => m?.pending);
146
146
  const realExisting = ex.filter(
147
147
  (m) => m && !m.pending && m.id !== 'delimiter-new'
148
148
  );
@@ -151,29 +151,6 @@ function mergeHistoryIntoCache(
151
151
  // Nothing usable came back → keep the cache exactly as it was.
152
152
  if (realFetched.length === 0) {return ex;}
153
153
 
154
- // Optimistic sends are preserved across a history merge - EXCEPT the
155
- // ones the fetched page proves the server already has. That happens
156
- // whenever a send reached the server but its echo did not reach us
157
- // before the process died: the optimistic bubble is restored from disk
158
- // still `pending: true` (and, since bug #39, flagged failed at boot),
159
- // while MAM hands back the very same message under its ARCHIVE id.
160
- // Keying only on `id` never matched those two, so the room ended up
161
- // showing the message twice - once for real and once as a bubble stuck
162
- // on "sending…"/"Failed" that nothing could ever clear. The archived
163
- // copy carries our original stanza id as `xmppId` (getDataFromXml), so
164
- // match on that too and drop the local ghost.
165
- const fetchedKeys = new Set<string>();
166
- for (const m of realFetched) {
167
- if (m?.id != null) {fetchedKeys.add(String(m.id));}
168
- if ((m as any)?.xmppId) {fetchedKeys.add(String((m as any).xmppId));}
169
- }
170
- const pending = ex.filter(
171
- (m) =>
172
- m?.pending &&
173
- !fetchedKeys.has(String(m.id)) &&
174
- !(m.xmppId && fetchedKeys.has(String(m.xmppId)))
175
- );
176
-
177
154
  const byMs = (a: IMessage, b: IMessage) =>
178
155
  msgSortableMs(a) - msgSortableMs(b);
179
156
  const capTail = (arr: IMessage[]) =>
@@ -237,33 +214,6 @@ export interface RoomMessagesState {
237
214
  // — see `applyPrivateStoreMarkers`. Re-fetched every init/reconnect,
238
215
  // so it is intentionally NOT persisted.
239
216
  privateStoreMarkers: Record<string, number>;
240
- // The single source of truth for "read up to here, but the user
241
- // hasn't reached the bottom yet" (`{ roomJID: boundaryMs }`).
242
- // Set by MessageList (via ChatRoom's `onReadBoundaryChange`) the
243
- // moment the user first scrolls away from the bottom, to the
244
- // msgSortableMs of the newest message they'd actually seen. Every
245
- // path that stamps a read marker for a room the user is leaving
246
- // (ChatRoom unmount, xmppProvider's AppState background handler and
247
- // `isVisible=false` handler, the live `advance()` effect, and
248
- // `useChatRoomFocus`'s `leaveRoom`) must consult this instead of
249
- // unconditionally stamping "the newest acked message" - otherwise
250
- // leaving a room while scrolled up marks messages the user never
251
- // reached as read (customer #42, a regression of #33 reintroduced by
252
- // #38's server-timestamp marker). See `getReadMarkerTimestamp` in
253
- // helpers/getServerReadTimestamp.ts.
254
- //
255
- // Cleared when the boundary no longer applies: the user scrolls back
256
- // to the bottom, the visible room changes, or the room is truly left
257
- // (ChatRoom unmounts, or a tab-navigator focus hook releases the
258
- // room). NOT cleared merely because the app backgrounds or a host's
259
- // `isVisible` flips false - MessageList typically stays mounted
260
- // through those, so its own scroll-tracking ref (the only thing that
261
- // could re-derive this value) is still intact and the boundary must
262
- // stay in sync with it. Deliberately NOT persisted (this key isn't
263
- // read by `persistence.ts`, which only ever picks `rooms` back out of
264
- // this slice) - it's meaningless across a process restart, where
265
- // MessageList always mounts fresh at the bottom.
266
- readBoundaries: Record<string, number>;
267
217
  }
268
218
 
269
219
  const initialState: RoomMessagesState = {
@@ -280,7 +230,6 @@ const initialState: RoomMessagesState = {
280
230
  },
281
231
  pendingNotificationJid: null,
282
232
  privateStoreMarkers: {},
283
- readBoundaries: {},
284
233
  };
285
234
 
286
235
  const isValidRoomJid = (jid: unknown): jid is string => {
@@ -368,8 +317,6 @@ const reducers = {
368
317
  : [];
369
318
  state.rooms[roomData.jid] = {
370
319
  ...roomData,
371
- icon: roomData.icon !== undefined ? roomData.icon : existing?.icon,
372
- roomBg: roomData.roomBg !== undefined ? roomData.roomBg : existing?.roomBg,
373
320
  messages:
374
321
  existingMessages.length > 0 ? existingMessages : incomingMessages,
375
322
  lastViewedTimestamp: lastViewed,
@@ -547,7 +494,7 @@ const reducers = {
547
494
  state.visibleRoomJID === roomJID
548
495
  ? null
549
496
  : lastViewedValue
550
- ? lastViewedValue
497
+ ? new Date(lastViewedValue)
551
498
  : null;
552
499
 
553
500
  insertMessageWithDelimiter(roomMessages, message, lastViewedTimestamp);
@@ -565,7 +512,6 @@ const reducers = {
565
512
  state.rooms = {};
566
513
  state.visibleRoomJID = null;
567
514
  state.privateStoreMarkers = {};
568
- state.readBoundaries = {};
569
515
  state.isUnreadSyncing = false;
570
516
  },
571
517
  setComposing(
@@ -632,19 +578,7 @@ const reducers = {
632
578
  *
633
579
  * Monotonic: a marker only ever moves a baseline FORWARD, so a stale
634
580
  * server value can't resurrect already-read messages and a more-recent
635
- * local read (tab blur stamping the server read timestamp) always wins.
636
- *
637
- * Bug #38 self-heal: forward-only is correct for a SANE existing
638
- * value, but a device whose clock was ahead may have already stamped
639
- * a marker in the future (either persisted locally from a previous
640
- * session, or fetched from the server before this fix existed). To
641
- * "only ever move forward" from a corrupt future value is to never
642
- * move at all - the room would stay stuck at `unreadMessages: 0`
643
- * forever. When the room is loaded, detect a marker that sits well
644
- * past the newest message we actually know it has and waive the
645
- * forward-only check for that one comparison, so the incoming
646
- * (already-clamped, see xmppClient.getChatsPrivateStoreRequestStanza)
647
- * value can correct it even though it's numerically smaller.
581
+ * local read (tab blur stamping Date.now()) always wins.
648
582
  */
649
583
  applyPrivateStoreMarkers: (
650
584
  state: WritableDraft<RoomMessagesState>,
@@ -656,72 +590,20 @@ const reducers = {
656
590
  for (const jid of Object.keys(markers)) {
657
591
  const ts = Number(markers[jid]);
658
592
  if (!jid || !Number.isFinite(ts) || ts <= 0) {continue;}
659
-
660
- const room = state.rooms[jid];
661
- const newestKnownMs = room ? newestAckedMessageMs(room.messages) : 0;
662
- // Mirrors isCorruptFutureReadMarker in helpers/getServerReadTimestamp.ts
663
- // (duplicated to avoid a roomStore <-> helpers import cycle):
664
- // BOTH signals are required. "Further ahead than the newest
665
- // message this room has locally" happens all the time on a room
666
- // whose history hasn't synced yet, and healing on that alone
667
- // would drop a legitimate marker another device wrote after
668
- // reading newer messages. A real read marker can never be ahead
669
- // of real time, so that second signal is what distinguishes a
670
- // stale cache from a wrong clock.
671
- const nowMs = Date.now();
672
- const looksCorrupt = (existing: number) =>
673
- newestKnownMs > 0 &&
674
- existing > newestKnownMs + FUTURE_MARKER_TOLERANCE_MS &&
675
- existing > nowMs + FUTURE_MARKER_TOLERANCE_MS;
676
-
677
593
  // Remember the marker so rooms that load LATER (via addRoom)
678
594
  // inherit it even though they don't exist in the store yet.
679
- const cachedMarker = state.privateStoreMarkers[jid] || 0;
680
- if (ts > cachedMarker || looksCorrupt(cachedMarker)) {
595
+ if (ts > (state.privateStoreMarkers[jid] || 0)) {
681
596
  state.privateStoreMarkers[jid] = ts;
682
597
  }
683
598
  // Upgrade an already-loaded room's baseline + recompute its badge.
684
- // Forward-only, unless the room's CURRENT baseline is itself the
685
- // corrupt value being corrected.
686
- if (room && (ts > (room.lastViewedTimestamp || 0) || looksCorrupt(room.lastViewedTimestamp || 0))) {
599
+ // Only ever forward, so a later local read isn't clobbered.
600
+ const room = state.rooms[jid];
601
+ if (room && ts > (room.lastViewedTimestamp || 0)) {
687
602
  room.lastViewedTimestamp = ts;
688
603
  room.unreadMessages = countNewerMessages(room.messages, ts);
689
604
  }
690
605
  }
691
606
  },
692
- /**
693
- * Set (or clear) the "read up to here, but not further" boundary for
694
- * a room - see `readBoundaries` on `RoomMessagesState` for the full
695
- * contract. `ts` is the msgSortableMs of the newest message the user
696
- * actually reached before scrolling away from the bottom; `null`/`0`
697
- * clears it (the user is at the bottom, or nothing was reached yet).
698
- */
699
- setReadBoundary: (
700
- state: WritableDraft<RoomMessagesState>,
701
- action: PayloadAction<{ jid: string; ts: number | null }>
702
- ) => {
703
- const { jid, ts } = action.payload;
704
- if (!jid) {return;}
705
- if (!state.readBoundaries) {state.readBoundaries = {};}
706
- if (typeof ts === 'number' && Number.isFinite(ts) && ts > 0) {
707
- state.readBoundaries[jid] = ts;
708
- } else {
709
- delete state.readBoundaries[jid];
710
- }
711
- },
712
- /**
713
- * Release a room's read boundary once it has been consumed by a
714
- * genuine "leave" (ChatRoom unmount, or a tab-navigator focus hook
715
- * switching to a different room) - see `readBoundaries` for why the
716
- * background/`isVisible=false` paths deliberately do NOT call this.
717
- */
718
- clearReadBoundary: (
719
- state: WritableDraft<RoomMessagesState>,
720
- action: PayloadAction<{ jid: string }>
721
- ) => {
722
- const { jid } = action.payload;
723
- if (jid && state.readBoundaries) {delete state.readBoundaries[jid];}
724
- },
725
607
  setRoomRole: (
726
608
  state: WritableDraft<RoomMessagesState>,
727
609
  action: PayloadAction<{ chatJID: string; role: string }>
@@ -815,7 +697,6 @@ const reducers = {
815
697
  state.isLoading = false;
816
698
  state.isUnreadSyncing = false;
817
699
  state.privateStoreMarkers = {};
818
- state.readBoundaries = {};
819
700
  },
820
701
  setActiveMessage: (
821
702
  state: WritableDraft<RoomMessagesState>,
@@ -937,13 +818,27 @@ export const roomsStore: Slice<RoomMessagesState, typeof reducers, 'roomMessages
937
818
  reducers,
938
819
  });
939
820
 
940
- // Re-exported for backward compatibility - every existing call site
941
- // imports `msgSortableMs` from here. The implementation now lives in
942
- // helpers/msgSortableMs.ts (imported above), so insertMessageWithDelimiter.ts
943
- // (which this file itself imports) can use the SAME ordering source
944
- // without a roomStore <-> helpers import cycle. See that file for the
945
- // full rationale (server id vs. client `date`).
946
- export { msgSortableMs };
821
+ // Count messages strictly newer than the given millisecond timestamp.
822
+ // Uses `msg.id` (server-authoritative microsecond timestamp prefixed by
823
+ // 13-digit millis — see helpers/dateComparison `getHighResolutionTimestamp`)
824
+ // because `msg.date` can be derived client-side (createMessageFromXml
825
+ // falls back to `Date.now()` for realtime stanzas without a `date`
826
+ // attr), which makes the comparison drift vs what the server assigned.
827
+ // Excludes the "delimiter-new" sentinel, pending sends, and the current
828
+ // user's own messages (parity with unreadMiddleware's isOwnMessage
829
+ // filter — without this, the reducer and the middleware disagree about
830
+ // the count and we get a flicker as the badge gets written twice with
831
+ // different values on every message).
832
+ export const msgSortableMs = (msg: any): number => {
833
+ const id = String(msg?.id || '');
834
+ const m = /^(\d{13})/.exec(id);
835
+ if (m) {return Number(m[1]);}
836
+ if (msg?.date) {
837
+ const t = new Date(msg.date as any).getTime();
838
+ if (Number.isFinite(t)) {return t;}
839
+ }
840
+ return 0;
841
+ };
947
842
 
948
843
  const norm = (s: any): string => {
949
844
  if (s == null) {return '';}
@@ -975,31 +870,6 @@ const isOwn = (
975
870
  return false;
976
871
  };
977
872
 
978
- // Bug #38 tolerance: a stored read marker more than this far past the
979
- // newest message a room actually has is not "the user is a little
980
- // ahead" - it's a leftover from a device whose clock was wrong when it
981
- // stamped the marker. Kept in sync with (but duplicated from, to avoid
982
- // a roomStore ↔ helpers import cycle) FUTURE_READ_MARKER_TOLERANCE_MS
983
- // in helpers/getServerReadTimestamp.ts.
984
- const FUTURE_MARKER_TOLERANCE_MS = 5 * 60 * 1000;
985
-
986
- // Newest message in `messages` this room actually has proof the server
987
- // accepted - used only to sanity-check an already-stored read marker
988
- // against reality (see applyPrivateStoreMarkers's self-heal). Excludes
989
- // pending/optimistic sends via the `pending` flag alone: unlike
990
- // getServerReadTimestamp, this runs inside a reducer and can't reach
991
- // across to the roomHeapSlice slice, but `pending` already identifies
992
- // every optimistic send that matters for this comparison.
993
- const newestAckedMessageMs = (messages: IMessage[] | undefined): number => {
994
- let newest = 0;
995
- for (const m of messages || []) {
996
- if (!m || m.id === 'delimiter-new' || m.pending) {continue;}
997
- const ms = msgSortableMs(m);
998
- if (ms > newest) {newest = ms;}
999
- }
1000
- return newest;
1001
- };
1002
-
1003
873
  const countNewerMessages = (
1004
874
  messages: IMessage[],
1005
875
  timestamp: number,
@@ -1030,8 +900,6 @@ export const {
1030
900
  setUnreadSyncing,
1031
901
  setLastViewedTimestamp,
1032
902
  applyPrivateStoreMarkers,
1033
- setReadBoundary,
1034
- clearReadBoundary,
1035
903
  setRoomNoMessages,
1036
904
  setCurrentRoom,
1037
905
  setVisibleRoom,