@ethora/chat-component-rn 26.10.4 → 26.10.6
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 +8 -0
- package/README.md +15 -0
- package/app.plugin.js +2 -0
- package/lib/commonjs/assets/icons.js +2 -2
- package/lib/commonjs/assets/icons.js.map +1 -1
- package/lib/commonjs/components/MainComponents/AlbumGrid.js +152 -0
- package/lib/commonjs/components/MainComponents/AlbumGrid.js.map +1 -0
- package/lib/commonjs/components/MainComponents/ChatRoom.js +2 -2
- package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MediaMessage.js +199 -123
- package/lib/commonjs/components/MainComponents/MediaMessage.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MediaUploadOverlay.js +109 -0
- package/lib/commonjs/components/MainComponents/MediaUploadOverlay.js.map +1 -0
- package/lib/commonjs/components/MessageBubble/MediaCaption.js +51 -0
- package/lib/commonjs/components/MessageBubble/MediaCaption.js.map +1 -0
- package/lib/commonjs/components/MessageBubble/Message.js +40 -1
- package/lib/commonjs/components/MessageBubble/Message.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/MessageInteractions.js +2 -1
- package/lib/commonjs/components/MessageBubble/MessageInteractions.js.map +1 -1
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +75 -0
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/LastMessageItem.js +20 -4
- package/lib/commonjs/components/RoomComponents/LastMessageItem.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/styled/LastAudioMessage.js +3 -2
- package/lib/commonjs/components/RoomComponents/styled/LastAudioMessage.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/styled/LastMessageFile.js +3 -2
- package/lib/commonjs/components/RoomComponents/styled/LastMessageFile.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/styled/LastMessagePhoto.js +3 -2
- package/lib/commonjs/components/RoomComponents/styled/LastMessagePhoto.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/styled/LastMessageVideo.js +3 -2
- package/lib/commonjs/components/RoomComponents/styled/LastMessageVideo.js.map +1 -1
- package/lib/commonjs/components/Thread/ThreadWrapper.js +3 -2
- package/lib/commonjs/components/Thread/ThreadWrapper.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/ActiveCallBar.js +61 -16
- package/lib/commonjs/components/VideoCalls/ActiveCallBar.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/CallIcons.js +41 -16
- package/lib/commonjs/components/VideoCalls/CallIcons.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/VideoCallOverlay.js +183 -9
- package/lib/commonjs/components/VideoCalls/VideoCallOverlay.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/VideoCallSession.js +40 -15
- package/lib/commonjs/components/VideoCalls/VideoCallSession.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/callSessionController.js +49 -26
- package/lib/commonjs/components/VideoCalls/callSessionController.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/callUiStore.js +33 -4
- package/lib/commonjs/components/VideoCalls/callUiStore.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/livekitRuntime.js +9 -1
- package/lib/commonjs/components/VideoCalls/livekitRuntime.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/useCallKeep.js +197 -28
- package/lib/commonjs/components/VideoCalls/useCallKeep.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/useOngoingCallNotification.js +88 -0
- package/lib/commonjs/components/VideoCalls/useOngoingCallNotification.js.map +1 -0
- package/lib/commonjs/components/VideoCalls/usePipTile.js +232 -0
- package/lib/commonjs/components/VideoCalls/usePipTile.js.map +1 -0
- package/lib/commonjs/components/styled/MediaFilePreview.js +60 -47
- package/lib/commonjs/components/styled/MediaFilePreview.js.map +1 -1
- package/lib/commonjs/components/styled/MessageImage.js +16 -6
- package/lib/commonjs/components/styled/MessageImage.js.map +1 -1
- package/lib/commonjs/components/styled/SendInput.js +99 -68
- package/lib/commonjs/components/styled/SendInput.js.map +1 -1
- package/lib/commonjs/components/styled/VideoMessage.js +24 -10
- package/lib/commonjs/components/styled/VideoMessage.js.map +1 -1
- package/lib/commonjs/context/xmppProvider.js +46 -0
- package/lib/commonjs/context/xmppProvider.js.map +1 -1
- package/lib/commonjs/e2ee/fileEnvelope.js +6 -0
- package/lib/commonjs/e2ee/fileEnvelope.js.map +1 -1
- package/lib/commonjs/e2ee/sealedBody.js +32 -2
- package/lib/commonjs/e2ee/sealedBody.js.map +1 -1
- package/lib/commonjs/helpers/albumLayout.js +150 -0
- package/lib/commonjs/helpers/albumLayout.js.map +1 -0
- package/lib/commonjs/helpers/attachments.js +255 -0
- package/lib/commonjs/helpers/attachments.js.map +1 -0
- package/lib/commonjs/helpers/caption.js +214 -0
- package/lib/commonjs/helpers/caption.js.map +1 -0
- package/lib/commonjs/helpers/createMainMessageForThread.js +5 -1
- package/lib/commonjs/helpers/createMainMessageForThread.js.map +1 -1
- package/lib/commonjs/helpers/createMessageFromXml.js +19 -5
- package/lib/commonjs/helpers/createMessageFromXml.js.map +1 -1
- package/lib/commonjs/helpers/fileKind.js +40 -0
- package/lib/commonjs/helpers/fileKind.js.map +1 -0
- package/lib/commonjs/helpers/getDataFromXml.js +6 -1
- package/lib/commonjs/helpers/getDataFromXml.js.map +1 -1
- package/lib/commonjs/helpers/mapWithConcurrency.js +41 -0
- package/lib/commonjs/helpers/mapWithConcurrency.js.map +1 -0
- package/lib/commonjs/helpers/mediaLimits.js +33 -0
- package/lib/commonjs/helpers/mediaLimits.js.map +1 -0
- package/lib/commonjs/helpers/mediaSendRetry.js +64 -0
- package/lib/commonjs/helpers/mediaSendRetry.js.map +1 -0
- package/lib/commonjs/helpers/mediaWireData.js +62 -0
- package/lib/commonjs/helpers/mediaWireData.js.map +1 -0
- package/lib/commonjs/helpers/mentionSpans.js +19 -0
- package/lib/commonjs/helpers/mentionSpans.js.map +1 -0
- package/lib/commonjs/helpers/mimeToExtension.js +45 -0
- package/lib/commonjs/helpers/mimeToExtension.js.map +1 -1
- package/lib/commonjs/helpers/readReceipts.js +173 -0
- package/lib/commonjs/helpers/readReceipts.js.map +1 -0
- package/lib/commonjs/helpers/repairFilenameEncoding.js +79 -0
- package/lib/commonjs/helpers/repairFilenameEncoding.js.map +1 -0
- package/lib/commonjs/helpers/safeJson.js +18 -0
- package/lib/commonjs/helpers/safeJson.js.map +1 -0
- package/lib/commonjs/helpers/updateMessagesTillLast.js +3 -1
- package/lib/commonjs/helpers/updateMessagesTillLast.js.map +1 -1
- package/lib/commonjs/hooks/useSendMessage.js +384 -193
- package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
- package/lib/commonjs/i18n/strings.js +144 -0
- package/lib/commonjs/i18n/strings.js.map +1 -1
- package/lib/commonjs/main.js.map +1 -1
- package/lib/commonjs/networking/api-requests/auth.api.js +62 -3
- package/lib/commonjs/networking/api-requests/auth.api.js.map +1 -1
- package/lib/commonjs/networking/stanzaHandlers.js +100 -3
- package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
- package/lib/commonjs/networking/xmpp/handleStanzas.xmpp.js +4 -2
- package/lib/commonjs/networking/xmpp/handleStanzas.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/sendDisplayedMarker.xmpp.js +28 -0
- package/lib/commonjs/networking/xmpp/sendDisplayedMarker.xmpp.js.map +1 -0
- package/lib/commonjs/networking/xmpp/sendMediaMessage.xmpp.js +53 -2
- package/lib/commonjs/networking/xmpp/sendMediaMessage.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/sendReceivedReceipt.xmpp.js +28 -0
- package/lib/commonjs/networking/xmpp/sendReceivedReceipt.xmpp.js.map +1 -0
- package/lib/commonjs/networking/xmppClient.js +64 -0
- package/lib/commonjs/networking/xmppClient.js.map +1 -1
- package/lib/commonjs/roomStore/persistence.js +78 -5
- package/lib/commonjs/roomStore/persistence.js.map +1 -1
- package/lib/commonjs/roomStore/roomHeapSlice.js +4 -0
- package/lib/commonjs/roomStore/roomHeapSlice.js.map +1 -1
- package/lib/commonjs/roomStore/roomsSlice.js +114 -1
- package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
- package/lib/commonjs/types/models/attachment.model.js +2 -0
- package/lib/commonjs/types/models/attachment.model.js.map +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/module/assets/icons.js +1 -1
- package/lib/module/assets/icons.js.map +1 -1
- package/lib/module/components/MainComponents/AlbumGrid.js +146 -0
- package/lib/module/components/MainComponents/AlbumGrid.js.map +1 -0
- package/lib/module/components/MainComponents/ChatRoom.js +2 -2
- package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/module/components/MainComponents/MediaMessage.js +200 -124
- package/lib/module/components/MainComponents/MediaMessage.js.map +1 -1
- package/lib/module/components/MainComponents/MediaUploadOverlay.js +104 -0
- package/lib/module/components/MainComponents/MediaUploadOverlay.js.map +1 -0
- package/lib/module/components/MessageBubble/MediaCaption.js +46 -0
- package/lib/module/components/MessageBubble/MediaCaption.js.map +1 -0
- package/lib/module/components/MessageBubble/Message.js +44 -5
- package/lib/module/components/MessageBubble/Message.js.map +1 -1
- package/lib/module/components/MessageBubble/MessageInteractions.js +2 -1
- package/lib/module/components/MessageBubble/MessageInteractions.js.map +1 -1
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +75 -0
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
- package/lib/module/components/RoomComponents/LastMessageItem.js +20 -4
- package/lib/module/components/RoomComponents/LastMessageItem.js.map +1 -1
- package/lib/module/components/RoomComponents/styled/LastAudioMessage.js +3 -2
- package/lib/module/components/RoomComponents/styled/LastAudioMessage.js.map +1 -1
- package/lib/module/components/RoomComponents/styled/LastMessageFile.js +3 -2
- package/lib/module/components/RoomComponents/styled/LastMessageFile.js.map +1 -1
- package/lib/module/components/RoomComponents/styled/LastMessagePhoto.js +3 -2
- package/lib/module/components/RoomComponents/styled/LastMessagePhoto.js.map +1 -1
- package/lib/module/components/RoomComponents/styled/LastMessageVideo.js +3 -2
- package/lib/module/components/RoomComponents/styled/LastMessageVideo.js.map +1 -1
- package/lib/module/components/Thread/ThreadWrapper.js +3 -2
- package/lib/module/components/Thread/ThreadWrapper.js.map +1 -1
- package/lib/module/components/VideoCalls/ActiveCallBar.js +63 -18
- package/lib/module/components/VideoCalls/ActiveCallBar.js.map +1 -1
- package/lib/module/components/VideoCalls/CallIcons.js +38 -15
- package/lib/module/components/VideoCalls/CallIcons.js.map +1 -1
- package/lib/module/components/VideoCalls/VideoCallOverlay.js +185 -11
- package/lib/module/components/VideoCalls/VideoCallOverlay.js.map +1 -1
- package/lib/module/components/VideoCalls/VideoCallSession.js +41 -16
- package/lib/module/components/VideoCalls/VideoCallSession.js.map +1 -1
- package/lib/module/components/VideoCalls/callSessionController.js +46 -24
- package/lib/module/components/VideoCalls/callSessionController.js.map +1 -1
- package/lib/module/components/VideoCalls/callUiStore.js +30 -3
- package/lib/module/components/VideoCalls/callUiStore.js.map +1 -1
- package/lib/module/components/VideoCalls/livekitRuntime.js +9 -1
- package/lib/module/components/VideoCalls/livekitRuntime.js.map +1 -1
- package/lib/module/components/VideoCalls/useCallKeep.js +198 -29
- package/lib/module/components/VideoCalls/useCallKeep.js.map +1 -1
- package/lib/module/components/VideoCalls/useOngoingCallNotification.js +84 -0
- package/lib/module/components/VideoCalls/useOngoingCallNotification.js.map +1 -0
- package/lib/module/components/VideoCalls/usePipTile.js +228 -0
- package/lib/module/components/VideoCalls/usePipTile.js.map +1 -0
- package/lib/module/components/styled/MediaFilePreview.js +61 -48
- package/lib/module/components/styled/MediaFilePreview.js.map +1 -1
- package/lib/module/components/styled/MessageImage.js +16 -6
- package/lib/module/components/styled/MessageImage.js.map +1 -1
- package/lib/module/components/styled/SendInput.js +99 -68
- package/lib/module/components/styled/SendInput.js.map +1 -1
- package/lib/module/components/styled/VideoMessage.js +24 -10
- package/lib/module/components/styled/VideoMessage.js.map +1 -1
- package/lib/module/context/xmppProvider.js +46 -0
- package/lib/module/context/xmppProvider.js.map +1 -1
- package/lib/module/e2ee/fileEnvelope.js +1 -1
- package/lib/module/e2ee/fileEnvelope.js.map +1 -1
- package/lib/module/e2ee/sealedBody.js +32 -2
- package/lib/module/e2ee/sealedBody.js.map +1 -1
- package/lib/module/helpers/albumLayout.js +143 -0
- package/lib/module/helpers/albumLayout.js.map +1 -0
- package/lib/module/helpers/attachments.js +245 -0
- package/lib/module/helpers/attachments.js.map +1 -0
- package/lib/module/helpers/caption.js +207 -0
- package/lib/module/helpers/caption.js.map +1 -0
- package/lib/module/helpers/createMainMessageForThread.js +5 -1
- package/lib/module/helpers/createMainMessageForThread.js.map +1 -1
- package/lib/module/helpers/createMessageFromXml.js +20 -6
- package/lib/module/helpers/createMessageFromXml.js.map +1 -1
- package/lib/module/helpers/fileKind.js +34 -0
- package/lib/module/helpers/fileKind.js.map +1 -0
- package/lib/module/helpers/getDataFromXml.js +6 -1
- package/lib/module/helpers/getDataFromXml.js.map +1 -1
- package/lib/module/helpers/mapWithConcurrency.js +37 -0
- package/lib/module/helpers/mapWithConcurrency.js.map +1 -0
- package/lib/module/helpers/mediaLimits.js +27 -0
- package/lib/module/helpers/mediaLimits.js.map +1 -0
- package/lib/module/helpers/mediaSendRetry.js +55 -0
- package/lib/module/helpers/mediaSendRetry.js.map +1 -0
- package/lib/module/helpers/mediaWireData.js +58 -0
- package/lib/module/helpers/mediaWireData.js.map +1 -0
- package/lib/module/helpers/mentionSpans.js +14 -0
- package/lib/module/helpers/mentionSpans.js.map +1 -0
- package/lib/module/helpers/mimeToExtension.js +43 -0
- package/lib/module/helpers/mimeToExtension.js.map +1 -1
- package/lib/module/helpers/readReceipts.js +160 -0
- package/lib/module/helpers/readReceipts.js.map +1 -0
- package/lib/module/helpers/repairFilenameEncoding.js +74 -0
- package/lib/module/helpers/repairFilenameEncoding.js.map +1 -0
- package/lib/module/helpers/safeJson.js +13 -0
- package/lib/module/helpers/safeJson.js.map +1 -0
- package/lib/module/helpers/updateMessagesTillLast.js +3 -1
- package/lib/module/helpers/updateMessagesTillLast.js.map +1 -1
- package/lib/module/hooks/useSendMessage.js +387 -195
- package/lib/module/hooks/useSendMessage.js.map +1 -1
- package/lib/module/i18n/strings.js +144 -0
- package/lib/module/i18n/strings.js.map +1 -1
- package/lib/module/main.js.map +1 -1
- package/lib/module/networking/api-requests/auth.api.js +62 -3
- package/lib/module/networking/api-requests/auth.api.js.map +1 -1
- package/lib/module/networking/stanzaHandlers.js +97 -4
- package/lib/module/networking/stanzaHandlers.js.map +1 -1
- package/lib/module/networking/xmpp/handleStanzas.xmpp.js +5 -3
- package/lib/module/networking/xmpp/handleStanzas.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/sendDisplayedMarker.xmpp.js +25 -0
- package/lib/module/networking/xmpp/sendDisplayedMarker.xmpp.js.map +1 -0
- package/lib/module/networking/xmpp/sendMediaMessage.xmpp.js +53 -2
- package/lib/module/networking/xmpp/sendMediaMessage.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/sendReceivedReceipt.xmpp.js +25 -0
- package/lib/module/networking/xmpp/sendReceivedReceipt.xmpp.js.map +1 -0
- package/lib/module/networking/xmppClient.js +64 -0
- package/lib/module/networking/xmppClient.js.map +1 -1
- package/lib/module/roomStore/persistence.js +78 -5
- package/lib/module/roomStore/persistence.js.map +1 -1
- package/lib/module/roomStore/roomHeapSlice.js +4 -0
- package/lib/module/roomStore/roomHeapSlice.js.map +1 -1
- package/lib/module/roomStore/roomsSlice.js +109 -0
- package/lib/module/roomStore/roomsSlice.js.map +1 -1
- package/lib/module/types/models/attachment.model.js +2 -0
- package/lib/module/types/models/attachment.model.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/typescript/assets/icons.d.ts +6 -1
- package/lib/typescript/assets/icons.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/AlbumGrid.d.ts +21 -0
- package/lib/typescript/components/MainComponents/AlbumGrid.d.ts.map +1 -0
- package/lib/typescript/components/MainComponents/ChatRoom.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/MediaMessage.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/MediaUploadOverlay.d.ts +17 -0
- package/lib/typescript/components/MainComponents/MediaUploadOverlay.d.ts.map +1 -0
- package/lib/typescript/components/MessageBubble/MediaCaption.d.ts +12 -0
- package/lib/typescript/components/MessageBubble/MediaCaption.d.ts.map +1 -0
- package/lib/typescript/components/MessageBubble/Message.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/MessageInteractions.d.ts.map +1 -1
- package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.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 +2 -0
- package/lib/typescript/components/RoomComponents/styled/LastAudioMessage.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastMessageFile.d.ts +2 -0
- package/lib/typescript/components/RoomComponents/styled/LastMessageFile.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastMessagePhoto.d.ts +2 -0
- package/lib/typescript/components/RoomComponents/styled/LastMessagePhoto.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastMessageVideo.d.ts +2 -0
- package/lib/typescript/components/RoomComponents/styled/LastMessageVideo.d.ts.map +1 -1
- package/lib/typescript/components/Thread/ThreadWrapper.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/ActiveCallBar.d.ts +9 -3
- package/lib/typescript/components/VideoCalls/ActiveCallBar.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/CallIcons.d.ts +9 -0
- package/lib/typescript/components/VideoCalls/CallIcons.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/VideoCallOverlay.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/VideoCallSession.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/callSessionController.d.ts +7 -0
- package/lib/typescript/components/VideoCalls/callSessionController.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/callUiStore.d.ts +13 -0
- package/lib/typescript/components/VideoCalls/callUiStore.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/livekitRuntime.d.ts +5 -0
- package/lib/typescript/components/VideoCalls/livekitRuntime.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/useCallKeep.d.ts +12 -0
- package/lib/typescript/components/VideoCalls/useCallKeep.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/useOngoingCallNotification.d.ts +10 -0
- package/lib/typescript/components/VideoCalls/useOngoingCallNotification.d.ts.map +1 -0
- package/lib/typescript/components/VideoCalls/usePipTile.d.ts +46 -0
- package/lib/typescript/components/VideoCalls/usePipTile.d.ts.map +1 -0
- package/lib/typescript/components/styled/MediaFilePreview.d.ts.map +1 -1
- package/lib/typescript/components/styled/MessageImage.d.ts +10 -0
- package/lib/typescript/components/styled/MessageImage.d.ts.map +1 -1
- package/lib/typescript/components/styled/SendInput.d.ts +7 -1
- package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
- package/lib/typescript/components/styled/VideoMessage.d.ts +7 -0
- package/lib/typescript/components/styled/VideoMessage.d.ts.map +1 -1
- package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
- package/lib/typescript/e2ee/fileEnvelope.d.ts +1 -1
- package/lib/typescript/e2ee/fileEnvelope.d.ts.map +1 -1
- package/lib/typescript/e2ee/sealedBody.d.ts +16 -0
- package/lib/typescript/e2ee/sealedBody.d.ts.map +1 -1
- package/lib/typescript/helpers/albumLayout.d.ts +66 -0
- package/lib/typescript/helpers/albumLayout.d.ts.map +1 -0
- package/lib/typescript/helpers/attachments.d.ts +55 -0
- package/lib/typescript/helpers/attachments.d.ts.map +1 -0
- package/lib/typescript/helpers/caption.d.ts +64 -0
- package/lib/typescript/helpers/caption.d.ts.map +1 -0
- package/lib/typescript/helpers/createMainMessageForThread.d.ts.map +1 -1
- package/lib/typescript/helpers/createMessageFromXml.d.ts.map +1 -1
- package/lib/typescript/helpers/fileKind.d.ts +20 -0
- package/lib/typescript/helpers/fileKind.d.ts.map +1 -0
- package/lib/typescript/helpers/getDataFromXml.d.ts.map +1 -1
- package/lib/typescript/helpers/mapWithConcurrency.d.ts +9 -0
- package/lib/typescript/helpers/mapWithConcurrency.d.ts.map +1 -0
- package/lib/typescript/helpers/mediaLimits.d.ts +13 -0
- package/lib/typescript/helpers/mediaLimits.d.ts.map +1 -0
- package/lib/typescript/helpers/mediaSendRetry.d.ts +26 -0
- package/lib/typescript/helpers/mediaSendRetry.d.ts.map +1 -0
- package/lib/typescript/helpers/mediaWireData.d.ts +16 -0
- package/lib/typescript/helpers/mediaWireData.d.ts.map +1 -0
- package/lib/typescript/helpers/mentionSpans.d.ts +8 -0
- package/lib/typescript/helpers/mentionSpans.d.ts.map +1 -0
- package/lib/typescript/helpers/mimeToExtension.d.ts +7 -0
- package/lib/typescript/helpers/mimeToExtension.d.ts.map +1 -1
- package/lib/typescript/helpers/readReceipts.d.ts +82 -0
- package/lib/typescript/helpers/readReceipts.d.ts.map +1 -0
- package/lib/typescript/helpers/repairFilenameEncoding.d.ts +12 -0
- package/lib/typescript/helpers/repairFilenameEncoding.d.ts.map +1 -0
- package/lib/typescript/helpers/safeJson.d.ts +2 -0
- package/lib/typescript/helpers/safeJson.d.ts.map +1 -0
- package/lib/typescript/helpers/updateMessagesTillLast.d.ts.map +1 -1
- package/lib/typescript/hooks/useSendMessage.d.ts +2 -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 +1 -1
- package/lib/typescript/main.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/auth.api.d.ts +2 -0
- package/lib/typescript/networking/api-requests/auth.api.d.ts.map +1 -1
- package/lib/typescript/networking/stanzaHandlers.d.ts +7 -3
- package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/handleStanzas.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/sendDisplayedMarker.xmpp.d.ts +3 -0
- package/lib/typescript/networking/xmpp/sendDisplayedMarker.xmpp.d.ts.map +1 -0
- package/lib/typescript/networking/xmpp/sendMediaMessage.xmpp.d.ts +12 -0
- package/lib/typescript/networking/xmpp/sendMediaMessage.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/sendReceivedReceipt.xmpp.d.ts +3 -0
- package/lib/typescript/networking/xmpp/sendReceivedReceipt.xmpp.d.ts.map +1 -0
- package/lib/typescript/networking/xmppClient.d.ts +15 -0
- package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
- package/lib/typescript/roomStore/persistence.d.ts.map +1 -1
- package/lib/typescript/roomStore/roomHeapSlice.d.ts +22 -1
- package/lib/typescript/roomStore/roomHeapSlice.d.ts.map +1 -1
- package/lib/typescript/roomStore/roomsSlice.d.ts +67 -3
- package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
- package/lib/typescript/types/models/attachment.model.d.ts +52 -0
- package/lib/typescript/types/models/attachment.model.d.ts.map +1 -0
- package/lib/typescript/types/models/message.model.d.ts +26 -0
- package/lib/typescript/types/models/message.model.d.ts.map +1 -1
- package/lib/typescript/types/models/modal.model.d.ts +7 -0
- package/lib/typescript/types/models/modal.model.d.ts.map +1 -1
- package/lib/typescript/types/models/room.model.d.ts +2 -0
- package/lib/typescript/types/models/room.model.d.ts.map +1 -1
- package/lib/typescript/types/types.d.ts +69 -1
- package/lib/typescript/types/types.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +4 -1
- package/plugins/notification-service/Info.plist +31 -0
- package/plugins/notification-service/NotificationService.swift +82 -0
- package/plugins/withNotificationServiceExtension.js +137 -0
- package/src/assets/icons.tsx +20 -2
- package/src/components/MainComponents/AlbumGrid.tsx +183 -0
- package/src/components/MainComponents/ChatRoom.tsx +4 -2
- package/src/components/MainComponents/MediaMessage.tsx +246 -130
- package/src/components/MainComponents/MediaUploadOverlay.tsx +102 -0
- package/src/components/MessageBubble/MediaCaption.tsx +45 -0
- package/src/components/MessageBubble/Message.tsx +71 -3
- package/src/components/MessageBubble/MessageInteractions.tsx +2 -1
- package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +64 -0
- package/src/components/RoomComponents/LastMessageItem.tsx +15 -4
- package/src/components/RoomComponents/styled/LastAudioMessage.tsx +6 -3
- package/src/components/RoomComponents/styled/LastMessageFile.tsx +6 -2
- package/src/components/RoomComponents/styled/LastMessagePhoto.tsx +6 -2
- package/src/components/RoomComponents/styled/LastMessageVideo.tsx +6 -2
- package/src/components/Thread/ThreadWrapper.tsx +5 -9
- package/src/components/VideoCalls/ActiveCallBar.tsx +56 -10
- package/src/components/VideoCalls/CallIcons.tsx +36 -12
- package/src/components/VideoCalls/VideoCallOverlay.tsx +205 -8
- package/src/components/VideoCalls/VideoCallSession.tsx +45 -13
- package/src/components/VideoCalls/callSessionController.ts +51 -20
- package/src/components/VideoCalls/callUiStore.ts +33 -3
- package/src/components/VideoCalls/livekitRuntime.ts +13 -0
- package/src/components/VideoCalls/useCallKeep.ts +204 -33
- package/src/components/VideoCalls/useOngoingCallNotification.ts +113 -0
- package/src/components/VideoCalls/usePipTile.ts +214 -0
- package/src/components/styled/MediaFilePreview.tsx +49 -34
- package/src/components/styled/MessageImage.tsx +21 -5
- package/src/components/styled/SendInput.tsx +101 -87
- package/src/components/styled/VideoMessage.tsx +34 -9
- package/src/context/xmppProvider.tsx +32 -0
- package/src/e2ee/fileEnvelope.ts +1 -1
- package/src/e2ee/sealedBody.ts +44 -5
- package/src/helpers/albumLayout.ts +207 -0
- package/src/helpers/attachments.ts +316 -0
- package/src/helpers/caption.ts +283 -0
- package/src/helpers/createMainMessageForThread.ts +6 -1
- package/src/helpers/createMessageFromXml.ts +21 -5
- package/src/helpers/fileKind.ts +38 -0
- package/src/helpers/getDataFromXml.ts +5 -1
- package/src/helpers/mapWithConcurrency.ts +32 -0
- package/src/helpers/mediaLimits.ts +27 -0
- package/src/helpers/mediaSendRetry.ts +59 -0
- package/src/helpers/mediaWireData.ts +57 -0
- package/src/helpers/mentionSpans.ts +17 -0
- package/src/helpers/mimeToExtension.ts +51 -0
- package/src/helpers/readReceipts.ts +219 -0
- package/src/helpers/repairFilenameEncoding.ts +82 -0
- package/src/helpers/safeJson.ts +11 -0
- package/src/helpers/updateMessagesTillLast.tsx +2 -1
- package/src/hooks/useSendMessage.tsx +448 -249
- package/src/i18n/strings.ts +144 -0
- package/src/main.ts +3 -0
- package/src/networking/api-requests/auth.api.ts +60 -3
- package/src/networking/stanzaHandlers.ts +91 -2
- package/src/networking/xmpp/handleStanzas.xmpp.ts +6 -2
- package/src/networking/xmpp/sendDisplayedMarker.xmpp.ts +31 -0
- package/src/networking/xmpp/sendMediaMessage.xmpp.ts +60 -3
- package/src/networking/xmpp/sendReceivedReceipt.xmpp.ts +31 -0
- package/src/networking/xmppClient.ts +48 -0
- package/src/roomStore/persistence.ts +94 -3
- package/src/roomStore/roomHeapSlice.ts +23 -1
- package/src/roomStore/roomsSlice.ts +112 -1
- package/src/types/models/attachment.model.ts +51 -0
- package/src/types/models/message.model.ts +29 -0
- package/src/types/models/modal.model.ts +7 -0
- package/src/types/models/room.model.ts +2 -0
- package/src/types/types.ts +83 -1
- package/src/version.ts +1 -1
- package/lib/commonjs/components/VideoCalls/useDraggable.js +0 -59
- package/lib/commonjs/components/VideoCalls/useDraggable.js.map +0 -1
- package/lib/module/components/VideoCalls/useDraggable.js +0 -55
- package/lib/module/components/VideoCalls/useDraggable.js.map +0 -1
- package/lib/typescript/components/VideoCalls/useDraggable.d.ts +0 -19
- package/lib/typescript/components/VideoCalls/useDraggable.d.ts.map +0 -1
- package/src/components/VideoCalls/useDraggable.ts +0 -46
|
@@ -59,6 +59,49 @@ const MIME_TO_EXT = {
|
|
|
59
59
|
};
|
|
60
60
|
const VALID_EXT_RE = /\.[a-z0-9]{1,8}$/i;
|
|
61
61
|
|
|
62
|
+
// Extensions that stand for a picture, video, audio or PDF a bubble can
|
|
63
|
+
// show, read back from the table above (first entry per extension wins).
|
|
64
|
+
// `.webm` and `.svg` are left out on purpose: a recorded voice note is often
|
|
65
|
+
// a `.webm` and must stay generic (audio), and SVG is not a bubble picture.
|
|
66
|
+
const INFERRABLE_EXT_TO_MIME = {};
|
|
67
|
+
for (const [mime, ext] of Object.entries(MIME_TO_EXT)) {
|
|
68
|
+
const inferrable = mime === 'application/pdf' || mime.startsWith('image/') || mime.startsWith('video/') || mime.startsWith('audio/');
|
|
69
|
+
const bare = ext.slice(1);
|
|
70
|
+
if (inferrable && bare !== 'webm' && bare !== 'svg' && !INFERRABLE_EXT_TO_MIME[bare]) {
|
|
71
|
+
INFERRABLE_EXT_TO_MIME[bare] = mime;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// Spellings the table above has no entry for.
|
|
75
|
+
Object.assign(INFERRABLE_EXT_TO_MIME, {
|
|
76
|
+
jpeg: 'image/jpeg',
|
|
77
|
+
jpe: 'image/jpeg',
|
|
78
|
+
tif: 'image/tiff',
|
|
79
|
+
avif: 'image/avif',
|
|
80
|
+
avi: 'video/x-msvideo',
|
|
81
|
+
oga: 'audio/ogg',
|
|
82
|
+
opus: 'audio/ogg',
|
|
83
|
+
amr: 'audio/amr'
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
/** A mimetype that says nothing: empty, or the storage's "could not sniff". */
|
|
87
|
+
export function isGenericMime(mime) {
|
|
88
|
+
const normalized = (mime || '').toLowerCase().split(';')[0].trim();
|
|
89
|
+
return !normalized || normalized === 'application/octet-stream' || normalized === 'binary/octet-stream';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* The mimetype a file name's extension stands for, for the pictures, videos,
|
|
94
|
+
* audio and PDFs a bubble can show. Undefined for anything else.
|
|
95
|
+
*/
|
|
96
|
+
export function inferMimeFromName(name) {
|
|
97
|
+
const base = String(name || '').split(/[?#]/)[0];
|
|
98
|
+
const dot = base.lastIndexOf('.');
|
|
99
|
+
if (dot < 1) {
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
return INFERRABLE_EXT_TO_MIME[base.slice(dot + 1).toLowerCase()];
|
|
103
|
+
}
|
|
104
|
+
|
|
62
105
|
// Audio file extensions we recognise across the SDK. Used for the
|
|
63
106
|
// "looks like audio even when the mimetype is application/octet-stream"
|
|
64
107
|
// heuristic in MediaMessage / FilePreviewModal. Voice-message senders
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MIME_TO_EXT","VALID_EXT_RE","AUDIO_EXTENSIONS","IOS_AUDIO_PLAYBACK_EXTENSIONS","IOS_AUDIO_UNSUPPORTED_EXTENSIONS","AUDIO_EXT_RE","RegExp","map","e","replace","join","IOS_AUDIO_PLAYBACK_EXT_RE","AUDIO_NAME_HINT_RE","isLikelyAudio","
|
|
1
|
+
{"version":3,"names":["MIME_TO_EXT","VALID_EXT_RE","INFERRABLE_EXT_TO_MIME","mime","ext","Object","entries","inferrable","startsWith","bare","slice","assign","jpeg","jpe","tif","avif","avi","oga","opus","amr","isGenericMime","normalized","toLowerCase","split","trim","inferMimeFromName","name","base","String","dot","lastIndexOf","undefined","AUDIO_EXTENSIONS","IOS_AUDIO_PLAYBACK_EXTENSIONS","IOS_AUDIO_UNSUPPORTED_EXTENSIONS","AUDIO_EXT_RE","RegExp","map","e","replace","join","IOS_AUDIO_PLAYBACK_EXT_RE","AUDIO_NAME_HINT_RE","isLikelyAudio","fileName","url","opts","m","durationNum","duration","Number","isFinite","waveForm","length","originalName","urlLast","filenameFromUrl","test","urlPath","noQuery","decodeURIComponent","getExtensionForMime","last","pop","getLowerExtension","value","match","shouldCacheAudioForIosPlayback","src","urlName","candidates","hasIosPlayableName","some","getIosAudioPlaybackCacheExtension","candidate","isUnsupportedAudioForIosPlayback","includes","ensureFilenameHasExtension","Date","now"],"sourceRoot":"../../../src","sources":["helpers/mimeToExtension.ts"],"mappings":";;AAAA;AACA;AACA;;AAEA,MAAMA,WAAmC,GAAG;EAC1C;EACA,YAAY,EAAE,MAAM;EACpB,WAAW,EAAE,MAAM;EACnB,WAAW,EAAE,MAAM;EACnB,WAAW,EAAE,MAAM;EACnB,YAAY,EAAE,OAAO;EACrB,YAAY,EAAE,OAAO;EACrB,YAAY,EAAE,OAAO;EACrB,WAAW,EAAE,MAAM;EACnB,eAAe,EAAE,MAAM;EACvB,YAAY,EAAE,OAAO;EAErB;EACA,WAAW,EAAE,MAAM;EACnB,iBAAiB,EAAE,MAAM;EACzB,aAAa,EAAE,MAAM;EACrB,YAAY,EAAE,OAAO;EACrB,YAAY,EAAE,MAAM;EACpB,kBAAkB,EAAE,MAAM;EAC1B,YAAY,EAAE,OAAO;EAErB;EACA,YAAY,EAAE,MAAM;EACpB,WAAW,EAAE,MAAM;EACnB,WAAW,EAAE,MAAM;EACnB,aAAa,EAAE,MAAM;EACrB,WAAW,EAAE,MAAM;EACnB,aAAa,EAAE,MAAM;EACrB,WAAW,EAAE,MAAM;EACnB,WAAW,EAAE,MAAM;EACnB,YAAY,EAAE,OAAO;EACrB,YAAY,EAAE,OAAO;EAErB;EACA,iBAAiB,EAAE,MAAM;EACzB,oBAAoB,EAAE,MAAM;EAC5B,yEAAyE,EACvE,OAAO;EACT,0BAA0B,EAAE,MAAM;EAClC,mEAAmE,EAAE,OAAO;EAC5E,+BAA+B,EAAE,MAAM;EACvC,2EAA2E,EACzE,OAAO;EACT,YAAY,EAAE,MAAM;EACpB,UAAU,EAAE,MAAM;EAClB,WAAW,EAAE,OAAO;EACpB,kBAAkB,EAAE,OAAO;EAC3B,iBAAiB,EAAE,MAAM;EACzB,UAAU,EAAE,MAAM;EAClB,iBAAiB,EAAE,MAAM;EAEzB;EACA,iBAAiB,EAAE,MAAM;EACzB,8BAA8B,EAAE,MAAM;EACtC,6BAA6B,EAAE,KAAK;EAC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AiB,CAACU,SAAS,CAAC;IACxC,OAAOxC,gCAAgC,CAAC0C,QAAQ,CAC9CxE,GACF,CAAC;EACH,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASyE,0BAA0BA,CACxCjC,QAAmC,EACnCzC,IAA+B,EACvB;EACR,MAAMwB,IAAI,GACPiB,QAAQ,IAAIA,QAAQ,CAACpB,IAAI,CAAC,CAAC,IAAK,SAASsD,IAAI,CAACC,GAAG,CAAC,CAAC,EAAE;EACxD,IAAI9E,YAAY,CAACwD,IAAI,CAAC9B,IAAI,CAAC,EAAE;IAAC,OAAOA,IAAI;EAAC;EAC1C,OAAO,GAAGA,IAAI,GAAGkC,mBAAmB,CAAC1D,IAAI,CAAC,EAAE;AAC9C;;AAEA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { msgSortableMs } from './msgSortableMs';
|
|
4
|
+
import { isOwnMessage } from './isOwnMessage';
|
|
5
|
+
import { createUserNameFromSetUser } from './createUserNameFromSetUser';
|
|
6
|
+
|
|
7
|
+
// Delivery (XEP-0184) and read (XEP-0333) state for the reader's own messages.
|
|
8
|
+
// Pure helpers: the reducers, the stanza handlers, the flush that sends the
|
|
9
|
+
// read watermark and the bubble all read the same rules from here.
|
|
10
|
+
//
|
|
11
|
+
// Receipts are session-only. receivedBy / lastDisplayedByUser are never
|
|
12
|
+
// written to disk (see persistence.ts), so after a reload every own message
|
|
13
|
+
// falls back to "sent" until the peers acknowledge again.
|
|
14
|
+
|
|
15
|
+
/** Names listed in a "Read by" / "Delivered to" sheet before the rest become "+N". */
|
|
16
|
+
export const RECEIPT_NAME_LIMIT = 5;
|
|
17
|
+
const NO_VIEWERS = [];
|
|
18
|
+
|
|
19
|
+
/** Stanza ids of the receipt and marker frames (never chat messages). */
|
|
20
|
+
export const isReceiptMarkerId = id => {
|
|
21
|
+
const value = String(id ?? '');
|
|
22
|
+
return value.startsWith('message-received') || value.startsWith('message-displayed');
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// A message the reader can be shown as displayed: not an optimistic send,
|
|
26
|
+
// not the "New messages" divider, not a client-only call-log row.
|
|
27
|
+
const isDisplayableForReceipts = message => {
|
|
28
|
+
if (!message) return false;
|
|
29
|
+
if (message.pending) return false;
|
|
30
|
+
if (message.id === 'delimiter-new') return false;
|
|
31
|
+
if (String(message.id || '').startsWith('calllog-')) return false;
|
|
32
|
+
return true;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The message id that becomes this reader's read watermark, or null when
|
|
37
|
+
* nothing should be sent: no displayable message, the newest message is the
|
|
38
|
+
* reader's own (nothing to report), or a read boundary (the reader scrolled
|
|
39
|
+
* up) sits before every message. With a boundary the watermark is the newest
|
|
40
|
+
* message at or before it, so a scrolled-up reader never claims messages they
|
|
41
|
+
* did not reach.
|
|
42
|
+
*/
|
|
43
|
+
export const getReadWatermarkMessageId = (room, selfXmppUsername, boundaryTs) => {
|
|
44
|
+
if (!selfXmppUsername) return null;
|
|
45
|
+
const messages = (room?.messages || []).filter(isDisplayableForReceipts);
|
|
46
|
+
if (messages.length === 0) return null;
|
|
47
|
+
const newest = messages[messages.length - 1];
|
|
48
|
+
if (isOwnMessage(newest, selfXmppUsername)) return null;
|
|
49
|
+
if (typeof boundaryTs === 'number' && boundaryTs > 0) {
|
|
50
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
51
|
+
if (msgSortableMs(messages[i]) <= boundaryTs) return String(messages[i].id);
|
|
52
|
+
}
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
return String(newest.id);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/** The slice of the redux state the receipt rules read. */
|
|
59
|
+
|
|
60
|
+
// The reader's identity as the message list resolves it (xmppUsername, then
|
|
61
|
+
// walletAddress), so the watermark and the bubble agree on "own".
|
|
62
|
+
export const selfIdentity = state => state.chatSettingStore?.user?.xmppUsername || state.chatSettingStore?.user?.walletAddress || '';
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Watermark to send for `roomJid` right now, or null. Sends only while the
|
|
66
|
+
* room is the one on screen, never while an old-history jump window is open,
|
|
67
|
+
* and never when read markers are switched off (`disableLastRead` or
|
|
68
|
+
* `disableReadReceipts`).
|
|
69
|
+
*/
|
|
70
|
+
export const computeReadWatermark = (state, roomJid) => {
|
|
71
|
+
if (!roomJid) return null;
|
|
72
|
+
const config = state.chatSettingStore?.config;
|
|
73
|
+
if (config?.disableLastRead || config?.disableReadReceipts) return null;
|
|
74
|
+
const rooms = state.rooms;
|
|
75
|
+
if (rooms.visibleRoomJID !== roomJid) return null;
|
|
76
|
+
if (rooms.jumpWindow?.roomJID === roomJid) return null;
|
|
77
|
+
return getReadWatermarkMessageId(rooms.rooms?.[roomJid], selfIdentity(state), rooms.readBoundaries?.[roomJid] ?? null);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Other occupants whose read watermark sits at or after `messageId` in the
|
|
82
|
+
* room's list. Returns the shared empty array when there are none, so the
|
|
83
|
+
* selector result stays shallow-equal between store updates.
|
|
84
|
+
*/
|
|
85
|
+
export const viewersAtOrAfter = (room, messageId, selfXmppUsername) => {
|
|
86
|
+
const watermark = room?.lastDisplayedByUser;
|
|
87
|
+
const messages = room?.messages;
|
|
88
|
+
if (!watermark || !messages || messages.length === 0 || !messageId) return NO_VIEWERS;
|
|
89
|
+
const viewers = Object.keys(watermark).filter(xmppUsername => xmppUsername !== selfXmppUsername);
|
|
90
|
+
if (viewers.length === 0) return NO_VIEWERS;
|
|
91
|
+
const indexOf = id => {
|
|
92
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
93
|
+
if (messages[i].id === id) return i;
|
|
94
|
+
}
|
|
95
|
+
return -1;
|
|
96
|
+
};
|
|
97
|
+
const thisIndex = indexOf(messageId);
|
|
98
|
+
if (thisIndex === -1) return NO_VIEWERS;
|
|
99
|
+
const seen = viewers.filter(xmppUsername => {
|
|
100
|
+
const displayedIndex = indexOf(watermark[xmppUsername]);
|
|
101
|
+
return displayedIndex !== -1 && displayedIndex >= thisIndex;
|
|
102
|
+
});
|
|
103
|
+
return seen.length > 0 ? seen : NO_VIEWERS;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/** Selector form of viewersAtOrAfter, keyed by room and message. */
|
|
107
|
+
export const selectSeenBy = (state, roomJid, messageId, selfXmppUsername) => viewersAtOrAfter(state.rooms.rooms?.[roomJid], messageId, selfXmppUsername);
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* sent / delivered / seen for one of the reader's own messages. "seen" wins
|
|
111
|
+
* over "delivered", which wins over "sent". Only other occupants count.
|
|
112
|
+
*/
|
|
113
|
+
export const deliveredToOthers = (message, selfXmppUsername) => Object.keys(message.receivedBy || {}).filter(xmppUsername => xmppUsername !== selfXmppUsername);
|
|
114
|
+
export const statusOf = (seenBy, deliveredTo) => seenBy.length > 0 ? 'seen' : deliveredTo.length > 0 ? 'delivered' : 'sent';
|
|
115
|
+
export const getReceiptStatus = (message, room, selfXmppUsername) => {
|
|
116
|
+
const deliveredTo = deliveredToOthers(message, selfXmppUsername);
|
|
117
|
+
const seenBy = viewersAtOrAfter(room, String(message.id), selfXmppUsername);
|
|
118
|
+
return {
|
|
119
|
+
status: statusOf(seenBy, deliveredTo),
|
|
120
|
+
seenBy,
|
|
121
|
+
deliveredTo
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
/** Display name for a receipt entry: usersSet first, the raw username as the last resort. */
|
|
126
|
+
export const receiptNameFor = (usersSet, xmppUsername) => {
|
|
127
|
+
const name = createUserNameFromSetUser(usersSet || {}, xmppUsername);
|
|
128
|
+
return name && name !== 'Deleted User' ? name : xmppUsername;
|
|
129
|
+
};
|
|
130
|
+
const formatNames = names => {
|
|
131
|
+
const shown = names.slice(0, RECEIPT_NAME_LIMIT);
|
|
132
|
+
const extra = names.length - shown.length;
|
|
133
|
+
return extra > 0 ? `${shown.join(', ')} +${extra}` : shown.join(', ');
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Text for the tick's details sheet. Groups name the readers or recipients
|
|
138
|
+
* (capped, then "+N"); a 1:1 room only says Read / Delivered.
|
|
139
|
+
*/
|
|
140
|
+
export const describeReceipt = ({
|
|
141
|
+
status,
|
|
142
|
+
isGroup,
|
|
143
|
+
seenBy,
|
|
144
|
+
deliveredTo,
|
|
145
|
+
nameOf,
|
|
146
|
+
t
|
|
147
|
+
}) => {
|
|
148
|
+
if (status === 'seen') {
|
|
149
|
+
return isGroup ? t('message.receipt.readBy', {
|
|
150
|
+
names: formatNames(seenBy.map(nameOf))
|
|
151
|
+
}) : t('message.receipt.read');
|
|
152
|
+
}
|
|
153
|
+
if (status === 'delivered') {
|
|
154
|
+
return isGroup ? t('message.receipt.deliveredTo', {
|
|
155
|
+
names: formatNames(deliveredTo.map(nameOf))
|
|
156
|
+
}) : t('message.receipt.delivered');
|
|
157
|
+
}
|
|
158
|
+
return t('message.receipt.sent');
|
|
159
|
+
};
|
|
160
|
+
//# sourceMappingURL=readReceipts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["msgSortableMs","isOwnMessage","createUserNameFromSetUser","RECEIPT_NAME_LIMIT","NO_VIEWERS","isReceiptMarkerId","id","value","String","startsWith","isDisplayableForReceipts","message","pending","getReadWatermarkMessageId","room","selfXmppUsername","boundaryTs","messages","filter","length","newest","i","selfIdentity","state","chatSettingStore","user","xmppUsername","walletAddress","computeReadWatermark","roomJid","config","disableLastRead","disableReadReceipts","rooms","visibleRoomJID","jumpWindow","roomJID","readBoundaries","viewersAtOrAfter","messageId","watermark","lastDisplayedByUser","viewers","Object","keys","indexOf","thisIndex","seen","displayedIndex","selectSeenBy","deliveredToOthers","receivedBy","statusOf","seenBy","deliveredTo","getReceiptStatus","status","receiptNameFor","usersSet","name","formatNames","names","shown","slice","extra","join","describeReceipt","isGroup","nameOf","t","map"],"sourceRoot":"../../../src","sources":["helpers/readReceipts.ts"],"mappings":";;AACA,SAASA,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,yBAAyB,QAAQ,6BAA6B;;AAEvE;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA,OAAO,MAAMC,kBAAkB,GAAG,CAAC;AAEnC,MAAMC,UAAoB,GAAG,EAAE;;AAE/B;AACA,OAAO,MAAMC,iBAAiB,GAAIC,EAAW,IAAc;EACzD,MAAMC,KAAK,GAAGC,MAAM,CAACF,EAAE,IAAI,EAAE,CAAC;EAC9B,OAAOC,KAAK,CAACE,UAAU,CAAC,kBAAkB,CAAC,IAAIF,KAAK,CAACE,UAAU,CAAC,mBAAmB,CAAC;AACtF,CAAC;;AAED;AACA;AACA,MAAMC,wBAAwB,GAAIC,OAAoC,IAAc;EAClF,IAAI,CAACA,OAAO,EAAE,OAAO,KAAK;EAC1B,IAAIA,OAAO,CAACC,OAAO,EAAE,OAAO,KAAK;EACjC,IAAID,OAAO,CAACL,EAAE,KAAK,eAAe,EAAE,OAAO,KAAK;EAChD,IAAIE,MAAM,CAACG,OAAO,CAACL,EAAE,IAAI,EAAE,CAAC,CAACG,UAAU,CAAC,UAAU,CAAC,EAAE,OAAO,KAAK;EACjE,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,yBAAyB,GAAGA,CACvCC,IAAgD,EAChDC,gBAAwB,EACxBC,UAA0B,KACR;EAClB,IAAI,CAACD,gBAAgB,EAAE,OAAO,IAAI;EAClC,MAAME,QAAQ,GAAG,CAACH,IAAI,EAAEG,QAAQ,IAAI,EAAE,EAAEC,MAAM,CAACR,wBAAwB,CAAC;EACxE,IAAIO,QAAQ,CAACE,MAAM,K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
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Repairs file names the backend returns as UTF-8 bytes read as Latin-1
|
|
5
|
+
* (the classic multer/busboy `originalname` problem): "Список.pdf" arrives
|
|
6
|
+
* as "СпиÑок.pdf".
|
|
7
|
+
*
|
|
8
|
+
* Pure and conservative: a name is only replaced when every character fits
|
|
9
|
+
* in one byte, the bytes decode as strict UTF-8, the result differs, holds
|
|
10
|
+
* no replacement or control characters and contains at least one letter
|
|
11
|
+
* outside basic Latin. A correct name is returned untouched.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const hasMultiByteSignature = value =>
|
|
15
|
+
// UTF-8 lead bytes C2-F4 followed by a continuation byte 80-BF.
|
|
16
|
+
/[Â-ô][\u0080-¿]/.test(value);
|
|
17
|
+
const looksLikePercentEncoded = value => /%[0-9A-Fa-f]{2}/.test(value);
|
|
18
|
+
|
|
19
|
+
// C0 controls, DEL and the C1 range, checked per UTF-16 code unit.
|
|
20
|
+
const hasControlChars = value => {
|
|
21
|
+
for (let i = 0; i < value.length; i += 1) {
|
|
22
|
+
const code = value.charCodeAt(i);
|
|
23
|
+
if (code < 0x20 || code >= 0x7f && code <= 0x9f) return true;
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// Any code unit above ASCII (same as the former [^\u0000-\u007F] test).
|
|
29
|
+
const hasNonAscii = value => /[\u0080-\uFFFF]/.test(value);
|
|
30
|
+
const decodeLatin1AsUtf8 = value => {
|
|
31
|
+
if (typeof TextDecoder === 'undefined') return null;
|
|
32
|
+
const bytes = new Uint8Array(value.length);
|
|
33
|
+
for (let i = 0; i < value.length; i += 1) {
|
|
34
|
+
const code = value.charCodeAt(i);
|
|
35
|
+
if (code > 0xff) return null;
|
|
36
|
+
bytes[i] = code;
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
return new TextDecoder('utf-8', {
|
|
40
|
+
fatal: true
|
|
41
|
+
}).decode(bytes);
|
|
42
|
+
} catch {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const isPlausibleRepair = (original, repaired) => repaired !== original && !repaired.includes('�') && !hasControlChars(repaired) &&
|
|
47
|
+
// Must contain a letter from a non-Latin-1 script or a real accented
|
|
48
|
+
// letter, otherwise the "fix" is just noise.
|
|
49
|
+
hasNonAscii(repaired) && /\p{L}/u.test(repaired);
|
|
50
|
+
const tryPercentDecode = value => {
|
|
51
|
+
if (!looksLikePercentEncoded(value)) return value;
|
|
52
|
+
try {
|
|
53
|
+
const decoded = decodeURIComponent(value);
|
|
54
|
+
return hasControlChars(decoded) || decoded.includes('�') ? value : decoded;
|
|
55
|
+
} catch {
|
|
56
|
+
return value;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
export const repairFilenameEncoding = name => {
|
|
60
|
+
if (typeof name !== 'string' || name === '') return name;
|
|
61
|
+
let current = name;
|
|
62
|
+
|
|
63
|
+
// Percent-encoded names ("%D0%A1...") first; they may also be mojibake
|
|
64
|
+
// after decoding, so run the byte repair on the result.
|
|
65
|
+
const unescaped = tryPercentDecode(current);
|
|
66
|
+
if (unescaped !== current && hasNonAscii(unescaped)) {
|
|
67
|
+
current = unescaped;
|
|
68
|
+
}
|
|
69
|
+
if (!hasMultiByteSignature(current)) return current;
|
|
70
|
+
const repaired = decodeLatin1AsUtf8(current);
|
|
71
|
+
if (repaired !== null && isPlausibleRepair(current, repaired)) return repaired;
|
|
72
|
+
return current;
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=repairFilenameEncoding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["hasMultiByteSignature","value","test","looksLikePercentEncoded","hasControlChars","i","length","code","charCodeAt","hasNonAscii","decodeLatin1AsUtf8","TextDecoder","bytes","Uint8Array","fatal","decode","isPlausibleRepair","original","repaired","includes","tryPercentDecode","decoded","decodeURIComponent","repairFilenameEncoding","name","current","unescaped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AAOA,QAAQ;EAC9E,OAAOO,OAAO;AAChB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export const safeJsonParse = (rawValue, fallback) => {
|
|
4
|
+
if (typeof rawValue !== 'string' || rawValue.trim() === '') {
|
|
5
|
+
return fallback;
|
|
6
|
+
}
|
|
7
|
+
try {
|
|
8
|
+
return JSON.parse(rawValue);
|
|
9
|
+
} catch {
|
|
10
|
+
return fallback;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=safeJson.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["safeJsonParse","rawValue","fallback","trim","JSON","parse"],"sourceRoot":"../../../src","sources":["helpers/safeJson.ts"],"mappings":";;AAAA,OAAO,MAAMA,aAAa,GAAGA,CAAIC,QAAiB,EAAEC,QAAW,KAAQ;EACrE,IAAI,OAAOD,QAAQ,KAAK,QAAQ,IAAIA,QAAQ,CAACE,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;IAC1D,OAAOD,QAAQ;EACjB;EAEA,IAAI;IACF,OAAOE,IAAI,CAACC,KAAK,CAACJ,QAAQ,CAAC;EAC7B,CAAC,CAAC,MAAM;IACN,OAAOC,QAAQ;EACjB;AACF,CAAC","ignoreList":[]}
|
|
@@ -53,7 +53,9 @@ export const updateMessagesTillLast = async (rooms, client, batchSize = 5, maxFe
|
|
|
53
53
|
source: 'background',
|
|
54
54
|
selfApplied: true
|
|
55
55
|
});
|
|
56
|
-
|
|
56
|
+
|
|
57
|
+
// undefined when the stanza was dropped (e.g. reconnecting).
|
|
58
|
+
if (!fetchedMessages?.length) {
|
|
57
59
|
break;
|
|
58
60
|
}
|
|
59
61
|
counter++;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["store","addRoomMessages","setRoomMessages","checkUniqueUsers","updateMessagesTillLast","rooms","client","batchSize","maxFetchAttempts","messagesPerFetch","roomEntries","Object","keys","length","processedIndex","currentBatch","slice","lastTimestampsByJid","reduce","acc","current","room","getState","cached","Array","isArray","messages","newest","m","pending","id","Number","isFinite","Promise","all","map","jid","index","res","setTimeout","counter","isMessageFound","currentJidNewMessages","lastCachedMessagesTimeStamp","lastMessageId","undefined","fetchedMessages","getHistoryStanza","coalesceRoom","source","selfApplied","some","message","dispatch","roomJID","error","console","log"],"sourceRoot":"../../../src","sources":["helpers/updateMessagesTillLast.tsx"],"mappings":";;AACA,SAASA,KAAK,QAAQ,cAAc;AACpC,SAASC,eAAe,EAAEC,eAAe,QAAQ,yBAAyB;AAE1E,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMC,sBAAsB,GAAG,MAAAA,CACpCC,KAEC,EACDC,MAAkB,EAClBC,SAAS,GAAG,CAAC,EACbC,gBAAgB,GAAG,CAAC,EACpBC,gBAAgB,GAAG,CAAC,KACjB;EACH,MAAMC,WAAW,GAAGC,MAAM,CAACC,IAAI,CAACP,KAAK,CAAC;EACtC,IAAIK,WAAW,CAACG,MAAM,GAAG,CAAC,EAAE;IAC1B,IAAIC,cAAc,GAAG,CAAC;IAEtB,OAAOA,cAAc,GAAGJ,WAAW,CAACG,MAAM,EAAE;MAC1C,MAAME,YAAY,GAAGL,WAAW,CAACM,KAAK,CACpCF,cAAc,EACdA,cAAc,GAAGP,SACnB,CAAC;MAGD,MAAMU,mBAAmB,GAAGF,YAAY,CAACG,MAAM,CAC7C,CAACC,GAA2B,EAAEC,OAAe,KAAK;QAChD,MAAMC,IAAI,GAAIrB,KAAK,CAACsB,QAAQ,CAAC,CAAC,CAASjB,KAAK,EAAEA,KAAK,GAAGe,OAAO,CAAC;QAC9D,MAAMG,MAAkB,GAAGC,KAAK,CAACC,OAAO,CAACJ,IAAI,EAAEK,QAAQ,CAAC,GACpDL,IAAI,CAACK,QAAQ,GACb,EAAE;QACN,IAAIC,MAAM,GAAG,C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,WAAW,EAAE;YAAK,CAChE,CAAC;
|
|
1
|
+
{"version":3,"names":["store","addRoomMessages","setRoomMessages","checkUniqueUsers","updateMessagesTillLast","rooms","client","batchSize","maxFetchAttempts","messagesPerFetch","roomEntries","Object","keys","length","processedIndex","currentBatch","slice","lastTimestampsByJid","reduce","acc","current","room","getState","cached","Array","isArray","messages","newest","m","pending","id","Number","isFinite","Promise","all","map","jid","index","res","setTimeout","counter","isMessageFound","currentJidNewMessages","lastCachedMessagesTimeStamp","lastMessageId","undefined","fetchedMessages","getHistoryStanza","coalesceRoom","source","selfApplied","some","message","dispatch","roomJID","error","console","log"],"sourceRoot":"../../../src","sources":["helpers/updateMessagesTillLast.tsx"],"mappings":";;AACA,SAASA,KAAK,QAAQ,cAAc;AACpC,SAASC,eAAe,EAAEC,eAAe,QAAQ,yBAAyB;AAE1E,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMC,sBAAsB,GAAG,MAAAA,CACpCC,KAEC,EACDC,MAAkB,EAClBC,SAAS,GAAG,CAAC,EACbC,gBAAgB,GAAG,CAAC,EACpBC,gBAAgB,GAAG,CAAC,KACjB;EACH,MAAMC,WAAW,GAAGC,MAAM,CAACC,IAAI,CAACP,KAAK,CAAC;EACtC,IAAIK,WAAW,CAACG,MAAM,GAAG,CAAC,EAAE;IAC1B,IAAIC,cAAc,GAAG,CAAC;IAEtB,OAAOA,cAAc,GAAGJ,WAAW,CAACG,MAAM,EAAE;MAC1C,MAAME,YAAY,GAAGL,WAAW,CAACM,KAAK,CACpCF,cAAc,EACdA,cAAc,GAAGP,SACnB,CAAC;MAGD,MAAMU,mBAAmB,GAAGF,YAAY,CAACG,MAAM,CAC7C,CAACC,GAA2B,EAAEC,OAAe,KAAK;QAChD,MAAMC,IAAI,GAAIrB,KAAK,CAACsB,QAAQ,CAAC,CAAC,CAASjB,KAAK,EAAEA,KAAK,GAAGe,OAAO,CAAC;QAC9D,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