@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.
- package/CHANGELOG.md +26 -0
- package/README.md +95 -0
- package/lib/commonjs/assets/emojiData.js +40 -0
- package/lib/commonjs/assets/emojiData.js.map +1 -0
- package/lib/commonjs/assets/icons.js +5 -3
- package/lib/commonjs/assets/icons.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatHeader.js +35 -15
- package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatRoom.js +33 -24
- package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatWrapper.js +22 -16
- package/lib/commonjs/components/MainComponents/ChatWrapper.js.map +1 -1
- package/lib/commonjs/components/MainComponents/EncryptedSendNotice.js +47 -0
- package/lib/commonjs/components/MainComponents/EncryptedSendNotice.js.map +1 -0
- package/lib/commonjs/components/MainComponents/EncryptionCard.js +286 -0
- package/lib/commonjs/components/MainComponents/EncryptionCard.js.map +1 -0
- package/lib/commonjs/components/MainComponents/MediaMessage.js +7 -0
- package/lib/commonjs/components/MainComponents/MediaMessage.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MessageContainer.js +4 -12
- package/lib/commonjs/components/MainComponents/MessageContainer.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MessageList.js +110 -35
- package/lib/commonjs/components/MainComponents/MessageList.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ReduxWrapper.js +5 -0
- package/lib/commonjs/components/MainComponents/ReduxWrapper.js.map +1 -1
- package/lib/commonjs/components/MainComponents/RoomList.js +32 -29
- package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
- package/lib/commonjs/components/MainComponents/RoomStack.js +133 -65
- package/lib/commonjs/components/MainComponents/RoomStack.js.map +1 -1
- package/lib/commonjs/components/MainComponents/SealedAttachment.js +231 -0
- package/lib/commonjs/components/MainComponents/SealedAttachment.js.map +1 -0
- package/lib/commonjs/components/MainComponents/SystemMessage.js +6 -2
- package/lib/commonjs/components/MainComponents/SystemMessage.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/Avatar.js +5 -1
- package/lib/commonjs/components/MessageBubble/Avatar.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/BottomReplyContainer.js +18 -21
- package/lib/commonjs/components/MessageBubble/BottomReplyContainer.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/EmojiPickerSheet.js +447 -0
- package/lib/commonjs/components/MessageBubble/EmojiPickerSheet.js.map +1 -0
- package/lib/commonjs/components/MessageBubble/Message.js +264 -136
- package/lib/commonjs/components/MessageBubble/Message.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/MessageInteractions.js +215 -13
- package/lib/commonjs/components/MessageBubble/MessageInteractions.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/MessageReaction.js +113 -94
- package/lib/commonjs/components/MessageBubble/MessageReaction.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/MessageReply.js +66 -24
- package/lib/commonjs/components/MessageBubble/MessageReply.js.map +1 -1
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +7 -4
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +159 -16
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
- package/lib/commonjs/components/Modals/FilePreviewModal/PdfView.js +4 -0
- package/lib/commonjs/components/Modals/FilePreviewModal/PdfView.js.map +1 -1
- package/lib/commonjs/components/Modals/Modal/SwipeBackLayer.js +76 -44
- package/lib/commonjs/components/Modals/Modal/SwipeBackLayer.js.map +1 -1
- package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js +29 -6
- package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js +5 -1
- package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/ChatRoomItem.js +37 -13
- package/lib/commonjs/components/RoomComponents/ChatRoomItem.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/LastMessageItem.js +6 -0
- package/lib/commonjs/components/RoomComponents/LastMessageItem.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/styled/LastAudioMessage.js +2 -2
- package/lib/commonjs/components/RoomComponents/styled/LastAudioMessage.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/styled/LastMessageEmoji.js +8 -9
- package/lib/commonjs/components/RoomComponents/styled/LastMessageEmoji.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/styled/LastMessageFile.js +4 -6
- package/lib/commonjs/components/RoomComponents/styled/LastMessageFile.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/styled/LastMessagePhoto.js +2 -2
- package/lib/commonjs/components/RoomComponents/styled/LastMessagePhoto.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/styled/LastMessageSealed.js +41 -0
- package/lib/commonjs/components/RoomComponents/styled/LastMessageSealed.js.map +1 -0
- package/lib/commonjs/components/RoomComponents/styled/LastMessageVideo.js +2 -2
- package/lib/commonjs/components/RoomComponents/styled/LastMessageVideo.js.map +1 -1
- package/lib/commonjs/components/Thread/ThreadWrapper.js +273 -152
- package/lib/commonjs/components/Thread/ThreadWrapper.js.map +1 -1
- package/lib/commonjs/components/UsersList/UsersList.js +2 -1
- package/lib/commonjs/components/UsersList/UsersList.js.map +1 -1
- package/lib/commonjs/components/styled/DateLabel.js +6 -3
- package/lib/commonjs/components/styled/DateLabel.js.map +1 -1
- package/lib/commonjs/components/styled/SendInput.js +4 -2
- package/lib/commonjs/components/styled/SendInput.js.map +1 -1
- package/lib/commonjs/context/MessageNotificationContext.js +188 -9
- package/lib/commonjs/context/MessageNotificationContext.js.map +1 -1
- package/lib/commonjs/context/xmppProvider.js +22 -7
- package/lib/commonjs/context/xmppProvider.js.map +1 -1
- package/lib/commonjs/e2ee/crypto.js +207 -0
- package/lib/commonjs/e2ee/crypto.js.map +1 -0
- package/lib/commonjs/e2ee/deviceStore.js +84 -0
- package/lib/commonjs/e2ee/deviceStore.js.map +1 -0
- package/lib/commonjs/e2ee/fileCipher.js +95 -0
- package/lib/commonjs/e2ee/fileCipher.js.map +1 -0
- package/lib/commonjs/e2ee/fileEnvelope.js +79 -0
- package/lib/commonjs/e2ee/fileEnvelope.js.map +1 -0
- package/lib/commonjs/e2ee/index.js +210 -0
- package/lib/commonjs/e2ee/index.js.map +1 -0
- package/lib/commonjs/e2ee/limits.js +9 -0
- package/lib/commonjs/e2ee/limits.js.map +1 -0
- package/lib/commonjs/e2ee/ns.js +8 -0
- package/lib/commonjs/e2ee/ns.js.map +1 -0
- package/lib/commonjs/e2ee/omemo.js +622 -0
- package/lib/commonjs/e2ee/omemo.js.map +1 -0
- package/lib/commonjs/e2ee/protobuf.js +149 -0
- package/lib/commonjs/e2ee/protobuf.js.map +1 -0
- package/lib/commonjs/e2ee/ratchet.js +238 -0
- package/lib/commonjs/e2ee/ratchet.js.map +1 -0
- package/lib/commonjs/e2ee/sealedBody.js +23 -0
- package/lib/commonjs/e2ee/sealedBody.js.map +1 -0
- package/lib/commonjs/e2ee/sealedFiles.js +174 -0
- package/lib/commonjs/e2ee/sealedFiles.js.map +1 -0
- package/lib/commonjs/e2ee/send.js +54 -0
- package/lib/commonjs/e2ee/send.js.map +1 -0
- package/lib/commonjs/e2ee/stanza.js +114 -0
- package/lib/commonjs/e2ee/stanza.js.map +1 -0
- package/lib/commonjs/e2ee/store.js +43 -0
- package/lib/commonjs/e2ee/store.js.map +1 -0
- package/lib/commonjs/helpers/accountName.js +23 -0
- package/lib/commonjs/helpers/accountName.js.map +1 -0
- package/lib/commonjs/helpers/createMessageFromXml.js +19 -4
- package/lib/commonjs/helpers/createMessageFromXml.js.map +1 -1
- package/lib/commonjs/helpers/createRoomFromApi.js +36 -2
- package/lib/commonjs/helpers/createRoomFromApi.js.map +1 -1
- package/lib/commonjs/helpers/createUserNameFromSetUser.js +2 -1
- package/lib/commonjs/helpers/createUserNameFromSetUser.js.map +1 -1
- package/lib/commonjs/helpers/displayName.js +16 -0
- package/lib/commonjs/helpers/displayName.js.map +1 -0
- package/lib/commonjs/helpers/emoji.js +51 -0
- package/lib/commonjs/helpers/emoji.js.map +1 -0
- package/lib/commonjs/helpers/haptics.js +29 -0
- package/lib/commonjs/helpers/haptics.js.map +1 -0
- package/lib/commonjs/helpers/historyPreloadScheduler.js +32 -66
- package/lib/commonjs/helpers/historyPreloadScheduler.js.map +1 -1
- package/lib/commonjs/helpers/insertMessageWithDelimiter.js +21 -12
- package/lib/commonjs/helpers/insertMessageWithDelimiter.js.map +1 -1
- package/lib/commonjs/helpers/mamReactions.js +57 -0
- package/lib/commonjs/helpers/mamReactions.js.map +1 -0
- package/lib/commonjs/helpers/parseMessageReference.js +42 -0
- package/lib/commonjs/helpers/parseMessageReference.js.map +1 -0
- package/lib/commonjs/helpers/persistCrypto.js +5 -0
- package/lib/commonjs/helpers/persistCrypto.js.map +1 -1
- package/lib/commonjs/helpers/reactionsConfig.js +17 -0
- package/lib/commonjs/helpers/reactionsConfig.js.map +1 -0
- package/lib/commonjs/helpers/secureKeyValue.js +20 -0
- package/lib/commonjs/helpers/secureKeyValue.js.map +1 -1
- package/lib/commonjs/helpers/updateMessagesTillLast.js +17 -2
- package/lib/commonjs/helpers/updateMessagesTillLast.js.map +1 -1
- package/lib/commonjs/helpers/videoCache.js +136 -0
- package/lib/commonjs/helpers/videoCache.js.map +1 -0
- package/lib/commonjs/hooks/useHeapSender.js +3 -1
- package/lib/commonjs/hooks/useHeapSender.js.map +1 -1
- package/lib/commonjs/hooks/useLogout.js +8 -0
- package/lib/commonjs/hooks/useLogout.js.map +1 -1
- package/lib/commonjs/hooks/useMessageHeapState.js +3 -2
- package/lib/commonjs/hooks/useMessageHeapState.js.map +1 -1
- package/lib/commonjs/hooks/useRoomInitialization.js +16 -7
- package/lib/commonjs/hooks/useRoomInitialization.js.map +1 -1
- package/lib/commonjs/hooks/useSendMessage.js +85 -15
- package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
- package/lib/commonjs/hooks/useUnreadMessagesCounter.js +1 -1
- package/lib/commonjs/hooks/useUnreadMessagesCounter.js.map +1 -1
- package/lib/commonjs/i18n/strings.js +180 -0
- package/lib/commonjs/i18n/strings.js.map +1 -1
- package/lib/commonjs/main.js +13 -0
- package/lib/commonjs/main.js.map +1 -1
- package/lib/commonjs/networking/api-requests/auth.api.js +4 -1
- package/lib/commonjs/networking/api-requests/auth.api.js.map +1 -1
- package/lib/commonjs/networking/api-requests/rooms.api.js +111 -17
- package/lib/commonjs/networking/api-requests/rooms.api.js.map +1 -1
- package/lib/commonjs/networking/stanzaHandlers.js +106 -50
- package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
- package/lib/commonjs/networking/xmpp/getHistory.xmpp.js +29 -74
- package/lib/commonjs/networking/xmpp/getHistory.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/handleStanzas.xmpp.js +44 -0
- package/lib/commonjs/networking/xmpp/handleStanzas.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/mamRouter.js +186 -0
- package/lib/commonjs/networking/xmpp/mamRouter.js.map +1 -0
- package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js +41 -4
- package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/sendMediaMessage.xmpp.js +16 -3
- package/lib/commonjs/networking/xmpp/sendMediaMessage.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/sendTextMessage.xmpp.js +13 -6
- package/lib/commonjs/networking/xmpp/sendTextMessage.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js +14 -6
- package/lib/commonjs/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmppClient.js +104 -23
- package/lib/commonjs/networking/xmppClient.js.map +1 -1
- package/lib/commonjs/roomStore/Middleware/newMessageMidlleware.js +29 -34
- package/lib/commonjs/roomStore/Middleware/newMessageMidlleware.js.map +1 -1
- package/lib/commonjs/roomStore/Middleware/perfMiddleware.js +51 -0
- package/lib/commonjs/roomStore/Middleware/perfMiddleware.js.map +1 -0
- package/lib/commonjs/roomStore/Middleware/reactionsMiddleware.js +66 -43
- package/lib/commonjs/roomStore/Middleware/reactionsMiddleware.js.map +1 -1
- package/lib/commonjs/roomStore/Middleware/unreadMidlleware.js +88 -68
- package/lib/commonjs/roomStore/Middleware/unreadMidlleware.js.map +1 -1
- package/lib/commonjs/roomStore/index.js +18 -14
- package/lib/commonjs/roomStore/index.js.map +1 -1
- package/lib/commonjs/roomStore/persistBackend.js +93 -0
- package/lib/commonjs/roomStore/persistBackend.js.map +1 -0
- package/lib/commonjs/roomStore/persistence.js +253 -51
- package/lib/commonjs/roomStore/persistence.js.map +1 -1
- package/lib/commonjs/roomStore/roomsSlice.js +282 -136
- package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
- package/lib/commonjs/theme/theme.js +3 -0
- package/lib/commonjs/theme/theme.js.map +1 -1
- package/lib/commonjs/utils/devLogger.js +14 -0
- package/lib/commonjs/utils/devLogger.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/assets/emojiData.js +36 -0
- package/lib/module/assets/emojiData.js.map +1 -0
- package/lib/module/assets/icons.js +4 -2
- package/lib/module/assets/icons.js.map +1 -1
- package/lib/module/components/MainComponents/ChatHeader.js +37 -17
- package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/module/components/MainComponents/ChatRoom.js +34 -25
- package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/module/components/MainComponents/ChatWrapper.js +23 -17
- package/lib/module/components/MainComponents/ChatWrapper.js.map +1 -1
- package/lib/module/components/MainComponents/EncryptedSendNotice.js +42 -0
- package/lib/module/components/MainComponents/EncryptedSendNotice.js.map +1 -0
- package/lib/module/components/MainComponents/EncryptionCard.js +281 -0
- package/lib/module/components/MainComponents/EncryptionCard.js.map +1 -0
- package/lib/module/components/MainComponents/MediaMessage.js +7 -0
- package/lib/module/components/MainComponents/MediaMessage.js.map +1 -1
- package/lib/module/components/MainComponents/MessageContainer.js +7 -14
- package/lib/module/components/MainComponents/MessageContainer.js.map +1 -1
- package/lib/module/components/MainComponents/MessageList.js +110 -35
- package/lib/module/components/MainComponents/MessageList.js.map +1 -1
- package/lib/module/components/MainComponents/ReduxWrapper.js +5 -0
- package/lib/module/components/MainComponents/ReduxWrapper.js.map +1 -1
- package/lib/module/components/MainComponents/RoomList.js +32 -29
- package/lib/module/components/MainComponents/RoomList.js.map +1 -1
- package/lib/module/components/MainComponents/RoomStack.js +131 -63
- package/lib/module/components/MainComponents/RoomStack.js.map +1 -1
- package/lib/module/components/MainComponents/SealedAttachment.js +224 -0
- package/lib/module/components/MainComponents/SealedAttachment.js.map +1 -0
- package/lib/module/components/MainComponents/SystemMessage.js +6 -2
- package/lib/module/components/MainComponents/SystemMessage.js.map +1 -1
- package/lib/module/components/MessageBubble/Avatar.js +5 -1
- package/lib/module/components/MessageBubble/Avatar.js.map +1 -1
- package/lib/module/components/MessageBubble/BottomReplyContainer.js +19 -22
- package/lib/module/components/MessageBubble/BottomReplyContainer.js.map +1 -1
- package/lib/module/components/MessageBubble/EmojiPickerSheet.js +438 -0
- package/lib/module/components/MessageBubble/EmojiPickerSheet.js.map +1 -0
- package/lib/module/components/MessageBubble/Message.js +269 -140
- package/lib/module/components/MessageBubble/Message.js.map +1 -1
- package/lib/module/components/MessageBubble/MessageInteractions.js +217 -15
- package/lib/module/components/MessageBubble/MessageInteractions.js.map +1 -1
- package/lib/module/components/MessageBubble/MessageReaction.js +115 -94
- package/lib/module/components/MessageBubble/MessageReaction.js.map +1 -1
- package/lib/module/components/MessageBubble/MessageReply.js +65 -24
- package/lib/module/components/MessageBubble/MessageReply.js.map +1 -1
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +7 -4
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +161 -18
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
- package/lib/module/components/Modals/FilePreviewModal/PdfView.js +4 -0
- package/lib/module/components/Modals/FilePreviewModal/PdfView.js.map +1 -1
- package/lib/module/components/Modals/Modal/SwipeBackLayer.js +76 -44
- package/lib/module/components/Modals/Modal/SwipeBackLayer.js.map +1 -1
- package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js +32 -8
- package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
- package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js +4 -0
- package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
- package/lib/module/components/RoomComponents/ChatRoomItem.js +37 -13
- package/lib/module/components/RoomComponents/ChatRoomItem.js.map +1 -1
- package/lib/module/components/RoomComponents/LastMessageItem.js +6 -0
- package/lib/module/components/RoomComponents/LastMessageItem.js.map +1 -1
- package/lib/module/components/RoomComponents/styled/LastAudioMessage.js +2 -2
- package/lib/module/components/RoomComponents/styled/LastAudioMessage.js.map +1 -1
- package/lib/module/components/RoomComponents/styled/LastMessageEmoji.js +8 -9
- package/lib/module/components/RoomComponents/styled/LastMessageEmoji.js.map +1 -1
- package/lib/module/components/RoomComponents/styled/LastMessageFile.js +4 -6
- package/lib/module/components/RoomComponents/styled/LastMessageFile.js.map +1 -1
- package/lib/module/components/RoomComponents/styled/LastMessagePhoto.js +2 -2
- package/lib/module/components/RoomComponents/styled/LastMessagePhoto.js.map +1 -1
- package/lib/module/components/RoomComponents/styled/LastMessageSealed.js +36 -0
- package/lib/module/components/RoomComponents/styled/LastMessageSealed.js.map +1 -0
- package/lib/module/components/RoomComponents/styled/LastMessageVideo.js +2 -2
- package/lib/module/components/RoomComponents/styled/LastMessageVideo.js.map +1 -1
- package/lib/module/components/Thread/ThreadWrapper.js +273 -153
- package/lib/module/components/Thread/ThreadWrapper.js.map +1 -1
- package/lib/module/components/UsersList/UsersList.js +2 -1
- package/lib/module/components/UsersList/UsersList.js.map +1 -1
- package/lib/module/components/styled/DateLabel.js +6 -3
- package/lib/module/components/styled/DateLabel.js.map +1 -1
- package/lib/module/components/styled/SendInput.js +4 -2
- package/lib/module/components/styled/SendInput.js.map +1 -1
- package/lib/module/context/MessageNotificationContext.js +190 -11
- package/lib/module/context/MessageNotificationContext.js.map +1 -1
- package/lib/module/context/xmppProvider.js +22 -7
- package/lib/module/context/xmppProvider.js.map +1 -1
- package/lib/module/e2ee/crypto.js +170 -0
- package/lib/module/e2ee/crypto.js.map +1 -0
- package/lib/module/e2ee/deviceStore.js +77 -0
- package/lib/module/e2ee/deviceStore.js.map +1 -0
- package/lib/module/e2ee/fileCipher.js +90 -0
- package/lib/module/e2ee/fileCipher.js.map +1 -0
- package/lib/module/e2ee/fileEnvelope.js +66 -0
- package/lib/module/e2ee/fileEnvelope.js.map +1 -0
- package/lib/module/e2ee/index.js +185 -0
- package/lib/module/e2ee/index.js.map +1 -0
- package/lib/module/e2ee/limits.js +5 -0
- package/lib/module/e2ee/limits.js.map +1 -0
- package/lib/module/e2ee/ns.js +4 -0
- package/lib/module/e2ee/ns.js.map +1 -0
- package/lib/module/e2ee/omemo.js +610 -0
- package/lib/module/e2ee/omemo.js.map +1 -0
- package/lib/module/e2ee/protobuf.js +140 -0
- package/lib/module/e2ee/protobuf.js.map +1 -0
- package/lib/module/e2ee/ratchet.js +228 -0
- package/lib/module/e2ee/ratchet.js.map +1 -0
- package/lib/module/e2ee/sealedBody.js +19 -0
- package/lib/module/e2ee/sealedBody.js.map +1 -0
- package/lib/module/e2ee/sealedFiles.js +154 -0
- package/lib/module/e2ee/sealedFiles.js.map +1 -0
- package/lib/module/e2ee/send.js +48 -0
- package/lib/module/e2ee/send.js.map +1 -0
- package/lib/module/e2ee/stanza.js +107 -0
- package/lib/module/e2ee/stanza.js.map +1 -0
- package/lib/module/e2ee/store.js +35 -0
- package/lib/module/e2ee/store.js.map +1 -0
- package/lib/module/helpers/accountName.js +18 -0
- package/lib/module/helpers/accountName.js.map +1 -0
- package/lib/module/helpers/createMessageFromXml.js +19 -4
- package/lib/module/helpers/createMessageFromXml.js.map +1 -1
- package/lib/module/helpers/createRoomFromApi.js +36 -2
- package/lib/module/helpers/createRoomFromApi.js.map +1 -1
- package/lib/module/helpers/createUserNameFromSetUser.js +3 -1
- package/lib/module/helpers/createUserNameFromSetUser.js.map +1 -1
- package/lib/module/helpers/displayName.js +11 -0
- package/lib/module/helpers/displayName.js.map +1 -0
- package/lib/module/helpers/emoji.js +44 -0
- package/lib/module/helpers/emoji.js.map +1 -0
- package/lib/module/helpers/haptics.js +24 -0
- package/lib/module/helpers/haptics.js.map +1 -0
- package/lib/module/helpers/historyPreloadScheduler.js +32 -66
- package/lib/module/helpers/historyPreloadScheduler.js.map +1 -1
- package/lib/module/helpers/insertMessageWithDelimiter.js +21 -12
- package/lib/module/helpers/insertMessageWithDelimiter.js.map +1 -1
- package/lib/module/helpers/mamReactions.js +51 -0
- package/lib/module/helpers/mamReactions.js.map +1 -0
- package/lib/module/helpers/parseMessageReference.js +37 -0
- package/lib/module/helpers/parseMessageReference.js.map +1 -0
- package/lib/module/helpers/persistCrypto.js +4 -0
- package/lib/module/helpers/persistCrypto.js.map +1 -1
- package/lib/module/helpers/reactionsConfig.js +10 -0
- package/lib/module/helpers/reactionsConfig.js.map +1 -0
- package/lib/module/helpers/secureKeyValue.js +19 -0
- package/lib/module/helpers/secureKeyValue.js.map +1 -1
- package/lib/module/helpers/updateMessagesTillLast.js +17 -2
- package/lib/module/helpers/updateMessagesTillLast.js.map +1 -1
- package/lib/module/helpers/videoCache.js +125 -0
- package/lib/module/helpers/videoCache.js.map +1 -0
- package/lib/module/hooks/useHeapSender.js +3 -1
- package/lib/module/hooks/useHeapSender.js.map +1 -1
- package/lib/module/hooks/useLogout.js +8 -0
- package/lib/module/hooks/useLogout.js.map +1 -1
- package/lib/module/hooks/useMessageHeapState.js +3 -2
- package/lib/module/hooks/useMessageHeapState.js.map +1 -1
- package/lib/module/hooks/useRoomInitialization.js +17 -8
- package/lib/module/hooks/useRoomInitialization.js.map +1 -1
- package/lib/module/hooks/useSendMessage.js +85 -15
- package/lib/module/hooks/useSendMessage.js.map +1 -1
- package/lib/module/hooks/useUnreadMessagesCounter.js +1 -1
- package/lib/module/hooks/useUnreadMessagesCounter.js.map +1 -1
- package/lib/module/i18n/strings.js +180 -0
- package/lib/module/i18n/strings.js.map +1 -1
- package/lib/module/main.js +1 -0
- package/lib/module/main.js.map +1 -1
- package/lib/module/networking/api-requests/auth.api.js +4 -1
- package/lib/module/networking/api-requests/auth.api.js.map +1 -1
- package/lib/module/networking/api-requests/rooms.api.js +109 -18
- package/lib/module/networking/api-requests/rooms.api.js.map +1 -1
- package/lib/module/networking/stanzaHandlers.js +107 -51
- package/lib/module/networking/stanzaHandlers.js.map +1 -1
- package/lib/module/networking/xmpp/getHistory.xmpp.js +29 -74
- package/lib/module/networking/xmpp/getHistory.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/handleStanzas.xmpp.js +42 -0
- package/lib/module/networking/xmpp/handleStanzas.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/mamRouter.js +175 -0
- package/lib/module/networking/xmpp/mamRouter.js.map +1 -0
- package/lib/module/networking/xmpp/presenceInRoom.xmpp.js +38 -2
- package/lib/module/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/sendMediaMessage.xmpp.js +16 -3
- package/lib/module/networking/xmpp/sendMediaMessage.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/sendTextMessage.xmpp.js +13 -6
- package/lib/module/networking/xmpp/sendTextMessage.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js +14 -6
- package/lib/module/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js.map +1 -1
- package/lib/module/networking/xmppClient.js +105 -24
- package/lib/module/networking/xmppClient.js.map +1 -1
- package/lib/module/roomStore/Middleware/newMessageMidlleware.js +29 -34
- package/lib/module/roomStore/Middleware/newMessageMidlleware.js.map +1 -1
- package/lib/module/roomStore/Middleware/perfMiddleware.js +45 -0
- package/lib/module/roomStore/Middleware/perfMiddleware.js.map +1 -0
- package/lib/module/roomStore/Middleware/reactionsMiddleware.js +66 -43
- package/lib/module/roomStore/Middleware/reactionsMiddleware.js.map +1 -1
- package/lib/module/roomStore/Middleware/unreadMidlleware.js +89 -69
- package/lib/module/roomStore/Middleware/unreadMidlleware.js.map +1 -1
- package/lib/module/roomStore/index.js +19 -15
- package/lib/module/roomStore/index.js.map +1 -1
- package/lib/module/roomStore/persistBackend.js +86 -0
- package/lib/module/roomStore/persistBackend.js.map +1 -0
- package/lib/module/roomStore/persistence.js +253 -49
- package/lib/module/roomStore/persistence.js.map +1 -1
- package/lib/module/roomStore/roomsSlice.js +275 -134
- package/lib/module/roomStore/roomsSlice.js.map +1 -1
- package/lib/module/theme/theme.js +3 -0
- package/lib/module/theme/theme.js.map +1 -1
- package/lib/module/utils/devLogger.js +13 -0
- package/lib/module/utils/devLogger.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/assets/emojiData.d.ts +8 -0
- package/lib/typescript/assets/emojiData.d.ts.map +1 -0
- package/lib/typescript/assets/icons.d.ts +8 -0
- package/lib/typescript/assets/icons.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ChatHeader.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ChatRoom.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ChatWrapper.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/EncryptedSendNotice.d.ts +4 -0
- package/lib/typescript/components/MainComponents/EncryptedSendNotice.d.ts.map +1 -0
- package/lib/typescript/components/MainComponents/EncryptionCard.d.ts +10 -0
- package/lib/typescript/components/MainComponents/EncryptionCard.d.ts.map +1 -0
- package/lib/typescript/components/MainComponents/MediaMessage.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/MessageContainer.d.ts +2 -2
- package/lib/typescript/components/MainComponents/MessageContainer.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/MessageList.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ReduxWrapper.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/RoomStack.d.ts +7 -2
- package/lib/typescript/components/MainComponents/RoomStack.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/SealedAttachment.d.ts +13 -0
- package/lib/typescript/components/MainComponents/SealedAttachment.d.ts.map +1 -0
- package/lib/typescript/components/MainComponents/SystemMessage.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/Avatar.d.ts +2 -0
- package/lib/typescript/components/MessageBubble/Avatar.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/BottomReplyContainer.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/EmojiPickerSheet.d.ts +11 -0
- package/lib/typescript/components/MessageBubble/EmojiPickerSheet.d.ts.map +1 -0
- package/lib/typescript/components/MessageBubble/Message.d.ts +2 -2
- package/lib/typescript/components/MessageBubble/Message.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/MessageInteractions.d.ts +2 -0
- package/lib/typescript/components/MessageBubble/MessageInteractions.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/MessageReaction.d.ts +1 -0
- package/lib/typescript/components/MessageBubble/MessageReaction.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/MessageReply.d.ts +7 -7
- package/lib/typescript/components/MessageBubble/MessageReply.d.ts.map +1 -1
- package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/FilePreviewModal/PdfView.d.ts.map +1 -1
- package/lib/typescript/components/Modals/Modal/SwipeBackLayer.d.ts +2 -1
- package/lib/typescript/components/Modals/Modal/SwipeBackLayer.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts +2 -2
- package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/LastMessageItem.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastAudioMessage.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastMessageEmoji.d.ts +3 -6
- package/lib/typescript/components/RoomComponents/styled/LastMessageEmoji.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastMessageSealed.d.ts +7 -0
- package/lib/typescript/components/RoomComponents/styled/LastMessageSealed.d.ts.map +1 -0
- package/lib/typescript/components/Thread/ThreadWrapper.d.ts +7 -1
- package/lib/typescript/components/Thread/ThreadWrapper.d.ts.map +1 -1
- package/lib/typescript/components/UsersList/UsersList.d.ts.map +1 -1
- package/lib/typescript/components/styled/DateLabel.d.ts +1 -0
- package/lib/typescript/components/styled/DateLabel.d.ts.map +1 -1
- package/lib/typescript/components/styled/SendInput.d.ts +1 -0
- package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
- package/lib/typescript/context/MessageNotificationContext.d.ts.map +1 -1
- package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
- package/lib/typescript/e2ee/crypto.d.ts +28 -0
- package/lib/typescript/e2ee/crypto.d.ts.map +1 -0
- package/lib/typescript/e2ee/deviceStore.d.ts +4 -0
- package/lib/typescript/e2ee/deviceStore.d.ts.map +1 -0
- package/lib/typescript/e2ee/fileCipher.d.ts +7 -0
- package/lib/typescript/e2ee/fileCipher.d.ts.map +1 -0
- package/lib/typescript/e2ee/fileEnvelope.d.ts +27 -0
- package/lib/typescript/e2ee/fileEnvelope.d.ts.map +1 -0
- package/lib/typescript/e2ee/index.d.ts +23 -0
- package/lib/typescript/e2ee/index.d.ts.map +1 -0
- package/lib/typescript/e2ee/limits.d.ts +3 -0
- package/lib/typescript/e2ee/limits.d.ts.map +1 -0
- package/lib/typescript/e2ee/ns.d.ts +2 -0
- package/lib/typescript/e2ee/ns.d.ts.map +1 -0
- package/lib/typescript/e2ee/omemo.d.ts +64 -0
- package/lib/typescript/e2ee/omemo.d.ts.map +1 -0
- package/lib/typescript/e2ee/protobuf.d.ts +25 -0
- package/lib/typescript/e2ee/protobuf.d.ts.map +1 -0
- package/lib/typescript/e2ee/ratchet.d.ts +39 -0
- package/lib/typescript/e2ee/ratchet.d.ts.map +1 -0
- package/lib/typescript/e2ee/sealedBody.d.ts +2 -0
- package/lib/typescript/e2ee/sealedBody.d.ts.map +1 -0
- package/lib/typescript/e2ee/sealedFiles.d.ts +31 -0
- package/lib/typescript/e2ee/sealedFiles.d.ts.map +1 -0
- package/lib/typescript/e2ee/send.d.ts +6 -0
- package/lib/typescript/e2ee/send.d.ts.map +1 -0
- package/lib/typescript/e2ee/stanza.d.ts +8 -0
- package/lib/typescript/e2ee/stanza.d.ts.map +1 -0
- package/lib/typescript/e2ee/store.d.ts +16 -0
- package/lib/typescript/e2ee/store.d.ts.map +1 -0
- package/lib/typescript/helpers/accountName.d.ts +7 -0
- package/lib/typescript/helpers/accountName.d.ts.map +1 -0
- package/lib/typescript/helpers/createMessageFromXml.d.ts.map +1 -1
- package/lib/typescript/helpers/createRoomFromApi.d.ts.map +1 -1
- package/lib/typescript/helpers/createUserNameFromSetUser.d.ts.map +1 -1
- package/lib/typescript/helpers/displayName.d.ts +2 -0
- package/lib/typescript/helpers/displayName.d.ts.map +1 -0
- package/lib/typescript/helpers/emoji.d.ts +6 -0
- package/lib/typescript/helpers/emoji.d.ts.map +1 -0
- package/lib/typescript/helpers/haptics.d.ts +3 -0
- package/lib/typescript/helpers/haptics.d.ts.map +1 -0
- package/lib/typescript/helpers/historyPreloadScheduler.d.ts +1 -0
- package/lib/typescript/helpers/historyPreloadScheduler.d.ts.map +1 -1
- package/lib/typescript/helpers/insertMessageWithDelimiter.d.ts.map +1 -1
- package/lib/typescript/helpers/mamReactions.d.ts +13 -0
- package/lib/typescript/helpers/mamReactions.d.ts.map +1 -0
- package/lib/typescript/helpers/parseMessageReference.d.ts +16 -0
- package/lib/typescript/helpers/parseMessageReference.d.ts.map +1 -0
- package/lib/typescript/helpers/persistCrypto.d.ts +1 -0
- package/lib/typescript/helpers/persistCrypto.d.ts.map +1 -1
- package/lib/typescript/helpers/reactionsConfig.d.ts +5 -0
- package/lib/typescript/helpers/reactionsConfig.d.ts.map +1 -0
- package/lib/typescript/helpers/secureKeyValue.d.ts +4 -0
- package/lib/typescript/helpers/secureKeyValue.d.ts.map +1 -1
- package/lib/typescript/helpers/updateMessagesTillLast.d.ts.map +1 -1
- package/lib/typescript/helpers/videoCache.d.ts +19 -0
- package/lib/typescript/helpers/videoCache.d.ts.map +1 -0
- package/lib/typescript/hooks/useHeapSender.d.ts.map +1 -1
- package/lib/typescript/hooks/useLogout.d.ts.map +1 -1
- package/lib/typescript/hooks/useMessageHeapState.d.ts.map +1 -1
- package/lib/typescript/hooks/useRoomInitialization.d.ts +2 -2
- package/lib/typescript/hooks/useRoomInitialization.d.ts.map +1 -1
- package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
- package/lib/typescript/i18n/strings.d.ts.map +1 -1
- package/lib/typescript/main.d.ts +2 -0
- package/lib/typescript/main.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/auth.api.d.ts +4 -1
- package/lib/typescript/networking/api-requests/auth.api.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/rooms.api.d.ts +22 -1
- package/lib/typescript/networking/api-requests/rooms.api.d.ts.map +1 -1
- package/lib/typescript/networking/stanzaHandlers.d.ts +4 -2
- package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/getHistory.xmpp.d.ts +3 -1
- package/lib/typescript/networking/xmpp/getHistory.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/handleStanzas.xmpp.d.ts +1 -0
- package/lib/typescript/networking/xmpp/handleStanzas.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/mamRouter.d.ts +23 -0
- package/lib/typescript/networking/xmpp/mamRouter.d.ts.map +1 -0
- package/lib/typescript/networking/xmpp/presenceInRoom.xmpp.d.ts +1 -0
- package/lib/typescript/networking/xmpp/presenceInRoom.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/sendMediaMessage.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/sendTextMessage.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmppClient.d.ts +22 -1
- package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
- package/lib/typescript/roomStore/Middleware/newMessageMidlleware.d.ts.map +1 -1
- package/lib/typescript/roomStore/Middleware/perfMiddleware.d.ts +4 -0
- package/lib/typescript/roomStore/Middleware/perfMiddleware.d.ts.map +1 -0
- package/lib/typescript/roomStore/Middleware/reactionsMiddleware.d.ts +9 -0
- package/lib/typescript/roomStore/Middleware/reactionsMiddleware.d.ts.map +1 -1
- package/lib/typescript/roomStore/Middleware/unreadMidlleware.d.ts.map +1 -1
- package/lib/typescript/roomStore/index.d.ts.map +1 -1
- package/lib/typescript/roomStore/persistBackend.d.ts +11 -0
- package/lib/typescript/roomStore/persistBackend.d.ts.map +1 -0
- package/lib/typescript/roomStore/persistence.d.ts +5 -6
- package/lib/typescript/roomStore/persistence.d.ts.map +1 -1
- package/lib/typescript/roomStore/roomsSlice.d.ts +41 -1
- package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
- package/lib/typescript/theme/theme.d.ts +4 -1
- package/lib/typescript/theme/theme.d.ts.map +1 -1
- package/lib/typescript/types/models/message.model.d.ts +9 -0
- package/lib/typescript/types/models/message.model.d.ts.map +1 -1
- package/lib/typescript/types/models/room.model.d.ts +21 -0
- package/lib/typescript/types/models/room.model.d.ts.map +1 -1
- package/lib/typescript/types/models/xmpp.model.d.ts +6 -1
- package/lib/typescript/types/models/xmpp.model.d.ts.map +1 -1
- package/lib/typescript/types/types.d.ts +19 -3
- package/lib/typescript/types/types.d.ts.map +1 -1
- package/lib/typescript/utils/devLogger.d.ts +8 -0
- package/lib/typescript/utils/devLogger.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +14 -1
- package/src/assets/emojiData.ts +2146 -0
- package/src/assets/icons.tsx +32 -5
- package/src/components/MainComponents/ChatHeader.tsx +46 -16
- package/src/components/MainComponents/ChatRoom.tsx +46 -30
- package/src/components/MainComponents/ChatWrapper.tsx +28 -10
- package/src/components/MainComponents/EncryptedSendNotice.tsx +35 -0
- package/src/components/MainComponents/EncryptionCard.tsx +287 -0
- package/src/components/MainComponents/MediaMessage.tsx +5 -0
- package/src/components/MainComponents/MessageContainer.tsx +7 -15
- package/src/components/MainComponents/MessageList.tsx +96 -43
- package/src/components/MainComponents/ReduxWrapper.tsx +5 -0
- package/src/components/MainComponents/RoomList.tsx +28 -29
- package/src/components/MainComponents/RoomStack.tsx +156 -83
- package/src/components/MainComponents/SealedAttachment.tsx +251 -0
- package/src/components/MainComponents/SystemMessage.tsx +6 -2
- package/src/components/MessageBubble/Avatar.tsx +7 -1
- package/src/components/MessageBubble/BottomReplyContainer.tsx +20 -21
- package/src/components/MessageBubble/EmojiPickerSheet.tsx +468 -0
- package/src/components/MessageBubble/Message.tsx +242 -93
- package/src/components/MessageBubble/MessageInteractions.tsx +215 -15
- package/src/components/MessageBubble/MessageReaction.tsx +120 -96
- package/src/components/MessageBubble/MessageReply.tsx +65 -32
- package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +7 -4
- package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +181 -35
- package/src/components/Modals/FilePreviewModal/PdfView.tsx +4 -0
- package/src/components/Modals/Modal/SwipeBackLayer.tsx +114 -63
- package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +53 -8
- package/src/components/Modals/UserSettingsModal/UserSettingsModal.tsx +5 -0
- package/src/components/RoomComponents/ChatRoomItem.tsx +34 -15
- package/src/components/RoomComponents/LastMessageItem.tsx +5 -0
- package/src/components/RoomComponents/styled/LastAudioMessage.tsx +3 -1
- package/src/components/RoomComponents/styled/LastMessageEmoji.tsx +7 -8
- package/src/components/RoomComponents/styled/LastMessageFile.tsx +2 -2
- package/src/components/RoomComponents/styled/LastMessagePhoto.tsx +1 -1
- package/src/components/RoomComponents/styled/LastMessageSealed.tsx +31 -0
- package/src/components/RoomComponents/styled/LastMessageVideo.tsx +1 -1
- package/src/components/Thread/ThreadWrapper.tsx +287 -198
- package/src/components/UsersList/UsersList.tsx +2 -1
- package/src/components/styled/DateLabel.tsx +7 -3
- package/src/components/styled/SendInput.tsx +5 -2
- package/src/context/MessageNotificationContext.tsx +205 -7
- package/src/context/xmppProvider.tsx +29 -9
- package/src/e2ee/crypto.ts +194 -0
- package/src/e2ee/deviceStore.ts +80 -0
- package/src/e2ee/fileCipher.ts +86 -0
- package/src/e2ee/fileEnvelope.ts +115 -0
- package/src/e2ee/index.ts +192 -0
- package/src/e2ee/limits.ts +2 -0
- package/src/e2ee/ns.ts +1 -0
- package/src/e2ee/omemo.ts +802 -0
- package/src/e2ee/protobuf.ts +188 -0
- package/src/e2ee/ratchet.ts +271 -0
- package/src/e2ee/sealedBody.ts +17 -0
- package/src/e2ee/sealedFiles.ts +181 -0
- package/src/e2ee/send.ts +70 -0
- package/src/e2ee/stanza.ts +133 -0
- package/src/e2ee/store.ts +54 -0
- package/src/helpers/accountName.ts +15 -0
- package/src/helpers/createMessageFromXml.ts +31 -6
- package/src/helpers/createRoomFromApi.tsx +37 -1
- package/src/helpers/createUserNameFromSetUser.ts +2 -1
- package/src/helpers/displayName.ts +9 -0
- package/src/helpers/emoji.ts +39 -0
- package/src/helpers/haptics.ts +19 -0
- package/src/helpers/historyPreloadScheduler.ts +37 -69
- package/src/helpers/insertMessageWithDelimiter.ts +23 -16
- package/src/helpers/mamReactions.ts +59 -0
- package/src/helpers/parseMessageReference.ts +38 -0
- package/src/helpers/persistCrypto.ts +5 -0
- package/src/helpers/reactionsConfig.ts +13 -0
- package/src/helpers/secureKeyValue.ts +15 -0
- package/src/helpers/updateMessagesTillLast.tsx +14 -2
- package/src/helpers/videoCache.ts +138 -0
- package/src/hooks/useHeapSender.tsx +3 -2
- package/src/hooks/useLogout.tsx +9 -0
- package/src/hooks/useMessageHeapState.tsx +6 -2
- package/src/hooks/useRoomInitialization.tsx +32 -15
- package/src/hooks/useSendMessage.tsx +89 -16
- package/src/hooks/useUnreadMessagesCounter.ts +1 -1
- package/src/i18n/strings.ts +180 -0
- package/src/main.ts +2 -0
- package/src/networking/api-requests/auth.api.ts +9 -1
- package/src/networking/api-requests/rooms.api.ts +121 -18
- package/src/networking/stanzaHandlers.ts +116 -60
- package/src/networking/xmpp/getHistory.xmpp.ts +44 -106
- package/src/networking/xmpp/handleStanzas.xmpp.ts +51 -0
- package/src/networking/xmpp/mamRouter.ts +176 -0
- package/src/networking/xmpp/presenceInRoom.xmpp.ts +46 -3
- package/src/networking/xmpp/sendMediaMessage.xmpp.ts +19 -1
- package/src/networking/xmpp/sendTextMessage.xmpp.ts +17 -10
- package/src/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.ts +23 -10
- package/src/networking/xmppClient.ts +111 -20
- package/src/roomStore/Middleware/newMessageMidlleware.tsx +35 -38
- package/src/roomStore/Middleware/perfMiddleware.ts +50 -0
- package/src/roomStore/Middleware/reactionsMiddleware.tsx +53 -52
- package/src/roomStore/Middleware/unreadMidlleware.tsx +92 -80
- package/src/roomStore/index.ts +28 -27
- package/src/roomStore/persistBackend.ts +93 -0
- package/src/roomStore/persistence.ts +295 -73
- package/src/roomStore/roomsSlice.ts +304 -155
- package/src/theme/theme.ts +10 -1
- package/src/types/models/message.model.ts +9 -0
- package/src/types/models/room.model.ts +22 -0
- package/src/types/models/xmpp.model.ts +4 -2
- package/src/types/types.ts +19 -3
- package/src/utils/devLogger.ts +16 -0
- 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":["e2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AAgB,CAACkD,IAAI,EAAED,MAAM,CAAC;EAC7C,MAAMM,MAAM,GAAG,MAAMhB,aAAa,CAAC,CAAC;EACpC,MAAMiB,SAAS,GAAGF,MAAM,GACpB,MAAMC,MAAM,EAAEE,OAAO,CAAC9B,OAAO,EAAE2B,MAAM,EAAEF,OAAO,CAAC,GAC/C9C,SAAS;EAEb,IAAI,CAACkD,SAAS,EAAEE,OAAO,EAAE;IACvB,OAAOtB,KAAK,CACVT,OAAO,EACP6B,SAAS,EAAEzC,KAAK,KAAK,qCAAqC,GACtD,cAAc,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","createMemoryStore"],"sourceRoot":"../../../src","sources":["e2ee/store.ts"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,QAAQ,QAAQ,UAAU;AAQ/C,MAAMC,SAAS,GAAG,QAAQ;AAE1B,OAAO,SAASC,WAAWA,CAACC,KAAc,EAAU;EAClD,OAAOC,IAAI,CAACC,SAAS,CAACF,KAAK,EAAE,CAACG,IAAI,EAAEC,IAAI,KACtCA,IAAI,YAAYC,UAAU,GAAG;IAAE,CAACP,SAAS,GAAGD,QAAQ,CAACO,IAAI;EAAE,CAAC,GAAGA,IACjE,CAAC;AACH;AAEA,OAAO,SAASE,WAAWA,CAAIC,IAAY,EAAK;EAC9C,OAAON,IAAI,CAACO,KAAK,CAACD,IAAI,EAAE,CAACJ,IAAI,EAAEC,IAAI,KACjCA,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,IAAI,OAAOA,IAAI,CAACN,SAAS,CAAC,KAAK,QAAQ,GACnEF,UAAU,CAACQ,IAAI,C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
+
|
|
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
|
|
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 =
|
|
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","
|
|
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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,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
|
|
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":["
|
|
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"],"mappings":";;AAGA,MAAMA,iBAAiB,GAAGA,CACxBC,cAAsC,EACtCC,OAAe,KACa;EAC5B,MAAMC,IAAI,GAAGC,MAAM,CAACH,cAAc,EAAEE,IAAI,IAAI,EAAE,CAAC,CAACE,IAAI,CAAC,CAAC;EACtD,IAAI,CAACJ,cAAc,IAAI,CAACE,IAAI,EAAE;IAAC,OAAOG,SAAS;EAAC;EAChD,MAAMC,UAAU,GAAG,GAAGN,cAAc,CAACO,eAAe,IAAI,EAAE,IACxDP,cAAc,CAACQ,cAAc,IAAI,EAAE,EACnC,CAACJ,IAAI,CAAC,CAAC;EACT,OAAO;IACLK,EAAE,EAAET,cAAc,CAACU,SAAS,IAAIV,cAAc,CAACW,QAAQ,IAAI,EAAE;IAC7DC,MAAM,EAAEZ,cAAc,CAACW,QAAQ;IAC/BV,OAAO;IACPC,IAAI;IACJW,IAAI,EAAEb,cAAc,CAACc,SAAS;IAC9BC,SAAS,EAAE,KAAK;IAChBC,IAAI,EAAE;MACJP,EAAE,EAAET,cAAc,CAACiB,UAAU,IAAIjB,cAAc,CAACkB,IAAI,IAAI,EAAE;MAC1DC,IAAI,EAAEb;IACR;EACF,CAAC;AACH,CAAC;AAED,MAAMc,aAAa,GAAIC,IAA6B,IAAyB;EAC3E,IAAI,CAACA,IAAI,EAAE;IAAC,OAAOhB,SAAS;EAAC;EAC7B,MAAMI,EAAE,GAAGa,MAAM,CAACD,IAAI,CAACZ,EAAE,CAAC;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AACa,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
|
|
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":";;
|
|
1
|
+
{"version":3,"names":["composeName","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":";;AACA,SAASA,WAAW,QAAQ,eAAe;;AAE3C;AACA;AACA;AACA;A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I,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
|
-
|
|
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
|
-
|
|
13
|
-
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return
|
|
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
|
|
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
|
-
|
|
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
|
};
|