@ethora/chat-component-rn 26.8.5 → 26.8.7

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 (690) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +95 -0
  3. package/lib/commonjs/assets/emojiData.js +40 -0
  4. package/lib/commonjs/assets/emojiData.js.map +1 -0
  5. package/lib/commonjs/assets/icons.js +5 -3
  6. package/lib/commonjs/assets/icons.js.map +1 -1
  7. package/lib/commonjs/components/MainComponents/ChatHeader.js +35 -15
  8. package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
  9. package/lib/commonjs/components/MainComponents/ChatRoom.js +33 -24
  10. package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
  11. package/lib/commonjs/components/MainComponents/ChatWrapper.js +22 -16
  12. package/lib/commonjs/components/MainComponents/ChatWrapper.js.map +1 -1
  13. package/lib/commonjs/components/MainComponents/EncryptedSendNotice.js +47 -0
  14. package/lib/commonjs/components/MainComponents/EncryptedSendNotice.js.map +1 -0
  15. package/lib/commonjs/components/MainComponents/EncryptionCard.js +286 -0
  16. package/lib/commonjs/components/MainComponents/EncryptionCard.js.map +1 -0
  17. package/lib/commonjs/components/MainComponents/MediaMessage.js +7 -0
  18. package/lib/commonjs/components/MainComponents/MediaMessage.js.map +1 -1
  19. package/lib/commonjs/components/MainComponents/MessageContainer.js +4 -12
  20. package/lib/commonjs/components/MainComponents/MessageContainer.js.map +1 -1
  21. package/lib/commonjs/components/MainComponents/MessageList.js +110 -35
  22. package/lib/commonjs/components/MainComponents/MessageList.js.map +1 -1
  23. package/lib/commonjs/components/MainComponents/ReduxWrapper.js +5 -0
  24. package/lib/commonjs/components/MainComponents/ReduxWrapper.js.map +1 -1
  25. package/lib/commonjs/components/MainComponents/RoomList.js +32 -29
  26. package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
  27. package/lib/commonjs/components/MainComponents/RoomStack.js +133 -65
  28. package/lib/commonjs/components/MainComponents/RoomStack.js.map +1 -1
  29. package/lib/commonjs/components/MainComponents/SealedAttachment.js +231 -0
  30. package/lib/commonjs/components/MainComponents/SealedAttachment.js.map +1 -0
  31. package/lib/commonjs/components/MainComponents/SystemMessage.js +6 -2
  32. package/lib/commonjs/components/MainComponents/SystemMessage.js.map +1 -1
  33. package/lib/commonjs/components/MessageBubble/Avatar.js +5 -1
  34. package/lib/commonjs/components/MessageBubble/Avatar.js.map +1 -1
  35. package/lib/commonjs/components/MessageBubble/BottomReplyContainer.js +18 -21
  36. package/lib/commonjs/components/MessageBubble/BottomReplyContainer.js.map +1 -1
  37. package/lib/commonjs/components/MessageBubble/EmojiPickerSheet.js +447 -0
  38. package/lib/commonjs/components/MessageBubble/EmojiPickerSheet.js.map +1 -0
  39. package/lib/commonjs/components/MessageBubble/Message.js +264 -136
  40. package/lib/commonjs/components/MessageBubble/Message.js.map +1 -1
  41. package/lib/commonjs/components/MessageBubble/MessageInteractions.js +215 -13
  42. package/lib/commonjs/components/MessageBubble/MessageInteractions.js.map +1 -1
  43. package/lib/commonjs/components/MessageBubble/MessageReaction.js +113 -94
  44. package/lib/commonjs/components/MessageBubble/MessageReaction.js.map +1 -1
  45. package/lib/commonjs/components/MessageBubble/MessageReply.js +66 -24
  46. package/lib/commonjs/components/MessageBubble/MessageReply.js.map +1 -1
  47. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +7 -4
  48. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  49. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +159 -16
  50. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  51. package/lib/commonjs/components/Modals/FilePreviewModal/PdfView.js +4 -0
  52. package/lib/commonjs/components/Modals/FilePreviewModal/PdfView.js.map +1 -1
  53. package/lib/commonjs/components/Modals/Modal/SwipeBackLayer.js +76 -44
  54. package/lib/commonjs/components/Modals/Modal/SwipeBackLayer.js.map +1 -1
  55. package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js +29 -6
  56. package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
  57. package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js +5 -1
  58. package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
  59. package/lib/commonjs/components/RoomComponents/ChatRoomItem.js +37 -13
  60. package/lib/commonjs/components/RoomComponents/ChatRoomItem.js.map +1 -1
  61. package/lib/commonjs/components/RoomComponents/LastMessageItem.js +6 -0
  62. package/lib/commonjs/components/RoomComponents/LastMessageItem.js.map +1 -1
  63. package/lib/commonjs/components/RoomComponents/styled/LastAudioMessage.js +2 -2
  64. package/lib/commonjs/components/RoomComponents/styled/LastAudioMessage.js.map +1 -1
  65. package/lib/commonjs/components/RoomComponents/styled/LastMessageEmoji.js +8 -9
  66. package/lib/commonjs/components/RoomComponents/styled/LastMessageEmoji.js.map +1 -1
  67. package/lib/commonjs/components/RoomComponents/styled/LastMessageFile.js +4 -6
  68. package/lib/commonjs/components/RoomComponents/styled/LastMessageFile.js.map +1 -1
  69. package/lib/commonjs/components/RoomComponents/styled/LastMessagePhoto.js +2 -2
  70. package/lib/commonjs/components/RoomComponents/styled/LastMessagePhoto.js.map +1 -1
  71. package/lib/commonjs/components/RoomComponents/styled/LastMessageSealed.js +41 -0
  72. package/lib/commonjs/components/RoomComponents/styled/LastMessageSealed.js.map +1 -0
  73. package/lib/commonjs/components/RoomComponents/styled/LastMessageVideo.js +2 -2
  74. package/lib/commonjs/components/RoomComponents/styled/LastMessageVideo.js.map +1 -1
  75. package/lib/commonjs/components/Thread/ThreadWrapper.js +273 -152
  76. package/lib/commonjs/components/Thread/ThreadWrapper.js.map +1 -1
  77. package/lib/commonjs/components/UsersList/UsersList.js +2 -1
  78. package/lib/commonjs/components/UsersList/UsersList.js.map +1 -1
  79. package/lib/commonjs/components/styled/DateLabel.js +6 -3
  80. package/lib/commonjs/components/styled/DateLabel.js.map +1 -1
  81. package/lib/commonjs/components/styled/SendInput.js +4 -2
  82. package/lib/commonjs/components/styled/SendInput.js.map +1 -1
  83. package/lib/commonjs/context/MessageNotificationContext.js +188 -9
  84. package/lib/commonjs/context/MessageNotificationContext.js.map +1 -1
  85. package/lib/commonjs/context/xmppProvider.js +22 -7
  86. package/lib/commonjs/context/xmppProvider.js.map +1 -1
  87. package/lib/commonjs/e2ee/crypto.js +207 -0
  88. package/lib/commonjs/e2ee/crypto.js.map +1 -0
  89. package/lib/commonjs/e2ee/deviceStore.js +84 -0
  90. package/lib/commonjs/e2ee/deviceStore.js.map +1 -0
  91. package/lib/commonjs/e2ee/fileCipher.js +95 -0
  92. package/lib/commonjs/e2ee/fileCipher.js.map +1 -0
  93. package/lib/commonjs/e2ee/fileEnvelope.js +79 -0
  94. package/lib/commonjs/e2ee/fileEnvelope.js.map +1 -0
  95. package/lib/commonjs/e2ee/index.js +210 -0
  96. package/lib/commonjs/e2ee/index.js.map +1 -0
  97. package/lib/commonjs/e2ee/limits.js +9 -0
  98. package/lib/commonjs/e2ee/limits.js.map +1 -0
  99. package/lib/commonjs/e2ee/ns.js +8 -0
  100. package/lib/commonjs/e2ee/ns.js.map +1 -0
  101. package/lib/commonjs/e2ee/omemo.js +622 -0
  102. package/lib/commonjs/e2ee/omemo.js.map +1 -0
  103. package/lib/commonjs/e2ee/protobuf.js +149 -0
  104. package/lib/commonjs/e2ee/protobuf.js.map +1 -0
  105. package/lib/commonjs/e2ee/ratchet.js +238 -0
  106. package/lib/commonjs/e2ee/ratchet.js.map +1 -0
  107. package/lib/commonjs/e2ee/sealedBody.js +23 -0
  108. package/lib/commonjs/e2ee/sealedBody.js.map +1 -0
  109. package/lib/commonjs/e2ee/sealedFiles.js +174 -0
  110. package/lib/commonjs/e2ee/sealedFiles.js.map +1 -0
  111. package/lib/commonjs/e2ee/send.js +54 -0
  112. package/lib/commonjs/e2ee/send.js.map +1 -0
  113. package/lib/commonjs/e2ee/stanza.js +114 -0
  114. package/lib/commonjs/e2ee/stanza.js.map +1 -0
  115. package/lib/commonjs/e2ee/store.js +43 -0
  116. package/lib/commonjs/e2ee/store.js.map +1 -0
  117. package/lib/commonjs/helpers/accountName.js +23 -0
  118. package/lib/commonjs/helpers/accountName.js.map +1 -0
  119. package/lib/commonjs/helpers/createMessageFromXml.js +19 -4
  120. package/lib/commonjs/helpers/createMessageFromXml.js.map +1 -1
  121. package/lib/commonjs/helpers/createRoomFromApi.js +36 -2
  122. package/lib/commonjs/helpers/createRoomFromApi.js.map +1 -1
  123. package/lib/commonjs/helpers/createUserNameFromSetUser.js +2 -1
  124. package/lib/commonjs/helpers/createUserNameFromSetUser.js.map +1 -1
  125. package/lib/commonjs/helpers/displayName.js +16 -0
  126. package/lib/commonjs/helpers/displayName.js.map +1 -0
  127. package/lib/commonjs/helpers/emoji.js +51 -0
  128. package/lib/commonjs/helpers/emoji.js.map +1 -0
  129. package/lib/commonjs/helpers/haptics.js +29 -0
  130. package/lib/commonjs/helpers/haptics.js.map +1 -0
  131. package/lib/commonjs/helpers/historyPreloadScheduler.js +32 -66
  132. package/lib/commonjs/helpers/historyPreloadScheduler.js.map +1 -1
  133. package/lib/commonjs/helpers/insertMessageWithDelimiter.js +21 -12
  134. package/lib/commonjs/helpers/insertMessageWithDelimiter.js.map +1 -1
  135. package/lib/commonjs/helpers/mamReactions.js +57 -0
  136. package/lib/commonjs/helpers/mamReactions.js.map +1 -0
  137. package/lib/commonjs/helpers/parseMessageReference.js +42 -0
  138. package/lib/commonjs/helpers/parseMessageReference.js.map +1 -0
  139. package/lib/commonjs/helpers/persistCrypto.js +5 -0
  140. package/lib/commonjs/helpers/persistCrypto.js.map +1 -1
  141. package/lib/commonjs/helpers/reactionsConfig.js +17 -0
  142. package/lib/commonjs/helpers/reactionsConfig.js.map +1 -0
  143. package/lib/commonjs/helpers/secureKeyValue.js +20 -0
  144. package/lib/commonjs/helpers/secureKeyValue.js.map +1 -1
  145. package/lib/commonjs/helpers/updateMessagesTillLast.js +17 -2
  146. package/lib/commonjs/helpers/updateMessagesTillLast.js.map +1 -1
  147. package/lib/commonjs/helpers/videoCache.js +136 -0
  148. package/lib/commonjs/helpers/videoCache.js.map +1 -0
  149. package/lib/commonjs/hooks/useHeapSender.js +3 -1
  150. package/lib/commonjs/hooks/useHeapSender.js.map +1 -1
  151. package/lib/commonjs/hooks/useLogout.js +8 -0
  152. package/lib/commonjs/hooks/useLogout.js.map +1 -1
  153. package/lib/commonjs/hooks/useMessageHeapState.js +3 -2
  154. package/lib/commonjs/hooks/useMessageHeapState.js.map +1 -1
  155. package/lib/commonjs/hooks/useRoomInitialization.js +16 -7
  156. package/lib/commonjs/hooks/useRoomInitialization.js.map +1 -1
  157. package/lib/commonjs/hooks/useSendMessage.js +85 -15
  158. package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
  159. package/lib/commonjs/hooks/useUnreadMessagesCounter.js +1 -1
  160. package/lib/commonjs/hooks/useUnreadMessagesCounter.js.map +1 -1
  161. package/lib/commonjs/i18n/strings.js +180 -0
  162. package/lib/commonjs/i18n/strings.js.map +1 -1
  163. package/lib/commonjs/main.js +13 -0
  164. package/lib/commonjs/main.js.map +1 -1
  165. package/lib/commonjs/networking/api-requests/auth.api.js +4 -1
  166. package/lib/commonjs/networking/api-requests/auth.api.js.map +1 -1
  167. package/lib/commonjs/networking/api-requests/rooms.api.js +111 -17
  168. package/lib/commonjs/networking/api-requests/rooms.api.js.map +1 -1
  169. package/lib/commonjs/networking/stanzaHandlers.js +106 -50
  170. package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
  171. package/lib/commonjs/networking/xmpp/getHistory.xmpp.js +29 -74
  172. package/lib/commonjs/networking/xmpp/getHistory.xmpp.js.map +1 -1
  173. package/lib/commonjs/networking/xmpp/handleStanzas.xmpp.js +44 -0
  174. package/lib/commonjs/networking/xmpp/handleStanzas.xmpp.js.map +1 -1
  175. package/lib/commonjs/networking/xmpp/mamRouter.js +186 -0
  176. package/lib/commonjs/networking/xmpp/mamRouter.js.map +1 -0
  177. package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js +41 -4
  178. package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
  179. package/lib/commonjs/networking/xmpp/sendMediaMessage.xmpp.js +16 -3
  180. package/lib/commonjs/networking/xmpp/sendMediaMessage.xmpp.js.map +1 -1
  181. package/lib/commonjs/networking/xmpp/sendTextMessage.xmpp.js +13 -6
  182. package/lib/commonjs/networking/xmpp/sendTextMessage.xmpp.js.map +1 -1
  183. package/lib/commonjs/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js +14 -6
  184. package/lib/commonjs/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js.map +1 -1
  185. package/lib/commonjs/networking/xmppClient.js +104 -23
  186. package/lib/commonjs/networking/xmppClient.js.map +1 -1
  187. package/lib/commonjs/roomStore/Middleware/newMessageMidlleware.js +29 -34
  188. package/lib/commonjs/roomStore/Middleware/newMessageMidlleware.js.map +1 -1
  189. package/lib/commonjs/roomStore/Middleware/perfMiddleware.js +51 -0
  190. package/lib/commonjs/roomStore/Middleware/perfMiddleware.js.map +1 -0
  191. package/lib/commonjs/roomStore/Middleware/reactionsMiddleware.js +66 -43
  192. package/lib/commonjs/roomStore/Middleware/reactionsMiddleware.js.map +1 -1
  193. package/lib/commonjs/roomStore/Middleware/unreadMidlleware.js +88 -68
  194. package/lib/commonjs/roomStore/Middleware/unreadMidlleware.js.map +1 -1
  195. package/lib/commonjs/roomStore/index.js +18 -14
  196. package/lib/commonjs/roomStore/index.js.map +1 -1
  197. package/lib/commonjs/roomStore/persistBackend.js +93 -0
  198. package/lib/commonjs/roomStore/persistBackend.js.map +1 -0
  199. package/lib/commonjs/roomStore/persistence.js +253 -51
  200. package/lib/commonjs/roomStore/persistence.js.map +1 -1
  201. package/lib/commonjs/roomStore/roomsSlice.js +282 -136
  202. package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
  203. package/lib/commonjs/theme/theme.js +3 -0
  204. package/lib/commonjs/theme/theme.js.map +1 -1
  205. package/lib/commonjs/utils/devLogger.js +14 -0
  206. package/lib/commonjs/utils/devLogger.js.map +1 -1
  207. package/lib/commonjs/version.js +1 -1
  208. package/lib/module/assets/emojiData.js +36 -0
  209. package/lib/module/assets/emojiData.js.map +1 -0
  210. package/lib/module/assets/icons.js +4 -2
  211. package/lib/module/assets/icons.js.map +1 -1
  212. package/lib/module/components/MainComponents/ChatHeader.js +37 -17
  213. package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
  214. package/lib/module/components/MainComponents/ChatRoom.js +34 -25
  215. package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
  216. package/lib/module/components/MainComponents/ChatWrapper.js +23 -17
  217. package/lib/module/components/MainComponents/ChatWrapper.js.map +1 -1
  218. package/lib/module/components/MainComponents/EncryptedSendNotice.js +42 -0
  219. package/lib/module/components/MainComponents/EncryptedSendNotice.js.map +1 -0
  220. package/lib/module/components/MainComponents/EncryptionCard.js +281 -0
  221. package/lib/module/components/MainComponents/EncryptionCard.js.map +1 -0
  222. package/lib/module/components/MainComponents/MediaMessage.js +7 -0
  223. package/lib/module/components/MainComponents/MediaMessage.js.map +1 -1
  224. package/lib/module/components/MainComponents/MessageContainer.js +7 -14
  225. package/lib/module/components/MainComponents/MessageContainer.js.map +1 -1
  226. package/lib/module/components/MainComponents/MessageList.js +110 -35
  227. package/lib/module/components/MainComponents/MessageList.js.map +1 -1
  228. package/lib/module/components/MainComponents/ReduxWrapper.js +5 -0
  229. package/lib/module/components/MainComponents/ReduxWrapper.js.map +1 -1
  230. package/lib/module/components/MainComponents/RoomList.js +32 -29
  231. package/lib/module/components/MainComponents/RoomList.js.map +1 -1
  232. package/lib/module/components/MainComponents/RoomStack.js +131 -63
  233. package/lib/module/components/MainComponents/RoomStack.js.map +1 -1
  234. package/lib/module/components/MainComponents/SealedAttachment.js +224 -0
  235. package/lib/module/components/MainComponents/SealedAttachment.js.map +1 -0
  236. package/lib/module/components/MainComponents/SystemMessage.js +6 -2
  237. package/lib/module/components/MainComponents/SystemMessage.js.map +1 -1
  238. package/lib/module/components/MessageBubble/Avatar.js +5 -1
  239. package/lib/module/components/MessageBubble/Avatar.js.map +1 -1
  240. package/lib/module/components/MessageBubble/BottomReplyContainer.js +19 -22
  241. package/lib/module/components/MessageBubble/BottomReplyContainer.js.map +1 -1
  242. package/lib/module/components/MessageBubble/EmojiPickerSheet.js +438 -0
  243. package/lib/module/components/MessageBubble/EmojiPickerSheet.js.map +1 -0
  244. package/lib/module/components/MessageBubble/Message.js +269 -140
  245. package/lib/module/components/MessageBubble/Message.js.map +1 -1
  246. package/lib/module/components/MessageBubble/MessageInteractions.js +217 -15
  247. package/lib/module/components/MessageBubble/MessageInteractions.js.map +1 -1
  248. package/lib/module/components/MessageBubble/MessageReaction.js +115 -94
  249. package/lib/module/components/MessageBubble/MessageReaction.js.map +1 -1
  250. package/lib/module/components/MessageBubble/MessageReply.js +65 -24
  251. package/lib/module/components/MessageBubble/MessageReply.js.map +1 -1
  252. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +7 -4
  253. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  254. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +161 -18
  255. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  256. package/lib/module/components/Modals/FilePreviewModal/PdfView.js +4 -0
  257. package/lib/module/components/Modals/FilePreviewModal/PdfView.js.map +1 -1
  258. package/lib/module/components/Modals/Modal/SwipeBackLayer.js +76 -44
  259. package/lib/module/components/Modals/Modal/SwipeBackLayer.js.map +1 -1
  260. package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js +32 -8
  261. package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
  262. package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js +4 -0
  263. package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
  264. package/lib/module/components/RoomComponents/ChatRoomItem.js +37 -13
  265. package/lib/module/components/RoomComponents/ChatRoomItem.js.map +1 -1
  266. package/lib/module/components/RoomComponents/LastMessageItem.js +6 -0
  267. package/lib/module/components/RoomComponents/LastMessageItem.js.map +1 -1
  268. package/lib/module/components/RoomComponents/styled/LastAudioMessage.js +2 -2
  269. package/lib/module/components/RoomComponents/styled/LastAudioMessage.js.map +1 -1
  270. package/lib/module/components/RoomComponents/styled/LastMessageEmoji.js +8 -9
  271. package/lib/module/components/RoomComponents/styled/LastMessageEmoji.js.map +1 -1
  272. package/lib/module/components/RoomComponents/styled/LastMessageFile.js +4 -6
  273. package/lib/module/components/RoomComponents/styled/LastMessageFile.js.map +1 -1
  274. package/lib/module/components/RoomComponents/styled/LastMessagePhoto.js +2 -2
  275. package/lib/module/components/RoomComponents/styled/LastMessagePhoto.js.map +1 -1
  276. package/lib/module/components/RoomComponents/styled/LastMessageSealed.js +36 -0
  277. package/lib/module/components/RoomComponents/styled/LastMessageSealed.js.map +1 -0
  278. package/lib/module/components/RoomComponents/styled/LastMessageVideo.js +2 -2
  279. package/lib/module/components/RoomComponents/styled/LastMessageVideo.js.map +1 -1
  280. package/lib/module/components/Thread/ThreadWrapper.js +273 -153
  281. package/lib/module/components/Thread/ThreadWrapper.js.map +1 -1
  282. package/lib/module/components/UsersList/UsersList.js +2 -1
  283. package/lib/module/components/UsersList/UsersList.js.map +1 -1
  284. package/lib/module/components/styled/DateLabel.js +6 -3
  285. package/lib/module/components/styled/DateLabel.js.map +1 -1
  286. package/lib/module/components/styled/SendInput.js +4 -2
  287. package/lib/module/components/styled/SendInput.js.map +1 -1
  288. package/lib/module/context/MessageNotificationContext.js +190 -11
  289. package/lib/module/context/MessageNotificationContext.js.map +1 -1
  290. package/lib/module/context/xmppProvider.js +22 -7
  291. package/lib/module/context/xmppProvider.js.map +1 -1
  292. package/lib/module/e2ee/crypto.js +170 -0
  293. package/lib/module/e2ee/crypto.js.map +1 -0
  294. package/lib/module/e2ee/deviceStore.js +77 -0
  295. package/lib/module/e2ee/deviceStore.js.map +1 -0
  296. package/lib/module/e2ee/fileCipher.js +90 -0
  297. package/lib/module/e2ee/fileCipher.js.map +1 -0
  298. package/lib/module/e2ee/fileEnvelope.js +66 -0
  299. package/lib/module/e2ee/fileEnvelope.js.map +1 -0
  300. package/lib/module/e2ee/index.js +185 -0
  301. package/lib/module/e2ee/index.js.map +1 -0
  302. package/lib/module/e2ee/limits.js +5 -0
  303. package/lib/module/e2ee/limits.js.map +1 -0
  304. package/lib/module/e2ee/ns.js +4 -0
  305. package/lib/module/e2ee/ns.js.map +1 -0
  306. package/lib/module/e2ee/omemo.js +610 -0
  307. package/lib/module/e2ee/omemo.js.map +1 -0
  308. package/lib/module/e2ee/protobuf.js +140 -0
  309. package/lib/module/e2ee/protobuf.js.map +1 -0
  310. package/lib/module/e2ee/ratchet.js +228 -0
  311. package/lib/module/e2ee/ratchet.js.map +1 -0
  312. package/lib/module/e2ee/sealedBody.js +19 -0
  313. package/lib/module/e2ee/sealedBody.js.map +1 -0
  314. package/lib/module/e2ee/sealedFiles.js +154 -0
  315. package/lib/module/e2ee/sealedFiles.js.map +1 -0
  316. package/lib/module/e2ee/send.js +48 -0
  317. package/lib/module/e2ee/send.js.map +1 -0
  318. package/lib/module/e2ee/stanza.js +107 -0
  319. package/lib/module/e2ee/stanza.js.map +1 -0
  320. package/lib/module/e2ee/store.js +35 -0
  321. package/lib/module/e2ee/store.js.map +1 -0
  322. package/lib/module/helpers/accountName.js +18 -0
  323. package/lib/module/helpers/accountName.js.map +1 -0
  324. package/lib/module/helpers/createMessageFromXml.js +19 -4
  325. package/lib/module/helpers/createMessageFromXml.js.map +1 -1
  326. package/lib/module/helpers/createRoomFromApi.js +36 -2
  327. package/lib/module/helpers/createRoomFromApi.js.map +1 -1
  328. package/lib/module/helpers/createUserNameFromSetUser.js +3 -1
  329. package/lib/module/helpers/createUserNameFromSetUser.js.map +1 -1
  330. package/lib/module/helpers/displayName.js +11 -0
  331. package/lib/module/helpers/displayName.js.map +1 -0
  332. package/lib/module/helpers/emoji.js +44 -0
  333. package/lib/module/helpers/emoji.js.map +1 -0
  334. package/lib/module/helpers/haptics.js +24 -0
  335. package/lib/module/helpers/haptics.js.map +1 -0
  336. package/lib/module/helpers/historyPreloadScheduler.js +32 -66
  337. package/lib/module/helpers/historyPreloadScheduler.js.map +1 -1
  338. package/lib/module/helpers/insertMessageWithDelimiter.js +21 -12
  339. package/lib/module/helpers/insertMessageWithDelimiter.js.map +1 -1
  340. package/lib/module/helpers/mamReactions.js +51 -0
  341. package/lib/module/helpers/mamReactions.js.map +1 -0
  342. package/lib/module/helpers/parseMessageReference.js +37 -0
  343. package/lib/module/helpers/parseMessageReference.js.map +1 -0
  344. package/lib/module/helpers/persistCrypto.js +4 -0
  345. package/lib/module/helpers/persistCrypto.js.map +1 -1
  346. package/lib/module/helpers/reactionsConfig.js +10 -0
  347. package/lib/module/helpers/reactionsConfig.js.map +1 -0
  348. package/lib/module/helpers/secureKeyValue.js +19 -0
  349. package/lib/module/helpers/secureKeyValue.js.map +1 -1
  350. package/lib/module/helpers/updateMessagesTillLast.js +17 -2
  351. package/lib/module/helpers/updateMessagesTillLast.js.map +1 -1
  352. package/lib/module/helpers/videoCache.js +125 -0
  353. package/lib/module/helpers/videoCache.js.map +1 -0
  354. package/lib/module/hooks/useHeapSender.js +3 -1
  355. package/lib/module/hooks/useHeapSender.js.map +1 -1
  356. package/lib/module/hooks/useLogout.js +8 -0
  357. package/lib/module/hooks/useLogout.js.map +1 -1
  358. package/lib/module/hooks/useMessageHeapState.js +3 -2
  359. package/lib/module/hooks/useMessageHeapState.js.map +1 -1
  360. package/lib/module/hooks/useRoomInitialization.js +17 -8
  361. package/lib/module/hooks/useRoomInitialization.js.map +1 -1
  362. package/lib/module/hooks/useSendMessage.js +85 -15
  363. package/lib/module/hooks/useSendMessage.js.map +1 -1
  364. package/lib/module/hooks/useUnreadMessagesCounter.js +1 -1
  365. package/lib/module/hooks/useUnreadMessagesCounter.js.map +1 -1
  366. package/lib/module/i18n/strings.js +180 -0
  367. package/lib/module/i18n/strings.js.map +1 -1
  368. package/lib/module/main.js +1 -0
  369. package/lib/module/main.js.map +1 -1
  370. package/lib/module/networking/api-requests/auth.api.js +4 -1
  371. package/lib/module/networking/api-requests/auth.api.js.map +1 -1
  372. package/lib/module/networking/api-requests/rooms.api.js +109 -18
  373. package/lib/module/networking/api-requests/rooms.api.js.map +1 -1
  374. package/lib/module/networking/stanzaHandlers.js +107 -51
  375. package/lib/module/networking/stanzaHandlers.js.map +1 -1
  376. package/lib/module/networking/xmpp/getHistory.xmpp.js +29 -74
  377. package/lib/module/networking/xmpp/getHistory.xmpp.js.map +1 -1
  378. package/lib/module/networking/xmpp/handleStanzas.xmpp.js +42 -0
  379. package/lib/module/networking/xmpp/handleStanzas.xmpp.js.map +1 -1
  380. package/lib/module/networking/xmpp/mamRouter.js +175 -0
  381. package/lib/module/networking/xmpp/mamRouter.js.map +1 -0
  382. package/lib/module/networking/xmpp/presenceInRoom.xmpp.js +38 -2
  383. package/lib/module/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
  384. package/lib/module/networking/xmpp/sendMediaMessage.xmpp.js +16 -3
  385. package/lib/module/networking/xmpp/sendMediaMessage.xmpp.js.map +1 -1
  386. package/lib/module/networking/xmpp/sendTextMessage.xmpp.js +13 -6
  387. package/lib/module/networking/xmpp/sendTextMessage.xmpp.js.map +1 -1
  388. package/lib/module/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js +14 -6
  389. package/lib/module/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js.map +1 -1
  390. package/lib/module/networking/xmppClient.js +105 -24
  391. package/lib/module/networking/xmppClient.js.map +1 -1
  392. package/lib/module/roomStore/Middleware/newMessageMidlleware.js +29 -34
  393. package/lib/module/roomStore/Middleware/newMessageMidlleware.js.map +1 -1
  394. package/lib/module/roomStore/Middleware/perfMiddleware.js +45 -0
  395. package/lib/module/roomStore/Middleware/perfMiddleware.js.map +1 -0
  396. package/lib/module/roomStore/Middleware/reactionsMiddleware.js +66 -43
  397. package/lib/module/roomStore/Middleware/reactionsMiddleware.js.map +1 -1
  398. package/lib/module/roomStore/Middleware/unreadMidlleware.js +89 -69
  399. package/lib/module/roomStore/Middleware/unreadMidlleware.js.map +1 -1
  400. package/lib/module/roomStore/index.js +19 -15
  401. package/lib/module/roomStore/index.js.map +1 -1
  402. package/lib/module/roomStore/persistBackend.js +86 -0
  403. package/lib/module/roomStore/persistBackend.js.map +1 -0
  404. package/lib/module/roomStore/persistence.js +253 -49
  405. package/lib/module/roomStore/persistence.js.map +1 -1
  406. package/lib/module/roomStore/roomsSlice.js +275 -134
  407. package/lib/module/roomStore/roomsSlice.js.map +1 -1
  408. package/lib/module/theme/theme.js +3 -0
  409. package/lib/module/theme/theme.js.map +1 -1
  410. package/lib/module/utils/devLogger.js +13 -0
  411. package/lib/module/utils/devLogger.js.map +1 -1
  412. package/lib/module/version.js +1 -1
  413. package/lib/typescript/assets/emojiData.d.ts +8 -0
  414. package/lib/typescript/assets/emojiData.d.ts.map +1 -0
  415. package/lib/typescript/assets/icons.d.ts +8 -0
  416. package/lib/typescript/assets/icons.d.ts.map +1 -1
  417. package/lib/typescript/components/MainComponents/ChatHeader.d.ts.map +1 -1
  418. package/lib/typescript/components/MainComponents/ChatRoom.d.ts.map +1 -1
  419. package/lib/typescript/components/MainComponents/ChatWrapper.d.ts.map +1 -1
  420. package/lib/typescript/components/MainComponents/EncryptedSendNotice.d.ts +4 -0
  421. package/lib/typescript/components/MainComponents/EncryptedSendNotice.d.ts.map +1 -0
  422. package/lib/typescript/components/MainComponents/EncryptionCard.d.ts +10 -0
  423. package/lib/typescript/components/MainComponents/EncryptionCard.d.ts.map +1 -0
  424. package/lib/typescript/components/MainComponents/MediaMessage.d.ts.map +1 -1
  425. package/lib/typescript/components/MainComponents/MessageContainer.d.ts +2 -2
  426. package/lib/typescript/components/MainComponents/MessageContainer.d.ts.map +1 -1
  427. package/lib/typescript/components/MainComponents/MessageList.d.ts.map +1 -1
  428. package/lib/typescript/components/MainComponents/ReduxWrapper.d.ts.map +1 -1
  429. package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
  430. package/lib/typescript/components/MainComponents/RoomStack.d.ts +7 -2
  431. package/lib/typescript/components/MainComponents/RoomStack.d.ts.map +1 -1
  432. package/lib/typescript/components/MainComponents/SealedAttachment.d.ts +13 -0
  433. package/lib/typescript/components/MainComponents/SealedAttachment.d.ts.map +1 -0
  434. package/lib/typescript/components/MainComponents/SystemMessage.d.ts.map +1 -1
  435. package/lib/typescript/components/MessageBubble/Avatar.d.ts +2 -0
  436. package/lib/typescript/components/MessageBubble/Avatar.d.ts.map +1 -1
  437. package/lib/typescript/components/MessageBubble/BottomReplyContainer.d.ts.map +1 -1
  438. package/lib/typescript/components/MessageBubble/EmojiPickerSheet.d.ts +11 -0
  439. package/lib/typescript/components/MessageBubble/EmojiPickerSheet.d.ts.map +1 -0
  440. package/lib/typescript/components/MessageBubble/Message.d.ts +2 -2
  441. package/lib/typescript/components/MessageBubble/Message.d.ts.map +1 -1
  442. package/lib/typescript/components/MessageBubble/MessageInteractions.d.ts +2 -0
  443. package/lib/typescript/components/MessageBubble/MessageInteractions.d.ts.map +1 -1
  444. package/lib/typescript/components/MessageBubble/MessageReaction.d.ts +1 -0
  445. package/lib/typescript/components/MessageBubble/MessageReaction.d.ts.map +1 -1
  446. package/lib/typescript/components/MessageBubble/MessageReply.d.ts +7 -7
  447. package/lib/typescript/components/MessageBubble/MessageReply.d.ts.map +1 -1
  448. package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
  449. package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts.map +1 -1
  450. package/lib/typescript/components/Modals/FilePreviewModal/PdfView.d.ts.map +1 -1
  451. package/lib/typescript/components/Modals/Modal/SwipeBackLayer.d.ts +2 -1
  452. package/lib/typescript/components/Modals/Modal/SwipeBackLayer.d.ts.map +1 -1
  453. package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts.map +1 -1
  454. package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts.map +1 -1
  455. package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts +2 -2
  456. package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts.map +1 -1
  457. package/lib/typescript/components/RoomComponents/LastMessageItem.d.ts.map +1 -1
  458. package/lib/typescript/components/RoomComponents/styled/LastAudioMessage.d.ts.map +1 -1
  459. package/lib/typescript/components/RoomComponents/styled/LastMessageEmoji.d.ts +3 -6
  460. package/lib/typescript/components/RoomComponents/styled/LastMessageEmoji.d.ts.map +1 -1
  461. package/lib/typescript/components/RoomComponents/styled/LastMessageSealed.d.ts +7 -0
  462. package/lib/typescript/components/RoomComponents/styled/LastMessageSealed.d.ts.map +1 -0
  463. package/lib/typescript/components/Thread/ThreadWrapper.d.ts +7 -1
  464. package/lib/typescript/components/Thread/ThreadWrapper.d.ts.map +1 -1
  465. package/lib/typescript/components/UsersList/UsersList.d.ts.map +1 -1
  466. package/lib/typescript/components/styled/DateLabel.d.ts +1 -0
  467. package/lib/typescript/components/styled/DateLabel.d.ts.map +1 -1
  468. package/lib/typescript/components/styled/SendInput.d.ts +1 -0
  469. package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
  470. package/lib/typescript/context/MessageNotificationContext.d.ts.map +1 -1
  471. package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
  472. package/lib/typescript/e2ee/crypto.d.ts +28 -0
  473. package/lib/typescript/e2ee/crypto.d.ts.map +1 -0
  474. package/lib/typescript/e2ee/deviceStore.d.ts +4 -0
  475. package/lib/typescript/e2ee/deviceStore.d.ts.map +1 -0
  476. package/lib/typescript/e2ee/fileCipher.d.ts +7 -0
  477. package/lib/typescript/e2ee/fileCipher.d.ts.map +1 -0
  478. package/lib/typescript/e2ee/fileEnvelope.d.ts +27 -0
  479. package/lib/typescript/e2ee/fileEnvelope.d.ts.map +1 -0
  480. package/lib/typescript/e2ee/index.d.ts +23 -0
  481. package/lib/typescript/e2ee/index.d.ts.map +1 -0
  482. package/lib/typescript/e2ee/limits.d.ts +3 -0
  483. package/lib/typescript/e2ee/limits.d.ts.map +1 -0
  484. package/lib/typescript/e2ee/ns.d.ts +2 -0
  485. package/lib/typescript/e2ee/ns.d.ts.map +1 -0
  486. package/lib/typescript/e2ee/omemo.d.ts +64 -0
  487. package/lib/typescript/e2ee/omemo.d.ts.map +1 -0
  488. package/lib/typescript/e2ee/protobuf.d.ts +25 -0
  489. package/lib/typescript/e2ee/protobuf.d.ts.map +1 -0
  490. package/lib/typescript/e2ee/ratchet.d.ts +39 -0
  491. package/lib/typescript/e2ee/ratchet.d.ts.map +1 -0
  492. package/lib/typescript/e2ee/sealedBody.d.ts +2 -0
  493. package/lib/typescript/e2ee/sealedBody.d.ts.map +1 -0
  494. package/lib/typescript/e2ee/sealedFiles.d.ts +31 -0
  495. package/lib/typescript/e2ee/sealedFiles.d.ts.map +1 -0
  496. package/lib/typescript/e2ee/send.d.ts +6 -0
  497. package/lib/typescript/e2ee/send.d.ts.map +1 -0
  498. package/lib/typescript/e2ee/stanza.d.ts +8 -0
  499. package/lib/typescript/e2ee/stanza.d.ts.map +1 -0
  500. package/lib/typescript/e2ee/store.d.ts +16 -0
  501. package/lib/typescript/e2ee/store.d.ts.map +1 -0
  502. package/lib/typescript/helpers/accountName.d.ts +7 -0
  503. package/lib/typescript/helpers/accountName.d.ts.map +1 -0
  504. package/lib/typescript/helpers/createMessageFromXml.d.ts.map +1 -1
  505. package/lib/typescript/helpers/createRoomFromApi.d.ts.map +1 -1
  506. package/lib/typescript/helpers/createUserNameFromSetUser.d.ts.map +1 -1
  507. package/lib/typescript/helpers/displayName.d.ts +2 -0
  508. package/lib/typescript/helpers/displayName.d.ts.map +1 -0
  509. package/lib/typescript/helpers/emoji.d.ts +6 -0
  510. package/lib/typescript/helpers/emoji.d.ts.map +1 -0
  511. package/lib/typescript/helpers/haptics.d.ts +3 -0
  512. package/lib/typescript/helpers/haptics.d.ts.map +1 -0
  513. package/lib/typescript/helpers/historyPreloadScheduler.d.ts +1 -0
  514. package/lib/typescript/helpers/historyPreloadScheduler.d.ts.map +1 -1
  515. package/lib/typescript/helpers/insertMessageWithDelimiter.d.ts.map +1 -1
  516. package/lib/typescript/helpers/mamReactions.d.ts +13 -0
  517. package/lib/typescript/helpers/mamReactions.d.ts.map +1 -0
  518. package/lib/typescript/helpers/parseMessageReference.d.ts +16 -0
  519. package/lib/typescript/helpers/parseMessageReference.d.ts.map +1 -0
  520. package/lib/typescript/helpers/persistCrypto.d.ts +1 -0
  521. package/lib/typescript/helpers/persistCrypto.d.ts.map +1 -1
  522. package/lib/typescript/helpers/reactionsConfig.d.ts +5 -0
  523. package/lib/typescript/helpers/reactionsConfig.d.ts.map +1 -0
  524. package/lib/typescript/helpers/secureKeyValue.d.ts +4 -0
  525. package/lib/typescript/helpers/secureKeyValue.d.ts.map +1 -1
  526. package/lib/typescript/helpers/updateMessagesTillLast.d.ts.map +1 -1
  527. package/lib/typescript/helpers/videoCache.d.ts +19 -0
  528. package/lib/typescript/helpers/videoCache.d.ts.map +1 -0
  529. package/lib/typescript/hooks/useHeapSender.d.ts.map +1 -1
  530. package/lib/typescript/hooks/useLogout.d.ts.map +1 -1
  531. package/lib/typescript/hooks/useMessageHeapState.d.ts.map +1 -1
  532. package/lib/typescript/hooks/useRoomInitialization.d.ts +2 -2
  533. package/lib/typescript/hooks/useRoomInitialization.d.ts.map +1 -1
  534. package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
  535. package/lib/typescript/i18n/strings.d.ts.map +1 -1
  536. package/lib/typescript/main.d.ts +2 -0
  537. package/lib/typescript/main.d.ts.map +1 -1
  538. package/lib/typescript/networking/api-requests/auth.api.d.ts +4 -1
  539. package/lib/typescript/networking/api-requests/auth.api.d.ts.map +1 -1
  540. package/lib/typescript/networking/api-requests/rooms.api.d.ts +22 -1
  541. package/lib/typescript/networking/api-requests/rooms.api.d.ts.map +1 -1
  542. package/lib/typescript/networking/stanzaHandlers.d.ts +4 -2
  543. package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
  544. package/lib/typescript/networking/xmpp/getHistory.xmpp.d.ts +3 -1
  545. package/lib/typescript/networking/xmpp/getHistory.xmpp.d.ts.map +1 -1
  546. package/lib/typescript/networking/xmpp/handleStanzas.xmpp.d.ts +1 -0
  547. package/lib/typescript/networking/xmpp/handleStanzas.xmpp.d.ts.map +1 -1
  548. package/lib/typescript/networking/xmpp/mamRouter.d.ts +23 -0
  549. package/lib/typescript/networking/xmpp/mamRouter.d.ts.map +1 -0
  550. package/lib/typescript/networking/xmpp/presenceInRoom.xmpp.d.ts +1 -0
  551. package/lib/typescript/networking/xmpp/presenceInRoom.xmpp.d.ts.map +1 -1
  552. package/lib/typescript/networking/xmpp/sendMediaMessage.xmpp.d.ts.map +1 -1
  553. package/lib/typescript/networking/xmpp/sendTextMessage.xmpp.d.ts.map +1 -1
  554. package/lib/typescript/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.d.ts.map +1 -1
  555. package/lib/typescript/networking/xmppClient.d.ts +22 -1
  556. package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
  557. package/lib/typescript/roomStore/Middleware/newMessageMidlleware.d.ts.map +1 -1
  558. package/lib/typescript/roomStore/Middleware/perfMiddleware.d.ts +4 -0
  559. package/lib/typescript/roomStore/Middleware/perfMiddleware.d.ts.map +1 -0
  560. package/lib/typescript/roomStore/Middleware/reactionsMiddleware.d.ts +9 -0
  561. package/lib/typescript/roomStore/Middleware/reactionsMiddleware.d.ts.map +1 -1
  562. package/lib/typescript/roomStore/Middleware/unreadMidlleware.d.ts.map +1 -1
  563. package/lib/typescript/roomStore/index.d.ts.map +1 -1
  564. package/lib/typescript/roomStore/persistBackend.d.ts +11 -0
  565. package/lib/typescript/roomStore/persistBackend.d.ts.map +1 -0
  566. package/lib/typescript/roomStore/persistence.d.ts +5 -6
  567. package/lib/typescript/roomStore/persistence.d.ts.map +1 -1
  568. package/lib/typescript/roomStore/roomsSlice.d.ts +41 -1
  569. package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
  570. package/lib/typescript/theme/theme.d.ts +4 -1
  571. package/lib/typescript/theme/theme.d.ts.map +1 -1
  572. package/lib/typescript/types/models/message.model.d.ts +9 -0
  573. package/lib/typescript/types/models/message.model.d.ts.map +1 -1
  574. package/lib/typescript/types/models/room.model.d.ts +21 -0
  575. package/lib/typescript/types/models/room.model.d.ts.map +1 -1
  576. package/lib/typescript/types/models/xmpp.model.d.ts +6 -1
  577. package/lib/typescript/types/models/xmpp.model.d.ts.map +1 -1
  578. package/lib/typescript/types/types.d.ts +19 -3
  579. package/lib/typescript/types/types.d.ts.map +1 -1
  580. package/lib/typescript/utils/devLogger.d.ts +8 -0
  581. package/lib/typescript/utils/devLogger.d.ts.map +1 -1
  582. package/lib/typescript/version.d.ts +1 -1
  583. package/package.json +14 -1
  584. package/src/assets/emojiData.ts +2146 -0
  585. package/src/assets/icons.tsx +32 -5
  586. package/src/components/MainComponents/ChatHeader.tsx +46 -16
  587. package/src/components/MainComponents/ChatRoom.tsx +46 -30
  588. package/src/components/MainComponents/ChatWrapper.tsx +28 -10
  589. package/src/components/MainComponents/EncryptedSendNotice.tsx +35 -0
  590. package/src/components/MainComponents/EncryptionCard.tsx +287 -0
  591. package/src/components/MainComponents/MediaMessage.tsx +5 -0
  592. package/src/components/MainComponents/MessageContainer.tsx +7 -15
  593. package/src/components/MainComponents/MessageList.tsx +96 -43
  594. package/src/components/MainComponents/ReduxWrapper.tsx +5 -0
  595. package/src/components/MainComponents/RoomList.tsx +28 -29
  596. package/src/components/MainComponents/RoomStack.tsx +156 -83
  597. package/src/components/MainComponents/SealedAttachment.tsx +251 -0
  598. package/src/components/MainComponents/SystemMessage.tsx +6 -2
  599. package/src/components/MessageBubble/Avatar.tsx +7 -1
  600. package/src/components/MessageBubble/BottomReplyContainer.tsx +20 -21
  601. package/src/components/MessageBubble/EmojiPickerSheet.tsx +468 -0
  602. package/src/components/MessageBubble/Message.tsx +242 -93
  603. package/src/components/MessageBubble/MessageInteractions.tsx +215 -15
  604. package/src/components/MessageBubble/MessageReaction.tsx +120 -96
  605. package/src/components/MessageBubble/MessageReply.tsx +65 -32
  606. package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +7 -4
  607. package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +181 -35
  608. package/src/components/Modals/FilePreviewModal/PdfView.tsx +4 -0
  609. package/src/components/Modals/Modal/SwipeBackLayer.tsx +114 -63
  610. package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +53 -8
  611. package/src/components/Modals/UserSettingsModal/UserSettingsModal.tsx +5 -0
  612. package/src/components/RoomComponents/ChatRoomItem.tsx +34 -15
  613. package/src/components/RoomComponents/LastMessageItem.tsx +5 -0
  614. package/src/components/RoomComponents/styled/LastAudioMessage.tsx +3 -1
  615. package/src/components/RoomComponents/styled/LastMessageEmoji.tsx +7 -8
  616. package/src/components/RoomComponents/styled/LastMessageFile.tsx +2 -2
  617. package/src/components/RoomComponents/styled/LastMessagePhoto.tsx +1 -1
  618. package/src/components/RoomComponents/styled/LastMessageSealed.tsx +31 -0
  619. package/src/components/RoomComponents/styled/LastMessageVideo.tsx +1 -1
  620. package/src/components/Thread/ThreadWrapper.tsx +287 -198
  621. package/src/components/UsersList/UsersList.tsx +2 -1
  622. package/src/components/styled/DateLabel.tsx +7 -3
  623. package/src/components/styled/SendInput.tsx +5 -2
  624. package/src/context/MessageNotificationContext.tsx +205 -7
  625. package/src/context/xmppProvider.tsx +29 -9
  626. package/src/e2ee/crypto.ts +194 -0
  627. package/src/e2ee/deviceStore.ts +80 -0
  628. package/src/e2ee/fileCipher.ts +86 -0
  629. package/src/e2ee/fileEnvelope.ts +115 -0
  630. package/src/e2ee/index.ts +192 -0
  631. package/src/e2ee/limits.ts +2 -0
  632. package/src/e2ee/ns.ts +1 -0
  633. package/src/e2ee/omemo.ts +802 -0
  634. package/src/e2ee/protobuf.ts +188 -0
  635. package/src/e2ee/ratchet.ts +271 -0
  636. package/src/e2ee/sealedBody.ts +17 -0
  637. package/src/e2ee/sealedFiles.ts +181 -0
  638. package/src/e2ee/send.ts +70 -0
  639. package/src/e2ee/stanza.ts +133 -0
  640. package/src/e2ee/store.ts +54 -0
  641. package/src/helpers/accountName.ts +15 -0
  642. package/src/helpers/createMessageFromXml.ts +31 -6
  643. package/src/helpers/createRoomFromApi.tsx +37 -1
  644. package/src/helpers/createUserNameFromSetUser.ts +2 -1
  645. package/src/helpers/displayName.ts +9 -0
  646. package/src/helpers/emoji.ts +39 -0
  647. package/src/helpers/haptics.ts +19 -0
  648. package/src/helpers/historyPreloadScheduler.ts +37 -69
  649. package/src/helpers/insertMessageWithDelimiter.ts +23 -16
  650. package/src/helpers/mamReactions.ts +59 -0
  651. package/src/helpers/parseMessageReference.ts +38 -0
  652. package/src/helpers/persistCrypto.ts +5 -0
  653. package/src/helpers/reactionsConfig.ts +13 -0
  654. package/src/helpers/secureKeyValue.ts +15 -0
  655. package/src/helpers/updateMessagesTillLast.tsx +14 -2
  656. package/src/helpers/videoCache.ts +138 -0
  657. package/src/hooks/useHeapSender.tsx +3 -2
  658. package/src/hooks/useLogout.tsx +9 -0
  659. package/src/hooks/useMessageHeapState.tsx +6 -2
  660. package/src/hooks/useRoomInitialization.tsx +32 -15
  661. package/src/hooks/useSendMessage.tsx +89 -16
  662. package/src/hooks/useUnreadMessagesCounter.ts +1 -1
  663. package/src/i18n/strings.ts +180 -0
  664. package/src/main.ts +2 -0
  665. package/src/networking/api-requests/auth.api.ts +9 -1
  666. package/src/networking/api-requests/rooms.api.ts +121 -18
  667. package/src/networking/stanzaHandlers.ts +116 -60
  668. package/src/networking/xmpp/getHistory.xmpp.ts +44 -106
  669. package/src/networking/xmpp/handleStanzas.xmpp.ts +51 -0
  670. package/src/networking/xmpp/mamRouter.ts +176 -0
  671. package/src/networking/xmpp/presenceInRoom.xmpp.ts +46 -3
  672. package/src/networking/xmpp/sendMediaMessage.xmpp.ts +19 -1
  673. package/src/networking/xmpp/sendTextMessage.xmpp.ts +17 -10
  674. package/src/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.ts +23 -10
  675. package/src/networking/xmppClient.ts +111 -20
  676. package/src/roomStore/Middleware/newMessageMidlleware.tsx +35 -38
  677. package/src/roomStore/Middleware/perfMiddleware.ts +50 -0
  678. package/src/roomStore/Middleware/reactionsMiddleware.tsx +53 -52
  679. package/src/roomStore/Middleware/unreadMidlleware.tsx +92 -80
  680. package/src/roomStore/index.ts +28 -27
  681. package/src/roomStore/persistBackend.ts +93 -0
  682. package/src/roomStore/persistence.ts +295 -73
  683. package/src/roomStore/roomsSlice.ts +304 -155
  684. package/src/theme/theme.ts +10 -1
  685. package/src/types/models/message.model.ts +9 -0
  686. package/src/types/models/room.model.ts +22 -0
  687. package/src/types/models/xmpp.model.ts +4 -2
  688. package/src/types/types.ts +19 -3
  689. package/src/utils/devLogger.ts +16 -0
  690. package/src/version.ts +1 -1
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+
3
+ import { Element, parse } from 'ltx';
4
+ import { store } from '../roomStore';
5
+ import { translateKey } from '../i18n/strings';
6
+ import { NS_OMEMO } from './ns';
7
+ import { omemoReady, senderJidFromMuc } from './index';
8
+ const READY_TIMEOUT_MS = 8000;
9
+ export function encryptedCarrier(stanza, depth = 0) {
10
+ if (depth > 4 || !stanza?.getChild) {
11
+ return undefined;
12
+ }
13
+ if (stanza.name === 'message' && stanza.getChild('encrypted', NS_OMEMO)) {
14
+ return stanza;
15
+ }
16
+ for (const child of stanza.children ?? []) {
17
+ if (typeof child === 'string') {
18
+ continue;
19
+ }
20
+ const found = encryptedCarrier(child, depth + 1);
21
+ if (found) {
22
+ return found;
23
+ }
24
+ }
25
+ return undefined;
26
+ }
27
+ const PLACEHOLDER_KEY = {
28
+ unsupported: 'e2ee.unsupportedMessage',
29
+ 'other-device': 'e2ee.otherDevice',
30
+ failed: 'e2ee.undecryptable'
31
+ };
32
+ export function placeholderKey(error) {
33
+ return PLACEHOLDER_KEY[error] ?? PLACEHOLDER_KEY.failed;
34
+ }
35
+ function placeholder(error) {
36
+ const settings = store.getState()?.chatSettingStore;
37
+ return new Element('body', {}).t(translateKey(placeholderKey(error), settings?.config?.i18n?.locale || settings?.langSource, settings?.config?.i18n?.strings));
38
+ }
39
+ function mark(carrier, error) {
40
+ let data = carrier.getChild('data');
41
+ if (!data) {
42
+ data = new Element('data', {});
43
+ carrier.append(data);
44
+ }
45
+ data.attrs.omemoEncrypted = 'true';
46
+ if (error) {
47
+ data.attrs.undecryptable = 'true';
48
+ data.attrs.e2eeError = error;
49
+ }
50
+ }
51
+ function strip(carrier) {
52
+ carrier.remove('encrypted', NS_OMEMO);
53
+ carrier.remove('encryption', 'urn:xmpp:eme:0');
54
+ carrier.remove('body');
55
+ }
56
+ function close(carrier, error) {
57
+ strip(carrier);
58
+ carrier.append(placeholder(error));
59
+ mark(carrier, error);
60
+ return 'undecryptable';
61
+ }
62
+ export function rewriteEncryptedStanza(stanza) {
63
+ const carrier = encryptedCarrier(stanza);
64
+ if (!carrier) {
65
+ return 'not-encrypted';
66
+ }
67
+ const encrypted = carrier.getChild('encrypted', NS_OMEMO);
68
+ if (!encrypted?.getChild('payload')) {
69
+ return 'drop';
70
+ }
71
+ return close(carrier, 'unsupported');
72
+ }
73
+ const waitForDevice = () => {
74
+ let timer;
75
+ const timeout = new Promise(resolve => {
76
+ timer = setTimeout(() => resolve(undefined), READY_TIMEOUT_MS);
77
+ });
78
+ return Promise.race([omemoReady(), timeout]).finally(() => {
79
+ if (timer) {
80
+ clearTimeout(timer);
81
+ }
82
+ });
83
+ };
84
+ export async function decryptStanzaInPlace(stanza, domain) {
85
+ const carrier = encryptedCarrier(stanza);
86
+ if (!carrier) {
87
+ return 'not-encrypted';
88
+ }
89
+ const encrypted = carrier.getChild('encrypted', NS_OMEMO);
90
+ if (!encrypted?.getChild('payload')) {
91
+ return 'drop';
92
+ }
93
+ const from = String(carrier.attrs?.from || '');
94
+ const roomJid = from.split('/')[0];
95
+ const sender = senderJidFromMuc(from, domain);
96
+ const crypto = await waitForDevice();
97
+ const decrypted = sender ? await crypto?.decrypt(carrier, sender, roomJid) : undefined;
98
+ if (!decrypted?.content) {
99
+ return close(carrier, decrypted?.error === 'omemo_not_encrypted_for_this_device' ? 'other-device' : 'failed');
100
+ }
101
+ strip(carrier);
102
+ const wrapper = parse(`<omemo-content>${decrypted.content}</omemo-content>`);
103
+ carrier.append(...wrapper.children);
104
+ mark(carrier);
105
+ return 'decrypted';
106
+ }
107
+ //# sourceMappingURL=stanza.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Element","parse","store","translateKey","NS_OMEMO","omemoReady","senderJidFromMuc","READY_TIMEOUT_MS","encryptedCarrier","stanza","depth","getChild","undefined","name","child","children","found","PLACEHOLDER_KEY","unsupported","failed","placeholderKey","error","placeholder","settings","getState","chatSettingStore","t","config","i18n","locale","langSource","strings","mark","carrier","data","append","attrs","omemoEncrypted","undecryptable","e2eeError","strip","remove","close","rewriteEncryptedStanza","encrypted","waitForDevice","timer","timeout","Promise","resolve","setTimeout","race","finally","clearTimeout","decryptStanzaInPlace","domain","from","String","roomJid","split","sender","crypto","decrypted","decrypt","content","wrapper"],"sourceRoot":"../../../src","sources":["e2ee/stanza.ts"],"mappings":";;AAAA,SAASA,OAAO,EAAEC,KAAK,QAAQ,KAAK;AACpC,SAASC,KAAK,QAAQ,cAAc;AACpC,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,QAAQ,QAAQ,MAAM;AAC/B,SAASC,UAAU,EAAEC,gBAAgB,QAAQ,SAAS;AAatD,MAAMC,gBAAgB,GAAG,IAAI;AAE7B,OAAO,SAASC,gBAAgBA,CAC9BC,MAAe,EACfC,KAAK,GAAG,CAAC,EACY;EACrB,IAAIA,KAAK,GAAG,CAAC,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c,GACd,QACN,CAAC;EACH;EAEAmB,KAAK,CAACP,OAAO,CAAC;EACd,MAAMgC,OAAO,GAAGhE,KAAK,CAAC,kBAAkB6D,SAAS,CAACE,OAAO,kBAAkB,CAAC;EAC5E/B,OAAO,CAACE,MAAM,CAAC,GAAG8B,OAAO,CAAClD,QAAQ,CAAC;EACnCiB,IAAI,CAACC,OAAO,CAAC;EACb,OAAO,WAAW;AACpB","ignoreList":[]}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ import { fromBase64, toBase64 } from './crypto';
4
+ const BYTES_TAG = '$bytes';
5
+ export function encodeValue(value) {
6
+ return JSON.stringify(value, (_key, item) => item instanceof Uint8Array ? {
7
+ [BYTES_TAG]: toBase64(item)
8
+ } : item);
9
+ }
10
+ export function decodeValue(text) {
11
+ return JSON.parse(text, (_key, item) => item && typeof item === 'object' && typeof item[BYTES_TAG] === 'string' ? fromBase64(item[BYTES_TAG]) : item);
12
+ }
13
+ export function createStore(backend, jid) {
14
+ const prefix = `${jid.toLowerCase()}|`;
15
+ return {
16
+ get: async key => {
17
+ const raw = await backend.getItem(prefix + key);
18
+ return raw === null ? undefined : decodeValue(raw);
19
+ },
20
+ set: (key, value) => backend.setItem(prefix + key, encodeValue(value)),
21
+ delete: key => backend.removeItem(prefix + key)
22
+ };
23
+ }
24
+ export function createMemoryBackend() {
25
+ const data = new Map();
26
+ return {
27
+ getItem: async key => data.get(key) ?? null,
28
+ setItem: async (key, value) => void data.set(key, value),
29
+ removeItem: async key => void data.delete(key)
30
+ };
31
+ }
32
+ export function createMemoryStore(jid = 'memory') {
33
+ return createStore(createMemoryBackend(), jid);
34
+ }
35
+ //# sourceMappingURL=store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["fromBase64","toBase64","BYTES_TAG","encodeValue","value","JSON","stringify","_key","item","Uint8Array","decodeValue","text","parse","createStore","backend","jid","prefix","toLowerCase","get","key","raw","getItem","undefined","set","setItem","delete","removeItem","createMemoryBackend","data","Map","createM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AACH;AAEA,OAAO,SAASQ,mBAAmBA,CAAA,EAAkB;EACnD,MAAMC,IAAI,GAAG,IAAIC,GAAG,CAAiB,CAAC;EACtC,OAAO;IACLR,OAAO,EAAE,MAAOF,GAAG,IAAKS,IAAI,CAACV,GAAG,CAACC,GAAG,CAAC,IAAI,IAAI;IAC7CK,OAAO,EAAE,MAAAA,CAAOL,GAAG,EAAEf,KAAK,KAAK,KAAKwB,IAAI,CAACL,GAAG,CAACJ,GAAG,EAAEf,KAAK,CAAC;IACxDsB,UAAU,EAAE,MAAOP,GAAG,IAAK,KAAKS,IAAI,CAACH,MAAM,CAACN,GAAG;EACjD,CAAC;AACH;AAEA,OAAO,SAASW,iBAAiBA,CAACf,GAAG,GAAG,QAAQ,EAAc;EAC5D,OAAOF,WAAW,CAACc,mBAAmB,CAAC,CAAC,EAAEZ,GAAG,CAAC;AAChD","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ export const accountNameOf = (user, appId) => {
4
+ for (const raw of [user?.xmppUsername, user?.userJID, user?.id, user?._id]) {
5
+ const value = String(raw || '').split('@')[0].trim();
6
+ if (!value) {
7
+ continue;
8
+ }
9
+ if (value.includes('_')) {
10
+ return value;
11
+ }
12
+ if (appId) {
13
+ return `${appId}_${value}`;
14
+ }
15
+ }
16
+ return '';
17
+ };
18
+ //# sourceMappingURL=accountName.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["accountNameOf","user","appId","raw","xmppUsername","userJID","id","_id","value","String","split","trim","includes"],"sourceRoot":"../../../src","sources":["helpers/accountName.ts"],"mappings":";;AAAA,OAAO,MAAMA,aAAa,GAAGA,CAC3BC,IAGa,EACbC,KAAa,KACF;EACX,KAAK,MAAMC,GAAG,IAAI,CAACF,IAAI,EAAEG,YAAY,EAAEH,IAAI,EAAEI,OAAO,EAAEJ,IAAI,EAAEK,EAAE,EAAEL,IAAI,EAAEM,GAAG,CAAC,EAAE;IAC1E,MAAMC,KAAK,GAAGC,MAAM,CAACN,GAAG,IAAI,EAAE,CAAC,CAACO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAEC,IAAI,CAAC,CAAC;IACrD,IAAI,CAACH,KAAK,EAAE;MAAC;IAAS;IACtB,IAAIA,KAAK,CAACI,QAAQ,CAAC,GAAG,CAAC,EAAE;MAAC,OAAOJ,KAAK;IAAC;IACvC,IAAIN,KAAK,EAAE;MAAC,OAAO,GAAGA,KAAK,IAAIM,KAAK,EAAE;IAAC;EACzC;EACA,OAAO,EAAE;AACX,CAAC","ignoreList":[]}
@@ -1,5 +1,8 @@
1
1
  "use strict";
