@ethora/chat-component-rn 26.5.5 → 26.5.10
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 +177 -0
- package/README.md +67 -10
- package/index.js +24 -0
- package/lib/commonjs/assets/icons.js +5 -1
- package/lib/commonjs/assets/icons.js.map +1 -1
- package/lib/commonjs/components/ContextMenu/ContextMenuComponents.js +11 -5
- package/lib/commonjs/components/ContextMenu/ContextMenuComponents.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatHeader.js +7 -1
- package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatRoom.js +66 -34
- package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatWrapper.js +59 -14
- package/lib/commonjs/components/MainComponents/ChatWrapper.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MediaMessage.js +15 -7
- package/lib/commonjs/components/MainComponents/MediaMessage.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MessageContainer.js +2 -2
- package/lib/commonjs/components/MainComponents/MessageContainer.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MessageList.js +175 -30
- package/lib/commonjs/components/MainComponents/MessageList.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ReduxWrapper.js +17 -8
- package/lib/commonjs/components/MainComponents/ReduxWrapper.js.map +1 -1
- package/lib/commonjs/components/MainComponents/SystemMessage.js +34 -22
- package/lib/commonjs/components/MainComponents/SystemMessage.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/Message.js +117 -19
- package/lib/commonjs/components/MessageBubble/Message.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/MessageInteractions.js +82 -22
- package/lib/commonjs/components/MessageBubble/MessageInteractions.js.map +1 -1
- package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js +16 -4
- package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
- package/lib/commonjs/components/Modals/FilePreviewModal/DocumentViewer.js +104 -0
- package/lib/commonjs/components/Modals/FilePreviewModal/DocumentViewer.js.map +1 -0
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +175 -40
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
- package/lib/commonjs/components/Modals/FilePreviewModal/PdfView.js +29 -1
- package/lib/commonjs/components/Modals/FilePreviewModal/PdfView.js.map +1 -1
- package/lib/commonjs/components/Modals/Modal/Modal.js +5 -1
- package/lib/commonjs/components/Modals/Modal/Modal.js.map +1 -1
- package/lib/commonjs/components/Modals/ModalWrapper/ModalWrapper.js +78 -39
- package/lib/commonjs/components/Modals/ModalWrapper/ModalWrapper.js.map +1 -1
- package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js +3 -3
- package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/styledModalComponents.js +4 -9
- package/lib/commonjs/components/Modals/styledModalComponents.js.map +1 -1
- package/lib/commonjs/components/styled/MediaFilePreview.js +115 -5
- package/lib/commonjs/components/styled/MediaFilePreview.js.map +1 -1
- package/lib/commonjs/components/styled/MessageImage.js +49 -10
- package/lib/commonjs/components/styled/MessageImage.js.map +1 -1
- package/lib/commonjs/components/styled/NewMessageLabel.js +8 -6
- package/lib/commonjs/components/styled/NewMessageLabel.js.map +1 -1
- package/lib/commonjs/components/styled/SendInput.js +53 -29
- package/lib/commonjs/components/styled/SendInput.js.map +1 -1
- package/lib/commonjs/components/styled/StyledInputComponents/MediaComponents.js +14 -4
- package/lib/commonjs/components/styled/StyledInputComponents/MediaComponents.js.map +1 -1
- package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js +7 -2
- package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
- package/lib/commonjs/components/styled/UnsupportedType.js +5 -1
- package/lib/commonjs/components/styled/UnsupportedType.js.map +1 -1
- package/lib/commonjs/components/styled/VideoMessage.js +60 -22
- package/lib/commonjs/components/styled/VideoMessage.js.map +1 -1
- package/lib/commonjs/context/MessageNotificationContext.js +7 -7
- package/lib/commonjs/context/MessageNotificationContext.js.map +1 -1
- package/lib/commonjs/context/xmppProvider.js +315 -34
- package/lib/commonjs/context/xmppProvider.js.map +1 -1
- package/lib/commonjs/helpers/chatAutoEnterer.js +2 -7
- package/lib/commonjs/helpers/chatAutoEnterer.js.map +1 -1
- package/lib/commonjs/helpers/historyPreloadScheduler.js +4 -1
- package/lib/commonjs/helpers/historyPreloadScheduler.js.map +1 -1
- package/lib/commonjs/helpers/insertMessageWithDelimiter.js +15 -5
- package/lib/commonjs/helpers/insertMessageWithDelimiter.js.map +1 -1
- package/lib/commonjs/helpers/keyboardLayout.js +18 -0
- package/lib/commonjs/helpers/keyboardLayout.js.map +1 -0
- package/lib/commonjs/helpers/mediaDimensions.js +51 -0
- package/lib/commonjs/helpers/mediaDimensions.js.map +1 -0
- package/lib/commonjs/helpers/mimeToExtension.js +131 -0
- package/lib/commonjs/helpers/mimeToExtension.js.map +1 -0
- package/lib/commonjs/helpers/normalizeRoomJid.js +20 -0
- package/lib/commonjs/helpers/normalizeRoomJid.js.map +1 -0
- package/lib/commonjs/helpers/resolveInitBeforeLoadUser.js +73 -1
- package/lib/commonjs/helpers/resolveInitBeforeLoadUser.js.map +1 -1
- package/lib/commonjs/hooks/useChatRoomFocus.js +87 -0
- package/lib/commonjs/hooks/useChatRoomFocus.js.map +1 -0
- package/lib/commonjs/hooks/useChatWrapperInit.js +22 -10
- package/lib/commonjs/hooks/useChatWrapperInit.js.map +1 -1
- package/lib/commonjs/hooks/useEventHandlers.js +9 -1
- package/lib/commonjs/hooks/useEventHandlers.js.map +1 -1
- package/lib/commonjs/hooks/useHeapSender.js +1 -1
- package/lib/commonjs/hooks/useHeapSender.js.map +1 -1
- package/lib/commonjs/hooks/useLogout.js +3 -3
- package/lib/commonjs/hooks/useLogout.js.map +1 -1
- package/lib/commonjs/hooks/useMessageHeapState.js +6 -2
- package/lib/commonjs/hooks/useMessageHeapState.js.map +1 -1
- package/lib/commonjs/hooks/usePushNotifications.js +6 -2
- package/lib/commonjs/hooks/usePushNotifications.js.map +1 -1
- package/lib/commonjs/hooks/useRoomState.js +2 -0
- package/lib/commonjs/hooks/useRoomState.js.map +1 -1
- package/lib/commonjs/hooks/useSendMessage.js +249 -14
- package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
- package/lib/commonjs/hooks/useUnreadMessagesCounter.js +12 -14
- package/lib/commonjs/hooks/useUnreadMessagesCounter.js.map +1 -1
- package/lib/commonjs/main.js +7 -0
- package/lib/commonjs/main.js.map +1 -1
- package/lib/commonjs/networking/api-requests/auth.api.js +74 -1
- package/lib/commonjs/networking/api-requests/auth.api.js.map +1 -1
- package/lib/commonjs/networking/apiClient.js +2 -1
- package/lib/commonjs/networking/apiClient.js.map +1 -1
- package/lib/commonjs/networking/outboundQueue.js +92 -0
- package/lib/commonjs/networking/outboundQueue.js.map +1 -0
- package/lib/commonjs/networking/xmpp/createTimeoutPromise.xmpp.js +4 -1
- package/lib/commonjs/networking/xmpp/createTimeoutPromise.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/flushLastViewedToPrivateStore.js +7 -8
- package/lib/commonjs/networking/xmpp/flushLastViewedToPrivateStore.js.map +1 -1
- package/lib/commonjs/networking/xmpp/getRoomsPaged.xmpp.js +26 -3
- package/lib/commonjs/networking/xmpp/getRoomsPaged.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js +26 -8
- package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/sendTextMessage.xmpp.js +2 -1
- package/lib/commonjs/networking/xmpp/sendTextMessage.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmppClient.js +371 -26
- package/lib/commonjs/networking/xmppClient.js.map +1 -1
- package/lib/commonjs/roomStore/Middleware/unreadMidlleware.js +22 -6
- package/lib/commonjs/roomStore/Middleware/unreadMidlleware.js.map +1 -1
- package/lib/commonjs/roomStore/roomHeapSlice.js +26 -8
- package/lib/commonjs/roomStore/roomHeapSlice.js.map +1 -1
- package/lib/commonjs/roomStore/roomsSlice.js +157 -23
- package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
- package/lib/commonjs/utils/installPromiseRejectionTracker.js +83 -0
- package/lib/commonjs/utils/installPromiseRejectionTracker.js.map +1 -0
- package/lib/commonjs/utils/resendMessage.js +1 -1
- package/lib/commonjs/utils/resendMessage.js.map +1 -1
- package/lib/module/assets/icons.js +5 -1
- package/lib/module/assets/icons.js.map +1 -1
- package/lib/module/components/ContextMenu/ContextMenuComponents.js +11 -5
- package/lib/module/components/ContextMenu/ContextMenuComponents.js.map +1 -1
- package/lib/module/components/MainComponents/ChatHeader.js +7 -1
- package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/module/components/MainComponents/ChatRoom.js +67 -35
- package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/module/components/MainComponents/ChatWrapper.js +59 -14
- package/lib/module/components/MainComponents/ChatWrapper.js.map +1 -1
- package/lib/module/components/MainComponents/MediaMessage.js +15 -7
- package/lib/module/components/MainComponents/MediaMessage.js.map +1 -1
- package/lib/module/components/MainComponents/MessageContainer.js +2 -2
- package/lib/module/components/MainComponents/MessageContainer.js.map +1 -1
- package/lib/module/components/MainComponents/MessageList.js +176 -31
- package/lib/module/components/MainComponents/MessageList.js.map +1 -1
- package/lib/module/components/MainComponents/ReduxWrapper.js +18 -8
- package/lib/module/components/MainComponents/ReduxWrapper.js.map +1 -1
- package/lib/module/components/MainComponents/SystemMessage.js +33 -21
- package/lib/module/components/MainComponents/SystemMessage.js.map +1 -1
- package/lib/module/components/MessageBubble/Message.js +118 -20
- package/lib/module/components/MessageBubble/Message.js.map +1 -1
- package/lib/module/components/MessageBubble/MessageInteractions.js +84 -24
- package/lib/module/components/MessageBubble/MessageInteractions.js.map +1 -1
- package/lib/module/components/Modals/AttachSheet/AttachSheet.js +15 -3
- package/lib/module/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
- package/lib/module/components/Modals/FilePreviewModal/DocumentViewer.js +99 -0
- package/lib/module/components/Modals/FilePreviewModal/DocumentViewer.js.map +1 -0
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +179 -42
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
- package/lib/module/components/Modals/FilePreviewModal/PdfView.js +31 -3
- package/lib/module/components/Modals/FilePreviewModal/PdfView.js.map +1 -1
- package/lib/module/components/Modals/Modal/Modal.js +5 -1
- package/lib/module/components/Modals/Modal/Modal.js.map +1 -1
- package/lib/module/components/Modals/ModalWrapper/ModalWrapper.js +80 -41
- package/lib/module/components/Modals/ModalWrapper/ModalWrapper.js.map +1 -1
- package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js +3 -3
- package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
- package/lib/module/components/Modals/styledModalComponents.js +4 -9
- package/lib/module/components/Modals/styledModalComponents.js.map +1 -1
- package/lib/module/components/styled/MediaFilePreview.js +116 -6
- package/lib/module/components/styled/MediaFilePreview.js.map +1 -1
- package/lib/module/components/styled/MessageImage.js +51 -12
- package/lib/module/components/styled/MessageImage.js.map +1 -1
- package/lib/module/components/styled/NewMessageLabel.js +8 -6
- package/lib/module/components/styled/NewMessageLabel.js.map +1 -1
- package/lib/module/components/styled/SendInput.js +54 -30
- package/lib/module/components/styled/SendInput.js.map +1 -1
- package/lib/module/components/styled/StyledInputComponents/MediaComponents.js +14 -4
- package/lib/module/components/styled/StyledInputComponents/MediaComponents.js.map +1 -1
- package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js +7 -2
- package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
- package/lib/module/components/styled/UnsupportedType.js +5 -1
- package/lib/module/components/styled/UnsupportedType.js.map +1 -1
- package/lib/module/components/styled/VideoMessage.js +61 -23
- package/lib/module/components/styled/VideoMessage.js.map +1 -1
- package/lib/module/context/MessageNotificationContext.js +7 -7
- package/lib/module/context/MessageNotificationContext.js.map +1 -1
- package/lib/module/context/xmppProvider.js +319 -37
- package/lib/module/context/xmppProvider.js.map +1 -1
- package/lib/module/helpers/chatAutoEnterer.js +2 -7
- package/lib/module/helpers/chatAutoEnterer.js.map +1 -1
- package/lib/module/helpers/historyPreloadScheduler.js +4 -1
- package/lib/module/helpers/historyPreloadScheduler.js.map +1 -1
- package/lib/module/helpers/insertMessageWithDelimiter.js +15 -5
- package/lib/module/helpers/insertMessageWithDelimiter.js.map +1 -1
- package/lib/module/helpers/keyboardLayout.js +12 -0
- package/lib/module/helpers/keyboardLayout.js.map +1 -0
- package/lib/module/helpers/mediaDimensions.js +46 -0
- package/lib/module/helpers/mediaDimensions.js.map +1 -0
- package/lib/module/helpers/mimeToExtension.js +124 -0
- package/lib/module/helpers/mimeToExtension.js.map +1 -0
- package/lib/module/helpers/normalizeRoomJid.js +15 -0
- package/lib/module/helpers/normalizeRoomJid.js.map +1 -0
- package/lib/module/helpers/resolveInitBeforeLoadUser.js +71 -0
- package/lib/module/helpers/resolveInitBeforeLoadUser.js.map +1 -1
- package/lib/module/hooks/useChatRoomFocus.js +82 -0
- package/lib/module/hooks/useChatRoomFocus.js.map +1 -0
- package/lib/module/hooks/useChatWrapperInit.js +22 -10
- package/lib/module/hooks/useChatWrapperInit.js.map +1 -1
- package/lib/module/hooks/useEventHandlers.js +9 -1
- package/lib/module/hooks/useEventHandlers.js.map +1 -1
- package/lib/module/hooks/useHeapSender.js +1 -1
- package/lib/module/hooks/useHeapSender.js.map +1 -1
- package/lib/module/hooks/useLogout.js +3 -3
- package/lib/module/hooks/useLogout.js.map +1 -1
- package/lib/module/hooks/useMessageHeapState.js +6 -2
- package/lib/module/hooks/useMessageHeapState.js.map +1 -1
- package/lib/module/hooks/usePushNotifications.js +6 -2
- package/lib/module/hooks/usePushNotifications.js.map +1 -1
- package/lib/module/hooks/useRoomState.js +2 -0
- package/lib/module/hooks/useRoomState.js.map +1 -1
- package/lib/module/hooks/useSendMessage.js +252 -17
- package/lib/module/hooks/useSendMessage.js.map +1 -1
- package/lib/module/hooks/useUnreadMessagesCounter.js +12 -14
- package/lib/module/hooks/useUnreadMessagesCounter.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 +74 -2
- package/lib/module/networking/api-requests/auth.api.js.map +1 -1
- package/lib/module/networking/apiClient.js +2 -1
- package/lib/module/networking/apiClient.js.map +1 -1
- package/lib/module/networking/outboundQueue.js +84 -0
- package/lib/module/networking/outboundQueue.js.map +1 -0
- package/lib/module/networking/xmpp/createTimeoutPromise.xmpp.js +4 -1
- package/lib/module/networking/xmpp/createTimeoutPromise.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/flushLastViewedToPrivateStore.js +7 -8
- package/lib/module/networking/xmpp/flushLastViewedToPrivateStore.js.map +1 -1
- package/lib/module/networking/xmpp/getRoomsPaged.xmpp.js +26 -3
- package/lib/module/networking/xmpp/getRoomsPaged.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/presenceInRoom.xmpp.js +26 -8
- package/lib/module/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/sendTextMessage.xmpp.js +2 -1
- package/lib/module/networking/xmpp/sendTextMessage.xmpp.js.map +1 -1
- package/lib/module/networking/xmppClient.js +371 -26
- package/lib/module/networking/xmppClient.js.map +1 -1
- package/lib/module/roomStore/Middleware/unreadMidlleware.js +22 -6
- package/lib/module/roomStore/Middleware/unreadMidlleware.js.map +1 -1
- package/lib/module/roomStore/roomHeapSlice.js +24 -7
- package/lib/module/roomStore/roomHeapSlice.js.map +1 -1
- package/lib/module/roomStore/roomsSlice.js +154 -22
- package/lib/module/roomStore/roomsSlice.js.map +1 -1
- package/lib/module/utils/installPromiseRejectionTracker.js +78 -0
- package/lib/module/utils/installPromiseRejectionTracker.js.map +1 -0
- package/lib/module/utils/resendMessage.js +1 -1
- package/lib/module/utils/resendMessage.js.map +1 -1
- package/lib/typescript/assets/icons.d.ts +8 -4
- package/lib/typescript/assets/icons.d.ts.map +1 -1
- package/lib/typescript/components/ContextMenu/ContextMenuComponents.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/MediaMessage.d.ts +1 -0
- package/lib/typescript/components/MainComponents/MediaMessage.d.ts.map +1 -1
- 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 +1 -0
- package/lib/typescript/components/MainComponents/ReduxWrapper.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/SystemMessage.d.ts +0 -7
- package/lib/typescript/components/MainComponents/SystemMessage.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/Message.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/MessageInteractions.d.ts +4 -2
- package/lib/typescript/components/MessageBubble/MessageInteractions.d.ts.map +1 -1
- package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts.map +1 -1
- package/lib/typescript/components/Modals/FilePreviewModal/DocumentViewer.d.ts +29 -0
- package/lib/typescript/components/Modals/FilePreviewModal/DocumentViewer.d.ts.map +1 -0
- package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts +0 -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/Modal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/ModalWrapper/ModalWrapper.d.ts +6 -0
- package/lib/typescript/components/Modals/ModalWrapper/ModalWrapper.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/styledModalComponents.d.ts.map +1 -1
- package/lib/typescript/components/styled/MediaFilePreview.d.ts.map +1 -1
- package/lib/typescript/components/styled/MessageImage.d.ts.map +1 -1
- package/lib/typescript/components/styled/NewMessageLabel.d.ts +1 -5
- package/lib/typescript/components/styled/NewMessageLabel.d.ts.map +1 -1
- package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
- package/lib/typescript/components/styled/StyledInputComponents/MediaComponents.d.ts +9 -1
- package/lib/typescript/components/styled/StyledInputComponents/MediaComponents.d.ts.map +1 -1
- package/lib/typescript/components/styled/StyledInputComponents/StyledInputComponents.d.ts.map +1 -1
- package/lib/typescript/components/styled/UnsupportedType.d.ts +1 -0
- package/lib/typescript/components/styled/UnsupportedType.d.ts.map +1 -1
- package/lib/typescript/components/styled/VideoMessage.d.ts.map +1 -1
- package/lib/typescript/context/xmppProvider.d.ts +1 -0
- package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
- package/lib/typescript/helpers/chatAutoEnterer.d.ts.map +1 -1
- package/lib/typescript/helpers/historyPreloadScheduler.d.ts.map +1 -1
- package/lib/typescript/helpers/insertMessageWithDelimiter.d.ts.map +1 -1
- package/lib/typescript/helpers/keyboardLayout.d.ts +9 -0
- package/lib/typescript/helpers/keyboardLayout.d.ts.map +1 -0
- package/lib/typescript/helpers/mediaDimensions.d.ts +9 -0
- package/lib/typescript/helpers/mediaDimensions.d.ts.map +1 -0
- package/lib/typescript/helpers/mimeToExtension.d.ts +37 -0
- package/lib/typescript/helpers/mimeToExtension.d.ts.map +1 -0
- package/lib/typescript/helpers/normalizeRoomJid.d.ts +2 -0
- package/lib/typescript/helpers/normalizeRoomJid.d.ts.map +1 -0
- package/lib/typescript/helpers/resolveInitBeforeLoadUser.d.ts +18 -0
- package/lib/typescript/helpers/resolveInitBeforeLoadUser.d.ts.map +1 -1
- package/lib/typescript/hooks/useChatRoomFocus.d.ts +42 -0
- package/lib/typescript/hooks/useChatRoomFocus.d.ts.map +1 -0
- package/lib/typescript/hooks/useChatWrapperInit.d.ts.map +1 -1
- package/lib/typescript/hooks/useEventHandlers.d.ts +6 -0
- package/lib/typescript/hooks/useEventHandlers.d.ts.map +1 -1
- package/lib/typescript/hooks/useHeapSender.d.ts.map +1 -1
- package/lib/typescript/hooks/useMessageHeapState.d.ts +2 -0
- package/lib/typescript/hooks/useMessageHeapState.d.ts.map +1 -1
- package/lib/typescript/hooks/usePushNotifications.d.ts.map +1 -1
- package/lib/typescript/hooks/useRoomState.d.ts +1 -0
- package/lib/typescript/hooks/useRoomState.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/hooks/useUnreadMessagesCounter.d.ts.map +1 -1
- package/lib/typescript/main.d.ts +1 -0
- package/lib/typescript/main.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/auth.api.d.ts +3 -0
- package/lib/typescript/networking/api-requests/auth.api.d.ts.map +1 -1
- package/lib/typescript/networking/apiClient.d.ts.map +1 -1
- package/lib/typescript/networking/outboundQueue.d.ts +57 -0
- package/lib/typescript/networking/outboundQueue.d.ts.map +1 -0
- package/lib/typescript/networking/xmpp/createTimeoutPromise.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/flushLastViewedToPrivateStore.d.ts +1 -1
- package/lib/typescript/networking/xmpp/flushLastViewedToPrivateStore.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/getRoomsPaged.xmpp.d.ts +1 -1
- package/lib/typescript/networking/xmpp/getRoomsPaged.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/presenceInRoom.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/sendTextMessage.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmppClient.d.ts +58 -5
- package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
- package/lib/typescript/roomStore/Middleware/unreadMidlleware.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 +8 -1
- package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
- package/lib/typescript/types/models/media.model.d.ts +1 -0
- package/lib/typescript/types/models/media.model.d.ts.map +1 -1
- package/lib/typescript/types/models/xmpp.model.d.ts +1 -1
- package/lib/typescript/types/models/xmpp.model.d.ts.map +1 -1
- package/lib/typescript/types/types.d.ts +10 -0
- package/lib/typescript/types/types.d.ts.map +1 -1
- package/lib/typescript/utils/installPromiseRejectionTracker.d.ts +20 -0
- package/lib/typescript/utils/installPromiseRejectionTracker.d.ts.map +1 -0
- package/lib/typescript/utils/resendMessage.d.ts.map +1 -1
- package/package.json +18 -2
- package/src/assets/icons.tsx +23 -14
- package/src/components/ContextMenu/ContextMenuComponents.tsx +10 -5
- package/src/components/MainComponents/ChatHeader.tsx +5 -1
- package/src/components/MainComponents/ChatRoom.tsx +81 -61
- package/src/components/MainComponents/ChatWrapper.tsx +100 -21
- package/src/components/MainComponents/MediaMessage.tsx +18 -8
- package/src/components/MainComponents/MessageContainer.tsx +4 -2
- package/src/components/MainComponents/MessageList.tsx +185 -31
- package/src/components/MainComponents/ReduxWrapper.tsx +19 -9
- package/src/components/MainComponents/SystemMessage.tsx +38 -26
- package/src/components/MessageBubble/Message.tsx +110 -27
- package/src/components/MessageBubble/MessageInteractions.tsx +98 -29
- package/src/components/Modals/AttachSheet/AttachSheet.tsx +17 -3
- package/src/components/Modals/FilePreviewModal/DocumentViewer.tsx +93 -0
- package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +182 -37
- package/src/components/Modals/FilePreviewModal/PdfView.tsx +32 -4
- package/src/components/Modals/Modal/Modal.tsx +4 -1
- package/src/components/Modals/ModalWrapper/ModalWrapper.tsx +77 -44
- package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +19 -15
- package/src/components/Modals/styledModalComponents.tsx +4 -9
- package/src/components/styled/MediaFilePreview.tsx +111 -5
- package/src/components/styled/MessageImage.tsx +58 -14
- package/src/components/styled/NewMessageLabel.tsx +8 -5
- package/src/components/styled/SendInput.tsx +67 -29
- package/src/components/styled/StyledInputComponents/MediaComponents.tsx +15 -5
- package/src/components/styled/StyledInputComponents/StyledInputComponents.tsx +7 -2
- package/src/components/styled/UnsupportedType.tsx +7 -1
- package/src/components/styled/VideoMessage.tsx +59 -18
- package/src/context/MessageNotificationContext.tsx +8 -8
- package/src/context/xmppProvider.tsx +337 -32
- package/src/helpers/chatAutoEnterer.ts +2 -8
- package/src/helpers/historyPreloadScheduler.ts +4 -1
- package/src/helpers/insertMessageWithDelimiter.ts +22 -15
- package/src/helpers/keyboardLayout.ts +18 -0
- package/src/helpers/mediaDimensions.ts +47 -0
- package/src/helpers/mimeToExtension.ts +135 -0
- package/src/helpers/normalizeRoomJid.ts +6 -0
- package/src/helpers/resolveInitBeforeLoadUser.ts +79 -0
- package/src/hooks/useChatRoomFocus.ts +95 -0
- package/src/hooks/useChatWrapperInit.ts +51 -46
- package/src/hooks/useEventHandlers.tsx +24 -1
- package/src/hooks/useHeapSender.tsx +2 -1
- package/src/hooks/useLogout.tsx +3 -3
- package/src/hooks/useMessageHeapState.tsx +6 -2
- package/src/hooks/usePushNotifications.ts +21 -8
- package/src/hooks/useRoomState.tsx +4 -0
- package/src/hooks/useSendMessage.tsx +333 -17
- package/src/hooks/useUnreadMessagesCounter.ts +13 -16
- package/src/main.ts +1 -0
- package/src/networking/api-requests/auth.api.ts +60 -2
- package/src/networking/apiClient.ts +2 -1
- package/src/networking/outboundQueue.ts +98 -0
- package/src/networking/xmpp/createTimeoutPromise.xmpp.ts +5 -1
- package/src/networking/xmpp/flushLastViewedToPrivateStore.ts +11 -13
- package/src/networking/xmpp/getRoomsPaged.xmpp.ts +27 -3
- package/src/networking/xmpp/presenceInRoom.xmpp.ts +24 -9
- package/src/networking/xmpp/sendTextMessage.xmpp.ts +2 -1
- package/src/networking/xmppClient.ts +399 -31
- package/src/roomStore/Middleware/unreadMidlleware.tsx +23 -5
- package/src/roomStore/roomHeapSlice.ts +47 -4
- package/src/roomStore/roomsSlice.ts +177 -27
- package/src/types/models/media.model.ts +3 -0
- package/src/types/models/xmpp.model.ts +2 -1
- package/src/types/types.ts +25 -0
- package/src/utils/installPromiseRejectionTracker.ts +91 -0
- package/src/utils/resendMessage.ts +2 -1
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import React, { createContext, useCallback, useContext, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import React, { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { AppState, DeviceEventEmitter } from 'react-native';
|
|
5
|
+
import NetInfo from '@react-native-community/netinfo';
|
|
5
6
|
import XmppClient from '../networking/xmppClient';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
7
|
+
import { refreshTokens } from '../roomStore/chatSettingsSlice';
|
|
8
|
+
import { buildXmppClientKey, getGlobalXmppClient, getReusableXmppClientByKey, isXmppClientReusable, setGlobalXmppClient, withXmppClientInitLock } from '../utils/clientRegistry';
|
|
9
|
+
import { applyResolvedUserToStore, refreshUserCredentialsForXmpp, resolveInitBeforeLoadUser } from '../helpers/resolveInitBeforeLoadUser';
|
|
8
10
|
import { ensureScopedChatCache } from '../helpers/ensureScopedChatCache';
|
|
9
11
|
import { getRooms as prefetchRoomsViaRest } from '../networking/api-requests/rooms.api';
|
|
10
12
|
import { allRoomPresences } from '../networking/xmpp/allRoomPresences.xmpp';
|
|
11
13
|
import { store } from '../roomStore';
|
|
12
14
|
import { logout, setStoreClient } from '../roomStore/chatSettingsSlice';
|
|
13
|
-
import { setLogoutState } from '../roomStore/roomsSlice';
|
|
15
|
+
import { setLogoutState, setVisibleRoom, clearVisibleRoom, setLastViewedTimestamp, deleteRoomMessage } from '../roomStore/roomsSlice';
|
|
14
16
|
import { runHistoryPreloadScheduler } from '../helpers/historyPreloadScheduler';
|
|
15
17
|
import { asyncLocalStorage } from '../hooks/useLocalStorage';
|
|
16
18
|
import { localStorageConstants } from '../helpers/constants/LOCAL_STORAGE';
|
|
@@ -21,11 +23,11 @@ const XmppContext = /*#__PURE__*/createContext(null);
|
|
|
21
23
|
const LOGOUT_EVENT = 'ethora-xmpp-logout';
|
|
22
24
|
export const XmppProvider = ({
|
|
23
25
|
children,
|
|
24
|
-
config
|
|
26
|
+
config,
|
|
27
|
+
isVisible
|
|
25
28
|
}) => {
|
|
26
29
|
const [client, setClient] = useState(null);
|
|
27
30
|
const [providerBootstrapStatus, setProviderBootstrapStatus] = useState('idle');
|
|
28
|
-
const [reconnectAttempts, setReconnectAttempts] = useState(0);
|
|
29
31
|
|
|
30
32
|
// Track which "init mode" this provider runs in. When config.initBeforeLoad
|
|
31
33
|
// is true, the provider owns bootstrap and ChatWrapper just waits.
|
|
@@ -33,6 +35,65 @@ export const XmppProvider = ({
|
|
|
33
35
|
const lastCredsRef = useRef(null);
|
|
34
36
|
const completedBootstrapKeyRef = useRef('');
|
|
35
37
|
const inflightBootstrapKeyRef = useRef('');
|
|
38
|
+
|
|
39
|
+
// Callback XmppClient uses to fetch fresh credentials after a SASL
|
|
40
|
+
// `not-authorized` (typically JWT expiry during idle, bug #17).
|
|
41
|
+
// Always installed — the underlying `refreshUserCredentialsForXmpp`
|
|
42
|
+
// picks the right path based on config:
|
|
43
|
+
// - `jwtLogin` → re-exchange JWT via `/users/client`
|
|
44
|
+
// - `userLogin` / `customLogin` / store / persisted → `/users/my`
|
|
45
|
+
// with REST refresh chain (handles 401 → refresh → retry)
|
|
46
|
+
// Returns last-known cached creds if nothing usable is available so
|
|
47
|
+
// the XmppClient at least doesn't crash on `undefined.password`.
|
|
48
|
+
const credentialsProvider = useMemo(() => {
|
|
49
|
+
return async () => {
|
|
50
|
+
// 1. Consumer-supplied REST refresh (when wired). This runs
|
|
51
|
+
// before the SDK's own refresh chain so non-Ethora backends
|
|
52
|
+
// can keep auth state in sync with their own token endpoint.
|
|
53
|
+
const customRefresh = config?.refreshTokens?.refreshFunction;
|
|
54
|
+
if (customRefresh) {
|
|
55
|
+
try {
|
|
56
|
+
const result = await customRefresh();
|
|
57
|
+
if (result?.accessToken) {
|
|
58
|
+
store.dispatch(refreshTokens({
|
|
59
|
+
token: result.accessToken,
|
|
60
|
+
refreshToken: result.refreshToken || ''
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
} catch (err) {
|
|
64
|
+
devPushLog('warn', 'XMPP creds refresh: customRefresh failed', err);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// 2. Re-mint XMPP creds via the right priority chain for the
|
|
69
|
+
// current auth mode. This call ALWAYS hydrates (unlike
|
|
70
|
+
// `resolveInitBeforeLoadUser` which short-circuits when a
|
|
71
|
+
// cached user already has xmppCredentials).
|
|
72
|
+
const fresh = await refreshUserCredentialsForXmpp(config).catch(err => {
|
|
73
|
+
devPushLog('warn', 'XMPP creds refresh: full chain failed', err);
|
|
74
|
+
return null;
|
|
75
|
+
});
|
|
76
|
+
if (fresh) {
|
|
77
|
+
applyResolvedUserToStore(fresh);
|
|
78
|
+
return {
|
|
79
|
+
username: fresh.xmppUsername || fresh.defaultWallet?.walletAddress || '',
|
|
80
|
+
password: fresh.xmppPassword || ''
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// 3. Last-resort: return the cached creds so reconnect() can
|
|
85
|
+
// still attempt a connection. If the original failure was
|
|
86
|
+
// a stale JWT this will fail again and the user has to
|
|
87
|
+
// re-mount the chat — but at least we don't break the
|
|
88
|
+
// transient-network-blip case where the cached creds are
|
|
89
|
+
// still valid.
|
|
90
|
+
const u = store.getState().chatSettingStore.user;
|
|
91
|
+
return {
|
|
92
|
+
username: u?.xmppUsername || u?.defaultWallet?.walletAddress || '',
|
|
93
|
+
password: u?.xmppPassword || ''
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
}, [config?.jwtLogin?.enabled, config?.jwtLogin?.token, config?.refreshTokens?.refreshFunction, config?.userLogin?.enabled, config?.customLogin?.enabled, config?.initBeforeLoadAuth?.myEndpoint]);
|
|
36
97
|
const initializeClient = useCallback(async (username, password, xmppSettings) => {
|
|
37
98
|
const settings = xmppSettings || config?.xmppSettings;
|
|
38
99
|
const key = buildXmppClientKey(username, settings);
|
|
@@ -62,7 +123,19 @@ export const XmppProvider = ({
|
|
|
62
123
|
// 3. Otherwise create a new client under the init lock to dedup
|
|
63
124
|
// concurrent calls for the same key.
|
|
64
125
|
const created = await withXmppClientInitLock(key, async () => {
|
|
126
|
+
const prevGlobal = getGlobalXmppClient();
|
|
127
|
+
if (prevGlobal) {
|
|
128
|
+
try {
|
|
129
|
+
await prevGlobal.close();
|
|
130
|
+
} catch {}
|
|
131
|
+
}
|
|
65
132
|
const newClient = new XmppClient(username, password, settings);
|
|
133
|
+
// Wire up the credentialsProvider so SASL `not-authorized`
|
|
134
|
+
// after idle triggers a refresh chain (jwtLogin →
|
|
135
|
+
// /users/client; userLogin/customLogin/store → /users/my +
|
|
136
|
+
// REST refresh) instead of looping forever with stale creds.
|
|
137
|
+
// Bug #17 — full coverage in 26.5.6.
|
|
138
|
+
newClient.setCredentialsProvider(credentialsProvider);
|
|
66
139
|
setGlobalXmppClient(newClient, key);
|
|
67
140
|
await newClient.waitForOnline().catch(err => {
|
|
68
141
|
console.error('Error waiting for xmpp online:', err);
|
|
@@ -70,15 +143,36 @@ export const XmppProvider = ({
|
|
|
70
143
|
});
|
|
71
144
|
return newClient;
|
|
72
145
|
});
|
|
146
|
+
|
|
147
|
+
// Reused clients (steps 1+2 above) also need the provider — config
|
|
148
|
+
// may have changed since the singleton was created.
|
|
149
|
+
created.setCredentialsProvider(credentialsProvider);
|
|
150
|
+
|
|
151
|
+
// Re-join MUC rooms on every 'online'. After a reconnect the new
|
|
152
|
+
// XMPP stream isn't a member of any room, so a sent message gets a
|
|
153
|
+
// local double-tick but never reaches the room (bug #21). Re-sending
|
|
154
|
+
// presence on reconnect fixes delivery. On the very first connect
|
|
155
|
+
// the room list isn't loaded yet so this joins nothing — the
|
|
156
|
+
// bootstrap's own allRoomPresences handles that pass.
|
|
157
|
+
created.setOnOnline(() => {
|
|
158
|
+
const underlying = created.client;
|
|
159
|
+
if (!underlying) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
allRoomPresences(underlying).catch(e => devPushLog('warn', 'reconnect: allRoomPresences re-join failed', e));
|
|
163
|
+
// Also refresh the private store so unread / lastViewed markers
|
|
164
|
+
// are accurate after a long reconnect — the MUC re-join above only
|
|
165
|
+
// restores delivery, not unread state. Idempotent on first connect.
|
|
166
|
+
created.getChatsPrivateStoreRequestStanza().catch(e => devPushLog('warn', 'reconnect: privateStore refresh failed', e));
|
|
167
|
+
});
|
|
73
168
|
setClient(created);
|
|
74
169
|
lastCredsRef.current = {
|
|
75
170
|
username,
|
|
76
171
|
password,
|
|
77
172
|
settings
|
|
78
173
|
};
|
|
79
|
-
setReconnectAttempts(0);
|
|
80
174
|
return created;
|
|
81
|
-
}, [client, config?.xmppSettings]);
|
|
175
|
+
}, [client, config?.xmppSettings, credentialsProvider]);
|
|
82
176
|
|
|
83
177
|
// -----------------------------------------------------------
|
|
84
178
|
// initBeforeLoad — eager auth + xmpp connect at provider mount
|
|
@@ -90,6 +184,32 @@ export const XmppProvider = ({
|
|
|
90
184
|
}
|
|
91
185
|
const abortController = new AbortController();
|
|
92
186
|
let cancelled = false;
|
|
187
|
+
// Auto-retry a TRANSIENT bootstrap failure a few times with backoff
|
|
188
|
+
// before surfacing the error modal — a flaky network at launch should
|
|
189
|
+
// self-heal, not dead-end the user on a Retry button. (Bad-creds
|
|
190
|
+
// failures resolve to null below and fail fast — they never reach the
|
|
191
|
+
// catch, so they aren't retried.)
|
|
192
|
+
const MAX_BOOTSTRAP_ATTEMPTS = 3;
|
|
193
|
+
let bootstrapAttempt = 0;
|
|
194
|
+
// Overall time budget: if we never reach 'ready' (a step hangs), abort
|
|
195
|
+
// the in-flight work and fail so the loader can't spin forever.
|
|
196
|
+
const BOOTSTRAP_BUDGET_MS = 45000;
|
|
197
|
+
let reachedReady = false;
|
|
198
|
+
let budgetTimer = setTimeout(() => {
|
|
199
|
+
if (cancelled || reachedReady) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
devPushLog('warn', 'initBeforeLoad: time budget exceeded → failed');
|
|
203
|
+
abortController.abort();
|
|
204
|
+
inflightBootstrapKeyRef.current = '';
|
|
205
|
+
setProviderBootstrapStatus('failed');
|
|
206
|
+
}, BOOTSTRAP_BUDGET_MS);
|
|
207
|
+
const clearBudget = () => {
|
|
208
|
+
if (budgetTimer) {
|
|
209
|
+
clearTimeout(budgetTimer);
|
|
210
|
+
budgetTimer = null;
|
|
211
|
+
}
|
|
212
|
+
};
|
|
93
213
|
const run = async () => {
|
|
94
214
|
// Stable bootstrap key — re-run only when these change.
|
|
95
215
|
const explicitUser = config?.userLogin?.enabled ? config?.userLogin?.user : null;
|
|
@@ -183,6 +303,8 @@ export const XmppProvider = ({
|
|
|
183
303
|
store.dispatch(setStoreClient(c));
|
|
184
304
|
completedBootstrapKeyRef.current = key;
|
|
185
305
|
inflightBootstrapKeyRef.current = '';
|
|
306
|
+
reachedReady = true;
|
|
307
|
+
clearBudget();
|
|
186
308
|
setProviderBootstrapStatus('ready');
|
|
187
309
|
devPushLog('rn', 'initBeforeLoad: READY');
|
|
188
310
|
|
|
@@ -200,21 +322,40 @@ export const XmppProvider = ({
|
|
|
200
322
|
roomLimit: qos?.preloadTopKRooms
|
|
201
323
|
}).catch(err => console.warn('History preload scheduler failed', err));
|
|
202
324
|
} catch (error) {
|
|
203
|
-
if (cancelled) {
|
|
325
|
+
if (cancelled || abortController.signal.aborted) {
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
bootstrapAttempt += 1;
|
|
329
|
+
// Throws here are transient (network / XMPP connect). A bad-creds
|
|
330
|
+
// failure resolves to null above and fails fast without throwing,
|
|
331
|
+
// so it never reaches this catch. Retry with backoff before the
|
|
332
|
+
// modal; release the in-flight key so the recursive run() isn't
|
|
333
|
+
// short-circuited by its own guard.
|
|
334
|
+
if (bootstrapAttempt < MAX_BOOTSTRAP_ATTEMPTS) {
|
|
335
|
+
const backoff = Math.min(8000, 1000 * 2 ** (bootstrapAttempt - 1));
|
|
336
|
+
devPushLog('rn', `initBeforeLoad: attempt ${bootstrapAttempt} failed (${error?.message}); retrying in ${backoff}ms`);
|
|
337
|
+
inflightBootstrapKeyRef.current = '';
|
|
338
|
+
setTimeout(() => {
|
|
339
|
+
if (!cancelled && !abortController.signal.aborted) {
|
|
340
|
+
run();
|
|
341
|
+
}
|
|
342
|
+
}, backoff);
|
|
204
343
|
return;
|
|
205
344
|
}
|
|
206
|
-
devPushLog('error', 'initBeforeLoad: bootstrap threw', {
|
|
345
|
+
devPushLog('error', 'initBeforeLoad: bootstrap threw (giving up)', {
|
|
207
346
|
message: error?.message,
|
|
208
347
|
status: error?.response?.status,
|
|
209
348
|
data: error?.response?.data
|
|
210
349
|
});
|
|
211
350
|
inflightBootstrapKeyRef.current = '';
|
|
351
|
+
clearBudget();
|
|
212
352
|
setProviderBootstrapStatus('failed');
|
|
213
353
|
}
|
|
214
354
|
};
|
|
215
355
|
run();
|
|
216
356
|
return () => {
|
|
217
357
|
cancelled = true;
|
|
358
|
+
clearBudget();
|
|
218
359
|
abortController.abort();
|
|
219
360
|
// Re-running this effect (deps changed or unmount) must release the
|
|
220
361
|
// in-flight bootstrap key so the next render isn't permanently
|
|
@@ -233,34 +374,34 @@ export const XmppProvider = ({
|
|
|
233
374
|
}, [config?.initBeforeLoad, config?.appId, config?.baseUrl, config?.userLogin?.enabled, config?.userLogin?.user?.defaultWallet?.walletAddress, config?.userLogin?.user?.xmppUsername, config?.userLogin?.user?.token, config?.jwtLogin?.enabled, config?.jwtLogin?.token, config?.xmppSettings?.devServer]);
|
|
234
375
|
|
|
235
376
|
// -----------------------------------------------------------
|
|
236
|
-
// Reconnect
|
|
377
|
+
// Reconnect watchdog. The client now owns reconnection (onDisconnect →
|
|
378
|
+
// scheduleReconnect with uncapped, clamped backoff; a connect 'error'
|
|
379
|
+
// reschedules too). This is the single provider-side safety net for the
|
|
380
|
+
// states the event-driven triggers miss: a stuck 'connecting', a connect
|
|
381
|
+
// 'error', or a server-side outage where NetInfo never reported the
|
|
382
|
+
// device offline. While foregrounded, if we're not provably online and
|
|
383
|
+
// not suppressed, force a reconnect (debounced inside forceReconnect).
|
|
384
|
+
//
|
|
385
|
+
// Replaces the old status-keyed reconnect effect, which keyed on
|
|
386
|
+
// `client.status` — a mutated class field React does NOT track — so on a
|
|
387
|
+
// silent socket drop it frequently never re-ran (and its 3-attempts-then-
|
|
388
|
+
// full-reinit path was effectively dead).
|
|
237
389
|
// -----------------------------------------------------------
|
|
238
390
|
useEffect(() => {
|
|
239
391
|
if (!client) {
|
|
240
392
|
return;
|
|
241
393
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
if (lastCredsRef.current) {
|
|
254
|
-
const {
|
|
255
|
-
username,
|
|
256
|
-
password,
|
|
257
|
-
settings
|
|
258
|
-
} = lastCredsRef.current;
|
|
259
|
-
setGlobalXmppClient(null);
|
|
260
|
-
setClient(null);
|
|
261
|
-
initializeClient(username, password, settings).catch(err => console.error('Full reinit failed:', err));
|
|
262
|
-
}
|
|
263
|
-
}, [client, client?.status, reconnectAttempts, initializeClient]);
|
|
394
|
+
const id = setInterval(() => {
|
|
395
|
+
if (AppState.currentState !== 'active') {
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
if (client.status !== 'online' && !client.suppressReconnect) {
|
|
399
|
+
devPushLog('rn', `watchdog: client ${client.status} → forceReconnect`);
|
|
400
|
+
client.forceReconnect();
|
|
401
|
+
}
|
|
402
|
+
}, 30000);
|
|
403
|
+
return () => clearInterval(id);
|
|
404
|
+
}, [client]);
|
|
264
405
|
|
|
265
406
|
// -----------------------------------------------------------
|
|
266
407
|
// AppState → background: flush lastViewedTimestamp into the
|
|
@@ -275,26 +416,158 @@ export const XmppProvider = ({
|
|
|
275
416
|
// entry, or when this build has `disableLastRead`.
|
|
276
417
|
// -----------------------------------------------------------
|
|
277
418
|
useEffect(() => {
|
|
419
|
+
// Remembers the room that was visible when we backgrounded so it can
|
|
420
|
+
// be re-marked visible on return. Lives in the effect closure (one per
|
|
421
|
+
// client) — persists across the listener's many invocations.
|
|
422
|
+
let visibleBeforeBackground = null;
|
|
278
423
|
const sub = AppState.addEventListener('change', next => {
|
|
424
|
+
const c = client;
|
|
279
425
|
if (next === 'active') {
|
|
426
|
+
// Returned to foreground. If the socket died while backgrounded
|
|
427
|
+
// (iOS suspends the WebSocket; long background kills it), the
|
|
428
|
+
// status may still read 'online' until xmpp.js notices the dead
|
|
429
|
+
// TCP — which can take a full timeout. Force an immediate
|
|
430
|
+
// reconnect when we're not provably online so cached UI gets
|
|
431
|
+
// live again fast instead of "100 years".
|
|
432
|
+
// Only force a reconnect from a genuinely dead state. Don't
|
|
433
|
+
// interrupt an in-progress 'connecting' (iOS delivers spurious
|
|
434
|
+
// inactive→active flaps for control-center / notifications /
|
|
435
|
+
// biometric prompts that would otherwise restart a healthy
|
|
436
|
+
// connect).
|
|
437
|
+
if (c && (c.status === 'offline' || c.status === 'error')) {
|
|
438
|
+
devPushLog('rn', `AppState active: client ${c.status} → forceReconnect`);
|
|
439
|
+
c.forceReconnect();
|
|
440
|
+
}
|
|
441
|
+
// Re-mark the previously-open room visible so its unread clears
|
|
442
|
+
// now that the user is looking again. We restore ONLY what was
|
|
443
|
+
// visible at background time, so a chat the consumer had already
|
|
444
|
+
// blurred (e.g. on a non-chat tab/route) correctly stays cleared.
|
|
445
|
+
if (visibleBeforeBackground) {
|
|
446
|
+
store.dispatch(setVisibleRoom({
|
|
447
|
+
roomJID: visibleBeforeBackground
|
|
448
|
+
}));
|
|
449
|
+
visibleBeforeBackground = null;
|
|
450
|
+
}
|
|
280
451
|
return;
|
|
281
452
|
}
|
|
282
|
-
|
|
453
|
+
// Going to background/inactive (sleep / app switcher / tray):
|
|
283
454
|
if (!c) {
|
|
284
455
|
return;
|
|
285
456
|
}
|
|
286
457
|
const state = store.getState();
|
|
287
458
|
const rooms = state.rooms?.rooms;
|
|
288
|
-
const
|
|
459
|
+
const visibleRoomJID = state.rooms?.visibleRoomJID || null;
|
|
460
|
+
// Mark the open room "not visible" while backgrounded so messages
|
|
461
|
+
// that arrive (or MAM-replay on reconnect) count as unread instead
|
|
462
|
+
// of being silently treated as read — the "mounted == visible ==
|
|
463
|
+
// read" gap. Stamp lastViewed=now as the read baseline, clear
|
|
464
|
+
// visibility, then flush that marker to the server private store.
|
|
465
|
+
// Restored on the next 'active' transition above. Handled here in
|
|
466
|
+
// the provider so consumers using the component as a package get
|
|
467
|
+
// correct unread without reaching into the chat store themselves.
|
|
468
|
+
visibleBeforeBackground = visibleRoomJID;
|
|
469
|
+
if (visibleRoomJID) {
|
|
470
|
+
store.dispatch(setLastViewedTimestamp({
|
|
471
|
+
chatJID: visibleRoomJID,
|
|
472
|
+
timestamp: Date.now()
|
|
473
|
+
}));
|
|
474
|
+
// Drop the "New messages" divider for the room we're leaving so it
|
|
475
|
+
// doesn't linger when the user comes back (mirrors ChatRoom's
|
|
476
|
+
// unmount cleanup, which never runs while the pane stays mounted).
|
|
477
|
+
store.dispatch(deleteRoomMessage({
|
|
478
|
+
roomJID: visibleRoomJID,
|
|
479
|
+
messageId: 'delimiter-new'
|
|
480
|
+
}));
|
|
481
|
+
store.dispatch(clearVisibleRoom());
|
|
482
|
+
}
|
|
289
483
|
// Fire-and-forget — we're going to the background and don't
|
|
290
484
|
// care about the resolution path.
|
|
291
485
|
c.flushLastViewedToPrivateStoreStanza(rooms, {
|
|
292
|
-
|
|
486
|
+
visibleRoomJID
|
|
293
487
|
}).catch(() => {});
|
|
294
488
|
});
|
|
295
489
|
return () => sub.remove();
|
|
296
490
|
}, [client]);
|
|
297
491
|
|
|
492
|
+
// -----------------------------------------------------------
|
|
493
|
+
// Consumer visibility signal (`isVisible` prop). For hosts that keep
|
|
494
|
+
// <Chat> MOUNTED while hidden (tab/route navigators — so the XMPP
|
|
495
|
+
// connection survives tab switches), ChatRoom's mount/unmount can't tell
|
|
496
|
+
// "shown" from "hidden", so the unread middleware would keep the open
|
|
497
|
+
// room's badge at 0 and messages arriving while you're elsewhere look
|
|
498
|
+
// already-read. When the host passes `isVisible`, mirror the AppState
|
|
499
|
+
// background/foreground handling: hidden → stamp lastViewed=now + clear
|
|
500
|
+
// room visibility (so later messages count) + flush; shown → restore
|
|
501
|
+
// visibility for the open room. Doing it here means consumers never
|
|
502
|
+
// touch the chat store themselves. (Undefined = host unmounts on hide,
|
|
503
|
+
// nothing to do.)
|
|
504
|
+
// -----------------------------------------------------------
|
|
505
|
+
useEffect(() => {
|
|
506
|
+
if (typeof isVisible !== 'boolean') {
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
const state = store.getState();
|
|
510
|
+
const rooms = state.rooms?.rooms;
|
|
511
|
+
const activeRoomJID = state.rooms?.activeRoomJID || null;
|
|
512
|
+
if (isVisible) {
|
|
513
|
+
if (activeRoomJID) {
|
|
514
|
+
store.dispatch(setVisibleRoom({
|
|
515
|
+
roomJID: activeRoomJID
|
|
516
|
+
}));
|
|
517
|
+
}
|
|
518
|
+
} else {
|
|
519
|
+
if (activeRoomJID) {
|
|
520
|
+
store.dispatch(setLastViewedTimestamp({
|
|
521
|
+
chatJID: activeRoomJID,
|
|
522
|
+
timestamp: Date.now()
|
|
523
|
+
}));
|
|
524
|
+
// Drop the "New messages" divider so it's gone when the user
|
|
525
|
+
// returns to the chat (mirrors ChatRoom's unmount cleanup).
|
|
526
|
+
store.dispatch(deleteRoomMessage({
|
|
527
|
+
roomJID: activeRoomJID,
|
|
528
|
+
messageId: 'delimiter-new'
|
|
529
|
+
}));
|
|
530
|
+
}
|
|
531
|
+
store.dispatch(clearVisibleRoom());
|
|
532
|
+
if (client?.flushLastViewedToPrivateStoreStanza) {
|
|
533
|
+
client.flushLastViewedToPrivateStoreStanza(rooms, {
|
|
534
|
+
visibleRoomJID: activeRoomJID
|
|
535
|
+
}).catch(() => {});
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}, [isVisible, client]);
|
|
539
|
+
|
|
540
|
+
// -----------------------------------------------------------
|
|
541
|
+
// NetInfo → proactive reconnect on network restore. Without this the
|
|
542
|
+
// only reconnect trigger is xmpp.js noticing the socket is dead, which
|
|
543
|
+
// on a Wi-Fi/cellular drop can hang on the TCP timeout for tens of
|
|
544
|
+
// seconds. NetInfo tells us the instant connectivity returns so we can
|
|
545
|
+
// force a reconnect immediately (and reset the backoff budget).
|
|
546
|
+
// -----------------------------------------------------------
|
|
547
|
+
useEffect(() => {
|
|
548
|
+
if (!client) {
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
const unsub = NetInfo.addEventListener(state => {
|
|
552
|
+
// Guard against undefined/partial state (jest mock, early emit).
|
|
553
|
+
const reachable = !!state?.isConnected && state?.isInternetReachable !== false;
|
|
554
|
+
if (!reachable) {
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
// Reachable. If we're in a dead state, kick a reconnect — do NOT
|
|
558
|
+
// require a prior offline→online transition (a missed/coalesced
|
|
559
|
+
// offline event otherwise left us stuck offline forever). Skip
|
|
560
|
+
// 'connecting' so we don't interrupt an in-progress connect; the
|
|
561
|
+
// watchdog covers a stuck 'connecting'. forceReconnect() debounces
|
|
562
|
+
// bursts and resets the backoff itself.
|
|
563
|
+
if (client.status === 'offline' || client.status === 'error') {
|
|
564
|
+
devPushLog('rn', `NetInfo: reachable & client ${client.status} → forceReconnect`);
|
|
565
|
+
client.forceReconnect();
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
return () => unsub();
|
|
569
|
+
}, [client]);
|
|
570
|
+
|
|
298
571
|
// -----------------------------------------------------------
|
|
299
572
|
// Retry-bootstrap listener — fired by ChatWrapper's error modal so
|
|
300
573
|
// a transient failure (bad endpoint, server hiccup, etc.) can be
|
|
@@ -327,7 +600,6 @@ export const XmppProvider = ({
|
|
|
327
600
|
setClient(null);
|
|
328
601
|
completedBootstrapKeyRef.current = '';
|
|
329
602
|
inflightBootstrapKeyRef.current = '';
|
|
330
|
-
setReconnectAttempts(0);
|
|
331
603
|
setProviderBootstrapStatus('idle');
|
|
332
604
|
await clearPersistedState();
|
|
333
605
|
});
|
|
@@ -349,6 +621,16 @@ export const useXmppClient = () => {
|
|
|
349
621
|
if (!context) {
|
|
350
622
|
throw new Error('useXmppClient must be used within an XmppProvider');
|
|
351
623
|
}
|
|
624
|
+
if (!context.client) {
|
|
625
|
+
const candidates = [getGlobalXmppClient(), store.getState()?.chatSettingStore?.client];
|
|
626
|
+
const live = candidates.find(c => c && c.status === 'online');
|
|
627
|
+
if (live) {
|
|
628
|
+
return {
|
|
629
|
+
...context,
|
|
630
|
+
client: live
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
}
|
|
352
634
|
return context;
|
|
353
635
|
};
|
|
354
636
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","createContext","useCallback","useContext","useEffect","useRef","useState","AppState","DeviceEventEmitter","XmppClient","buildXmppClientKey","getReusableXmppClientByKey","isXmppClientReusable","setGlobalXmppClient","withXmppClientInitLock","applyResolvedUserToStore","resolveInitBeforeLoadUser","ensureScopedChatCache","getRooms","prefetchRoomsViaRest","allRoomPresences","store","logout","setStoreClient","setLogoutState","runHistoryPreloadScheduler","asyncLocalStorage","localStorageConstants","clearPersistedState","pushLog","devPushLog","jsx","_jsx","XmppContext","LOGOUT_EVENT","XmppProvider","children","config","client","setClient","providerBootstrapStatus","setProviderBootstrapStatus","reconnectAttempts","setReconnectAttempts","initMode","initBeforeLoad","lastCredsRef","completedBootstrapKeyRef","inflightBootstrapKeyRef","initializeClient","username","password","xmppSettings","settings","key","reusable","current","created","newClient","waitForOnline","catch","err","console","error","abortController","AbortController","cancelled","run","explicitUser","userLogin","enabled","user","appId","baseUrl","defaultWallet","walletAddress","xmppUsername","token","jwtLogin","devServer","join","mode","customLogin","clearStoreBeforeInit","dispatch","ETHORA_USER","remove","undefined","resolved","signal","xmppPassword","hasResolved","xmppPasswordPresent","restRoomsPromise","c","getRoomsStanza","e","getChatsPrivateStoreRequestStanza","roomCount","Object","keys","getState","rooms","length","qos","historyQoS","activeRoomJID","defaultRoomJids","defaultRooms","map","r","jid","filter","Boolean","selectedRoomJid","concurrency","stagedPreloadConcurrency","pageSize","stagedPreloadFirstPassSize","roomLimit","preloadTopKRooms","warn","message","status","response","data","abort","log","scheduleReconnect","prev","sub","addEventListener","next","state","flushLastViewedToPrivateStoreStanza","addListener","disconnect","suppressReconnect","Provider","value","useXmppClient","context","Error","emitXmppLogout","emit"],"sourceRoot":"../../../src","sources":["context/xmppProvider.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAEVC,aAAa,EACbC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,SAASC,QAAQ,EAAEC,kBAAkB,QAAQ,cAAc;AAC3D,OAAOC,UAAU,MAAM,0BAA0B;AAOjD,SACEC,kBAAkB,EAClBC,0BAA0B,EAC1BC,oBAAoB,EACpBC,mBAAmB,EACnBC,sBAAsB,QACjB,yBAAyB;AAChC,SACEC,wBAAwB,EACxBC,yBAAyB,QACpB,sCAAsC;AAC7C,SAASC,qBAAqB,QAAQ,kCAAkC;AACxE,SAASC,QAAQ,IAAIC,oBAAoB,QAAQ,sCAAsC;AACvF,SA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,CACW,CAAC;AAE3B,CAAC;AAED,OAAO,MAAMwG,aAAa,GAAGA,CAAA,KAAM;EACjC,MAAMC,OAAO,GAAG1I,UAAU,CAAC8B,WAAW,CAAC;EACvC,IAAI,CAAC4G,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CAAC,mDAAmD,CAAC;EACtE;EACA,OAAOD,OAAO;AAChB,CAAC;;AAED;AACA,OAAO,SAASE,cAAcA,CAAA,EAAG;EAC/BvI,kBAAkB,CAACwI,IAAI,CAAC9G,YAAY,CAAC;AACvC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","createContext","useCallback","useContext","useEffect","useMemo","useRef","useState","AppState","DeviceEventEmitter","NetInfo","XmppClient","refreshTokens","buildXmppClientKey","getGlobalXmppClient","getReusableXmppClientByKey","isXmppClientReusable","setGlobalXmppClient","withXmppClientInitLock","applyResolvedUserToStore","refreshUserCredentialsForXmpp","resolveInitBeforeLoadUser","ensureScopedChatCache","getRooms","prefetchRoomsViaRest","allRoomPresences","store","logout","setStoreClient","setLogoutState","setVisibleRoom","clearVisibleRoom","setLastViewedTimestamp","deleteRoomMessage","runHistoryPreloadScheduler","asyncLocalStorage","localStorageConstants","clearPersistedState","pushLog","devPushLog","jsx","_jsx","XmppContext","LOGOUT_EVENT","XmppProvider","children","config","isVisible","client","setClient","providerBootstrapStatus","setProviderBootstrapStatus","initMode","initBeforeLoad","lastCredsRef","completedBootstrapKeyRef","inflightBootstrapKeyRef","credentialsProvider","customRefresh","refreshFunction","result","accessToken","dispatch","token","refreshToken","err","fresh","catch","username","xmppUsername","defaultWallet","walletAddress","password","xmppPassword","u","getState","chatSettingStore","user","jwtLogin","enabled","userLogin","customLogin","initBeforeLoadAuth","myEndpoint","initializeClient","xmppSettings","settings","key","reusable","current","created","prevGlobal","close","newClient","setCredentialsProvider","waitForOnline","console","error","setOnOnline","underlying","e","getChatsPrivateStoreRequestStanza","abortController","AbortController","cancelled","MAX_BOOTSTRAP_ATTEMPTS","bootstrapAttempt","BOOTSTRAP_BUDGET_MS","reachedReady","budgetTimer","setTimeout","abort","clearBudget","clearTimeout","run","explicitUser","appId","baseUrl","devServer","join","mode","clearStoreBeforeInit","ETHORA_USER","remove","undefined","resolved","signal","hasResolved","xmppPasswordPresent","restRoomsPromise","c","getRoomsStanza","roomCount","Object","keys","rooms","length","qos","historyQoS","activeRoomJID","defaultRoomJids","defaultRooms","map","r","jid","filter","Boolean","selectedRoomJid","concurrency","stagedPreloadConcurrency","pageSize","stagedPreloadFirstPassSize","roomLimit","preloadTopKRooms","warn","aborted","backoff","Math","min","message","status","response","data","id","setInterval","currentState","suppressReconnect","forceReconnect","clearInterval","visibleBeforeBackground","sub","addEventListener","next","roomJID","state","visibleRoomJID","chatJID","timestamp","Date","now","messageId","flushLastViewedToPrivateStoreStanza","unsub","reachable","isConnected","isInternetReachable","addListener","disconnect","Provider","value","useXmppClient","context","Error","candidates","live","find","emitXmppLogout","emit"],"sourceRoot":"../../../src","sources":["context/xmppProvider.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAEVC,aAAa,EACbC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,SAASC,QAAQ,EAAEC,kBAAkB,QAAQ,cAAc;AAC3D,OAAOC,OAAO,MAAM,iCAAiC;AACrD,OAAOC,UAAU,MAEV,0BAA0B;AACjC,SAASC,aAAa,QAAQ,gCAAgC;AAO9D,SACEC,kBAAkB,EAClBC,mBAAmB,EACnBC,0BAA0B,EAC1BC,oBAAoB,EACpBC,mBAAmB,EACnBC,sBAAsB,QACjB,yBAAyB;AAChC,SACEC,wBAAwB,EACxBC,6BAA6B,EAC7BC,yBAAyB,QACpB,sCAAsC;AAC7C,SAASC,qBAAqB,QAAQ,kCAAkC;AACxE,SAASC,QAAQ,IAAIC,oBAAoB,QAAQ,sCAAsC;AACvF,SAASC,gBAAgB,QAAQ,0CAA0C;AAC3E,SAASC,KAAK,QAAQ,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AU,CAACuC,WAAW,CAAC;EACvC,IAAI,CAACqJ,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CAAC,mDAAmD,CAAC;EACtE;EACA,IAAI,CAACD,OAAO,CAAC/I,MAAM,EAAE;IACnB,MAAMiJ,UAAgD,GAAG,CACvDnL,mBAAmB,CAAC,CAAC,EACrBY,KAAK,CAACiD,QAAQ,CAAC,CAAC,EAAEC,gBAAgB,EAAE5B,MAAM,CAC3C;IACD,MAAMkJ,IAAI,GAAGD,UAAU,CAACE,IAAI,CACzBjE,CAAC,IAAKA,CAAC,IAAKA,CAAC,CAAS8B,MAAM,KAAK,QACpC,CAAC;IACD,IAAIkC,IAAI,EAAE;MACR,OAAO;QAAE,GAAGH,OAAO;QAAE/I,MAAM,EAAEkJ;MAAK,CAAC;IACrC;EACF;EACA,OAAOH,OAAO;AAChB,CAAC;;AAED;AACA,OAAO,SAASK,cAAcA,CAAA,EAAG;EAC/B3L,kBAAkB,CAAC4L,IAAI,CAAC1J,YAAY,CAAC;AACvC","ignoreList":[]}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
/** @format */
|
|
4
4
|
|
|
5
5
|
import { setCurrentRoom } from '../roomStore/roomsSlice';
|
|
6
|
+
import { normalizeRoomJid } from './normalizeRoomJid';
|
|
6
7
|
export const chatAutoEnterer = ({
|
|
7
8
|
roomJID,
|
|
8
9
|
wasAutoSelected,
|
|
@@ -14,14 +15,8 @@ export const chatAutoEnterer = ({
|
|
|
14
15
|
wasAutoSelected
|
|
15
16
|
});
|
|
16
17
|
if (roomJID) {
|
|
17
|
-
// If roomJID is already a full JID, use it directly
|
|
18
|
-
// Otherwise, construct it from chatId if needed
|
|
19
18
|
const conferenceDomain = config.xmppSettings?.conference ?? '';
|
|
20
|
-
|
|
21
|
-
if (!roomJID.includes('@') && conferenceDomain) {
|
|
22
|
-
finalRoomJID = `${roomJID}@${conferenceDomain}`;
|
|
23
|
-
console.log('🟡 chatAutoEnterer: Constructed roomJID', finalRoomJID);
|
|
24
|
-
}
|
|
19
|
+
const finalRoomJID = normalizeRoomJid(roomJID, conferenceDomain);
|
|
25
20
|
console.log('🟡 chatAutoEnterer: Setting current room', finalRoomJID);
|
|
26
21
|
dispatch(setCurrentRoom({
|
|
27
22
|
roomJID: finalRoomJID
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["setCurrentRoom","chatAutoEnterer","roomJID","wasAutoSelected","config","dispatch","console","log","conferenceDomain","xmppSettings","conference","finalRoomJID"
|
|
1
|
+
{"version":3,"names":["setCurrentRoom","normalizeRoomJid","chatAutoEnterer","roomJID","wasAutoSelected","config","dispatch","console","log","conferenceDomain","xmppSettings","conference","finalRoomJID"],"sourceRoot":"../../../src","sources":["helpers/chatAutoEnterer.ts"],"mappings":";;AAAA;;AAGA,SAASA,cAAc,QAAQ,yBAAyB;AACxD,SAASC,gBAAgB,QAAQ,oBAAoB;AAerD,OAAO,MAAMC,eAAe,GAAGA,CAAC;EAC9BC,OAAO;EACPC,eAAe;EACfC,MAAM;EACNC;AACc,CAAC,KAAW;EAC1BC,OAAO,CAACC,GAAG,CAAC,4BAA4B,EAAE;IAAEL,OAAO;IAAEC;EAAgB,CAAC,CAAC;EAEvE,IAAID,OAAO,EAAE;IACX,MAAMM,gBAAgB,GAAGJ,MAAM,CAACK,YAAY,EAAEC,UAAU,IAAI,EAAE;IAC9D,MAAMC,YAAY,GAAGX,gBAAgB,CAACE,OAAO,EAAEM,gBAAgB,CAAC;IAEhEF,OAAO,CAACC,GAAG,CAAC,0CAA0C,EAAEI,YAAY,CAAC;IACrEN,QAAQ,CAACN,cAAc,CAAC;MAAEG,OAAO,EAAES;IAAa,CAAC,CAAC,CAAC;IACnD;EACF;EAEAL,OAAO,CAACC,GAAG,CAAC,yCAAyC,CAAC;EACtD;EACA;AACF,CAAC","ignoreList":[]}
|
|
@@ -4,7 +4,10 @@ import { AppState } from 'react-native';
|
|
|
4
4
|
import { store } from '../roomStore';
|
|
5
5
|
import { applyRoomsPreloadBatch } from '../roomStore/roomsSlice';
|
|
6
6
|
const DEFAULT_CONCURRENCY = 3;
|
|
7
|
-
|
|
7
|
+
// Fetch the most recent ~20 on re-entry (mirrors web). A larger first page
|
|
8
|
+
// also means more id-overlap with cache, so the merge in
|
|
9
|
+
// `mergeHistoryIntoCache` rarely has to fall back to clear-and-replace.
|
|
10
|
+
const DEFAULT_PAGE_SIZE = 20;
|
|
8
11
|
const DEFAULT_RETRY_LIMIT = 2;
|
|
9
12
|
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
|
|
10
13
|
const messageTimestamp = m => {
|