@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,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.markStreamingUnsupported = exports.isStreamingUnsupported = exports.isRemoteUrl = exports.getVideoCacheUri = exports.findCachedVideo = exports.downloadVideoToCache = exports.__resetVideoCacheForTests = void 0;
|
|
7
|
+
var FileSystem = _interopRequireWildcard(require("expo-file-system/legacy"));
|
|
8
|
+
var _mimeToExtension = require("./mimeToExtension");
|
|
9
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
10
|
+
// Containers the native players open from a local file by extension.
|
|
11
|
+
const VIDEO_EXT_RE = /\.(mp4|mov|m4v|webm|3gp|mkv|mpeg)$/i;
|
|
12
|
+
const hashString = value => {
|
|
13
|
+
let hash = 5381;
|
|
14
|
+
for (let i = 0; i < value.length; i++) {
|
|
15
|
+
hash = hash * 33 ^ value.charCodeAt(i);
|
|
16
|
+
}
|
|
17
|
+
return (hash >>> 0).toString(36);
|
|
18
|
+
};
|
|
19
|
+
const isRemoteUrl = url => /^https?:\/\//i.test(url || '');
|
|
20
|
+
exports.isRemoteUrl = isRemoteUrl;
|
|
21
|
+
const hostOf = url => (/^https?:\/\/(?:[^@/]+@)?([^:/?#]+)/i.exec(url)?.[1] || '').toLowerCase();
|
|
22
|
+
|
|
23
|
+
// The query carries the short-lived file token; the file is the same.
|
|
24
|
+
const withoutQuery = url => url.split('#')[0].split('?')[0];
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Where a remote video is kept once downloaded. The extension matters:
|
|
28
|
+
* AVFoundation picks the demuxer of a local file by it.
|
|
29
|
+
*/
|
|
30
|
+
const getVideoCacheUri = (url, mimetype, cacheDirectory) => {
|
|
31
|
+
const fromUrl = VIDEO_EXT_RE.exec((0, _mimeToExtension.filenameFromUrl)(url))?.[0];
|
|
32
|
+
const fromMime = (0, _mimeToExtension.getExtensionForMime)(mimetype);
|
|
33
|
+
const ext = (fromUrl || (VIDEO_EXT_RE.test(fromMime) ? fromMime : '.mp4')).toLowerCase();
|
|
34
|
+
return `${cacheDirectory}ethora-video-${hashString(withoutQuery(url))}${ext}`;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Hosts that answered a streaming attempt with an error. AVPlayer refuses a
|
|
39
|
+
* server that replies 200 to a byte-range request ("server is not correctly
|
|
40
|
+
* configured"), so for those the next video skips the doomed stream and
|
|
41
|
+
* downloads straight away.
|
|
42
|
+
*/
|
|
43
|
+
exports.getVideoCacheUri = getVideoCacheUri;
|
|
44
|
+
const hostsWithoutStreaming = new Set();
|
|
45
|
+
const markStreamingUnsupported = url => {
|
|
46
|
+
const host = hostOf(url);
|
|
47
|
+
if (host) {
|
|
48
|
+
hostsWithoutStreaming.add(host);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
exports.markStreamingUnsupported = markStreamingUnsupported;
|
|
52
|
+
const isStreamingUnsupported = url => hostsWithoutStreaming.has(hostOf(url));
|
|
53
|
+
exports.isStreamingUnsupported = isStreamingUnsupported;
|
|
54
|
+
const findCachedVideo = async (url, mimetype) => {
|
|
55
|
+
const cacheDirectory = FileSystem.cacheDirectory;
|
|
56
|
+
if (!cacheDirectory || !isRemoteUrl(url)) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
const uri = getVideoCacheUri(url, mimetype, cacheDirectory);
|
|
61
|
+
const info = await FileSystem.getInfoAsync(uri);
|
|
62
|
+
return info.exists ? uri : null;
|
|
63
|
+
} catch {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
exports.findCachedVideo = findCachedVideo;
|
|
68
|
+
const inFlight = new Map();
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Downloads the video next to the app's other caches and resolves with the
|
|
72
|
+
* local uri. One download per file however many callers ask; `onProgress`
|
|
73
|
+
* gets 0..1 when the server reports a length.
|
|
74
|
+
*/
|
|
75
|
+
const downloadVideoToCache = (url, mimetype, onProgress) => {
|
|
76
|
+
const cacheDirectory = FileSystem.cacheDirectory;
|
|
77
|
+
if (!cacheDirectory) {
|
|
78
|
+
return Promise.reject(new Error('video_cache_unavailable'));
|
|
79
|
+
}
|
|
80
|
+
const finalUri = getVideoCacheUri(url, mimetype, cacheDirectory);
|
|
81
|
+
const running = inFlight.get(finalUri);
|
|
82
|
+
if (running) {
|
|
83
|
+
if (onProgress) {
|
|
84
|
+
running.listeners.add(onProgress);
|
|
85
|
+
}
|
|
86
|
+
return running.promise;
|
|
87
|
+
}
|
|
88
|
+
const listeners = new Set();
|
|
89
|
+
if (onProgress) {
|
|
90
|
+
listeners.add(onProgress);
|
|
91
|
+
}
|
|
92
|
+
const run = async () => {
|
|
93
|
+
// Download under another name: an interrupted download must not be
|
|
94
|
+
// mistaken for the cached file next time.
|
|
95
|
+
const part = `${finalUri}.part`;
|
|
96
|
+
await FileSystem.deleteAsync(part, {
|
|
97
|
+
idempotent: true
|
|
98
|
+
}).catch(() => {});
|
|
99
|
+
const task = FileSystem.createDownloadResumable(url, part, {}, p => {
|
|
100
|
+
if (p.totalBytesExpectedToWrite > 0) {
|
|
101
|
+
const fraction = Math.min(1, p.totalBytesWritten / p.totalBytesExpectedToWrite);
|
|
102
|
+
listeners.forEach(listener => listener(fraction));
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
const result = await task.downloadAsync();
|
|
106
|
+
if (!result || result.status < 200 || result.status >= 300) {
|
|
107
|
+
await FileSystem.deleteAsync(part, {
|
|
108
|
+
idempotent: true
|
|
109
|
+
}).catch(() => {});
|
|
110
|
+
throw new Error(`video_download_status_${result?.status ?? 'cancelled'}`);
|
|
111
|
+
}
|
|
112
|
+
await FileSystem.deleteAsync(finalUri, {
|
|
113
|
+
idempotent: true
|
|
114
|
+
}).catch(() => {});
|
|
115
|
+
await FileSystem.moveAsync({
|
|
116
|
+
from: part,
|
|
117
|
+
to: finalUri
|
|
118
|
+
});
|
|
119
|
+
return finalUri;
|
|
120
|
+
};
|
|
121
|
+
const promise = run().finally(() => {
|
|
122
|
+
inFlight.delete(finalUri);
|
|
123
|
+
});
|
|
124
|
+
inFlight.set(finalUri, {
|
|
125
|
+
promise,
|
|
126
|
+
listeners
|
|
127
|
+
});
|
|
128
|
+
return promise;
|
|
129
|
+
};
|
|
130
|
+
exports.downloadVideoToCache = downloadVideoToCache;
|
|
131
|
+
const __resetVideoCacheForTests = () => {
|
|
132
|
+
hostsWithoutStreaming.clear();
|
|
133
|
+
inFlight.clear();
|
|
134
|
+
};
|
|
135
|
+
exports.__resetVideoCacheForTests = __resetVideoCacheForTests;
|
|
136
|
+
//# sourceMappingURL=videoCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["FileSystem","_interopRequireWildcard","require","_mimeToExtension","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","VIDEO_EXT_RE","hashString","value","hash","length","charCodeAt","toString","isRemoteUrl","url","test","exports","hostOf","exec","toLowerCase","withoutQuery","split","getVideoCacheUri","mimetype","cacheDirectory","fromUrl","filenameFromUrl","fromMime","getExtensionForMime","ext","hostsWithoutStreaming","Set","markStreamingUnsupported","host","add","isStreamingUnsupported","findCachedVideo","uri","info","getInfoAsync","exists","inFlight","Map","downloadVideoToCache","onProgress","Promise","reject","Error","finalUri","running","listeners","promise","run","part","deleteAsync","idempotent","catch","task","createDownloadResumable","p","totalBytesExpectedToWrite","fraction","Math","min","totalBytesWritten","forEach","listener","result","downloadAsync","status","moveAsync","from","to","finally","delete","__resetVideoCacheForTests","clear"],"sourceRoot":"../../../src","sources":["helpers/videoCache.ts"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAAyE,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,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BAAA;AAEK,MAAMgC,yBAAyB,GAAGA,CAAA,KAAY;EACnD7C,qBAAqB,CAAC8C,KAAK,CAAC,CAAC;EAC7BnC,QAAQ,CAACmC,KAAK,CAAC,CAAC;AAClB,CAAC;AAAC5D,OAAA,CAAA2D,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
@@ -37,7 +37,9 @@ const useHeapSender = client => {
|
|
|
37
37
|
if (msg.langSource) {
|
|
38
38
|
await client.sendTextMessageWithTranslateTagStanza(msg.roomJid, msg.user.firstName || msg.user.name?.split(' ')[0] || '', msg.user.lastName || msg.user.name?.split(' ')[1] || '', '', msg.user.walletAddress || '', msg.body, '', !!msg.isReply, msg.showInChannel === 'true', msg.mainMessage || '', msg.langSource, msg.id);
|
|
39
39
|
} else {
|
|
40
|
-
await client.sendMessage(msg.roomJid, msg.user.firstName || msg.user.name?.split(' ')[0] || '', msg.user.lastName || msg.user.name?.split(' ')[1] || '', '', msg.user.walletAddress || '', msg.body, '',
|
|
40
|
+
await client.sendMessage(msg.roomJid, msg.user.firstName || msg.user.name?.split(' ')[0] || '', msg.user.lastName || msg.user.name?.split(' ')[1] || '', '', msg.user.walletAddress || '', msg.body, '',
|
|
41
|
+
// Wire values are strings: '"false"' is truthy.
|
|
42
|
+
String(msg.isReply) === 'true', String(msg.showInChannel) === 'true', msg.mainMessage, msg.id);
|
|
41
43
|
}
|
|
42
44
|
} catch (err) {
|
|
43
45
|
console.warn('Failed to send heap message', msg, err);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactRedux","_useMessageHeapState","useHeapSender","client","dispatch","useDispatch","queue","useMessageHeapState","sendingRef","useRef","inFlightRef","Map","sendHeapMessages","useCallback","length","presencesReady","console","warn","current","msg","lastAttempt","get","id","Date","now","set","langSource","sendTextMessageWithTranslateTagStanza","roomJid","user","firstName","name","split","lastName","walletAddress","body","isReply","showInChannel","mainMessage","sendMessage","err","delete","prevReadyRef","useEffect","nowReady","wasReady","currentIds","Set","map","m","Array","from","keys","has","exports"],"sourceRoot":"../../../src","sources":["hooks/useHeapSender.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,oBAAA,GAAAF,OAAA;AAIO,MAAMG,aAAa,GAAIC,MAAyB,IAAK;EAC1D,MAAMC,QAAQ,GAAG,IAAAC,uBAAW,EAAC,CAAC;EAC9B,MAAM;IAAEC;EAAM,CAAC,GAAG,IAAAC,wCAAmB,EAAC,CAAC;EACvC,MAAMC,UAAU,GAAG,IAAAC,aAAM,EAAC,KAAK,CAAC;EAChC,MAAMC,WAAW,GAAG,IAAAD,aAAM,EAAsB,IAAIE,GAAG,CAAC,CAAC,CAAC;EAE1D,MAAMC,gBAAgB,GAAG,IAAAC,kBAAW,EAAC,YAAY;IAC/C,IAAI,CAACV,MAAM,IAAIG,KAAK,CAACQ,MAAM,KAAK,CAAC,EAAE;MAAC;IAAO;IAC3C,IAAI,CAACX,MAAM,CAACY,cAAc,EAAE;MAC1BC,OAAO,CAACC,IAAI,CAAC,yCAAyC,CAAC;MACvD;IACF;IACA,IAAIT,UAAU,CAACU,OAAO,EAAE;MAAC;IAAO;IAChCV,UAAU,CAACU,OAAO,GAAG,IAAI;IACzB,IAAI;MACF,KAAK,MAAMC,GAAG,IAAIb,KAAK,EAAE;QACvB,MAAMc,WAAW,GAAGV,WAAW,CAACQ,OAAO,CAACG,GAAG,CAACF,GAAG,CAACG,EAAE,CAAC;QACnD,IAAIF,WAAW,IAAIG,IAAI,CAACC,GAAG,CAAC,CAAC,GAAGJ,WAAW,GAAG,KAAK,EAAE;UACnD;QACF;QACAV,WAAW,CAACQ,OAAO,CAACO,GAAG,CAACN,GAAG,CAACG,EAAE,EAAEC,IAAI,CAACC,GAAG,CAAC,CAAC,CAAC;QAC3C,IAAI;UACF,IAAIL,GAAG,CAACO,UAAU,EAAE;YAClB,MAAMvB,MAAM,CAACwB,qCAAqC,CAChDR,GAAG,CAACS,OAAO,EACXT,GAAG,CAACU,IAAI,CAACC,SAAS,IAAIX,GAAG,CAACU,IAAI,CAACE,IAAI,EAAEC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EACxDb,GAAG,CAACU,IAAI,CAACI,QAAQ,IAAId,GAAG,CAACU,IAAI,CAACE,IAAI,EAAEC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EACvD,EAAE,EACFb,GAAG,CAACU,IAAI,CAACK,aAAa,IAAI,EAAE,EAC5Bf,GAAG,CAACgB,IAAI,EACR,EAAE,EACF,CAAC,CAAChB,GAAG,CAACiB,OAAO,EACbjB,GAAG,CAACkB,aAAa,KAAK,MAAM,EAC5BlB,GAAG,CAACmB,WAAW,IAAI,EAAE,EACrBnB,GAAG,CAACO,UAAU,EACdP,GAAG,CAACG,EACN,CAAC;UACH,CAAC,MAAM;YACL,MAAMnB,MAAM,CAACoC,WAAW,CACtBpB,GAAG,CAACS,OAAO,EACXT,GAAG,CAACU,IAAI,CAACC,SAAS,IAAIX,GAAG,CAACU,IAAI,CAACE,IAAI,EAAEC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EACxDb,GAAG,CAACU,IAAI,CAACI,QAAQ,IAAId,GAAG,CAACU,IAAI,CAACE,IAAI,EAAEC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EACvD,EAAE,EACFb,GAAG,CAACU,IAAI,CAACK,aAAa,IAAI,EAAE,EAC5Bf,GAAG,CAACgB,IAAI,EACR,EAAE,
|
|
1
|
+
{"version":3,"names":["_react","require","_reactRedux","_useMessageHeapState","useHeapSender","client","dispatch","useDispatch","queue","useMessageHeapState","sendingRef","useRef","inFlightRef","Map","sendHeapMessages","useCallback","length","presencesReady","console","warn","current","msg","lastAttempt","get","id","Date","now","set","langSource","sendTextMessageWithTranslateTagStanza","roomJid","user","firstName","name","split","lastName","walletAddress","body","isReply","showInChannel","mainMessage","sendMessage","String","err","delete","prevReadyRef","useEffect","nowReady","wasReady","currentIds","Set","map","m","Array","from","keys","has","exports"],"sourceRoot":"../../../src","sources":["hooks/useHeapSender.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,oBAAA,GAAAF,OAAA;AAIO,MAAMG,aAAa,GAAIC,MAAyB,IAAK;EAC1D,MAAMC,QAAQ,GAAG,IAAAC,uBAAW,EAAC,CAAC;EAC9B,MAAM;IAAEC;EAAM,CAAC,GAAG,IAAAC,wCAAmB,EAAC,CAAC;EACvC,MAAMC,UAAU,GAAG,IAAAC,aAAM,EAAC,KAAK,CAAC;EAChC,MAAMC,WAAW,GAAG,IAAAD,aAAM,EAAsB,IAAIE,GAAG,CAAC,CAAC,CAAC;EAE1D,MAAMC,gBAAgB,GAAG,IAAAC,kBAAW,EAAC,YAAY;IAC/C,IAAI,CAACV,MAAM,IAAIG,KAAK,CAACQ,MAAM,KAAK,CAAC,EAAE;MAAC;IAAO;IAC3C,IAAI,CAACX,MAAM,CAACY,cAAc,EAAE;MAC1BC,OAAO,CAACC,IAAI,CAAC,yCAAyC,CAAC;MACvD;IACF;IACA,IAAIT,UAAU,CAACU,OAAO,EAAE;MAAC;IAAO;IAChCV,UAAU,CAACU,OAAO,GAAG,IAAI;IACzB,IAAI;MACF,KAAK,MAAMC,GAAG,IAAIb,KAAK,EAAE;QACvB,MAAMc,WAAW,GAAGV,WAAW,CAACQ,OAAO,CAACG,GAAG,CAACF,GAAG,CAACG,EAAE,CAAC;QACnD,IAAIF,WAAW,IAAIG,IAAI,CAACC,GAAG,CAAC,CAAC,GAAGJ,WAAW,GAAG,KAAK,EAAE;UACnD;QACF;QACAV,WAAW,CAACQ,OAAO,CAACO,GAAG,CAACN,GAAG,CAACG,EAAE,EAAEC,IAAI,CAACC,GAAG,CAAC,CAAC,CAAC;QAC3C,IAA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AC,EAAE,CAAChB,KAAK,CAAC,CAAC;EAEX,OAAO;IAAEM;EAAiB,CAAC;AAC7B,CAAC;AAAC2C,OAAA,CAAArD,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -18,6 +18,7 @@ var _rooms = require("../networking/api-requests/rooms.api");
|
|
|
18
18
|
var _persistence = require("../roomStore/persistence");
|
|
19
19
|
var _secureUserStorage = require("../helpers/secureUserStorage");
|
|
20
20
|
var _getServerReadTimestamp = require("../helpers/getServerReadTimestamp");
|
|
21
|
+
var _e2ee = require("../e2ee");
|
|
21
22
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
23
|
// AsyncStorage keys the library writes but that aren't cleared by any
|
|
23
24
|
// slice reducer. Listed here so a single logout call wipes the full
|
|
@@ -103,6 +104,13 @@ const logoutService = exports.logoutService = {
|
|
|
103
104
|
} catch (e) {
|
|
104
105
|
console.warn('logoutService: push reset failed', e);
|
|
105
106
|
}
|
|
107
|
+
(0, _e2ee.stopOmemo)();
|
|
108
|
+
try {
|
|
109
|
+
const {
|
|
110
|
+
clearOpenedFiles
|
|
111
|
+
} = require('../e2ee/sealedFiles');
|
|
112
|
+
clearOpenedFiles();
|
|
113
|
+
} catch {}
|
|
106
114
|
|
|
107
115
|
// 3. REST: nuke the in-memory `/chats/my` cache so the next login
|
|
108
116
|
// doesn't read user A's rooms while user B is bootstrapping.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactRedux","require","_reactNative","_asyncStorage","_interopRequireDefault","_roomStore","_chatSettingsSlice","_roomsSlice","_react","_roomHeapSlice","_pushSubscriptionService","_pushRegistration","_rooms","_persistence","_secureUserStorage","_getServerReadTimestamp","e","__esModule","default","LIBRARY_STRAY_KEYS","logoutService","exports","performLogout","state","store","getState","client","chatSettingStore","rooms","visibleRoomJID","boundaryTs","getFlushBoundaryTs","roomHeapSlice","readBoundaries","undefined","flushLastViewedToPrivateStoreStanza","Promise","race","visibleRoomTs","onlyIfNoUnread","res","setTimeout","console","warn","DeviceEventEmitter","emit","releasePushRegistration","pushSubscriptionService","reset","clearRoomsRestCache","dispatch","setLogoutState","clearHeap","logout","clearPersistedState","AsyncStorage","multiRemove","secureUserStorage","remove","useLogout","useDispatch","useCallback","err"],"sourceRoot":"../../../src","sources":["hooks/useLogout.tsx"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,kBAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,cAAA,GAAAR,OAAA;AACA,IAAAS,wBAAA,GAAAT,OAAA;AACA,IAAAU,iBAAA,GAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,YAAA,GAAAZ,OAAA;AACA,IAAAa,kBAAA,GAAAb,OAAA;AACA,IAAAc,uBAAA,GAAAd,OAAA;
|
|
1
|
+
{"version":3,"names":["_reactRedux","require","_reactNative","_asyncStorage","_interopRequireDefault","_roomStore","_chatSettingsSlice","_roomsSlice","_react","_roomHeapSlice","_pushSubscriptionService","_pushRegistration","_rooms","_persistence","_secureUserStorage","_getServerReadTimestamp","_e2ee","e","__esModule","default","LIBRARY_STRAY_KEYS","logoutService","exports","performLogout","state","store","getState","client","chatSettingStore","rooms","visibleRoomJID","boundaryTs","getFlushBoundaryTs","roomHeapSlice","readBoundaries","undefined","flushLastViewedToPrivateStoreStanza","Promise","race","visibleRoomTs","onlyIfNoUnread","res","setTimeout","console","warn","DeviceEventEmitter","emit","releasePushRegistration","pushSubscriptionService","reset","stopOmemo","clearOpenedFiles","clearRoomsRestCache","dispatch","setLogoutState","clearHeap","logout","clearPersistedState","AsyncStorage","multiRemove","secureUserStorage","remove","useLogout","useDispatch","useCallback","err"],"s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IAC7B,IAAI;MACF,MAAM3C,aAAa,CAACE,aAAa,CAAC,CAAC;IACrC,CAAC,CAAC,OAAO0C,GAAG,EAAE;MACZtB,OAAO,CAACC,IAAI,CAAC,iCAAiC,EAAEqB,GAAG,CAAC;IACtD;EACF,CAAC,EAAE,EAAE,CAAC;AACR,CAAC;AAAC3C,OAAA,CAAAwC,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -4,12 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useMessageHeapState = void 0;
|
|
7
|
+
var _react = require("react");
|
|
7
8
|
var _reactRedux = require("react-redux");
|
|
8
9
|
const useMessageHeapState = () => {
|
|
9
10
|
const queue = (0, _reactRedux.useSelector)(state => state.roomHeapSlice?.messageHeap);
|
|
10
11
|
const failedMessages = (0, _reactRedux.useSelector)(state => state.roomHeapSlice?.failedMessages);
|
|
11
|
-
const idSet = new Set(queue?.map(m => m.id) ?? []);
|
|
12
|
-
const failedIdSet = new Set(Object.keys(failedMessages || {}));
|
|
12
|
+
const idSet = (0, _react.useMemo)(() => new Set(queue?.map(m => m.id) ?? []), [queue]);
|
|
13
|
+
const failedIdSet = (0, _react.useMemo)(() => new Set(Object.keys(failedMessages || {})), [failedMessages]);
|
|
13
14
|
return {
|
|
14
15
|
queue,
|
|
15
16
|
idSet,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_react","require","_reactRedux","useMessageHeapState","queue","useSelector","state","roomHeapSlice","messageHeap","failedMessages","idSet","useMemo","Set","map","m","id","failedIdSet","Object","keys","exports"],"sourceRoot":"../../../src","sources":["hooks/useMessageHeapState.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAGO,MAAME,mBAAmB,GAAGA,CAAA,KAAM;EACvC,MAAMC,KAAK,GAAG,IAAAC,uBAAW,EACtBC,KAAgB,IAAKA,KAAK,CAACC,aAAa,EAAEC,WAC7C,CAAC;EACD,MAAMC,cAAc,GAAG,IAAAJ,uBAAW,EAC/BC,KAAgB,IAAKA,KAAK,CAACC,aAAa,EAAEE,cAC7C,CAAC;EACD,MAAMC,KAAK,GAAG,IAAAC,cAAO,EAAC,MAAM,IAAIC,GAAG,CAACR,KAAK,EAAES,GAAG,CAAEC,CAAC,IAAKA,CAAC,CAACC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,CAACX,KAAK,CAAC,CAAC;EAC5E,MAAMY,WAAW,GAAG,IAAAL,cAAO,EACzB,MAAM,IAAIC,GAAG,CAACK,MAAM,CAACC,IAAI,CAACT,cAAc,IAAI,CAAC,CAAC,CAAC,CAAC,EAChD,CAACA,cAAc,CACjB,CAAC;EAED,OAAO;IAAEL,KAAK;IAAEM,KAAK;IAAED,cAAc;IAAEO;EAAY,CAAC;AACtD,CAAC;AAACG,OAAA,CAAAhB,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -18,11 +18,20 @@ const hasLoadedRoomHistory = room => {
|
|
|
18
18
|
}
|
|
19
19
|
return messages.some(message => message?.id !== 'delimiter-new' && message?.pending !== true && !!String(message?.body || '').trim());
|
|
20
20
|
};
|
|
21
|
-
const
|
|
21
|
+
const defaultRoomJids = config => (config?.defaultRooms || []).map(room => typeof room === 'string' ? room : room?.jid);
|
|
22
|
+
const useRoomInitialization = (activeRoomJID, config) => {
|
|
22
23
|
const {
|
|
23
24
|
client
|
|
24
25
|
} = (0, _xmppProvider.useXmppClient)();
|
|
25
26
|
const dispatch = (0, _reactRedux.useDispatch)();
|
|
27
|
+
const reduxStore = (0, _reactRedux.useStore)();
|
|
28
|
+
const hasRooms = (0, _reactRedux.useSelector)(state => Object.keys(state.rooms.rooms || {}).length > 0);
|
|
29
|
+
const activeRoomExists = (0, _reactRedux.useSelector)(state => !!activeRoomJID && !!state.rooms.rooms?.[activeRoomJID]);
|
|
30
|
+
const activeHistoryLoaded = (0, _reactRedux.useSelector)(state => hasLoadedRoomHistory(state.rooms.rooms?.[activeRoomJID]));
|
|
31
|
+
const defaultRoomsMissing = (0, _reactRedux.useSelector)(state => {
|
|
32
|
+
const jids = defaultRoomJids(config);
|
|
33
|
+
return jids.length > 0 && jids.some(jid => !state.rooms.rooms?.[jid]);
|
|
34
|
+
});
|
|
26
35
|
const syncRooms = (0, _useGetNewArchRoom.default)();
|
|
27
36
|
|
|
28
37
|
// Fast active-room join. Mirrors web's first effect: as soon as the
|
|
@@ -51,8 +60,8 @@ const useRoomInitialization = (activeRoomJID, roomsList, config, messageLength)
|
|
|
51
60
|
}
|
|
52
61
|
}, [client, activeRoomJID]);
|
|
53
62
|
(0, _react.useEffect)(() => {
|
|
54
|
-
const
|
|
55
|
-
const shouldLoadActiveHistory = !!activeRoomJID && !
|
|
63
|
+
const roomsList = reduxStore.getState().rooms.rooms || {};
|
|
64
|
+
const shouldLoadActiveHistory = !!activeRoomJID && !activeHistoryLoaded;
|
|
56
65
|
const getDefaultHistory = async () => {
|
|
57
66
|
if (!client || !activeRoomJID) {
|
|
58
67
|
return;
|
|
@@ -121,7 +130,7 @@ const useRoomInitialization = (activeRoomJID, roomsList, config, messageLength)
|
|
|
121
130
|
chatJID: activeRoomJID
|
|
122
131
|
}));
|
|
123
132
|
getDefaultHistory();
|
|
124
|
-
} else {
|
|
133
|
+
} else if (roomsList?.[activeRoomJID]?.isLoading) {
|
|
125
134
|
dispatch((0, _roomsSlice.setIsLoading)({
|
|
126
135
|
loading: false,
|
|
127
136
|
chatJID: activeRoomJID
|
|
@@ -131,8 +140,7 @@ const useRoomInitialization = (activeRoomJID, roomsList, config, messageLength)
|
|
|
131
140
|
initialPresenceAndHistory();
|
|
132
141
|
}
|
|
133
142
|
if (client && config?.defaultRooms) {
|
|
134
|
-
|
|
135
|
-
if (roomsList && !allExist) {
|
|
143
|
+
if (defaultRoomsMissing) {
|
|
136
144
|
config?.defaultRooms.map(async room => {
|
|
137
145
|
client.presenceInRoomStanza(typeof room === 'string' ? room : room.jid);
|
|
138
146
|
});
|
|
@@ -143,7 +151,8 @@ const useRoomInitialization = (activeRoomJID, roomsList, config, messageLength)
|
|
|
143
151
|
}
|
|
144
152
|
}
|
|
145
153
|
}
|
|
146
|
-
|
|
154
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
155
|
+
}, [activeRoomJID, hasRooms, activeRoomExists, activeHistoryLoaded, defaultRoomsMissing]);
|
|
147
156
|
};
|
|
148
157
|
exports.useRoomInitialization = useRoomInitialization;
|
|
149
158
|
//# sourceMappingURL=useRoomInitialization.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_roomsSlice","_xmppProvider","_reactRedux","_useGetNewArchRoom","_interopRequireDefault","e","__esModule","default","countUndefinedText","arr","Array","isArray","filter","item","body","undefined","length","hasLoadedRoomHistory","room","messages","some","message","id","pending","String","trim","
|
|
1
|
+
{"version":3,"names":["_react","require","_roomsSlice","_xmppProvider","_reactRedux","_useGetNewArchRoom","_interopRequireDefault","e","__esModule","default","countUndefinedText","arr","Array","isArray","filter","item","body","undefined","length","hasLoadedRoomHistory","room","messages","some","message","id","pending","String","trim","defaultRoomJids","config","defaultRooms","map","jid","useRoomInitialization","activeRoomJID","client","useXmppClient","dispatch","useDispatch","reduxStore","useStore","hasRooms","useSelector","state","Object","keys","rooms","activeRoomExists","activeHistoryLoaded","defaultRoomsMissing","jids","syncRooms","useGetNewArchRoom","useEffect","setActiveRoomJid","promoteRoomHistory","presenceInRoomStanza","getRoomInfoStanza","roomsList","getState","shouldLoadActiveHistory","getDefaultHistory","setIsLoading","loading","chatJID","res","getHistoryStanza","prioritizeRoomPresence","catch","Number","loadingText","initialPresenceAndHistory","newArch","getRoomsStanza","isLoading","exports"],"sourceRoot":"../../../src","sources":["hooks/useRoomInitialization.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,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AO,EAAE9B;QAAc,CAAC,CAAC,CAAC;QACjE2B,iBAAiB,CAAC,CAAC;MACrB,CAAC,MAAM,IAAIH,SAAS,GAAGxB,aAAa,CAAC,EAAEwC,SAAS,EAAE;QAChDrC,QAAQ,CAAC,IAAAyB,wBAAY,EAAC;UAAEC,OAAO,EAAE,KAAK;UAAEC,OAAO,EAAE9B;QAAc,CAAC,CAAC,CAAC;MACpE;IACF,CAAC,MAAM,IAAI,CAACwB,SAAS,GAAGxB,aAAa,CAAC,EAAE;MACtCqC,yBAAyB,CAAC,CAAC;IAC7B;IAEA,IAAIpC,MAAM,IAAIN,MAAM,EAAEC,YAAY,EAAE;MAClC,IAAImB,mBAAmB,EAAE;QACvBpB,MAAM,EAAEC,YAAY,CAACC,GAAG,CAAC,MAAOX,IAAI,IAAK;UACvCe,MAAM,CAACqB,oBAAoB,CAAC,OAAOpC,IAAI,KAAK,QAAQ,GAAGA,IAAI,GAAGA,IAAI,CAACY,GAAG,CAAC;QACzE,CAAC,CAAC;QACF,IAAIH,MAAM,EAAE2C,OAAO,EAAE;UACnB;QAAA,CACD,MAAM;UACLrC,MAAM,CAACsC,cAAc,CAAC,CAAC;QACzB;MACF;IACF;IACA;EACF,CAAC,EAAE,CACDvC,aAAa,EACbO,QAAQ,EACRM,gBAAgB,EAChBC,mBAAmB,EACnBC,mBAAmB,CACpB,CAAC;AACJ,CAAC;AAAC0B,OAAA,CAAA1C,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -16,6 +16,8 @@ var _outboundQueue = require("../networking/outboundQueue");
|
|
|
16
16
|
var _roomStore = require("../roomStore");
|
|
17
17
|
var _clientRegistry = require("../utils/clientRegistry");
|
|
18
18
|
var _useEventHandlers = require("./useEventHandlers");
|
|
19
|
+
var _e2ee = require("../e2ee");
|
|
20
|
+
var _send = require("../e2ee/send");
|
|
19
21
|
// Watchdog: if a message stays "pending" (no server echo) for this
|
|
20
22
|
// long after the optimistic dispatch, mark it failed so the bubble
|
|
21
23
|
// flips out of the "sending..." state. Covers the silent-failure
|
|
@@ -75,16 +77,22 @@ const useSendMessage = _configOverride => {
|
|
|
75
77
|
// Mirrors the web SDK, which always sends through the translate-tag path.
|
|
76
78
|
const langSource = (0, _reactRedux.useSelector)(state => state.chatSettingStore.langSource);
|
|
77
79
|
const editAction = (0, _reactRedux.useSelector)(state => state.rooms.editAction);
|
|
78
|
-
const rooms = (0, _reactRedux.useSelector)(state => state.rooms.rooms);
|
|
79
80
|
const {
|
|
80
81
|
handleMessageSent,
|
|
81
82
|
handleMessageFailed,
|
|
82
83
|
handleMessageEdited,
|
|
83
84
|
handleMessageRetry
|
|
84
85
|
} = (0, _useEventHandlers.useEventHandlers)(config);
|
|
85
|
-
const failedMessages = (0, _reactRedux.useSelector)(state => state.roomHeapSlice?.failedMessages || {});
|
|
86
86
|
const sendMessage = (0, _react.useCallback)(async (message, activeRoomJID, isReply, isChecked, mainMessage, existingId) => {
|
|
87
87
|
if (editAction?.isEdit) {
|
|
88
|
+
const edited = reduxStore.getState().rooms?.rooms?.[editAction.roomJid]?.messages?.find(m => m.id === editAction.messageId);
|
|
89
|
+
if (edited && !(0, _e2ee.canEditMessage)(edited)) {
|
|
90
|
+
console.warn('edit not sent: the message was encrypted');
|
|
91
|
+
dispatch((0, _roomsSlice.setEditAction)({
|
|
92
|
+
isEdit: false
|
|
93
|
+
}));
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
88
96
|
try {
|
|
89
97
|
client?.editMessageStanza(editAction.roomJid, editAction.messageId, message);
|
|
90
98
|
handleMessageEdited({
|
|
@@ -106,6 +114,10 @@ const useSendMessage = _configOverride => {
|
|
|
106
114
|
}));
|
|
107
115
|
return;
|
|
108
116
|
}
|
|
117
|
+
if (!(0, _e2ee.canSendToRoom)(activeRoomJID)) {
|
|
118
|
+
console.warn('message not sent: room is end-to-end encrypted');
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
109
121
|
|
|
110
122
|
// Critical-send hint to the QoS scheduler.
|
|
111
123
|
client?.onCriticalSend?.(activeRoomJID);
|
|
@@ -136,6 +148,14 @@ const useSendMessage = _configOverride => {
|
|
|
136
148
|
// manual-mode readers see the Translate link on it too (parity with
|
|
137
149
|
// the web SDK, which stamps langSource on the optimistic message).
|
|
138
150
|
langSource: langSource || 'en',
|
|
151
|
+
// Reply fields as the wire carries them (strings), so a thread reply
|
|
152
|
+
// shows in its thread — and NOT in the channel — from the first
|
|
153
|
+
// frame, not only once the server echo lands.
|
|
154
|
+
...(isReply ? {
|
|
155
|
+
isReply: 'true',
|
|
156
|
+
showInChannel: isChecked ? 'true' : 'false',
|
|
157
|
+
mainMessage
|
|
158
|
+
} : {}),
|
|
139
159
|
user: {
|
|
140
160
|
...user,
|
|
141
161
|
id: selfId,
|
|
@@ -277,6 +297,10 @@ const useSendMessage = _configOverride => {
|
|
|
277
297
|
}
|
|
278
298
|
}, [editAction, client, user, langSource, dispatch, handleMessageSent, handleMessageEdited, handleMessageFailed, reduxStore]);
|
|
279
299
|
const sendMedia = (0, _react.useCallback)(async (data, type, activeRoomJID, isReply = false, isChecked = false, mainMessage = '', existingId) => {
|
|
300
|
+
if (!(0, _e2ee.canSendMediaToRoom)(activeRoomJID)) {
|
|
301
|
+
console.warn('media not sent: room is end-to-end encrypted');
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
280
304
|
client?.onCriticalSend?.(activeRoomJID);
|
|
281
305
|
|
|
282
306
|
// Defensive 50 MB guard on every send path (SendInput blocks it at
|
|
@@ -339,7 +363,7 @@ const useSendMessage = _configOverride => {
|
|
|
339
363
|
mimetype: type,
|
|
340
364
|
originalName: data?.name,
|
|
341
365
|
size: fileSizeStr,
|
|
342
|
-
isReply,
|
|
366
|
+
isReply: isReply ? 'true' : 'false',
|
|
343
367
|
showInChannel: `${isChecked}`,
|
|
344
368
|
mainMessage
|
|
345
369
|
}
|
|
@@ -406,20 +430,40 @@ const useSendMessage = _configOverride => {
|
|
|
406
430
|
type: data?.type || data?.mimeType || type || 'application/octet-stream',
|
|
407
431
|
name: data?.name || data?.fileName || `media_${Date.now()}`
|
|
408
432
|
};
|
|
433
|
+
let sealed;
|
|
409
434
|
const tryUpload = async () => {
|
|
435
|
+
if ((0, _send.shouldEncrypt)(activeRoomJID) && !sealed) {
|
|
436
|
+
const {
|
|
437
|
+
sealPickedFile
|
|
438
|
+
} = require('../e2ee/sealedFiles');
|
|
439
|
+
sealed = await sealPickedFile({
|
|
440
|
+
uri: fileBlob.uri,
|
|
441
|
+
name: fileBlob.name,
|
|
442
|
+
type: fileBlob.type,
|
|
443
|
+
size: typeof data?.size === 'number' ? data.size : undefined
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
const part = sealed ? {
|
|
447
|
+
uri: sealed.uri,
|
|
448
|
+
type: 'application/octet-stream',
|
|
449
|
+
name: sealed.name
|
|
450
|
+
} : fileBlob;
|
|
451
|
+
const options = {
|
|
452
|
+
clientEncrypted: !!sealed
|
|
453
|
+
};
|
|
410
454
|
const fd = new FormData();
|
|
411
|
-
fd.append('files',
|
|
455
|
+
fd.append('files', part);
|
|
412
456
|
try {
|
|
413
|
-
return await (0, _auth.uploadFileV2)(fd, activeRoomJID);
|
|
457
|
+
return await (0, _auth.uploadFileV2)(fd, activeRoomJID, options);
|
|
414
458
|
} catch (err) {
|
|
415
459
|
if (err?.response?.status === 500) {
|
|
416
460
|
console.warn('upload "files" field returned 500 — retrying with "file" (singular)', {
|
|
417
|
-
name:
|
|
418
|
-
type:
|
|
461
|
+
name: part.name,
|
|
462
|
+
type: part.type
|
|
419
463
|
});
|
|
420
464
|
const fd2 = new FormData();
|
|
421
|
-
fd2.append('file',
|
|
422
|
-
return await (0, _auth.uploadFileV2)(fd2, activeRoomJID);
|
|
465
|
+
fd2.append('file', part);
|
|
466
|
+
return await (0, _auth.uploadFileV2)(fd2, activeRoomJID, options);
|
|
423
467
|
}
|
|
424
468
|
throw err;
|
|
425
469
|
}
|
|
@@ -457,8 +501,25 @@ const useSendMessage = _configOverride => {
|
|
|
457
501
|
isReply,
|
|
458
502
|
mainMessage,
|
|
459
503
|
isPrivate: item?.isPrivate,
|
|
460
|
-
__v: item.__v
|
|
504
|
+
__v: item.__v,
|
|
505
|
+
e2eeKeys: sealed ? [sealed.keyMaterial] : undefined
|
|
461
506
|
};
|
|
507
|
+
if (sealed) {
|
|
508
|
+
try {
|
|
509
|
+
const {
|
|
510
|
+
rememberOpened
|
|
511
|
+
} = require('../e2ee/sealedFiles');
|
|
512
|
+
await rememberOpened(item.location, {
|
|
513
|
+
uri: fileBlob.uri,
|
|
514
|
+
name: fileBlob.name,
|
|
515
|
+
type: fileBlob.type,
|
|
516
|
+
size: typeof data?.size === 'number' ? data.size : undefined
|
|
517
|
+
});
|
|
518
|
+
} catch (err) {
|
|
519
|
+
console.warn('could not keep the sent attachment', err);
|
|
520
|
+
}
|
|
521
|
+
sealed.dispose();
|
|
522
|
+
}
|
|
462
523
|
// Stanza id == placeholder id so the MUC echo's outer
|
|
463
524
|
// <message id="..."> matches xmppId on the placeholder and
|
|
464
525
|
// insertMessageWithDelimiter merges in place + flips pending.
|
|
@@ -508,6 +569,7 @@ const useSendMessage = _configOverride => {
|
|
|
508
569
|
// Upload (or stanza send) threw an explicit error. Clear the
|
|
509
570
|
// watchdog so it doesn't double-fire `markMessageFailed`.
|
|
510
571
|
clearTimeout(mediaWatchdog);
|
|
572
|
+
sealed?.dispose();
|
|
511
573
|
// Surface the real server payload so we can see why the upload
|
|
512
574
|
// was rejected (axios collapses the message to "Request failed
|
|
513
575
|
// with status code N"; the actual reason lives in
|
|
@@ -554,7 +616,7 @@ const useSendMessage = _configOverride => {
|
|
|
554
616
|
// "sending..."; if the retry fails again `markMessageFailed` re-arms
|
|
555
617
|
// it. No-op when the id isn't in the failed map.
|
|
556
618
|
const retryMessage = (0, _react.useCallback)(async failedId => {
|
|
557
|
-
const payload = failedMessages[failedId];
|
|
619
|
+
const payload = reduxStore.getState().roomHeapSlice?.failedMessages?.[failedId];
|
|
558
620
|
if (!payload) {
|
|
559
621
|
return;
|
|
560
622
|
}
|
|
@@ -564,7 +626,7 @@ const useSendMessage = _configOverride => {
|
|
|
564
626
|
// failed, but a confirmed (non-pending) copy is already sitting in
|
|
565
627
|
// the room. Resending here would deliver a genuine duplicate; just
|
|
566
628
|
// clear the failure and let the existing copy stand.
|
|
567
|
-
const roomMsgs = rooms?.[payload.roomJID]?.messages || [];
|
|
629
|
+
const roomMsgs = reduxStore.getState().rooms?.rooms?.[payload.roomJID]?.messages || [];
|
|
568
630
|
const alreadyDelivered = roomMsgs.some(m => !m.pending && (m.id === failedId || m.xmppId === failedId));
|
|
569
631
|
if (alreadyDelivered) {
|
|
570
632
|
dispatch((0, _roomHeapSlice.clearMessageFailure)(failedId));
|
|
@@ -584,7 +646,7 @@ const useSendMessage = _configOverride => {
|
|
|
584
646
|
} else {
|
|
585
647
|
await sendMedia(payload.data, payload.type, payload.roomJID, payload.isReply, payload.isChecked, payload.mainMessage, failedId);
|
|
586
648
|
}
|
|
587
|
-
}, [
|
|
649
|
+
}, [reduxStore, dispatch, handleMessageRetry, sendMessage, sendMedia]);
|
|
588
650
|
|
|
589
651
|
// ChatRoom/ThreadWrapper consume this as the "edit branch" of send.
|
|
590
652
|
// It mirrors the edit path inside `sendMessage` so callers can wire it
|
|
@@ -593,6 +655,14 @@ const useSendMessage = _configOverride => {
|
|
|
593
655
|
if (!editAction?.isEdit || !editAction.roomJid || !editAction.messageId) {
|
|
594
656
|
return;
|
|
595
657
|
}
|
|
658
|
+
const edited = reduxStore.getState().rooms?.rooms?.[editAction.roomJid]?.messages?.find(m => m.id === editAction.messageId);
|
|
659
|
+
if (edited && !(0, _e2ee.canEditMessage)(edited)) {
|
|
660
|
+
console.warn('edit not sent: the message was encrypted');
|
|
661
|
+
dispatch((0, _roomsSlice.setEditAction)({
|
|
662
|
+
isEdit: false
|
|
663
|
+
}));
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
596
666
|
try {
|
|
597
667
|
client?.editMessageStanza(editAction.roomJid, editAction.messageId, message);
|
|
598
668
|
handleMessageEdited({
|
|
@@ -621,7 +691,7 @@ const useSendMessage = _configOverride => {
|
|
|
621
691
|
if (!roomJID) {
|
|
622
692
|
return false;
|
|
623
693
|
}
|
|
624
|
-
const msgs = rooms?.[roomJID]?.messages;
|
|
694
|
+
const msgs = reduxStore.getState().rooms?.rooms?.[roomJID]?.messages;
|
|
625
695
|
if (!msgs || msgs.length === 0) {
|
|
626
696
|
return false;
|
|
627
697
|
}
|
|
@@ -634,7 +704,7 @@ const useSendMessage = _configOverride => {
|
|
|
634
704
|
return false;
|
|
635
705
|
}
|
|
636
706
|
return last.user?.id === selfId;
|
|
637
|
-
}, [
|
|
707
|
+
}, [reduxStore, user?.xmppUsername, user?.walletAddress]);
|
|
638
708
|
return {
|
|
639
709
|
sendMessage,
|
|
640
710
|
sendMedia,
|