2
2
 
3
+ import { isE2eeRoom } from '../e2ee';
4
+ import { composeName } from './displayName';
5
+ import { parseSealedMediaBody } from '../e2ee/sealedBody';
3
6
  /**
4
7
  * Build an IMessage from XML.
5
8
  *
@@ -77,11 +80,14 @@ export const createMessageFromXml = async (arg, bodyEl, positionalId, positional
77
80
  // Synthesize user.name from sender attrs (web reads usersSet from
78
81
  // redux in <Message>; we fix it once at the source so Avatar /
79
82
  // MessageHeader render the actual sender instead of "??").
80
- const firstName = (merged.senderFirstName || '').toString().trim();
81
- const lastName = (merged.senderLastName || '').toString().trim();
83
+ const firstName = (merged.senderFirstName || merged.firstName || '').toString().trim();
84
+ const lastName = (merged.senderLastName || merged.lastName || '').toString().trim();
82
85
  const fullName = (merged.fullName || '').toString().trim();
83
86
  const senderJID = (merged.senderJID || '').toString();
84
- const senderLocal = senderJID.includes('@') ? senderJID.split('@')[0] : senderJID;
87
+ const senderBare = senderJID.split('/')[0] || '';
88
+ const senderResource = senderJID.includes('/') ? senderJID.split('/')[1] || '' : '';
89
+ const senderIsOccupant = !!senderResource && (senderBare === String(merged.roomJid || '') || /@conference\./i.test(senderBare));
90
+ const senderLocal = senderIsOccupant ? senderResource : senderBare.includes('@') ? senderBare.split('@')[0] : senderBare;
85
91
 
86
92
  // Bug #41 root cause: the resource of the MUC `from` (room@conference/
87
93
  // occupant-id) is the SAME field getDataFromXml uses to derive
@@ -100,11 +106,20 @@ export const createMessageFromXml = async (arg, bodyEl, positionalId, positional
100
106
  // the "official" fetch lands.
101
107
  const xmppFrom = (merged.xmppFrom || '').toString();
102
108
  const fromResource = xmppFrom.includes('/') ? xmppFrom.split('/')[1] : '';
103
- const composed = [firstName, lastName].filter(Boolean).join(' ').trim();
109
+ const composed = composeName(firstName, lastName);
104
110
  const existingName = String(merged?.user?.name || '').trim();
105
111
  const resolvedName = existingName || composed || fullName || senderLocal || merged?.user?.id || '';
112
+ const unencrypted = merged.omemoEncrypted !== 'true' && isE2eeRoom(String(merged.roomJid || ''));
113
+ const sealedKeys = merged.clientEncrypted === 'true' ? parseSealedMediaBody(merged.body) : undefined;
106
114
  const message = {
107
115
  ...merged,
116
+ ...(unencrypted ? {
117
+ unencrypted: true
118
+ } : {}),
119
+ ...(sealedKeys ? {
120
+ e2eeKeys: sealedKeys,
121
+ body: 'media'
122
+ } : {}),
108
123
  user: {
109
124
  ...(merged.user || {}),
110
125
  id: merged?.user?.id || fromResource || senderLocal,
@@ -1 +1 @@
1
- {"version":3,"names":["createMessageFromXml","arg","bodyEl","positionalId","positionalFrom","positionalDeleted","console","log","id","body","date","user","name","roomJid","isPositional","undefined","inner","outerExtras","bodyText","getText","text","split","xmppFrom","deleted","data","merged","isDeleted","numericPart","exec","String","Date","slice","toISOString","now","firstName","senderFirstName","toString","trim","lastName","senderLastName","fullName","senderJID","senderLocal","includes","fromResource","composed","filter","Boolean","join","existingName","resolvedName","message"],"sourceRoot":"../../../src","sources":["helpers/createMessageFromXml.ts"],"mappings":";;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,oBAAoB,GAAG,MAAAA,CAClCC,GAAwB,EACxBC,MAAY,EACZC,YAAqB,EACrBC,cAAuB,EACvBC,iBAA2B,KACL;EACtB,IAAI,CAACJ,GAAG,EAAE;IACRK,OAAO,CAACC,GAAG,CAAC,wC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MQ,YAAY,GAAGtB,QAAQ,CAACqB,QAAQ,CAAC,GAAG,CAAC,GAAGrB,QAAQ,CAACD,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE;EAEzE,MAAMwB,QAAQ,GAAG,CAACX,SAAS,EAAEI,QAAQ,CAAC,CAACQ,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,CAACX,IAAI,CAAC,CAAC;EACvE,MAAMY,YAAY,GAAGpB,MAAM,CAACJ,MAAM,EAAEd,IAAI,EAAEC,IAAI,IAAI,EAAE,CAAC,CAACyB,IAAI,CAAC,CAAC;EAC5D,MAAMa,YAAY,GAChBD,YAAY,IACZJ,QAAQ,IACRL,QAAQ,IACRE,WAAW,IACXjB,MAAM,EAAEd,IAAI,EAAEH,EAAE,IAChB,EAAE;EAEJ,MAAM2C,OAAiB,GAAG;IACxB,GAAG1B,MAAM;IACTd,IAAI,EAAE;MACJ,IAAIc,MAAM,CAACd,IAAI,IAAI,CAAC,CAAC,CAAC;MACtBH,EAAE,EAAEiB,MAAM,EAAEd,IAAI,EAAEH,EAAE,IAAIoC,YAAY,IAAIF,WAAW;MACnD9B,IAAI,EAAEsC,YAAY;MAClBhB,SAAS,EAAEA,SAAS,IAAIT,MAAM,EAAEd,IAAI,EAAEuB,SAAS;MAC/CI,QAAQ,EAAEA,QAAQ,IAAIb,MAAM,EAAEd,IAAI,EAAE2B;IACtC;EACF,CAAC;EAED,OAAOa,OAAO;AAChB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["isE2eeRoom","composeName","parseSealedMediaBody","createMessageFromXml","arg","bodyEl","positionalId","positionalFrom","positionalDeleted","console","log","id","body","date","user","name","roomJid","isPositional","undefined","inner","outerExtras","bodyText","getText","text","split","xmppFrom","deleted","data","merged","isDeleted","numericPart","exec","String","Date","slice","toISOString","now","firstName","senderFirstName","toString","trim","lastName","senderLastName","fullName","senderJID","senderBare","senderResource","includes","senderIsOccupant","test","senderLocal","fromResource","composed","existingName","resolvedName","unencrypted","omemoEncrypted","sealedKeys","clientEncrypted","message","e2eeKeys"],"sourceRoot":"../../../src","sources":["helpers/createMessageFromXml.ts"],"mappings":";;AACA,SAASA,UAAU,QAAQ,SAAS;AACpC,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,oBAAoB,QAAQ,oBAAoB;AAMzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,oBAAoB,GAAG,MAAAA,CAClCC,GAAwB,EACxBC,MAAY,EACZC,YAAqB,EACrBC,cAAuB,EACvBC,iBAA2B,KACL;EACtB,IAAI,CAACJ,GAAG,EAAE;IACRK,OAAO,CAACC,GAAG,CAAC,wCAAwC,CAAC;IACrD;IACA;IACA,OAAO;MAAEC,EAAE,EAAE,EAAE;MAAEC,IAAI,EAAE,EAAE;MAAEC,IAAI,EAAE,EAAE;MAAEC,IAAI,EAAE;QAAEH,EAAE,EAAE,EAAE;QAAEI,IAAI,EAAE;MAAG,CAAQ;MAAEC,OAAO,EAAE;IAAG,CAAC;EACvF;;EAEA;EACA;EACA;EACA,MAAMC,YAAY,GAAGZ,MAAM,KAAKa,SAAS,IAAIZ,YAAY,KAAKY,SAAS;EAEvE,IAAIC,KAAU,CAAC,CAAC;EAChB,IAAIC,WAAgB,GAAG,CAAC,CAAC;EAEzB,IAAIH,YAAY,EAAE;IAChBE,KAAK,GAAGf,GAAG,CAAC,CAAC;IACb,MAAMiB,QAAQ,GACZ,OAAOhB,MAAM,KAAK,QAAQ,GACtBA,MAAM,GACNA,MAAM,EAAEiB,OAAO,GACbjB,MAAM,CAACiB,OAAO,CAAC,CAAC,GAChBjB,MAAM,EAAEkB,IAAI;IACpBH,WAAW,GAAG;MACZT,EAAE,EAAEL,YAAY;MAChBM,IAAI,EAAES,QAAQ;MACdL,OAAO,EAAE,CAACT,cAAc,IAAI,EAAE,EAAEiB,KAAK,CAAC,GAAG,CAAC,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I,EAAEC,IAAI,IAAI,EAAE,CAAC,CAACyB,IAAI,CAAC,CAAC;EAC5D,MAAMc,YAAY,GAChBD,YAAY,IACZD,QAAQ,IACRT,QAAQ,IACRO,WAAW,IACXtB,MAAM,EAAEd,IAAI,EAAEH,EAAE,IAChB,EAAE;EAEJ,MAAM4C,WAAW,GACf3B,MAAM,CAAC4B,cAAc,KAAK,MAAM,IAAIxD,UAAU,CAACgC,MAAM,CAACJ,MAAM,CAACZ,OAAO,IAAI,EAAE,CAAC,CAAC;EAE9E,MAAMyC,UAAU,GACd7B,MAAM,CAAC8B,eAAe,KAAK,MAAM,GAC7BxD,oBAAoB,CAAC0B,MAAM,CAAChB,IAAI,CAAC,GACjCM,SAAS;EAEf,MAAMyC,OAAiB,GAAG;IACxB,GAAG/B,MAAM;IACT,IAAI2B,WAAW,GAAG;MAAEA,WAAW,EAAE;IAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7C,IAAIE,UAAU,GAAG;MAAEG,QAAQ,EAAEH,UAAU;MAAE7C,IAAI,EAAE;IAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9DE,IAAI,EAAE;MACJ,IAAIc,MAAM,CAACd,IAAI,IAAI,CAAC,CAAC,CAAC;MACtBH,EAAE,EAAEiB,MAAM,EAAEd,IAAI,EAAEH,EAAE,IAAIwC,YAAY,IAAID,WAAW;MACnDnC,IAAI,EAAEuC,YAAY;MAClBjB,SAAS,EAAEA,SAAS,IAAIT,MAAM,EAAEd,IAAI,EAAEuB,SAAS;MAC/CI,QAAQ,EAAEA,QAAQ,IAAIb,MAAM,EAAEd,IAAI,EAAE2B;IACtC;EACF,CAAC;EAED,OAAOkB,OAAO;AAChB,CAAC","ignoreList":[]}
@@ -1,11 +1,43 @@
1
1
  "use strict";
2
2
 
3
+ const mapApiLastMessage = (apiLastMessage, roomJid) => {
4
+ const body = String(apiLastMessage?.body || '').trim();
5
+ if (!apiLastMessage || !body) {
6
+ return undefined;
7
+ }
8
+ const senderName = `${apiLastMessage.senderFirstName || ''} ${apiLastMessage.senderLastName || ''}`.trim();
9
+ return {
10
+ id: apiLastMessage.messageId || apiLastMessage.stanzaId || '',
11
+ xmppId: apiLastMessage.stanzaId,
12
+ roomJid,
13
+ body,
14
+ date: apiLastMessage.createdAt,
15
+ isDeleted: false,
16
+ user: {
17
+ id: apiLastMessage.fromUserId || apiLastMessage.from || '',
18
+ name: senderName
19
+ }
20
+ };
21
+ };
22
+ const seedTimestamp = seed => {
23
+ if (!seed) {
24
+ return undefined;
25
+ }
26
+ const id = Number(seed.id);
27
+ if (Number.isFinite(id) && id > 0) {
28
+ return id;
29
+ }
30
+ const ms = seed.date ? new Date(seed.date).getTime() : NaN;
31
+ return Number.isFinite(ms) && ms > 0 ? ms * 1000 : undefined;
32
+ };
3
33
  export const createRoomFromApi = (room, service = 'conference.dev.xmpp.ethoradev.com', usersArrayLength = 0) => {
4
34
  try {
35
+ const jid = `${room?.name}@${service}` || '';
36
+ const lastMessage = mapApiLastMessage(room?.lastMessage, jid);
5
37
  const roomData = {
6
38
  ...room,
7
39
  id: room?._id || '',
8
- jid: `${room?.name}@${service}` || '',
40
+ jid,
9
41
  name: room?.title || '',
10
42
  title: room?.title || '',
11
43
  usersCnt: Number(room?.members?.length || usersArrayLength + 1),
@@ -14,7 +46,9 @@ export const createRoomFromApi = (room, service = 'conference.dev.xmpp.ethoradev
14
46
  roomBg: null,
15
47
  icon: room?.picture !== 'none' ? room?.picture : null,
16
48
  unreadMessages: 0,
17
- lastViewedTimestamp: 0
49
+ lastViewedTimestamp: 0,
50
+ lastMessage,
51
+ lastMessageTimestamp: seedTimestamp(lastMessage)
18
52
  };
19
53
  return roomData;
20
54
  } catch (error) {
@@ -1 +1 @@
1
- {"version":3,"names":["createRoomFromApi","room","service","usersArrayLength","roomData","id","_id","jid","name","title","usersCnt","Number","members","length","messages","isLoading","roomBg","icon","picture","unreadMessages","lastViewedTimestamp","error","console","log"],"sourceRoot":"../../../src","sources":["helpers/createRoomFromApi.tsx"],"mappings":";;AAEA,OAAO,MAAMA,iBAAiB,GAAGA,CAC/BC,IAAa,EACbC,OAAe,GAAG,mCAAmC,EACrDC,gBAAwB,GAAG,CAAC,KACX;EACjB,IAAI;IACF,MAAMC,QAAe,GAAG;MACtB,GAAGH,IAAI;MACPI,EAAE,EAAGJ,IAAI,EAAUK,GAAG,IAAI,EAAE;MAC5BC,GAAG,EAAE,GAAGN,IAAI,EAAEO,IAAI,IAAIN,OAAO,EAAE,IAAI,EAAE;MACrCM,IAAI,EAAEP,IAAI,EAAEQ,KAAK,IAAI,EAAE;MACvBA,KAAK,EAAER,IAAI,EAAEQ,KAAK,IAAI,EAAE;MACxBC,QAAQ,EAAEC,MAAM,CAACV,IAAI,EAAEW,OAAO,EAAEC,MAAM,IAAIV,gBAAgB,GAAG,CAAC,CAAC;MAC/DW,QAAQ,EAAE,EAAE;MACZC,SAAS,EAAE,KAAK;MAChBC,MAAM,EAAE,IAAI;MACZC,IAAI,EAAEhB,IAAI,EAAEiB,OAAO,KAAK,MAAM,GAAGjB,IAAI,EAAEiB,OAAO,GAAG,IAAI;MACrDC,cAAc,EAAE,CAAC;MACjBC,mBAAmB,EAAE;IACvB,CAAC;IACD,OAAOhB,QAAQ;EACjB,CAAC,CAAC,OAAOiB,KAAK,EAAE;IACdC,OAAO,CAACC,GAAG,CAACF,KAAK,CAAC;IAClB,OAAO,IAAI;EACb;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["mapApiLastMessage","apiLastMessage","roomJid","body","String","trim","undefined","senderName","senderFirstName","senderLastName","id","messageId","stanzaId","xmppId","date","createdAt","isDeleted","user","fromUserId","from","name","seedTimestamp","seed","Number","isFinite","ms","Date","getTime","NaN","createRoomFromApi","room","service","usersArrayLength","jid","lastMessage","roomData","_id","title","usersCnt","members","length","messages","isLoading","roomBg","icon","picture","unreadMessages","lastViewedTimestamp","lastMessageTimestamp","error","console","log"],"sourceRoot":"../../../src","sources":["helpers/createRoomFromApi.tsx"],"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,GAAG,IAAI,GAAGnB,SAAS;AAC9D,CAAC;AAED,OAAO,MAAMuB,iBAAiB,GAAGA,CAC/BC,IAAa,EACbC,OAAe,GAAG,mCAAmC,EACrDC,gBAAwB,GAAG,CAAC,KACX;EACjB,IAAI;IACF,MAAMC,GAAG,GAAG,GAAGH,IAAI,EAAEV,IAAI,IAAIW,OAAO,EAAE,IAAI,EAAE;IAC5C,MAAMG,WAAW,GAAGlC,iBAAiB,CAAC8B,IAAI,EAAEI,WAAW,EAAED,GAAG,CAAC;IAC7D,MAAME,QAAe,GAAG;MACtB,GAAGL,IAAI;MACPpB,EAAE,EAAGoB,IAAI,EAAUM,GAAG,IAAI,EAAE;MAC5BH,GAAG;MACHb,IAAI,EAAEU,IAAI,EAAEO,KAAK,IAAI,EAAE;MACvBA,KAAK,EAAEP,IAAI,EAAEO,KAAK,IAAI,EAAE;MACxBC,QAAQ,EAAEf,MAAM,CAACO,IAAI,EAAES,OAAO,EAAEC,MAAM,IAAIR,gBAAgB,GAAG,CAAC,CAAC;MAC/DS,QAAQ,EAAE,EAAE;MACZC,SAAS,EAAE,KAAK;MAChBC,MAAM,EAAE,IAAI;MACZC,IAAI,EAAEd,IAAI,EAAEe,OAAO,KAAK,MAAM,GAAGf,IAAI,EAAEe,OAAO,GAAG,IAAI;MACrDC,cAAc,EAAE,CAAC;MACjBC,mBAAmB,EAAE,CAAC;MACtBb,WAAW;MACXc,oBAAoB,EAAE3B,aAAa,CAACa,WAAW;IACjD,CAAC;IACD,OAAOC,QAAQ;EACjB,CAAC,CAAC,OAAOc,KAAK,EAAE;IACdC,OAAO,CAACC,GAAG,CAACF,KAAK,CAAC;IAClB,OAAO,IAAI;EACb;AACF,CAAC","ignoreList":[]}
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ import { composeName } from './displayName';
4
+
3
5
  /**
4
6
  * Cache-only lookup. Returns the literal "Deleted User" as a MISS sentinel
5
7
  * when `usersSet` has no entry for `userId` yet, callers that want a
@@ -17,7 +19,7 @@ export const createUserNameFromSetUser = (usersSet, userId) => {
17
19
  // members (no REST match yet) carry just the roster `name` attr —
18
20
  // fall back to that before giving up and returning the raw id.
19
21
  const bareName = user.name?.trim() || '';
20
- return `${firstName} ${lastName}`.trim() || bareName || userId;
22
+ return composeName(firstName, lastName) || bareName || userId;
21
23
  };
22
24
 
23
25
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["createUserNameFromSetUser","usersSet","userId","user","firstName","trim","lastName","bareName","name","resolveSenderDisplayName","message","rawUserId","String","id","localUserId","split","currentNameRaw","currentName","dataFullName","fullName","dataFirst","senderFirstName","dataLast","senderLastName","composedFromData","usersSetName","usersSetNameAlt","isUsersSetUseful"],"sourceRoot":"../../../src","sources":["helpers/createUserNameFromSetUser.ts"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,yBAAyB,GAAGA,CACvCC,QAAoC,EACpCC,MAAc,KACH;EACX,MAAMC,IAAI,GAAGF,QAAQ,CAACC,MAAM,CAAC;EAE7B,IAAI,CAACC,IAAI,EAAE;IAAC,OAAO,cAAc;EAAC;EAElC,MAAMC,SAAS,GAAGD,IAAI,CAACC,SAAS,EAAEC,IAAI,CAAC,CAAC,IAAI,EAAE;EAC9C,MAAMC,QAAQ,GAAGH,IAAI,CAACG,QAAQ,EAAED,IAAI,CAAC,CAAC,IAAI,EAAE;EAC5C;EACA;EACA;EACA,MAAME,QAAQ,GAAGJ,IAAI,CAACK,IAAI,EAAEH,IAAI,CAAC,CAAC,IAAI,EAAE;EAExC,OAAO,GAAGD,SAAS,IAAIE,QAAQ,EAAE,CAACD,IAAI,CAAC,CAAC,IAAIE,QAAQ,IAAIL,MAAM;AAChE,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMO,wBAAwB,GAAGA,CACtCC,OAIC,EACDT,QAAoC,KACz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userId","user","firstName","trim","lastName","bareName","name","resolveSenderDisplayName","message","rawUserId","String","id","localUserId","split","currentNameRaw","currentName","dataFullName","fullName","dataFirst","senderFirstName","dataLast","senderLastName","composedFromData","usersSetName","usersSetNameAlt","isUsersSetUseful"],"sourceRoot":"../../../src","sources":["helpers/createUserNameFromSetUser.ts"],"mappings":";;AACA,SAASA,WAAW,QAAQ,eAAe;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,yBAAyB,GAAGA,CACvCC,QAAoC,EACpCC,MAAc,KACH;EACX,MAAMC,IAAI,GAAGF,QAAQ,CAACC,MAAM,CAAC;EAE7B,IAAI,CAACC,IAAI,EAAE;IAAC,OAAO,cAAc;EAAC;EAElC,MAAMC,SAAS,GAAGD,IAAI,CAACC,SAAS,EAAEC,IAAI,CAAC,CAAC,IAAI,EAAE;EAC9C,MAAMC,QAAQ,GAAGH,IAAI,CAACG,QAAQ,EAAED,IAAI,CAAC,CAAC,IAAI,EAAE;EAC5C;EACA;EACA;EACA,MAAME,QAAQ,GAAGJ,IAAI,CAACK,IAAI,EAAEH,IAAI,CAAC,CAAC,IAAI,EAAE;EAExC,OAAON,WAAW,CAACK,SAAS,EAAEE,QAAQ,CAAC,IAAIC,QAAQ,IAAIL,MAAM;AAC/D,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMO,wBAAwB,GAAGA,CACtCC,OAIC,EACDT,QAAoC,KACzB;EACX,MAAMU,SAAS,GAAGC,MAAM,CAACF,OAAO,EAAEP,IAAI,EAAEU,EAAE,IAAI,EAAE,CAAC;EACjD,MAAMC,WAAW,GAAGH,SAAS,CAACI,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;EAC3C,MAAMC,cAAc,GAAGJ,MAAM,CAACF,OAAO,EAAEP,IAAI,EAAEK,IAAI,IAAI,EAAE,CAAC,CAACH,IAAI,CAAC,CAAC;EAC/D;EACA;EACA,MAAMY,WAAW,GAAGD,cAAc,KAAK,cAAc,GAAG,EAAE,GAAGA,cAAc;EAE3E,MAAME,YAAY,GAAGN,MAAM,CAACF,OAAO,EAAES,QAAQ,IAAI,EAAE,CAAC,CAACd,IAAI,CAAC,CAAC;EAC3D,MAAMe,SAAS,GAAGR,MAAM,CAACF,OAAO,EAAEW,eAAe,IAAI,EAAE,CAAC,CAAChB,IAAI,CAAC,CAAC;EAC/D,MAAMiB,QAAQ,GAAGV,MAAM,CAACF,OAAO,EAAEa,cAAc,IAAI,EAAE,CAAC,CAAClB,IAAI,CAAC,CAAC;EAC7D,MAAMmB,gBAAgB,GAAGN,YAAY,IAAI,GAAGE,SAAS,IAAIE,QAAQ,EAAE,CAACjB,IAAI,CAAC,CAAC;EAE1E,MAAMoB,YAAY,GAAGzB,yBAAyB,CAACC,QAAQ,EAAEa,WAAW,CAAC;EACrE,MAAMY,eAAe,GAAG1B,yBAAyB,CAACC,QAAQ,EAAEU,SAAS,CAAC;EACtE,MAAMgB,gBAAgB,GAAInB,IAAY,IAAK,CAAC,CAACA,IAAI,IAAIA,IAAI,KAAK,cAAc;EAE5E,OACES,WAAW,IACVU,gBAAgB,CAACF,YAAY,CAAC,IAAIA,YAAa,IAC/CE,gBAAgB,CAACD,eAAe,CAAC,IAAIA,eAAgB,IACtDF,gBAAgB,IAChBV,WAAW,IACXH,SAAS,IACT,cAAc;AAElB,CAAC","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ export const composeName = (first, last) => {
4
+ const f = String(first ?? '').trim();
5
+ const l = String(last ?? '').trim();
6
+ if (f && f.includes('@') && f.toLowerCase() === l.toLowerCase()) {
7
+ return f;
8
+ }
9
+ return `${f} ${l}`.trim();
10
+ };
11
+ //# sourceMappingURL=displayName.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["composeName","first","last","f","String","trim","l","includes","toLowerCase"],"sourceRoot":"../../../src","sources":["helpers/displayName.ts"],"mappings":";;AAAA,OAAO,MAAMA,WAAW,GAAGA,CACzBC,KAAqB,EACrBC,IAAoB,KACT;EACX,MAAMC,CAAC,GAAGC,MAAM,CAACH,KAAK,IAAI,EAAE,CAAC,CAACI,IAAI,CAAC,CAAC;EACpC,MAAMC,CAAC,GAAGF,MAAM,CAACF,IAAI,IAAI,EAAE,CAAC,CAACG,IAAI,CAAC,CAAC;EACnC,IAAIF,CAAC,IAAIA,CAAC,CAACI,QAAQ,CAAC,GAAG,CAAC,IAAIJ,CAAC,CAACK,WAAW,CAAC,CAAC,KAAKF,CAAC,CAACE,WAAW,CAAC,CAAC,EAAE;IAAC,OAAOL,CAAC;EAAC;EAC3E,OAAO,GAAGA,CAAC,IAAIG,CAAC,EAAE,CAACD,IAAI,CAAC,CAAC;AAC3B,CAAC","ignoreList":[]}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ import { EMOJI_CATEGORIES } from '../assets/emojiData';
4
+ let byId = null;
5
+ const index = () => {
6
+ if (!byId) {
7
+ byId = new Map();
8
+ for (const category of EMOJI_CATEGORIES) {
9
+ for (const entry of category.emojis) {
10
+ byId.set(entry[0], entry);
11
+ }
12
+ }
13
+ }
14
+ return byId;
15
+ };
16
+ export const getEmojiNativeById = id => index().get(id)?.[1] ?? id;
17
+ export const getEmojiIdByNative = native => {
18
+ for (const [id, entry] of index()) {
19
+ if (entry[1] === native) {
20
+ return id;
21
+ }
22
+ }
23
+ return undefined;
24
+ };
25
+ export const DEFAULT_QUICK_REACTIONS = ['+1', 'heart', 'joy', 'open_mouth', 'cry', 'pray'];
26
+ export const searchEmojis = (query, limit = 60) => {
27
+ const q = query.trim().toLowerCase();
28
+ if (!q) {
29
+ return [];
30
+ }
31
+ const out = [];
32
+ for (const category of EMOJI_CATEGORIES) {
33
+ for (const entry of category.emojis) {
34
+ if (entry[0].includes(q) || entry[2].includes(q)) {
35
+ out.push(entry);
36
+ if (out.length >= limit) {
37
+ return out;
38
+ }
39
+ }
40
+ }
41
+ }
42
+ return out;
43
+ };
44
+ //# sourceMappingURL=emoji.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EMOJI_CATEGORIES","byId","index","Map","category","entry","emojis","set","getEmojiNativeById","id","get","getEmojiIdByNative","native","undefined","DEFAULT_QUICK_REACTIONS","searchEmojis","query","limit","q","trim","toLowerCase","out","includes","push","length"],"sourceRoot":"../../../src","sources":["helpers/emoji.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAyB,qBAAqB;AAEvE,IAAIC,IAAoC,GAAG,IAAI;AAC/C,MAAMC,KAAK,GAAGA,CAAA,KAA+B;EAC3C,IAAI,CAACD,IAAI,EAAE;IACTA,IAAI,GAAG,IAAIE,GAAG,CAAC,CAAC;IAChB,KAAK,MAAMC,QAAQ,IAAIJ,gBAAgB,EAAE;MACvC,KAAK,MAAMK,KAAK,IAAID,QAAQ,CAACE,MAAM,EAAE;QAACL,IAAI,CAACM,GAAG,CAACF,KAAK,CAAC,CAAC,CAAC,EAAEA,KAAK,CAAC;MAAC;IAClE;EACF;EACA,OAAOJ,IAAI;AACb,CAAC;AAED,OAAO,MAAMO,kBAAkB,GAAIC,EAAU,IAC3CP,KAAK,CAAC,CAAC,CAACQ,GAAG,CAACD,EAAE,CAAC,GAAG,CAAC,CAAC,IAAIA,EAAE;AAE5B,OAAO,MAAME,kBAAkB,GAAIC,MAAc,IAAyB;EACxE,KAAK,MAAM,CAACH,EAAE,EAAEJ,KAAK,CAAC,IAAIH,KAAK,CAAC,CAAC,EAAE;IACjC,IAAIG,KAAK,CAAC,CAAC,CAAC,KAAKO,MAAM,EAAE;MAAC,OAAOH,EAAE;IAAC;EACtC;EACA,OAAOI,SAAS;AAClB,CAAC;AAED,OAAO,MAAMC,uBAAuB,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,CAAC;AAE1F,OAAO,MAAMC,YAAY,GAAGA,CAACC,KAAa,EAAEC,KAAK,GAAG,EAAE,KAAmB;EACvE,MAAMC,CAAC,GAAGF,KAAK,CAACG,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC;EACpC,IAAI,CAACF,CAAC,EAAE;IAAC,OAAO,EAAE;EAAC;EACnB,MAAMG,GAAiB,GAAG,EAAE;EAC5B,KAAK,MAAMjB,QAAQ,IAAIJ,gBAAgB,EAAE;IACvC,KAAK,MAAMK,KAAK,IAAID,QAAQ,CAACE,MAAM,EAAE;MACnC,IAAID,KAAK,CAAC,CAAC,CAAC,CAACiB,QAAQ,CAACJ,CAAC,CAAC,IAAIb,KAAK,CAAC,CAAC,CAAC,CAACiB,QAAQ,CAACJ,CAAC,CAAC,EAAE;QAChDG,GAAG,CAACE,IAAI,CAAClB,KAAK,CAAC;QACf,IAAIgB,GAAG,CAACG,MAAM,IAAIP,KAAK,EAAE;UAAC,OAAOI,GAAG;QAAC;MACvC;IACF;EACF;EACA,OAAOA,GAAG;AACZ,CAAC","ignoreList":[]}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ // expo-haptics is an OPTIONAL peer, probed the same way as expo-blur: the JS
4
+ // package alone is not enough, the native module has to be in the binary,
5
+ // otherwise the call throws. Without it the gesture simply has no feedback.
6
+ let Haptics = null;
7
+ try {
8
+ const {
9
+ requireNativeModule
10
+ } = require('expo-modules-core');
11
+ requireNativeModule('ExpoHaptics');
12
+ Haptics = require('expo-haptics');
13
+ } catch {
14
+ Haptics = null;
15
+ }
16
+
17
+ /** Short tap, the messenger "I got your long-press" feedback. Never throws. */
18
+ export const hapticTap = () => {
19
+ if (!Haptics) {
20
+ return;
21
+ }
22
+ Haptics.impactAsync?.(Haptics.ImpactFeedbackStyle?.Medium).catch?.(() => {});
23
+ };
24
+ //# sourceMappingURL=haptics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Haptics","requireNativeModule","require","hapticTap","impactAsync","ImpactFeedbackStyle","Medium","catch"],"sourceRoot":"../../../src","sources":["helpers/haptics.ts"],"mappings":";;AAAA;AACA;AACA;AACA,IAAIA,OAAY,GAAG,IAAI;AACvB,IAAI;EACF,MAAM;IAAEC;EAAoB,CAAC,GAAGC,OAAO,CAAC,mBAAmB,CAAC;EAC5DD,mBAAmB,CAAC,aAAa,CAAC;EAClCD,OAAO,GAAGE,OAAO,CAAC,cAAc,CAAC;AACnC,CAAC,CAAC,MAAM;EACNF,OAAO,GAAG,IAAI;AAChB;;AAEA;AACA,OAAO,MAAMG,SAAS,GAAGA,CAAA,KAAM;EAC7B,IAAI,CAACH,OAAO,EAAE;IACZ;EACF;EACAA,OAAO,CAACI,WAAW,GAAGJ,OAAO,CAACK,mBAAmB,EAAEC,MAAM,CAAC,CAACC,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC;AAC9E,CAAC","ignoreList":[]}
@@ -4,18 +4,10 @@ import { AppState } from 'react-native';
4
4
  import { store } from '../roomStore';
