@ethora/chat-component-rn 26.9.1 → 26.10.0
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 +30 -0
- package/README.md +19 -0
- package/lib/commonjs/assets/icons.js +2 -2
- package/lib/commonjs/assets/icons.js.map +1 -1
- package/lib/commonjs/components/Header/HeaderRoomList.js +22 -6
- package/lib/commonjs/components/Header/HeaderRoomList.js.map +1 -1
- package/lib/commonjs/components/InputComponents/Search.js +38 -1
- package/lib/commonjs/components/InputComponents/Search.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ArchivedMessageCard.js +166 -0
- package/lib/commonjs/components/MainComponents/ArchivedMessageCard.js.map +1 -0
- package/lib/commonjs/components/MainComponents/ChatHeader.js +22 -5
- package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatRoom.js +56 -25
- package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatWrapper.js +31 -1
- package/lib/commonjs/components/MainComponents/ChatWrapper.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MediaMessage.js +18 -3
- package/lib/commonjs/components/MainComponents/MediaMessage.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MessageList.js +739 -42
- package/lib/commonjs/components/MainComponents/MessageList.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MessageSearchButton.js +58 -0
- package/lib/commonjs/components/MainComponents/MessageSearchButton.js.map +1 -0
- package/lib/commonjs/components/MainComponents/ReduxWrapper.js +15 -6
- package/lib/commonjs/components/MainComponents/ReduxWrapper.js.map +1 -1
- package/lib/commonjs/components/MainComponents/RoomList.js +110 -1
- package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
- package/lib/commonjs/components/Menu/HeaderRoomListMenu.js +14 -3
- package/lib/commonjs/components/Menu/HeaderRoomListMenu.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/BubbleHighlight.js +112 -0
- package/lib/commonjs/components/MessageBubble/BubbleHighlight.js.map +1 -0
- package/lib/commonjs/components/MessageBubble/Message.js +169 -125
- package/lib/commonjs/components/MessageBubble/Message.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/MessageInteractions.js +98 -78
- package/lib/commonjs/components/MessageBubble/MessageInteractions.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/messageMenuLayout.js +50 -0
- package/lib/commonjs/components/MessageBubble/messageMenuLayout.js.map +1 -0
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +73 -37
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/MessageSearchModal/MessageHitResults.js +253 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/MessageHitResults.js.map +1 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/MessageSearchModal.js +488 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/MessageSearchModal.js.map +1 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/openHit.js +51 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/openHit.js.map +1 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/resolveSender.js +47 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/resolveSender.js.map +1 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/searchFilters.js +83 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/searchFilters.js.map +1 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/snippet.js +61 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/snippet.js.map +1 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/useMessageSearch.js +136 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/useMessageSearch.js.map +1 -0
- package/lib/commonjs/components/Modals/PublicChatsModal/PublicChatsModal.js +306 -0
- package/lib/commonjs/components/Modals/PublicChatsModal/PublicChatsModal.js.map +1 -0
- package/lib/commonjs/components/Modals/PublicChatsModal/publicChatsLogic.js +36 -0
- package/lib/commonjs/components/Modals/PublicChatsModal/publicChatsLogic.js.map +1 -0
- package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js +8 -1
- package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/ChatRoomItem.js +13 -2
- package/lib/commonjs/components/RoomComponents/ChatRoomItem.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/SwipeableRoomRow.js +38 -6
- package/lib/commonjs/components/RoomComponents/SwipeableRoomRow.js.map +1 -1
- package/lib/commonjs/components/Thread/ThreadHeader.js +3 -1
- package/lib/commonjs/components/Thread/ThreadHeader.js.map +1 -1
- package/lib/commonjs/components/Thread/ThreadWrapper.js +90 -10
- package/lib/commonjs/components/Thread/ThreadWrapper.js.map +1 -1
- package/lib/commonjs/components/styled/AudioDecoderHost.js +338 -0
- package/lib/commonjs/components/styled/AudioDecoderHost.js.map +1 -0
- package/lib/commonjs/components/styled/AudioMessage.js +493 -420
- package/lib/commonjs/components/styled/AudioMessage.js.map +1 -1
- package/lib/commonjs/components/styled/SendInput.js +31 -5
- package/lib/commonjs/components/styled/SendInput.js.map +1 -1
- package/lib/commonjs/context/MessageNotificationContext.js +14 -4
- package/lib/commonjs/context/MessageNotificationContext.js.map +1 -1
- package/lib/commonjs/context/xmppProvider.js +41 -77
- package/lib/commonjs/context/xmppProvider.js.map +1 -1
- package/lib/commonjs/helpers/audioWaveform.js +165 -0
- package/lib/commonjs/helpers/audioWaveform.js.map +1 -0
- package/lib/commonjs/helpers/backgroundJoinSweep.js +36 -0
- package/lib/commonjs/helpers/backgroundJoinSweep.js.map +1 -0
- package/lib/commonjs/helpers/bubbleHighlight.js +44 -0
- package/lib/commonjs/helpers/bubbleHighlight.js.map +1 -0
- package/lib/commonjs/helpers/checkUniqueUsers.js +14 -12
- package/lib/commonjs/helpers/checkUniqueUsers.js.map +1 -1
- package/lib/commonjs/helpers/constants/MODAL_COMPONENTS.js +5 -1
- package/lib/commonjs/helpers/constants/MODAL_COMPONENTS.js.map +1 -1
- package/lib/commonjs/helpers/constants/MODAL_TYPES.js +3 -1
- package/lib/commonjs/helpers/constants/MODAL_TYPES.js.map +1 -1
- package/lib/commonjs/helpers/createRoomFromApi.js +40 -3
- package/lib/commonjs/helpers/createRoomFromApi.js.map +1 -1
- package/lib/commonjs/helpers/dedupeMembers.js +34 -0
- package/lib/commonjs/helpers/dedupeMembers.js.map +1 -0
- package/lib/commonjs/helpers/ethoraLogger.js +56 -0
- package/lib/commonjs/helpers/ethoraLogger.js.map +1 -0
- package/lib/commonjs/helpers/getUnnamedUsers.js +9 -4
- package/lib/commonjs/helpers/getUnnamedUsers.js.map +1 -1
- package/lib/commonjs/helpers/historyPreloadConfig.js +44 -0
- package/lib/commonjs/helpers/historyPreloadConfig.js.map +1 -0
- package/lib/commonjs/helpers/historyPreloadScheduler.js +372 -137
- package/lib/commonjs/helpers/historyPreloadScheduler.js.map +1 -1
- package/lib/commonjs/helpers/initRoomsPresence.js +17 -5
- package/lib/commonjs/helpers/initRoomsPresence.js.map +1 -1
- package/lib/commonjs/helpers/insertMessageWithDelimiter.js +5 -0
- package/lib/commonjs/helpers/insertMessageWithDelimiter.js.map +1 -1
- package/lib/commonjs/helpers/isLikelyMucJid.js +67 -0
- package/lib/commonjs/helpers/isLikelyMucJid.js.map +1 -0
- package/lib/commonjs/helpers/isMessageSearchEnabled.js +18 -0
- package/lib/commonjs/helpers/isMessageSearchEnabled.js.map +1 -0
- package/lib/commonjs/helpers/joiningRoom.js +14 -0
- package/lib/commonjs/helpers/joiningRoom.js.map +1 -0
- package/lib/commonjs/helpers/jumpThread.js +100 -0
- package/lib/commonjs/helpers/jumpThread.js.map +1 -0
- package/lib/commonjs/helpers/jumpToMessage.js +58 -0
- package/lib/commonjs/helpers/jumpToMessage.js.map +1 -0
- package/lib/commonjs/helpers/jumpWindow.js +187 -0
- package/lib/commonjs/helpers/jumpWindow.js.map +1 -0
- package/lib/commonjs/helpers/loadRoomHistory.js +75 -0
- package/lib/commonjs/helpers/loadRoomHistory.js.map +1 -0
- package/lib/commonjs/helpers/notificationPolicy.js +77 -0
- package/lib/commonjs/helpers/notificationPolicy.js.map +1 -0
- package/lib/commonjs/helpers/openRoomAtMessage.js +47 -0
- package/lib/commonjs/helpers/openRoomAtMessage.js.map +1 -0
- package/lib/commonjs/helpers/openThreadForJump.js +72 -0
- package/lib/commonjs/helpers/openThreadForJump.js.map +1 -0
- package/lib/commonjs/helpers/parseMessageReference.js +27 -8
- package/lib/commonjs/helpers/parseMessageReference.js.map +1 -1
- package/lib/commonjs/helpers/publicChatsEntry.js +17 -0
- package/lib/commonjs/helpers/publicChatsEntry.js.map +1 -0
- package/lib/commonjs/helpers/roomActivityScore.js +37 -0
- package/lib/commonjs/helpers/roomActivityScore.js.map +1 -0
- package/lib/commonjs/helpers/roomUserCount.js +36 -0
- package/lib/commonjs/helpers/roomUserCount.js.map +1 -0
- package/lib/commonjs/helpers/runConfiguredHistoryPreload.js +68 -0
- package/lib/commonjs/helpers/runConfiguredHistoryPreload.js.map +1 -0
- package/lib/commonjs/helpers/sessionAppId.js +24 -0
- package/lib/commonjs/helpers/sessionAppId.js.map +1 -0
- package/lib/commonjs/helpers/timestamp.js +43 -0
- package/lib/commonjs/helpers/timestamp.js.map +1 -0
- package/lib/commonjs/helpers/userResolver.js +517 -0
- package/lib/commonjs/helpers/userResolver.js.map +1 -0
- package/lib/commonjs/helpers/xmppIdShape.js +52 -0
- package/lib/commonjs/helpers/xmppIdShape.js.map +1 -0
- package/lib/commonjs/hooks/useChatWrapperInit.js +27 -5
- package/lib/commonjs/hooks/useChatWrapperInit.js.map +1 -1
- package/lib/commonjs/hooks/useHeapSender.js +54 -3
- package/lib/commonjs/hooks/useHeapSender.js.map +1 -1
- package/lib/commonjs/hooks/useJumpToMessage.js +411 -0
- package/lib/commonjs/hooks/useJumpToMessage.js.map +1 -0
- package/lib/commonjs/hooks/useMessageLoaderQueue.js +32 -5
- package/lib/commonjs/hooks/useMessageLoaderQueue.js.map +1 -1
- package/lib/commonjs/hooks/useMessageQueue.js +13 -5
- package/lib/commonjs/hooks/useMessageQueue.js.map +1 -1
- package/lib/commonjs/hooks/useRoomDirectory.js +29 -0
- package/lib/commonjs/hooks/useRoomDirectory.js.map +1 -0
- package/lib/commonjs/hooks/useRoomInitialization.js +27 -5
- package/lib/commonjs/hooks/useRoomInitialization.js.map +1 -1
- package/lib/commonjs/hooks/useRoomMute.js +62 -0
- package/lib/commonjs/hooks/useRoomMute.js.map +1 -0
- package/lib/commonjs/hooks/useRoomState.js +3 -1
- package/lib/commonjs/hooks/useRoomState.js.map +1 -1
- package/lib/commonjs/hooks/useSendMessage.js +13 -3
- package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
- package/lib/commonjs/i18n/strings.js +288 -6
- package/lib/commonjs/i18n/strings.js.map +1 -1
- package/lib/commonjs/networking/api-requests/messageSearch.api.js +87 -0
- package/lib/commonjs/networking/api-requests/messageSearch.api.js.map +1 -0
- package/lib/commonjs/networking/api-requests/publicChats.api.js +48 -0
- package/lib/commonjs/networking/api-requests/publicChats.api.js.map +1 -0
- package/lib/commonjs/networking/api-requests/roomMembers.api.js +253 -4
- package/lib/commonjs/networking/api-requests/roomMembers.api.js.map +1 -1
- package/lib/commonjs/networking/api-requests/rooms.api.js +48 -12
- package/lib/commonjs/networking/api-requests/rooms.api.js.map +1 -1
- package/lib/commonjs/networking/api-requests/xmppToken.api.js +71 -0
- package/lib/commonjs/networking/api-requests/xmppToken.api.js.map +1 -0
- package/lib/commonjs/networking/ethoraEvents.js +227 -0
- package/lib/commonjs/networking/ethoraEvents.js.map +1 -0
- package/lib/commonjs/networking/stanzaHandlers.js +153 -16
- package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
- package/lib/commonjs/networking/xmpp/allRoomPresences.xmpp.js +124 -3
- package/lib/commonjs/networking/xmpp/allRoomPresences.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/getHistory.xmpp.js +319 -35
- package/lib/commonjs/networking/xmpp/getHistory.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/handleStanzas.xmpp.js +7 -0
- package/lib/commonjs/networking/xmpp/handleStanzas.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/historyCursor.js +101 -0
- package/lib/commonjs/networking/xmpp/historyCursor.js.map +1 -0
- package/lib/commonjs/networking/xmpp/mamQueryIds.js +17 -0
- package/lib/commonjs/networking/xmpp/mamQueryIds.js.map +1 -0
- package/lib/commonjs/networking/xmpp/mamRouter.js +24 -9
- package/lib/commonjs/networking/xmpp/mamRouter.js.map +1 -1
- package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js +70 -65
- package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/roomJoinSweep.js +389 -0
- package/lib/commonjs/networking/xmpp/roomJoinSweep.js.map +1 -0
- package/lib/commonjs/networking/xmpp/sendMediaMessage.xmpp.js +0 -1
- package/lib/commonjs/networking/xmpp/sendMediaMessage.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/sendTextMessage.xmpp.js +0 -1
- package/lib/commonjs/networking/xmpp/sendTextMessage.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js +0 -1
- package/lib/commonjs/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmppClient.js +269 -41
- package/lib/commonjs/networking/xmppClient.js.map +1 -1
- package/lib/commonjs/networking/xmppCredentials.js +80 -0
- package/lib/commonjs/networking/xmppCredentials.js.map +1 -0
- package/lib/commonjs/roomStore/Middleware/jumpThreadMiddleware.js +158 -0
- package/lib/commonjs/roomStore/Middleware/jumpThreadMiddleware.js.map +1 -0
- package/lib/commonjs/roomStore/Middleware/reactionsMiddleware.js +6 -0
- package/lib/commonjs/roomStore/Middleware/reactionsMiddleware.js.map +1 -1
- package/lib/commonjs/roomStore/Middleware/unreadMidlleware.js +45 -7
- package/lib/commonjs/roomStore/Middleware/unreadMidlleware.js.map +1 -1
- package/lib/commonjs/roomStore/chatSettingsSlice.js +15 -1
- package/lib/commonjs/roomStore/chatSettingsSlice.js.map +1 -1
- package/lib/commonjs/roomStore/index.js +13 -3
- package/lib/commonjs/roomStore/index.js.map +1 -1
- package/lib/commonjs/roomStore/persistence.js +48 -1
- package/lib/commonjs/roomStore/persistence.js.map +1 -1
- package/lib/commonjs/roomStore/roomsSlice.js +474 -60
- package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
- package/lib/commonjs/roomStore/safeKey.js +44 -0
- package/lib/commonjs/roomStore/safeKey.js.map +1 -0
- package/lib/commonjs/roomStore/usersSetCap.js +37 -0
- package/lib/commonjs/roomStore/usersSetCap.js.map +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/assets/icons.js +1 -1
- package/lib/module/assets/icons.js.map +1 -1
- package/lib/module/components/Header/HeaderRoomList.js +23 -7
- package/lib/module/components/Header/HeaderRoomList.js.map +1 -1
- package/lib/module/components/InputComponents/Search.js +39 -2
- package/lib/module/components/InputComponents/Search.js.map +1 -1
- package/lib/module/components/MainComponents/ArchivedMessageCard.js +161 -0
- package/lib/module/components/MainComponents/ArchivedMessageCard.js.map +1 -0
- package/lib/module/components/MainComponents/ChatHeader.js +22 -5
- package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/module/components/MainComponents/ChatRoom.js +57 -26
- package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/module/components/MainComponents/ChatWrapper.js +31 -1
- package/lib/module/components/MainComponents/ChatWrapper.js.map +1 -1
- package/lib/module/components/MainComponents/MediaMessage.js +18 -3
- package/lib/module/components/MainComponents/MediaMessage.js.map +1 -1
- package/lib/module/components/MainComponents/MessageList.js +740 -42
- package/lib/module/components/MainComponents/MessageList.js.map +1 -1
- package/lib/module/components/MainComponents/MessageSearchButton.js +48 -0
- package/lib/module/components/MainComponents/MessageSearchButton.js.map +1 -0
- package/lib/module/components/MainComponents/ReduxWrapper.js +15 -7
- package/lib/module/components/MainComponents/ReduxWrapper.js.map +1 -1
- package/lib/module/components/MainComponents/RoomList.js +111 -2
- package/lib/module/components/MainComponents/RoomList.js.map +1 -1
- package/lib/module/components/Menu/HeaderRoomListMenu.js +15 -4
- package/lib/module/components/Menu/HeaderRoomListMenu.js.map +1 -1
- package/lib/module/components/MessageBubble/BubbleHighlight.js +106 -0
- package/lib/module/components/MessageBubble/BubbleHighlight.js.map +1 -0
- package/lib/module/components/MessageBubble/Message.js +172 -127
- package/lib/module/components/MessageBubble/Message.js.map +1 -1
- package/lib/module/components/MessageBubble/MessageInteractions.js +98 -78
- package/lib/module/components/MessageBubble/MessageInteractions.js.map +1 -1
- package/lib/module/components/MessageBubble/messageMenuLayout.js +45 -0
- package/lib/module/components/MessageBubble/messageMenuLayout.js.map +1 -0
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +74 -38
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/module/components/Modals/MessageSearchModal/MessageHitResults.js +243 -0
- package/lib/module/components/Modals/MessageSearchModal/MessageHitResults.js.map +1 -0
- package/lib/module/components/Modals/MessageSearchModal/MessageSearchModal.js +482 -0
- package/lib/module/components/Modals/MessageSearchModal/MessageSearchModal.js.map +1 -0
- package/lib/module/components/Modals/MessageSearchModal/openHit.js +45 -0
- package/lib/module/components/Modals/MessageSearchModal/openHit.js.map +1 -0
- package/lib/module/components/Modals/MessageSearchModal/resolveSender.js +41 -0
- package/lib/module/components/Modals/MessageSearchModal/resolveSender.js.map +1 -0
- package/lib/module/components/Modals/MessageSearchModal/searchFilters.js +74 -0
- package/lib/module/components/Modals/MessageSearchModal/searchFilters.js.map +1 -0
- package/lib/module/components/Modals/MessageSearchModal/snippet.js +57 -0
- package/lib/module/components/Modals/MessageSearchModal/snippet.js.map +1 -0
- package/lib/module/components/Modals/MessageSearchModal/useMessageSearch.js +131 -0
- package/lib/module/components/Modals/MessageSearchModal/useMessageSearch.js.map +1 -0
- package/lib/module/components/Modals/PublicChatsModal/PublicChatsModal.js +300 -0
- package/lib/module/components/Modals/PublicChatsModal/PublicChatsModal.js.map +1 -0
- package/lib/module/components/Modals/PublicChatsModal/publicChatsLogic.js +30 -0
- package/lib/module/components/Modals/PublicChatsModal/publicChatsLogic.js.map +1 -0
- package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js +8 -1
- package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
- package/lib/module/components/RoomComponents/ChatRoomItem.js +14 -3
- package/lib/module/components/RoomComponents/ChatRoomItem.js.map +1 -1
- package/lib/module/components/RoomComponents/SwipeableRoomRow.js +39 -7
- package/lib/module/components/RoomComponents/SwipeableRoomRow.js.map +1 -1
- package/lib/module/components/Thread/ThreadHeader.js +3 -1
- package/lib/module/components/Thread/ThreadHeader.js.map +1 -1
- package/lib/module/components/Thread/ThreadWrapper.js +89 -9
- package/lib/module/components/Thread/ThreadWrapper.js.map +1 -1
- package/lib/module/components/styled/AudioDecoderHost.js +332 -0
- package/lib/module/components/styled/AudioDecoderHost.js.map +1 -0
- package/lib/module/components/styled/AudioMessage.js +495 -422
- package/lib/module/components/styled/AudioMessage.js.map +1 -1
- package/lib/module/components/styled/SendInput.js +32 -6
- package/lib/module/components/styled/SendInput.js.map +1 -1
- package/lib/module/context/MessageNotificationContext.js +15 -5
- package/lib/module/context/MessageNotificationContext.js.map +1 -1
- package/lib/module/context/xmppProvider.js +42 -78
- package/lib/module/context/xmppProvider.js.map +1 -1
- package/lib/module/helpers/audioWaveform.js +153 -0
- package/lib/module/helpers/audioWaveform.js.map +1 -0
- package/lib/module/helpers/backgroundJoinSweep.js +30 -0
- package/lib/module/helpers/backgroundJoinSweep.js.map +1 -0
- package/lib/module/helpers/bubbleHighlight.js +38 -0
- package/lib/module/helpers/bubbleHighlight.js.map +1 -0
- package/lib/module/helpers/checkUniqueUsers.js +15 -13
- package/lib/module/helpers/checkUniqueUsers.js.map +1 -1
- package/lib/module/helpers/constants/MODAL_COMPONENTS.js +5 -1
- package/lib/module/helpers/constants/MODAL_COMPONENTS.js.map +1 -1
- package/lib/module/helpers/constants/MODAL_TYPES.js +3 -1
- package/lib/module/helpers/constants/MODAL_TYPES.js.map +1 -1
- package/lib/module/helpers/createRoomFromApi.js +37 -3
- package/lib/module/helpers/createRoomFromApi.js.map +1 -1
- package/lib/module/helpers/dedupeMembers.js +28 -0
- package/lib/module/helpers/dedupeMembers.js.map +1 -0
- package/lib/module/helpers/ethoraLogger.js +52 -0
- package/lib/module/helpers/ethoraLogger.js.map +1 -0
- package/lib/module/helpers/getUnnamedUsers.js +9 -4
- package/lib/module/helpers/getUnnamedUsers.js.map +1 -1
- package/lib/module/helpers/historyPreloadConfig.js +39 -0
- package/lib/module/helpers/historyPreloadConfig.js.map +1 -0
- package/lib/module/helpers/historyPreloadScheduler.js +368 -134
- package/lib/module/helpers/historyPreloadScheduler.js.map +1 -1
- package/lib/module/helpers/initRoomsPresence.js +18 -5
- package/lib/module/helpers/initRoomsPresence.js.map +1 -1
- package/lib/module/helpers/insertMessageWithDelimiter.js +5 -0
- package/lib/module/helpers/insertMessageWithDelimiter.js.map +1 -1
- package/lib/module/helpers/isLikelyMucJid.js +60 -0
- package/lib/module/helpers/isLikelyMucJid.js.map +1 -0
- package/lib/module/helpers/isMessageSearchEnabled.js +13 -0
- package/lib/module/helpers/isMessageSearchEnabled.js.map +1 -0
- package/lib/module/helpers/joiningRoom.js +9 -0
- package/lib/module/helpers/joiningRoom.js.map +1 -0
- package/lib/module/helpers/jumpThread.js +83 -0
- package/lib/module/helpers/jumpThread.js.map +1 -0
- package/lib/module/helpers/jumpToMessage.js +52 -0
- package/lib/module/helpers/jumpToMessage.js.map +1 -0
- package/lib/module/helpers/jumpWindow.js +177 -0
- package/lib/module/helpers/jumpWindow.js.map +1 -0
- package/lib/module/helpers/loadRoomHistory.js +69 -0
- package/lib/module/helpers/loadRoomHistory.js.map +1 -0
- package/lib/module/helpers/notificationPolicy.js +70 -0
- package/lib/module/helpers/notificationPolicy.js.map +1 -0
- package/lib/module/helpers/openRoomAtMessage.js +41 -0
- package/lib/module/helpers/openRoomAtMessage.js.map +1 -0
- package/lib/module/helpers/openThreadForJump.js +68 -0
- package/lib/module/helpers/openThreadForJump.js.map +1 -0
- package/lib/module/helpers/parseMessageReference.js +26 -6
- package/lib/module/helpers/parseMessageReference.js.map +1 -1
- package/lib/module/helpers/publicChatsEntry.js +12 -0
- package/lib/module/helpers/publicChatsEntry.js.map +1 -0
- package/lib/module/helpers/roomActivityScore.js +30 -0
- package/lib/module/helpers/roomActivityScore.js.map +1 -0
- package/lib/module/helpers/roomUserCount.js +29 -0
- package/lib/module/helpers/roomUserCount.js.map +1 -0
- package/lib/module/helpers/runConfiguredHistoryPreload.js +63 -0
- package/lib/module/helpers/runConfiguredHistoryPreload.js.map +1 -0
- package/lib/module/helpers/sessionAppId.js +20 -0
- package/lib/module/helpers/sessionAppId.js.map +1 -0
- package/lib/module/helpers/timestamp.js +37 -0
- package/lib/module/helpers/timestamp.js.map +1 -0
- package/lib/module/helpers/userResolver.js +503 -0
- package/lib/module/helpers/userResolver.js.map +1 -0
- package/lib/module/helpers/xmppIdShape.js +46 -0
- package/lib/module/helpers/xmppIdShape.js.map +1 -0
- package/lib/module/hooks/useChatWrapperInit.js +16 -5
- package/lib/module/hooks/useChatWrapperInit.js.map +1 -1
- package/lib/module/hooks/useHeapSender.js +54 -3
- package/lib/module/hooks/useHeapSender.js.map +1 -1
- package/lib/module/hooks/useJumpToMessage.js +389 -0
- package/lib/module/hooks/useJumpToMessage.js.map +1 -0
- package/lib/module/hooks/useMessageLoaderQueue.js +32 -5
- package/lib/module/hooks/useMessageLoaderQueue.js.map +1 -1
- package/lib/module/hooks/useMessageQueue.js +13 -5
- package/lib/module/hooks/useMessageQueue.js.map +1 -1
- package/lib/module/hooks/useRoomDirectory.js +24 -0
- package/lib/module/hooks/useRoomDirectory.js.map +1 -0
- package/lib/module/hooks/useRoomInitialization.js +29 -7
- package/lib/module/hooks/useRoomInitialization.js.map +1 -1
- package/lib/module/hooks/useRoomMute.js +58 -0
- package/lib/module/hooks/useRoomMute.js.map +1 -0
- package/lib/module/hooks/useRoomState.js +3 -1
- package/lib/module/hooks/useRoomState.js.map +1 -1
- package/lib/module/hooks/useSendMessage.js +13 -3
- package/lib/module/hooks/useSendMessage.js.map +1 -1
- package/lib/module/i18n/strings.js +288 -6
- package/lib/module/i18n/strings.js.map +1 -1
- package/lib/module/networking/api-requests/messageSearch.api.js +81 -0
- package/lib/module/networking/api-requests/messageSearch.api.js.map +1 -0
- package/lib/module/networking/api-requests/publicChats.api.js +43 -0
- package/lib/module/networking/api-requests/publicChats.api.js.map +1 -0
- package/lib/module/networking/api-requests/roomMembers.api.js +248 -4
- package/lib/module/networking/api-requests/roomMembers.api.js.map +1 -1
- package/lib/module/networking/api-requests/rooms.api.js +48 -12
- package/lib/module/networking/api-requests/rooms.api.js.map +1 -1
- package/lib/module/networking/api-requests/xmppToken.api.js +66 -0
- package/lib/module/networking/api-requests/xmppToken.api.js.map +1 -0
- package/lib/module/networking/ethoraEvents.js +220 -0
- package/lib/module/networking/ethoraEvents.js.map +1 -0
- package/lib/module/networking/stanzaHandlers.js +155 -18
- package/lib/module/networking/stanzaHandlers.js.map +1 -1
- package/lib/module/networking/xmpp/allRoomPresences.xmpp.js +125 -3
- package/lib/module/networking/xmpp/allRoomPresences.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/getHistory.xmpp.js +318 -35
- package/lib/module/networking/xmpp/getHistory.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/handleStanzas.xmpp.js +7 -0
- package/lib/module/networking/xmpp/handleStanzas.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/historyCursor.js +95 -0
- package/lib/module/networking/xmpp/historyCursor.js.map +1 -0
- package/lib/module/networking/xmpp/mamQueryIds.js +12 -0
- package/lib/module/networking/xmpp/mamQueryIds.js.map +1 -0
- package/lib/module/networking/xmpp/mamRouter.js +22 -8
- package/lib/module/networking/xmpp/mamRouter.js.map +1 -1
- package/lib/module/networking/xmpp/presenceInRoom.xmpp.js +68 -62
- package/lib/module/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/roomJoinSweep.js +385 -0
- package/lib/module/networking/xmpp/roomJoinSweep.js.map +1 -0
- package/lib/module/networking/xmpp/sendMediaMessage.xmpp.js +0 -1
- package/lib/module/networking/xmpp/sendMediaMessage.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/sendTextMessage.xmpp.js +0 -1
- package/lib/module/networking/xmpp/sendTextMessage.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js +0 -1
- package/lib/module/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js.map +1 -1
- package/lib/module/networking/xmppClient.js +269 -41
- package/lib/module/networking/xmppClient.js.map +1 -1
- package/lib/module/networking/xmppCredentials.js +76 -0
- package/lib/module/networking/xmppCredentials.js.map +1 -0
- package/lib/module/roomStore/Middleware/jumpThreadMiddleware.js +153 -0
- package/lib/module/roomStore/Middleware/jumpThreadMiddleware.js.map +1 -0
- package/lib/module/roomStore/Middleware/reactionsMiddleware.js +6 -0
- package/lib/module/roomStore/Middleware/reactionsMiddleware.js.map +1 -1
- package/lib/module/roomStore/Middleware/unreadMidlleware.js +46 -7
- package/lib/module/roomStore/Middleware/unreadMidlleware.js.map +1 -1
- package/lib/module/roomStore/chatSettingsSlice.js +13 -0
- package/lib/module/roomStore/chatSettingsSlice.js.map +1 -1
- package/lib/module/roomStore/index.js +7 -3
- package/lib/module/roomStore/index.js.map +1 -1
- package/lib/module/roomStore/persistence.js +46 -1
- package/lib/module/roomStore/persistence.js.map +1 -1
- package/lib/module/roomStore/roomsSlice.js +459 -58
- package/lib/module/roomStore/roomsSlice.js.map +1 -1
- package/lib/module/roomStore/safeKey.js +37 -0
- package/lib/module/roomStore/safeKey.js.map +1 -0
- package/lib/module/roomStore/usersSetCap.js +32 -0
- package/lib/module/roomStore/usersSetCap.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/assets/icons.d.ts +4 -0
- package/lib/typescript/assets/icons.d.ts.map +1 -1
- package/lib/typescript/components/Header/HeaderRoomList.d.ts.map +1 -1
- package/lib/typescript/components/InputComponents/Search.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ArchivedMessageCard.d.ts +12 -0
- package/lib/typescript/components/MainComponents/ArchivedMessageCard.d.ts.map +1 -0
- 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.map +1 -1
- package/lib/typescript/components/MainComponents/MessageList.d.ts +22 -1
- package/lib/typescript/components/MainComponents/MessageList.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/MessageSearchButton.d.ts +7 -0
- package/lib/typescript/components/MainComponents/MessageSearchButton.d.ts.map +1 -0
- package/lib/typescript/components/MainComponents/ReduxWrapper.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
- package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/BubbleHighlight.d.ts +12 -0
- package/lib/typescript/components/MessageBubble/BubbleHighlight.d.ts.map +1 -0
- package/lib/typescript/components/MessageBubble/Message.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/MessageInteractions.d.ts +5 -0
- package/lib/typescript/components/MessageBubble/MessageInteractions.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/messageMenuLayout.d.ts +29 -0
- package/lib/typescript/components/MessageBubble/messageMenuLayout.d.ts.map +1 -0
- package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts +2 -0
- package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/MessageSearchModal/MessageHitResults.d.ts +44 -0
- package/lib/typescript/components/Modals/MessageSearchModal/MessageHitResults.d.ts.map +1 -0
- package/lib/typescript/components/Modals/MessageSearchModal/MessageSearchModal.d.ts +12 -0
- package/lib/typescript/components/Modals/MessageSearchModal/MessageSearchModal.d.ts.map +1 -0
- package/lib/typescript/components/Modals/MessageSearchModal/openHit.d.ts +15 -0
- package/lib/typescript/components/Modals/MessageSearchModal/openHit.d.ts.map +1 -0
- package/lib/typescript/components/Modals/MessageSearchModal/resolveSender.d.ts +34 -0
- package/lib/typescript/components/Modals/MessageSearchModal/resolveSender.d.ts.map +1 -0
- package/lib/typescript/components/Modals/MessageSearchModal/searchFilters.d.ts +41 -0
- package/lib/typescript/components/Modals/MessageSearchModal/searchFilters.d.ts.map +1 -0
- package/lib/typescript/components/Modals/MessageSearchModal/snippet.d.ts +15 -0
- package/lib/typescript/components/Modals/MessageSearchModal/snippet.d.ts.map +1 -0
- package/lib/typescript/components/Modals/MessageSearchModal/useMessageSearch.d.ts +23 -0
- package/lib/typescript/components/Modals/MessageSearchModal/useMessageSearch.d.ts.map +1 -0
- package/lib/typescript/components/Modals/PublicChatsModal/PublicChatsModal.d.ts +16 -0
- package/lib/typescript/components/Modals/PublicChatsModal/PublicChatsModal.d.ts.map +1 -0
- package/lib/typescript/components/Modals/PublicChatsModal/publicChatsLogic.d.ts +14 -0
- package/lib/typescript/components/Modals/PublicChatsModal/publicChatsLogic.d.ts.map +1 -0
- package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/SwipeableRoomRow.d.ts +5 -1
- package/lib/typescript/components/RoomComponents/SwipeableRoomRow.d.ts.map +1 -1
- package/lib/typescript/components/Thread/ThreadHeader.d.ts.map +1 -1
- package/lib/typescript/components/Thread/ThreadWrapper.d.ts +1 -0
- package/lib/typescript/components/Thread/ThreadWrapper.d.ts.map +1 -1
- package/lib/typescript/components/styled/AudioDecoderHost.d.ts +39 -0
- package/lib/typescript/components/styled/AudioDecoderHost.d.ts.map +1 -0
- package/lib/typescript/components/styled/AudioMessage.d.ts +14 -1
- package/lib/typescript/components/styled/AudioMessage.d.ts.map +1 -1
- package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
- package/lib/typescript/context/MessageNotificationContext.d.ts.map +1 -1
- package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
- package/lib/typescript/helpers/audioWaveform.d.ts +54 -0
- package/lib/typescript/helpers/audioWaveform.d.ts.map +1 -0
- package/lib/typescript/helpers/backgroundJoinSweep.d.ts +14 -0
- package/lib/typescript/helpers/backgroundJoinSweep.d.ts.map +1 -0
- package/lib/typescript/helpers/bubbleHighlight.d.ts +17 -0
- package/lib/typescript/helpers/bubbleHighlight.d.ts.map +1 -0
- package/lib/typescript/helpers/checkUniqueUsers.d.ts +2 -2
- package/lib/typescript/helpers/checkUniqueUsers.d.ts.map +1 -1
- package/lib/typescript/helpers/constants/MODAL_COMPONENTS.d.ts.map +1 -1
- package/lib/typescript/helpers/constants/MODAL_TYPES.d.ts +2 -0
- package/lib/typescript/helpers/constants/MODAL_TYPES.d.ts.map +1 -1
- package/lib/typescript/helpers/createRoomFromApi.d.ts +25 -0
- package/lib/typescript/helpers/createRoomFromApi.d.ts.map +1 -1
- package/lib/typescript/helpers/dedupeMembers.d.ts +11 -0
- package/lib/typescript/helpers/dedupeMembers.d.ts.map +1 -0
- package/lib/typescript/helpers/ethoraLogger.d.ts +13 -0
- package/lib/typescript/helpers/ethoraLogger.d.ts.map +1 -0
- package/lib/typescript/helpers/getUnnamedUsers.d.ts.map +1 -1
- package/lib/typescript/helpers/historyPreloadConfig.d.ts +26 -0
- package/lib/typescript/helpers/historyPreloadConfig.d.ts.map +1 -0
- package/lib/typescript/helpers/historyPreloadScheduler.d.ts +8 -4
- package/lib/typescript/helpers/historyPreloadScheduler.d.ts.map +1 -1
- package/lib/typescript/helpers/initRoomsPresence.d.ts +7 -0
- package/lib/typescript/helpers/initRoomsPresence.d.ts.map +1 -1
- package/lib/typescript/helpers/insertMessageWithDelimiter.d.ts.map +1 -1
- package/lib/typescript/helpers/isLikelyMucJid.d.ts +19 -0
- package/lib/typescript/helpers/isLikelyMucJid.d.ts.map +1 -0
- package/lib/typescript/helpers/isMessageSearchEnabled.d.ts +12 -0
- package/lib/typescript/helpers/isMessageSearchEnabled.d.ts.map +1 -0
- package/lib/typescript/helpers/joiningRoom.d.ts +7 -0
- package/lib/typescript/helpers/joiningRoom.d.ts.map +1 -0
- package/lib/typescript/helpers/jumpThread.d.ts +48 -0
- package/lib/typescript/helpers/jumpThread.d.ts.map +1 -0
- package/lib/typescript/helpers/jumpToMessage.d.ts +26 -0
- package/lib/typescript/helpers/jumpToMessage.d.ts.map +1 -0
- package/lib/typescript/helpers/jumpWindow.d.ts +74 -0
- package/lib/typescript/helpers/jumpWindow.d.ts.map +1 -0
- package/lib/typescript/helpers/loadRoomHistory.d.ts +34 -0
- package/lib/typescript/helpers/loadRoomHistory.d.ts.map +1 -0
- package/lib/typescript/helpers/notificationPolicy.d.ts +42 -0
- package/lib/typescript/helpers/notificationPolicy.d.ts.map +1 -0
- package/lib/typescript/helpers/openRoomAtMessage.d.ts +17 -0
- package/lib/typescript/helpers/openRoomAtMessage.d.ts.map +1 -0
- package/lib/typescript/helpers/openThreadForJump.d.ts +27 -0
- package/lib/typescript/helpers/openThreadForJump.d.ts.map +1 -0
- package/lib/typescript/helpers/parseMessageReference.d.ts +18 -5
- package/lib/typescript/helpers/parseMessageReference.d.ts.map +1 -1
- package/lib/typescript/helpers/publicChatsEntry.d.ts +11 -0
- package/lib/typescript/helpers/publicChatsEntry.d.ts.map +1 -0
- package/lib/typescript/helpers/roomActivityScore.d.ts +5 -0
- package/lib/typescript/helpers/roomActivityScore.d.ts.map +1 -0
- package/lib/typescript/helpers/roomUserCount.d.ts +20 -0
- package/lib/typescript/helpers/roomUserCount.d.ts.map +1 -0
- package/lib/typescript/helpers/runConfiguredHistoryPreload.d.ts +21 -0
- package/lib/typescript/helpers/runConfiguredHistoryPreload.d.ts.map +1 -0
- package/lib/typescript/helpers/sessionAppId.d.ts +8 -0
- package/lib/typescript/helpers/sessionAppId.d.ts.map +1 -0
- package/lib/typescript/helpers/timestamp.d.ts +3 -0
- package/lib/typescript/helpers/timestamp.d.ts.map +1 -0
- package/lib/typescript/helpers/userResolver.d.ts +58 -0
- package/lib/typescript/helpers/userResolver.d.ts.map +1 -0
- package/lib/typescript/helpers/xmppIdShape.d.ts +10 -0
- package/lib/typescript/helpers/xmppIdShape.d.ts.map +1 -0
- package/lib/typescript/hooks/useChatWrapperInit.d.ts +2 -0
- package/lib/typescript/hooks/useChatWrapperInit.d.ts.map +1 -1
- package/lib/typescript/hooks/useHeapSender.d.ts.map +1 -1
- package/lib/typescript/hooks/useJumpToMessage.d.ts +116 -0
- package/lib/typescript/hooks/useJumpToMessage.d.ts.map +1 -0
- package/lib/typescript/hooks/useMessageLoaderQueue.d.ts.map +1 -1
- package/lib/typescript/hooks/useMessageQueue.d.ts.map +1 -1
- package/lib/typescript/hooks/useRoomDirectory.d.ts +12 -0
- package/lib/typescript/hooks/useRoomDirectory.d.ts.map +1 -0
- package/lib/typescript/hooks/useRoomInitialization.d.ts.map +1 -1
- package/lib/typescript/hooks/useRoomMute.d.ts +8 -0
- package/lib/typescript/hooks/useRoomMute.d.ts.map +1 -0
- 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.map +1 -1
- package/lib/typescript/i18n/strings.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/messageSearch.api.d.ts +57 -0
- package/lib/typescript/networking/api-requests/messageSearch.api.d.ts.map +1 -0
- package/lib/typescript/networking/api-requests/publicChats.api.d.ts +24 -0
- package/lib/typescript/networking/api-requests/publicChats.api.d.ts.map +1 -0
- package/lib/typescript/networking/api-requests/roomMembers.api.d.ts +19 -1
- package/lib/typescript/networking/api-requests/roomMembers.api.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/rooms.api.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/xmppToken.api.d.ts +2 -0
- package/lib/typescript/networking/api-requests/xmppToken.api.d.ts.map +1 -0
- package/lib/typescript/networking/ethoraEvents.d.ts +45 -0
- package/lib/typescript/networking/ethoraEvents.d.ts.map +1 -0
- package/lib/typescript/networking/stanzaHandlers.d.ts +1 -1
- package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/allRoomPresences.xmpp.d.ts +32 -1
- package/lib/typescript/networking/xmpp/allRoomPresences.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/getHistory.xmpp.d.ts +64 -0
- package/lib/typescript/networking/xmpp/getHistory.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/handleStanzas.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/historyCursor.d.ts +35 -0
- package/lib/typescript/networking/xmpp/historyCursor.d.ts.map +1 -0
- package/lib/typescript/networking/xmpp/mamQueryIds.d.ts +10 -0
- package/lib/typescript/networking/xmpp/mamQueryIds.d.ts.map +1 -0
- package/lib/typescript/networking/xmpp/mamRouter.d.ts +7 -0
- package/lib/typescript/networking/xmpp/mamRouter.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/presenceInRoom.xmpp.d.ts +13 -2
- package/lib/typescript/networking/xmpp/presenceInRoom.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/roomJoinSweep.d.ts +82 -0
- package/lib/typescript/networking/xmpp/roomJoinSweep.d.ts.map +1 -0
- package/lib/typescript/networking/xmpp/sendMediaMessage.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/sendTextMessage.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmppClient.d.ts +90 -4
- package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
- package/lib/typescript/networking/xmppCredentials.d.ts +12 -0
- package/lib/typescript/networking/xmppCredentials.d.ts.map +1 -0
- package/lib/typescript/roomStore/Middleware/jumpThreadMiddleware.d.ts +3 -0
- package/lib/typescript/roomStore/Middleware/jumpThreadMiddleware.d.ts.map +1 -0
- package/lib/typescript/roomStore/Middleware/reactionsMiddleware.d.ts.map +1 -1
- package/lib/typescript/roomStore/Middleware/unreadMidlleware.d.ts.map +1 -1
- package/lib/typescript/roomStore/chatSettingsSlice.d.ts +8 -1
- package/lib/typescript/roomStore/chatSettingsSlice.d.ts.map +1 -1
- package/lib/typescript/roomStore/index.d.ts +2 -1
- package/lib/typescript/roomStore/index.d.ts.map +1 -1
- package/lib/typescript/roomStore/persistence.d.ts +8 -0
- package/lib/typescript/roomStore/persistence.d.ts.map +1 -1
- package/lib/typescript/roomStore/roomsSlice.d.ts +138 -2
- package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
- package/lib/typescript/roomStore/safeKey.d.ts +13 -0
- package/lib/typescript/roomStore/safeKey.d.ts.map +1 -0
- package/lib/typescript/roomStore/usersSetCap.d.ts +16 -0
- package/lib/typescript/roomStore/usersSetCap.d.ts.map +1 -0
- package/lib/typescript/types/models/media.model.d.ts +2 -0
- package/lib/typescript/types/models/media.model.d.ts.map +1 -1
- package/lib/typescript/types/models/room.model.d.ts +18 -5
- package/lib/typescript/types/models/room.model.d.ts.map +1 -1
- package/lib/typescript/types/models/xmpp.model.d.ts +8 -1
- package/lib/typescript/types/models/xmpp.model.d.ts.map +1 -1
- package/lib/typescript/types/types.d.ts +88 -5
- package/lib/typescript/types/types.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/lib/typescript/version.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/assets/icons.tsx +13 -0
- package/src/components/Header/HeaderRoomList.tsx +21 -4
- package/src/components/InputComponents/Search.tsx +33 -0
- package/src/components/MainComponents/ArchivedMessageCard.tsx +139 -0
- package/src/components/MainComponents/ChatHeader.tsx +19 -3
- package/src/components/MainComponents/ChatRoom.tsx +60 -23
- package/src/components/MainComponents/ChatWrapper.tsx +23 -4
- package/src/components/MainComponents/MediaMessage.tsx +17 -0
- package/src/components/MainComponents/MessageList.tsx +823 -84
- package/src/components/MainComponents/MessageSearchButton.tsx +48 -0
- package/src/components/MainComponents/ReduxWrapper.tsx +16 -5
- package/src/components/MainComponents/RoomList.tsx +125 -0
- package/src/components/Menu/HeaderRoomListMenu.tsx +26 -2
- package/src/components/MessageBubble/BubbleHighlight.tsx +106 -0
- package/src/components/MessageBubble/Message.tsx +265 -177
- package/src/components/MessageBubble/MessageInteractions.tsx +109 -86
- package/src/components/MessageBubble/messageMenuLayout.ts +59 -0
- package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +92 -21
- package/src/components/Modals/MessageSearchModal/MessageHitResults.tsx +271 -0
- package/src/components/Modals/MessageSearchModal/MessageSearchModal.tsx +487 -0
- package/src/components/Modals/MessageSearchModal/openHit.ts +50 -0
- package/src/components/Modals/MessageSearchModal/resolveSender.ts +57 -0
- package/src/components/Modals/MessageSearchModal/searchFilters.ts +109 -0
- package/src/components/Modals/MessageSearchModal/snippet.ts +58 -0
- package/src/components/Modals/MessageSearchModal/useMessageSearch.ts +151 -0
- package/src/components/Modals/PublicChatsModal/PublicChatsModal.tsx +288 -0
- package/src/components/Modals/PublicChatsModal/publicChatsLogic.ts +36 -0
- package/src/components/Modals/SelectUsersModal/SelectUsersModal.tsx +8 -1
- package/src/components/RoomComponents/ChatRoomItem.tsx +16 -3
- package/src/components/RoomComponents/SwipeableRoomRow.tsx +39 -6
- package/src/components/Thread/ThreadHeader.tsx +3 -1
- package/src/components/Thread/ThreadWrapper.tsx +96 -10
- package/src/components/styled/AudioDecoderHost.tsx +351 -0
- package/src/components/styled/AudioMessage.tsx +482 -425
- package/src/components/styled/SendInput.tsx +42 -4
- package/src/context/MessageNotificationContext.tsx +19 -5
- package/src/context/xmppProvider.tsx +44 -91
- package/src/helpers/audioWaveform.ts +142 -0
- package/src/helpers/backgroundJoinSweep.ts +35 -0
- package/src/helpers/bubbleHighlight.ts +47 -0
- package/src/helpers/checkUniqueUsers.tsx +15 -17
- package/src/helpers/constants/MODAL_COMPONENTS.tsx +4 -0
- package/src/helpers/constants/MODAL_TYPES.ts +3 -0
- package/src/helpers/createRoomFromApi.tsx +45 -4
- package/src/helpers/dedupeMembers.ts +29 -0
- package/src/helpers/ethoraLogger.ts +50 -0
- package/src/helpers/getUnnamedUsers.ts +7 -4
- package/src/helpers/historyPreloadConfig.ts +68 -0
- package/src/helpers/historyPreloadScheduler.ts +437 -199
- package/src/helpers/initRoomsPresence.ts +20 -7
- package/src/helpers/insertMessageWithDelimiter.ts +3 -0
- package/src/helpers/isLikelyMucJid.ts +72 -0
- package/src/helpers/isMessageSearchEnabled.ts +18 -0
- package/src/helpers/joiningRoom.ts +13 -0
- package/src/helpers/jumpThread.ts +102 -0
- package/src/helpers/jumpToMessage.ts +57 -0
- package/src/helpers/jumpWindow.ts +212 -0
- package/src/helpers/loadRoomHistory.ts +83 -0
- package/src/helpers/notificationPolicy.ts +82 -0
- package/src/helpers/openRoomAtMessage.ts +38 -0
- package/src/helpers/openThreadForJump.ts +96 -0
- package/src/helpers/parseMessageReference.ts +37 -8
- package/src/helpers/publicChatsEntry.ts +15 -0
- package/src/helpers/roomActivityScore.ts +45 -0
- package/src/helpers/roomUserCount.ts +44 -0
- package/src/helpers/runConfiguredHistoryPreload.ts +76 -0
- package/src/helpers/sessionAppId.ts +17 -0
- package/src/helpers/timestamp.ts +44 -0
- package/src/helpers/userResolver.ts +542 -0
- package/src/helpers/xmppIdShape.ts +46 -0
- package/src/hooks/useChatWrapperInit.ts +22 -4
- package/src/hooks/useHeapSender.tsx +54 -3
- package/src/hooks/useJumpToMessage.ts +538 -0
- package/src/hooks/useMessageLoaderQueue.tsx +40 -4
- package/src/hooks/useMessageQueue.ts +9 -5
- package/src/hooks/useRoomDirectory.ts +39 -0
- package/src/hooks/useRoomInitialization.tsx +33 -7
- package/src/hooks/useRoomMute.ts +42 -0
- package/src/hooks/useRoomState.tsx +6 -0
- package/src/hooks/useSendMessage.tsx +14 -2
- package/src/i18n/strings.ts +282 -0
- package/src/networking/api-requests/messageSearch.api.ts +130 -0
- package/src/networking/api-requests/publicChats.api.ts +71 -0
- package/src/networking/api-requests/roomMembers.api.ts +263 -11
- package/src/networking/api-requests/rooms.api.ts +52 -12
- package/src/networking/api-requests/xmppToken.api.ts +62 -0
- package/src/networking/ethoraEvents.ts +262 -0
- package/src/networking/stanzaHandlers.ts +145 -19
- package/src/networking/xmpp/allRoomPresences.xmpp.ts +155 -5
- package/src/networking/xmpp/getHistory.xmpp.ts +433 -47
- package/src/networking/xmpp/handleStanzas.xmpp.ts +8 -0
- package/src/networking/xmpp/historyCursor.ts +124 -0
- package/src/networking/xmpp/mamQueryIds.ts +11 -0
- package/src/networking/xmpp/mamRouter.ts +24 -10
- package/src/networking/xmpp/presenceInRoom.xmpp.ts +91 -68
- package/src/networking/xmpp/roomJoinSweep.ts +412 -0
- package/src/networking/xmpp/sendMediaMessage.xmpp.ts +0 -1
- package/src/networking/xmpp/sendTextMessage.xmpp.ts +0 -1
- package/src/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.ts +0 -1
- package/src/networking/xmppClient.ts +323 -47
- package/src/networking/xmppCredentials.ts +87 -0
- package/src/roomStore/Middleware/jumpThreadMiddleware.ts +163 -0
- package/src/roomStore/Middleware/reactionsMiddleware.tsx +4 -0
- package/src/roomStore/Middleware/unreadMidlleware.tsx +59 -11
- package/src/roomStore/chatSettingsSlice.ts +11 -0
- package/src/roomStore/index.ts +10 -3
- package/src/roomStore/persistence.ts +54 -0
- package/src/roomStore/roomsSlice.ts +547 -65
- package/src/roomStore/safeKey.ts +49 -0
- package/src/roomStore/usersSetCap.ts +37 -0
- package/src/types/models/media.model.ts +4 -0
- package/src/types/models/room.model.ts +18 -5
- package/src/types/models/xmpp.model.ts +15 -1
- package/src/types/types.ts +93 -5
- package/src/version.ts +1 -1
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import http from '../networking/apiClient';
|
|
4
|
+
import { lookupUser, resetUserLookupRoute } from '../networking/api-requests/roomMembers.api';
|
|
5
|
+
import { dedupeMembers } from './dedupeMembers';
|
|
6
|
+
import { store } from '../roomStore';
|
|
7
|
+
import { mergeUsersSet } from '../roomStore/roomsSlice';
|
|
8
|
+
import { updateUser } from '../roomStore/chatSettingsSlice';
|
|
9
|
+
import { isSafeKey, hasSafeIdSegments } from '../roomStore/safeKey';
|
|
10
|
+
import { normalizeXmppUsername } from './xmppUsername';
|
|
11
|
+
import { toLocalPart } from './xmppIdShape';
|
|
12
|
+
import { getSessionAppId } from './sessionAppId';
|
|
13
|
+
|
|
14
|
+
// Lazy user resolution.
|
|
15
|
+
//
|
|
16
|
+
// GET /v1/chats/my returns at most 30 members of a big room (plus
|
|
17
|
+
// `usersCnt`), so senders of older messages are unknown to usersSet. The
|
|
18
|
+
// source of truth for a name is the backend user record, fetched here:
|
|
19
|
+
// - one user: GET /v1/apps/users/<appId_userId>, falling back to
|
|
20
|
+
// GET /v2/chats/users?xmppUsername=<appId_userId> when the backend does
|
|
21
|
+
// not take our token on v1 (see lookupUser in roomMembers.api.ts)
|
|
22
|
+
// - GET /v2/chats/users?chatName=<roomLocal>&limit=500 a room directory
|
|
23
|
+
// Results go into rooms.usersSet through mergeUsersSet (names render from
|
|
24
|
+
// usersSet at render time, so nothing else needs rewriting). Only display fields are kept: the
|
|
25
|
+
// endpoint also returns email and tags, which must never reach the
|
|
26
|
+
// persisted usersSet.
|
|
27
|
+
|
|
28
|
+
const DEBOUNCE_MS = 150;
|
|
29
|
+
const CONCURRENCY = 4;
|
|
30
|
+
const SINGLE_FETCH_LIMIT = 10;
|
|
31
|
+
const MAX_PENDING = 200;
|
|
32
|
+
const NOT_FOUND_TTL_MS = 10 * 60_000;
|
|
33
|
+
const BACKOFF_STEPS_MS = [5_000, 30_000];
|
|
34
|
+
const DIRECTORY_PAGE_LIMIT = 500;
|
|
35
|
+
const DIRECTORY_MAX_PAGES = 200;
|
|
36
|
+
const DIRECTORY_MAX_STALE_PAGES = 5;
|
|
37
|
+
const INSERT_BUFFER_MS = 100;
|
|
38
|
+
let generation = 0;
|
|
39
|
+
const pending = new Set();
|
|
40
|
+
const inflight = new Set();
|
|
41
|
+
const negative = new Map();
|
|
42
|
+
let debounceTimer = null;
|
|
43
|
+
let activeWorkers = 0;
|
|
44
|
+
const queue = [];
|
|
45
|
+
let insertBuffer = [];
|
|
46
|
+
const refreshTimers = new Map();
|
|
47
|
+
const refreshAgain = new Set();
|
|
48
|
+
// ids whose in-progress fetch was asked for by refreshUser
|
|
49
|
+
const refreshForced = new Set();
|
|
50
|
+
let insertTimer = null;
|
|
51
|
+
const dirState = new Map();
|
|
52
|
+
const dirInflight = new Map();
|
|
53
|
+
// A failed directory is not retried for a while: without this a dead
|
|
54
|
+
// endpoint turned every debounce pass into another directory request.
|
|
55
|
+
const DIRECTORY_RETRY_MS = 30_000;
|
|
56
|
+
const dirFailedAt = new Map();
|
|
57
|
+
const dirCoolingDown = jid => Date.now() - (dirFailedAt.get(jid) ?? -Infinity) < DIRECTORY_RETRY_MS;
|
|
58
|
+
// The directory members of each room in server order, grown page by page.
|
|
59
|
+
const dirMembers = new Map();
|
|
60
|
+
const listeners = new Set();
|
|
61
|
+
const notify = () => {
|
|
62
|
+
listeners.forEach(l => {
|
|
63
|
+
try {
|
|
64
|
+
l();
|
|
65
|
+
} catch {
|
|
66
|
+
// a broken subscriber must not stop the others
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/** Re-render hook: called when a directory state or a negative cache entry changes. */
|
|
72
|
+
export const subscribeUserResolver = listener => {
|
|
73
|
+
listeners.add(listener);
|
|
74
|
+
return () => {
|
|
75
|
+
listeners.delete(listener);
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
let sessionIdentity = '';
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The signed-in account is the session identity: when another account signs
|
|
82
|
+
* in, every cache and in-flight result of the previous one is dropped (a
|
|
83
|
+
* token refresh for the same account must not). No token (logout, or a
|
|
84
|
+
* transient rehydrate gap) just yields '' and does no work.
|
|
85
|
+
*/
|
|
86
|
+
const getToken = () => {
|
|
87
|
+
const u = store.getState().chatSettingStore?.user;
|
|
88
|
+
const token = u?.token || '';
|
|
89
|
+
const identity = String(u?.xmppUsername || u?._id || '');
|
|
90
|
+
if (token && identity && sessionIdentity && identity !== sessionIdentity) {
|
|
91
|
+
resetUserResolver();
|
|
92
|
+
}
|
|
93
|
+
if (token && identity) sessionIdentity = identity;
|
|
94
|
+
return token;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/** `appId_userId@host/res`, `appId_userId`, or a doubled prefix -> `appId_userId`. */
|
|
98
|
+
const normalizeId = raw => {
|
|
99
|
+
if (typeof raw !== 'string') return '';
|
|
100
|
+
const local = toLocalPart(raw.split('/')[0]).trim();
|
|
101
|
+
if (!local || local === 'undefined') return '';
|
|
102
|
+
return normalizeXmppUsername(local);
|
|
103
|
+
};
|
|
104
|
+
const isLookupable = id => {
|
|
105
|
+
if (!id || /\s/.test(id) || !isSafeKey(id)) return false;
|
|
106
|
+
// Only appId_userId shaped ids can exist on the backend.
|
|
107
|
+
if (!id.includes('_')) return false;
|
|
108
|
+
if (!hasSafeIdSegments(id)) return false;
|
|
109
|
+
const appId = getSessionAppId();
|
|
110
|
+
if (appId && (id === appId || id === `${appId}_${appId}`)) return false;
|
|
111
|
+
return true;
|
|
112
|
+
};
|
|
113
|
+
const sanitizeUser = (raw, fallbackId) => {
|
|
114
|
+
if (!raw || typeof raw !== 'object') return null;
|
|
115
|
+
const xmppUsername = normalizeId(raw.xmppUsername) || fallbackId || '';
|
|
116
|
+
if (!isSafeKey(xmppUsername)) return null;
|
|
117
|
+
const user = {
|
|
118
|
+
_id: String(raw._id ?? ''),
|
|
119
|
+
xmppUsername,
|
|
120
|
+
firstName: typeof raw.firstName === 'string' ? raw.firstName : '',
|
|
121
|
+
lastName: typeof raw.lastName === 'string' ? raw.lastName : ''
|
|
122
|
+
};
|
|
123
|
+
if (typeof raw.profileImage === 'string' && raw.profileImage) {
|
|
124
|
+
user.profileImage = raw.profileImage;
|
|
125
|
+
}
|
|
126
|
+
return user;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
// One dispatch for the whole batch. Display fields are laid over whatever the
|
|
130
|
+
// entry already carries (role, jid, ...) so a lookup never strips what the
|
|
131
|
+
// REST member list put there. RN renders names from usersSet at render time,
|
|
132
|
+
// so no message rewrite is needed.
|
|
133
|
+
const insertIntoUsersSet = users => {
|
|
134
|
+
if (!users.length) return;
|
|
135
|
+
const existing = store.getState().rooms?.usersSet || {};
|
|
136
|
+
const members = {};
|
|
137
|
+
for (const u of users) {
|
|
138
|
+
if (!isSafeKey(u?.xmppUsername)) continue;
|
|
139
|
+
members[u.xmppUsername] = {
|
|
140
|
+
...(existing[u.xmppUsername] || {}),
|
|
141
|
+
...u
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
if (Object.keys(members).length) store.dispatch(mergeUsersSet({
|
|
145
|
+
members
|
|
146
|
+
}));
|
|
147
|
+
};
|
|
148
|
+
const flushInserts = () => {
|
|
149
|
+
if (insertTimer) {
|
|
150
|
+
clearTimeout(insertTimer);
|
|
151
|
+
insertTimer = null;
|
|
152
|
+
}
|
|
153
|
+
if (!insertBuffer.length) return;
|
|
154
|
+
const batch = insertBuffer;
|
|
155
|
+
insertBuffer = [];
|
|
156
|
+
insertIntoUsersSet(batch);
|
|
157
|
+
};
|
|
158
|
+
const bufferInsert = users => {
|
|
159
|
+
if (!users.length) return;
|
|
160
|
+
insertBuffer.push(...users);
|
|
161
|
+
if (!insertTimer) insertTimer = setTimeout(flushInserts, INSERT_BUFFER_MS);
|
|
162
|
+
};
|
|
163
|
+
const markNegative = (id, kind) => {
|
|
164
|
+
const prev = negative.get(id);
|
|
165
|
+
const attempts = (prev?.kind === 'error' ? prev.attempts : 0) + 1;
|
|
166
|
+
const ttl = kind !== 'error' ? NOT_FOUND_TTL_MS : BACKOFF_STEPS_MS[Math.min(attempts - 1, BACKOFF_STEPS_MS.length - 1)];
|
|
167
|
+
negative.set(id, {
|
|
168
|
+
until: Date.now() + ttl,
|
|
169
|
+
kind,
|
|
170
|
+
attempts
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
const isNegative = id => {
|
|
174
|
+
const n = negative.get(id);
|
|
175
|
+
if (!n) return false;
|
|
176
|
+
if (n.until <= Date.now()) {
|
|
177
|
+
// keep an expired error entry so attempts keep escalating the backoff
|
|
178
|
+
if (n.kind !== 'error') negative.delete(id);
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
return true;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* True for an id the backend answered 404 for: the user really is gone.
|
|
186
|
+
* (An id merely not resolved yet is NOT "not found".)
|
|
187
|
+
*/
|
|
188
|
+
export const isUserNotFound = rawId => {
|
|
189
|
+
const n = negative.get(normalizeId(rawId));
|
|
190
|
+
return Boolean(n && n.kind === 'notfound' && n.until > Date.now());
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Where a sender's lookup stands, for the display chain:
|
|
195
|
+
* - resolved: in usersSet
|
|
196
|
+
* - pending: queued, in flight, or not requested yet (a bubble just mounted)
|
|
197
|
+
* - notfound / forbidden: the backend answered, nothing to show from it
|
|
198
|
+
* - failed: the last attempt errored (backoff), or the lookup is exhausted
|
|
199
|
+
* - unavailable: this id can never be looked up (plain handle) or there is
|
|
200
|
+
* no session token, so nothing is coming
|
|
201
|
+
*/
|
|
202
|
+
|
|
203
|
+
export const getUserLookupStatus = rawId => {
|
|
204
|
+
const id = normalizeId(rawId);
|
|
205
|
+
if (!id) return 'unavailable';
|
|
206
|
+
if (store.getState().rooms?.usersSet?.[id]) return 'resolved';
|
|
207
|
+
const n = negative.get(id);
|
|
208
|
+
// an answer recorded a moment ago wins over the in-flight bookkeeping that
|
|
209
|
+
// is cleared right after it
|
|
210
|
+
if (n && isNegative(id)) return n.kind === 'error' ? 'failed' : n.kind;
|
|
211
|
+
if (pending.has(id) || inflight.has(id) || queue.includes(id)) {
|
|
212
|
+
return 'pending';
|
|
213
|
+
}
|
|
214
|
+
if (n && n.kind === 'error') return 'failed';
|
|
215
|
+
if (!isLookupable(id) || !getToken()) return 'unavailable';
|
|
216
|
+
return 'pending';
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
// A refreshed profile that is the signed-in user's own also updates the
|
|
220
|
+
// session user (chatSettingStore.user), which feeds the own-profile UI.
|
|
221
|
+
// Only the display fields, and only when something actually changed.
|
|
222
|
+
const applyToSessionUser = (id, fresh) => {
|
|
223
|
+
const me = store.getState().chatSettingStore?.user;
|
|
224
|
+
if (!me || normalizeId(me.xmppUsername) !== id) return;
|
|
225
|
+
const updates = {};
|
|
226
|
+
if (fresh.firstName !== undefined && fresh.firstName !== me.firstName) {
|
|
227
|
+
updates.firstName = fresh.firstName;
|
|
228
|
+
}
|
|
229
|
+
if (fresh.lastName !== undefined && fresh.lastName !== me.lastName) {
|
|
230
|
+
updates.lastName = fresh.lastName;
|
|
231
|
+
}
|
|
232
|
+
if (fresh.profileImage && fresh.profileImage !== me.profileImage) {
|
|
233
|
+
updates.profileImage = fresh.profileImage;
|
|
234
|
+
}
|
|
235
|
+
if (Object.keys(updates).length) store.dispatch(updateUser({
|
|
236
|
+
updates
|
|
237
|
+
}));
|
|
238
|
+
};
|
|
239
|
+
const fetchOne = async (id, gen) => {
|
|
240
|
+
const token = getToken();
|
|
241
|
+
if (!token) return;
|
|
242
|
+
const outcome = await lookupUser(id, token);
|
|
243
|
+
if (gen !== generation) return;
|
|
244
|
+
if (outcome.status === 'ok') {
|
|
245
|
+
const user = sanitizeUser(outcome.user, id);
|
|
246
|
+
if (user) {
|
|
247
|
+
negative.delete(id);
|
|
248
|
+
bufferInsert([user]);
|
|
249
|
+
if (refreshForced.delete(id)) applyToSessionUser(id, user);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
markNegative(id, 'notfound');
|
|
253
|
+
} else {
|
|
254
|
+
markNegative(id, outcome.status);
|
|
255
|
+
}
|
|
256
|
+
notify();
|
|
257
|
+
};
|
|
258
|
+
const pump = gen => {
|
|
259
|
+
while (activeWorkers < CONCURRENCY && queue.length) {
|
|
260
|
+
const id = queue.shift();
|
|
261
|
+
activeWorkers++;
|
|
262
|
+
inflight.add(id);
|
|
263
|
+
fetchOne(id, gen).finally(() => {
|
|
264
|
+
if (gen !== generation) return;
|
|
265
|
+
inflight.delete(id);
|
|
266
|
+
activeWorkers--;
|
|
267
|
+
// a refresh asked for while this fetch was running: its answer may
|
|
268
|
+
// predate the change, so fetch once more
|
|
269
|
+
if (refreshAgain.delete(id) && !queue.includes(id)) queue.push(id);
|
|
270
|
+
if (queue.length) pump(gen);else if (activeWorkers === 0) flushInserts();
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
const knownUsers = () => store.getState().rooms?.usersSet || {};
|
|
275
|
+
|
|
276
|
+
/** The room, if any, whose unknown senders among `ids` justify one directory fetch. */
|
|
277
|
+
const pickDirectoryRoom = ids => {
|
|
278
|
+
const idSet = new Set(ids);
|
|
279
|
+
const rooms = store.getState().rooms?.rooms || {};
|
|
280
|
+
let best = null;
|
|
281
|
+
let bestCount = SINGLE_FETCH_LIMIT;
|
|
282
|
+
for (const [jid, room] of Object.entries(rooms)) {
|
|
283
|
+
const cnt = Number(room?.usersCnt || 0);
|
|
284
|
+
const have = Array.isArray(room?.members) ? room.members.length : 0;
|
|
285
|
+
if (!(have < cnt) || dirState.get(jid) === 'done' || dirCoolingDown(jid)) {
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
const seen = new Set();
|
|
289
|
+
for (const m of room.messages || []) {
|
|
290
|
+
const uid = normalizeId(m?.user?.id);
|
|
291
|
+
if (uid && idSet.has(uid)) seen.add(uid);
|
|
292
|
+
}
|
|
293
|
+
if (seen.size > bestCount) {
|
|
294
|
+
best = jid;
|
|
295
|
+
bestCount = seen.size;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return best;
|
|
299
|
+
};
|
|
300
|
+
const flush = () => {
|
|
301
|
+
debounceTimer = null;
|
|
302
|
+
const gen = generation;
|
|
303
|
+
const users = knownUsers();
|
|
304
|
+
const ids = [...pending].filter(id => !users[id] && !inflight.has(id) && !isNegative(id));
|
|
305
|
+
pending.clear();
|
|
306
|
+
if (!ids.length) return;
|
|
307
|
+
if (ids.length > SINGLE_FETCH_LIMIT) {
|
|
308
|
+
const roomJid = pickDirectoryRoom(ids);
|
|
309
|
+
if (roomJid) {
|
|
310
|
+
ensureRoomDirectory(roomJid).then(() => {
|
|
311
|
+
if (gen !== generation) return;
|
|
312
|
+
// whoever the directory did not contain (left the room) still gets
|
|
313
|
+
// the per-user lookup
|
|
314
|
+
requestUsers(ids);
|
|
315
|
+
});
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
for (const id of ids) if (!queue.includes(id)) queue.push(id);
|
|
320
|
+
pump(gen);
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Ask for the profiles of these senders. Cheap to call from anywhere (a
|
|
325
|
+
* bubble mounting, a history batch parse): known, in-flight and recently
|
|
326
|
+
* failed ids are dropped, the rest are debounced into one pass.
|
|
327
|
+
*/
|
|
328
|
+
export function requestUsers(ids) {
|
|
329
|
+
if (!Array.isArray(ids) || !ids.length) return;
|
|
330
|
+
if (!getToken()) return;
|
|
331
|
+
const users = knownUsers();
|
|
332
|
+
let added = false;
|
|
333
|
+
for (const raw of ids) {
|
|
334
|
+
const id = normalizeId(raw);
|
|
335
|
+
if (!isLookupable(id)) continue;
|
|
336
|
+
if (users[id] || inflight.has(id) || pending.has(id) || isNegative(id)) {
|
|
337
|
+
continue;
|
|
338
|
+
}
|
|
339
|
+
pending.add(id);
|
|
340
|
+
added = true;
|
|
341
|
+
if (pending.size > MAX_PENDING) {
|
|
342
|
+
// drop the oldest
|
|
343
|
+
const oldest = pending.values().next().value;
|
|
344
|
+
pending.delete(oldest);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
if (!added) return;
|
|
348
|
+
if (debounceTimer) clearTimeout(debounceTimer);
|
|
349
|
+
debounceTimer = setTimeout(flush, DEBOUNCE_MS);
|
|
350
|
+
}
|
|
351
|
+
const REFRESH_DEBOUNCE_MS = 500;
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Re-fetch one user's profile even though it is already in usersSet, because
|
|
355
|
+
* the server said it changed (ethora-event user-profile-updated). Bypasses
|
|
356
|
+
* the cache and forgets a negative-cache entry, but shares everything else
|
|
357
|
+
* with requestUsers: the same route chain (lookupUser), the same worker
|
|
358
|
+
* queue and concurrency cap, one request at a time per user. Calls for the
|
|
359
|
+
* same user within REFRESH_DEBOUNCE_MS coalesce into one fetch. The answer
|
|
360
|
+
* goes through mergeUsersSet (display fields only), so existing bubbles are
|
|
361
|
+
* re-named. Never throws.
|
|
362
|
+
*/
|
|
363
|
+
export function refreshUser(rawId) {
|
|
364
|
+
const id = normalizeId(rawId);
|
|
365
|
+
if (!isLookupable(id) || !getToken()) return;
|
|
366
|
+
const prior = refreshTimers.get(id);
|
|
367
|
+
if (prior) clearTimeout(prior);
|
|
368
|
+
const gen = generation;
|
|
369
|
+
refreshTimers.set(id, setTimeout(() => {
|
|
370
|
+
refreshTimers.delete(id);
|
|
371
|
+
if (gen !== generation) return;
|
|
372
|
+
negative.delete(id);
|
|
373
|
+
refreshForced.add(id);
|
|
374
|
+
if (inflight.has(id)) {
|
|
375
|
+
refreshAgain.add(id);
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
if (!queue.includes(id)) queue.push(id);
|
|
379
|
+
pump(gen);
|
|
380
|
+
}, REFRESH_DEBOUNCE_MS));
|
|
381
|
+
}
|
|
382
|
+
const EMPTY_DIRECTORY = [];
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Members loaded so far by ensureRoomDirectory for this room (a new array
|
|
386
|
+
* identity after every page, a stable empty array before any).
|
|
387
|
+
*/
|
|
388
|
+
export const getRoomDirectoryMembers = roomJID => dirMembers.get(roomJID) || EMPTY_DIRECTORY;
|
|
389
|
+
|
|
390
|
+
/** requestUsers for the senders of a batch of messages (history page, jump window). */
|
|
391
|
+
export function requestSendersOf(messages) {
|
|
392
|
+
if (!messages?.length) return;
|
|
393
|
+
const ids = new Set();
|
|
394
|
+
for (const m of messages) {
|
|
395
|
+
const id = m?.user?.id;
|
|
396
|
+
if (id) ids.add(id);
|
|
397
|
+
}
|
|
398
|
+
if (ids.size) requestUsers([...ids]);
|
|
399
|
+
}
|
|
400
|
+
export const getRoomDirectoryState = roomJID => dirState.get(roomJID) || 'idle';
|
|
401
|
+
const setDirState = (roomJID, state) => {
|
|
402
|
+
if (dirState.get(roomJID) === state) return;
|
|
403
|
+
dirState.set(roomJID, state);
|
|
404
|
+
notify();
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Loads every member of one room into usersSet, once. Pages are not
|
|
409
|
+
* guaranteed to be full, so it stops on an empty page or offset >= total,
|
|
410
|
+
* never on `items.length < limit`.
|
|
411
|
+
*/
|
|
412
|
+
export function ensureRoomDirectory(roomJID) {
|
|
413
|
+
if (!roomJID || typeof roomJID !== 'string') return Promise.resolve();
|
|
414
|
+
if (dirState.get(roomJID) === 'done') return Promise.resolve();
|
|
415
|
+
const running = dirInflight.get(roomJID);
|
|
416
|
+
if (running) return running;
|
|
417
|
+
if (dirCoolingDown(roomJID)) return Promise.resolve();
|
|
418
|
+
const token = getToken();
|
|
419
|
+
const chatName = toLocalPart(roomJID);
|
|
420
|
+
if (!token || !chatName) return Promise.resolve();
|
|
421
|
+
const gen = generation;
|
|
422
|
+
setDirState(roomJID, 'loading');
|
|
423
|
+
const job = (async () => {
|
|
424
|
+
let offset = 0;
|
|
425
|
+
let total = Infinity;
|
|
426
|
+
let stale = 0;
|
|
427
|
+
try {
|
|
428
|
+
for (let page = 0; page < DIRECTORY_MAX_PAGES; page++) {
|
|
429
|
+
const res = await http.get('/v2/chats/users', {
|
|
430
|
+
params: {
|
|
431
|
+
chatName,
|
|
432
|
+
limit: DIRECTORY_PAGE_LIMIT,
|
|
433
|
+
offset
|
|
434
|
+
},
|
|
435
|
+
headers: {
|
|
436
|
+
Authorization: token
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
if (gen !== generation) return;
|
|
440
|
+
const data = res?.data || {};
|
|
441
|
+
const items = Array.isArray(data.items) ? data.items : Array.isArray(data.results) ? data.results : [];
|
|
442
|
+
if (!items.length) break;
|
|
443
|
+
const batch = items.map(item => sanitizeUser(item)).filter(u => Boolean(u));
|
|
444
|
+
// The backend can repeat the same user across pages (total counts the
|
|
445
|
+
// repeats), so merge by identity: first occurrence wins.
|
|
446
|
+
const before = dirMembers.get(roomJID) || EMPTY_DIRECTORY;
|
|
447
|
+
const merged = dedupeMembers([...before, ...batch]);
|
|
448
|
+
const added = merged.length - before.length;
|
|
449
|
+
if (added > 0) {
|
|
450
|
+
insertIntoUsersSet(batch);
|
|
451
|
+
dirMembers.set(roomJID, merged);
|
|
452
|
+
notify();
|
|
453
|
+
}
|
|
454
|
+
offset += items.length;
|
|
455
|
+
// Pages made only of repeats are normal at the tail (the real
|
|
456
|
+
// 435/11/3/1 shape), but a run of them means the server ignores
|
|
457
|
+
// offset: stop instead of walking to the page cap.
|
|
458
|
+
stale = added > 0 ? 0 : stale + 1;
|
|
459
|
+
if (stale >= DIRECTORY_MAX_STALE_PAGES) break;
|
|
460
|
+
const t = Number(data.total ?? data.pagination?.total);
|
|
461
|
+
if (Number.isFinite(t)) total = t;
|
|
462
|
+
if (offset >= total) break;
|
|
463
|
+
}
|
|
464
|
+
if (gen === generation) setDirState(roomJID, 'done');
|
|
465
|
+
} catch {
|
|
466
|
+
if (gen === generation) {
|
|
467
|
+
dirFailedAt.set(roomJID, Date.now());
|
|
468
|
+
setDirState(roomJID, 'error');
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
})().finally(() => {
|
|
472
|
+
if (dirInflight.get(roomJID) === job) dirInflight.delete(roomJID);
|
|
473
|
+
});
|
|
474
|
+
dirInflight.set(roomJID, job);
|
|
475
|
+
return job;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/** For tests and logout: drops every cache, timer and in-flight result. */
|
|
479
|
+
export function resetUserResolver() {
|
|
480
|
+
generation++;
|
|
481
|
+
sessionIdentity = '';
|
|
482
|
+
pending.clear();
|
|
483
|
+
inflight.clear();
|
|
484
|
+
negative.clear();
|
|
485
|
+
resetUserLookupRoute();
|
|
486
|
+
queue.length = 0;
|
|
487
|
+
activeWorkers = 0;
|
|
488
|
+
insertBuffer = [];
|
|
489
|
+
refreshTimers.forEach(t => clearTimeout(t));
|
|
490
|
+
refreshTimers.clear();
|
|
491
|
+
refreshAgain.clear();
|
|
492
|
+
refreshForced.clear();
|
|
493
|
+
if (debounceTimer) clearTimeout(debounceTimer);
|
|
494
|
+
debounceTimer = null;
|
|
495
|
+
if (insertTimer) clearTimeout(insertTimer);
|
|
496
|
+
insertTimer = null;
|
|
497
|
+
dirState.clear();
|
|
498
|
+
dirInflight.clear();
|
|
499
|
+
dirFailedAt.clear();
|
|
500
|
+
dirMembers.clear();
|
|
501
|
+
notify();
|
|
502
|
+
}
|
|
503
|
+
//# sourceMappingURL=userResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["http","lookupUser","resetUserLookupRoute","dedupeMembers","store","mergeUsersSet","updateUser","isSafeKey","hasSafeIdSegments","normalizeXmppUsername","toLocalPart","getSessionAppId","DEBOUNCE_MS","CONCURRENCY","SINGLE_FETCH_LIMIT","MAX_PENDING","NOT_FOUND_TTL_MS","BACKOFF_STEPS_MS","DIRECTORY_PAGE_LIMIT","DIRECTORY_MAX_PAGES","DIRECTORY_MAX_STALE_PAGES","INSERT_BUFFER_MS","generation","pending","Set","inflight","negative","Map","debounceTimer","activeWorkers","queue","insertBuffer","refreshTimers","refreshAgain","refreshForced","insertTimer","dirState","dirInflight","DIRECTORY_RETRY_MS","dirFailedAt","dirCoolingDown","jid","Date","now","get","Infinity","dirMembers","listeners","notify","forEach","l","subscribeUserResolver","listener","add","delete","sessionIdentity","getToken","u","getState","chatSettingStore","user","token","identity","String","xmppUsername","_id","resetUserResolver","normalizeId","raw","local","split","trim","isLookupable","id","test","includes","appId","sanitizeUser","fallbackId","firstName","lastName","profileImage","insertIntoUsersSet","users","length","existing","rooms","usersSet","members","Object","keys","dispatch","flushInserts","clearTimeout","batch","bufferInsert","push","setTimeout","markNegative","kind","prev","attempts","ttl","Math","min","set","until","isNegative","n","isUserNotFound","rawId","Boolean","getUserLookupStatus","has","applyToSessionUser","fresh","me","updates","undefined","fetchOne","gen","outcome","status","pump","shift","finally","knownUsers","pickDirectoryRoom","ids","idSet","best","bestCount","room","entries","cnt","Number","usersCnt","have","Array","isArray","seen","m","messages","uid","size","flush","filter","clear","roomJid","ensureRoomDirectory","then","requestUsers","added","oldest","values","next","value","REFRESH_DEBOUNCE_MS","refreshUser","prior","EMPTY_DIRECTORY","getRoomDirectoryMembers","roomJID","requestSendersOf","getRoomDirectoryState","setDirState","state","Promise","resolve","running","chatName","job","offset","total","stale","page","res","params","limit","headers","Authorization","data","items","results","map","item","before","merged","t","pagination","isFinite"],"sourceRoot":"../../../src","sources":["helpers/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EAAEtI,WAAW,CAACiB,MAAM,CAAC4G,OAAO,CAAC;EACnE,CAAC,CAAC;EACF7H,WAAW,CAACoE,GAAG,CAACyD,OAAO,EAAES,GAAG,CAAC;EAC7B,OAAOA,GAAG;AACZ;;AAEA;AACA,OAAO,SAASzG,iBAAiBA,CAAA,EAAS;EACxC5C,UAAU,EAAE;EACZiC,eAAe,GAAG,EAAE;EACpBhC,OAAO,CAAC4H,KAAK,CAAC,CAAC;EACf1H,QAAQ,CAAC0H,KAAK,CAAC,CAAC;EAChBzH,QAAQ,CAACyH,KAAK,CAAC,CAAC;EAChBjJ,oBAAoB,CAAC,CAAC;EACtB4B,KAAK,CAACsD,MAAM,GAAG,CAAC;EAChBvD,aAAa,GAAG,CAAC;EACjBE,YAAY,GAAG,EAAE;EACjBC,aAAa,CAACiB,OAAO,CAAE2I,CAAC,IAAK/F,YAAY,CAAC+F,CAAC,CAAC,CAAC;EAC7C5J,aAAa,CAACmH,KAAK,CAAC,CAAC;EACrBlH,YAAY,CAACkH,KAAK,CAAC,CAAC;EACpBjH,aAAa,CAACiH,KAAK,CAAC,CAAC;EACrB,IAAIvH,aAAa,EAAEiE,YAAY,CAACjE,aAAa,CAAC;EAC9CA,aAAa,GAAG,IAAI;EACpB,IAAIO,WAAW,EAAE0D,YAAY,CAAC1D,WAAW,CAAC;EAC1CA,WAAW,GAAG,IAAI;EAClBC,QAAQ,CAAC+G,KAAK,CAAC,CAAC;EAChB9G,WAAW,CAAC8G,KAAK,CAAC,CAAC;EACnB5G,WAAW,CAAC4G,KAAK,CAAC,CAAC;EACnBrG,UAAU,CAACqG,KAAK,CAAC,CAAC;EAClBnG,MAAM,CAAC,CAAC;AACV","ignoreList":[]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Pure string-shape helpers for xmpp local ids/JIDs - no dependency on the
|
|
4
|
+
// redux store. Kept separate from xmppUsername.ts (which imports `store`
|
|
5
|
+
// for normalizeXmppUsername/isSameXmppUsername) so this file can be safely
|
|
6
|
+
// imported from the redux reducer graph itself (roomsSlice.ts,
|
|
7
|
+
// createUserNameFromSetUser.ts): those are pulled in by roomStore/index.ts
|
|
8
|
+
// to build the root reducer, and importing anything that in turn imports
|
|
9
|
+
// `store` from roomStore/index.ts there creates a circular dependency back
|
|
10
|
+
// into the module that is still assembling the store.
|
|
11
|
+
|
|
12
|
+
// Strips a value that the local part of an XMPP JID may carry, leaving
|
|
13
|
+
// just the bare resource (anything before `@`). XMPP allows resources
|
|
14
|
+
// with `@` only in escaped form so the simple split is enough here.
|
|
15
|
+
export const toLocalPart = value => {
|
|
16
|
+
if (!value) return '';
|
|
17
|
+
return String(value).split('@')[0];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// A 24-character hex string is a Mongo ObjectId - the shape of both the
|
|
21
|
+
// appId and the userId that make up an Ethora xmpp username.
|
|
22
|
+
const HEX24 = '[0-9a-fA-F]{24}';
|
|
23
|
+
// `<appId>_<userId>` (the normal shape) or a bare id on its own (seen on
|
|
24
|
+
// system/local entries that never went through the appId_userId join).
|
|
25
|
+
// Anchored end to end so a human handle that merely contains 24 hex chars
|
|
26
|
+
// somewhere (unlikely, but not impossible) is never caught by accident.
|
|
27
|
+
const UUID = '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}';
|
|
28
|
+
// `<appId>_<uuid>` or `<appId>_<hex24>`, optionally followed by further
|
|
29
|
+
// `_<token>` segments (appId is hex24 on most deployments, any alphanumeric
|
|
30
|
+
// token on others). A bare id, or a two-segment mongo id, is the original
|
|
31
|
+
// shape.
|
|
32
|
+
const OPAQUE_XMPP_USER_ID_RE = new RegExp(`^(?:${HEX24}(?:_${HEX24})?|[A-Za-z0-9]+_(?:${HEX24}|${UUID})(?:_[0-9A-Za-z-]+)*)$`);
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* True when `value` (a full JID or already-bare local part) is a
|
|
36
|
+
* machine-generated Ethora id rather than anything a human would recognize
|
|
37
|
+
* as their own name - `<24 hex>_<24 hex>`, `<appId>_<uuid>` or a bare 24-hex
|
|
38
|
+
* id. Kept narrow on purpose: a handle a person actually picked is never
|
|
39
|
+
* this shape, so it is never mistaken for one.
|
|
40
|
+
*/
|
|
41
|
+
export const isOpaqueXmppUserId = value => {
|
|
42
|
+
const local = toLocalPart(value || '').trim();
|
|
43
|
+
if (!local) return false;
|
|
44
|
+
return OPAQUE_XMPP_USER_ID_RE.test(local);
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=xmppIdShape.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["toLocalPart","value","String","split","HEX24","UUID","OPAQUE_XMPP_USER_ID_RE","RegExp","isOpaqueXmppUserId","local","trim","test"],"sourceRoot":"../../../src","sources":["helpers/xmppIdShape.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO,MAAMA,WAAW,GAAIC,KAAc,IAAa;EACrD,IAAI,CAACA,KAAK,EAAE,OAAO,EAAE;EACrB,OAAOC,MAAM,CAACD,KAAK,CAAC,CAACE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACpC,CAAC;;AAED;AACA;AACA,MAAMC,KAAK,GAAG,iBAAiB;AAC/B;AACA;AACA;AACA;AACA,MAAMC,IAAI,GACR,6EAA6E;AAC/E;AACA;AACA;AACA;AACA,MAAMC,sBAAsB,GAAG,IAAIC,MAAM,CACvC,OAAOH,KAAK,OAAOA,KAAK,sBAAsBA,KAAK,IAAIC,IAAI,wBAC7D,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMG,kBAAkB,GAAIP,KAAgC,IAAc;EAC/E,MAAMQ,KAAK,GAAGT,WAAW,CAACC,KAAK,IAAI,EAAE,CAAC,CAACS,IAAI,CAAC,CAAC;EAC7C,IAAI,CAACD,KAAK,EAAE,OAAO,KAAK;EACxB,OAAOH,sBAAsB,CAACK,IAAI,CAACF,KAAK,CAAC;AAC3C,CAAC","ignoreList":[]}
|
|
@@ -8,6 +8,7 @@ import { resolveLegacyTranslatesLangSource } from '../helpers/resolveLangSource'
|
|
|
8
8
|
import { useXmppClient } from '../context/xmppProvider';
|
|
9
9
|
import { chatAutoEnterer } from '../helpers/chatAutoEnterer';
|
|
10
10
|
import { initRoomsPresence } from '../helpers/initRoomsPresence';
|
|
11
|
+
import { loadRoomsThenJoinInBackground, startBackgroundJoinSweep } from '../helpers/backgroundJoinSweep';
|
|
11
12
|
import { updateMessagesTillLast } from '../helpers/updateMessagesTillLast';
|
|
12
13
|
import { refreshAuthTokensQuietly } from '../networking/authRefresh';
|
|
13
14
|
import { setLangSource, setConfig } from '../roomStore/chatSettingsSlice';
|
|
@@ -19,6 +20,10 @@ import { isChatIdPresentInArray } from '../helpers/isChatIdPresentInArray';
|
|
|
19
20
|
import useGetNewArchRoom from './useGetNewArchRoom';
|
|
20
21
|
import { getRoomsWithRetry } from '../helpers/getRoomsWithRetry';
|
|
21
22
|
import { shallowEqual } from '../helpers/shallowEqual';
|
|
23
|
+
|
|
24
|
+
// The room list ends its loading state right after /chats/my; joining every
|
|
25
|
+
// room is a background sweep nobody waits for (see helpers/backgroundJoinSweep).
|
|
26
|
+
export { loadRoomsThenJoinInBackground, startBackgroundJoinSweep };
|
|
22
27
|
const useChatWrapperInit = ({
|
|
23
28
|
roomJID,
|
|
24
29
|
wasAutoSelected,
|
|
@@ -82,12 +87,13 @@ const useChatWrapperInit = ({
|
|
|
82
87
|
loading: true,
|
|
83
88
|
loadingText: 'Loading rooms...'
|
|
84
89
|
}));
|
|
85
|
-
|
|
86
|
-
|
|
90
|
+
// The list is usable as soon as the rooms fetch returns (rooms come
|
|
91
|
+
// seeded with lastMessage / unread). Joining them all runs in the
|
|
92
|
+
// background, open room first.
|
|
93
|
+
return loadRoomsThenJoinInBackground(client, () => syncRooms(client, config), () => dispatch(setIsLoading({
|
|
87
94
|
loading: false,
|
|
88
95
|
loadingText: undefined
|
|
89
|
-
}));
|
|
90
|
-
return rooms;
|
|
96
|
+
})));
|
|
91
97
|
};
|
|
92
98
|
useEffect(() => {
|
|
93
99
|
let retryTimeout;
|
|
@@ -121,7 +127,9 @@ const useChatWrapperInit = ({
|
|
|
121
127
|
if (roomsList && Object.keys(roomsList).length > 0) {
|
|
122
128
|
console.log(' Using existing roomsList', Object.keys(roomsList).length);
|
|
123
129
|
setInited(true);
|
|
124
|
-
|
|
130
|
+
// Persisted rooms: join (background sweep) + push subscribe
|
|
131
|
+
// without holding the private-store / unread step behind it.
|
|
132
|
+
initRoomsPresence(newClient, roomsList).catch(() => undefined);
|
|
125
133
|
} else {
|
|
126
134
|
if (config?.newArch) {
|
|
127
135
|
console.log(' Loading rooms with newArch');
|
|
@@ -184,6 +192,9 @@ const useChatWrapperInit = ({
|
|
|
184
192
|
}
|
|
185
193
|
}
|
|
186
194
|
setInited(true);
|
|
195
|
+
// Rooms that appeared since the bootstrap sweep (a /chats/my that
|
|
196
|
+
// returned late) get joined too; a no-op when nothing is left.
|
|
197
|
+
startBackgroundJoinSweep(client);
|
|
187
198
|
console.log(' Getting chats private store for existing client');
|
|
188
199
|
try {
|
|
189
200
|
// See the "new client" branch above: getChatsPrivateStoreRequestStanza
|