5
5
  import { applyRoomsPreloadBatch, setUnreadSyncing, RUNTIME_MESSAGE_LIMIT } from '../roomStore/roomsSlice';
6
6
  const DEFAULT_CONCURRENCY = 3;
7
- // Fetch the most recent ~20 on re-entry (mirrors web). A larger first page
8
- // also means more id-overlap with cache, so the merge in
9
- // `mergeHistoryIntoCache` rarely has to fall back to clear-and-replace.
10
- const DEFAULT_PAGE_SIZE = 20;
7
+ const DEFAULT_PAGE_SIZE = 10;
11
8
  const DEFAULT_RETRY_LIMIT = 2;
12
- // When the first page is entirely unread (every fetched message is newer
13
- // than `lastViewedTimestamp`), the true unread count could be far bigger
14
- // than `pageSize` — `useUnread()` only ever sees what's been loaded. Page
15
- // further back, up to this many extra fetches, until we either find the
16
- // boundary or give up (`unreadCapped` then stays true so callers at least
17
- // know the count is a floor, not exact). Customer-reported #34.
18
- const MAX_UNREAD_CATCHUP_PAGES = 8;
9
+ const DEFAULT_FIRST_WAVE = 30;
10
+ const BACKGROUND_BATCH_PAUSE_MS = 400;
19
11
  const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
20
12
  const messageTimestamp = m => {
21
13
  if (!m) {
@@ -32,10 +24,10 @@ const messageTimestamp = m => {
32
24
  return 0;
33
25
  };
34
26
  const getRoomLastActivityScore = room => {
35
- if (!room?.messages?.length) {
36
- return 0;
37
- }
38
- return room.messages.reduce((max, m) => Math.max(max, messageTimestamp(m)), 0);
27
+ const fromMessages = room?.messages?.length ? room.messages.reduce((max, m) => Math.max(max, messageTimestamp(m)), 0) : 0;
28
+ const fromStamp = Number(room?.lastMessageTimestamp) || 0;
29
+ const fromSeed = Number(room?.lastMessage?.id) || 0;
30
+ return Math.max(fromMessages, fromStamp, fromSeed);
39
31
  };
40
32
  const computeUnreadCapped = (room, messages, pageSize) => {
41
33
  if (!room) {
@@ -52,8 +44,11 @@ const computeUnreadCapped = (room, messages, pageSize) => {
52
44
  return false;
53
45
  }
54
46
  const lastViewed = Number(room.lastViewedTimestamp) || 0;
47
+ // No read marker yet (the private-store markers often land after the
48
+ // first preload page): the count is unknown, not "more than a page".
49
+ // Claiming capped here showed "10+" on rooms with a single unread.
55
50
  if (lastViewed <= 0) {
56
- return true;
51
+ return false;
57
52
  }
58
53
  const oldestTs = countable.reduce((minTs, m) => {
59
54
  const ts = messageTimestamp(m);
@@ -94,6 +89,7 @@ export const runHistoryPreloadScheduler = async options => {
94
89
  pageSize = DEFAULT_PAGE_SIZE,
95
90
  retryLimit = DEFAULT_RETRY_LIMIT,
96
91
  roomLimit,
92
+ firstWave = DEFAULT_FIRST_WAVE,
97
93
  selectedRoomJid = null,
98
94
  defaultRoomJids = [],
99
95
  forceReload = false
@@ -101,6 +97,13 @@ export const runHistoryPreloadScheduler = async options => {
101
97
  if (signal?.aborted) {
102
98
  return;
103
99
  }
100
+ const startedAt = Date.now();
101
+ let firstWaveLogged = false;
102
+ const devLog = msg => {
103
+ if (typeof __DEV__ !== 'undefined' && __DEV__) {
104
+ console.log(msg);
105
+ }
106
+ };
104
107
  store.dispatch(setUnreadSyncing(true));
105
108
  try {
106
109
  const state = store.getState();
@@ -124,6 +127,8 @@ export const runHistoryPreloadScheduler = async options => {
124
127
  const queue = roomLimit && roomLimit > 0 ? sortedQueue.slice(0, roomLimit) : sortedQueue;
125
128
  const inFlightByRoom = new Map();
126
129
  let consecutiveErrorCount = 0;
130
+ let started = 0;
131
+ devLog(`[preload] ${queue.length} rooms queued, first wave ${Math.min(firstWave, queue.length)}, page ${pageSize}`);
127
132
  while (queue.length > 0) {
128
133
  if (signal?.aborted) {
129
134
  return;
@@ -143,6 +148,12 @@ export const runHistoryPreloadScheduler = async options => {
143
148
  continue;
144
149
  }
145
150
  const batch = readyItems.slice(0, Math.max(1, concurrency));
151
+ const inBackgroundWave = started >= firstWave;
152
+ if (inBackgroundWave && !firstWaveLogged) {
153
+ firstWaveLogged = true;
154
+ devLog(`[preload] first wave done in ${Date.now() - startedAt}ms`);
155
+ }
156
+ started += batch.length;
146
157
 
147
158
  // Snapshot each room's historyPreloadState BEFORE marking the
148
159
  // batch as 'loading'. Without this snapshot the per-task
@@ -178,7 +189,8 @@ export const runHistoryPreloadScheduler = async options => {
178
189
  const fetchedMessages = await client.getHistoryStanza(item.jid, pageSize, undefined, undefined, {
179
190
  coalesceRoom: true,
180
191
  skipIfPreloaded: !forceReload,
181
- source: 'background'
192
+ source: 'background',
193
+ selfApplied: true
182
194
  });
183
195
  if (signal?.aborted) {
184
196
  return;
@@ -187,52 +199,7 @@ export const runHistoryPreloadScheduler = async options => {
187
199
  throw new Error('history_timeout');
188
200
  }
189
201
  const nextRoom = store.getState().rooms.rooms[item.jid];
190
- let combined = fetchedMessages || [];
191
- const lastViewed = Number(nextRoom?.lastViewedTimestamp) || 0;
192
-
193
- // The first page was entirely unread — keep paging older until
194
- // we find a message at/before `lastViewedTimestamp` (the true
195
- // boundary) or run out of catch-up budget, so the count isn't
196
- // silently truncated at `pageSize`.
197
- if (lastViewed > 0 && computeUnreadCapped(nextRoom, combined, pageSize)) {
198
- let lastPageLen = combined.length;
199
- let extraPages = 0;
200
- while (extraPages < MAX_UNREAD_CATCHUP_PAGES && lastPageLen >= pageSize && !signal?.aborted) {
201
- const oldestId = combined.reduce((min, m) => {
202
- const idNum = Number(m?.id);
203
- if (!Number.isFinite(idNum)) {
204
- return min;
205
- }
206
- return min === null || idNum < min ? idNum : min;
207
- }, null);
208
- if (oldestId === null) {
209
- break;
210
- }
211
- let older;
212
- try {
213
- older = await client.getHistoryStanza(item.jid, pageSize, oldestId, undefined, {
214
- coalesceRoom: true,
215
- skipIfPreloaded: !forceReload,
216
- source: 'background'
217
- });
218
- } catch {
219
- break;
220
- }
221
- if (!older || !older.length) {
222
- break;
223
- }
224
- combined = [...older, ...combined];
225
- lastPageLen = older.length;
226
- extraPages++;
227
- const oldestTs = combined.reduce((minTs, m) => {
228
- const ts = messageTimestamp(m);
229
- return ts > 0 ? Math.min(minTs, ts) : minTs;
230
- }, Number.MAX_SAFE_INTEGER);
231
- if (oldestTs !== Number.MAX_SAFE_INTEGER && oldestTs <= lastViewed) {
232
- break;
233
- }
234
- }
235
- }
202
+ const combined = fetchedMessages || [];
236
203
 
237
204
  // `mergeHistoryIntoCache` (roomsSlice) caps whatever we dispatch
238
205
  // here to the newest RUNTIME_MESSAGE_LIMIT messages before it
@@ -282,11 +249,10 @@ export const runHistoryPreloadScheduler = async options => {
282
249
  inFlightByRoom.set(item.jid, task);
283
250
  await task.finally(() => inFlightByRoom.delete(item.jid));
284
251
  }));
285
-
286
- // Yield to JS event loop (no requestIdleCallback in RN).
287
- await new Promise(r => setTimeout(r, 0));
252
+ await sleep(inBackgroundWave ? BACKGROUND_BATCH_PAUSE_MS : 0);
288
253
  }
289
254
  } finally {
255
+ devLog(`[preload] finished in ${Date.now() - startedAt}ms`);
290
256
  store.dispatch(setUnreadSyncing(false));
291
257
  }
292
258
  };