@ethora/chat-component-rn 26.9.1 → 26.10.1
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/Modals/SettingsModals/BlockedUsers/BlockedUsersModal.js +14 -12
- package/lib/commonjs/components/Modals/SettingsModals/BlockedUsers/BlockedUsersModal.js.map +1 -1
- package/lib/commonjs/components/Modals/SettingsModals/DocumentShares/DocumentSharesModal.js +41 -39
- package/lib/commonjs/components/Modals/SettingsModals/DocumentShares/DocumentSharesModal.js.map +1 -1
- package/lib/commonjs/components/Modals/SettingsModals/ManageDataModal/ManageDataModal.js +137 -50
- package/lib/commonjs/components/Modals/SettingsModals/ManageDataModal/ManageDataModal.js.map +1 -1
- package/lib/commonjs/components/Modals/SettingsModals/ProfileShares/ProfileShares.js +15 -13
- package/lib/commonjs/components/Modals/SettingsModals/ProfileShares/ProfileShares.js.map +1 -1
- package/lib/commonjs/components/Modals/SettingsModals/Referrals/Referrals.js +57 -55
- package/lib/commonjs/components/Modals/SettingsModals/Referrals/Referrals.js.map +1 -1
- package/lib/commonjs/components/Modals/SettingsModals/SharedStyledComponents.js +15 -1
- package/lib/commonjs/components/Modals/SettingsModals/SharedStyledComponents.js.map +1 -1
- package/lib/commonjs/components/Modals/SettingsModals/Visibility/VisibilityModal.js +61 -59
- package/lib/commonjs/components/Modals/SettingsModals/Visibility/VisibilityModal.js.map +1 -1
- package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js +8 -3
- package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.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 +312 -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/user.api.js +32 -3
- package/lib/commonjs/networking/api-requests/user.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 +21 -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/Modals/SettingsModals/BlockedUsers/BlockedUsersModal.js +15 -13
- package/lib/module/components/Modals/SettingsModals/BlockedUsers/BlockedUsersModal.js.map +1 -1
- package/lib/module/components/Modals/SettingsModals/DocumentShares/DocumentSharesModal.js +42 -40
- package/lib/module/components/Modals/SettingsModals/DocumentShares/DocumentSharesModal.js.map +1 -1
- package/lib/module/components/Modals/SettingsModals/ManageDataModal/ManageDataModal.js +138 -52
- package/lib/module/components/Modals/SettingsModals/ManageDataModal/ManageDataModal.js.map +1 -1
- package/lib/module/components/Modals/SettingsModals/ProfileShares/ProfileShares.js +16 -14
- package/lib/module/components/Modals/SettingsModals/ProfileShares/ProfileShares.js.map +1 -1
- package/lib/module/components/Modals/SettingsModals/Referrals/Referrals.js +58 -56
- package/lib/module/components/Modals/SettingsModals/Referrals/Referrals.js.map +1 -1
- package/lib/module/components/Modals/SettingsModals/SharedStyledComponents.js +14 -0
- package/lib/module/components/Modals/SettingsModals/SharedStyledComponents.js.map +1 -1
- package/lib/module/components/Modals/SettingsModals/Visibility/VisibilityModal.js +62 -60
- package/lib/module/components/Modals/SettingsModals/Visibility/VisibilityModal.js.map +1 -1
- package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js +9 -4
- package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.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 +312 -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/user.api.js +31 -3
- package/lib/module/networking/api-requests/user.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 +19 -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/Modals/SettingsModals/BlockedUsers/BlockedUsersModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/SettingsModals/DocumentShares/DocumentSharesModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/SettingsModals/ManageDataModal/ManageDataModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/SettingsModals/ProfileShares/ProfileShares.d.ts.map +1 -1
- package/lib/typescript/components/Modals/SettingsModals/Referrals/Referrals.d.ts.map +1 -1
- package/lib/typescript/components/Modals/SettingsModals/SharedStyledComponents.d.ts +1 -0
- package/lib/typescript/components/Modals/SettingsModals/SharedStyledComponents.d.ts.map +1 -1
- package/lib/typescript/components/Modals/SettingsModals/Visibility/VisibilityModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts.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/user.api.d.ts +8 -0
- package/lib/typescript/networking/api-requests/user.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/Modals/SettingsModals/BlockedUsers/BlockedUsersModal.tsx +20 -17
- package/src/components/Modals/SettingsModals/DocumentShares/DocumentSharesModal.tsx +58 -55
- package/src/components/Modals/SettingsModals/ManageDataModal/ManageDataModal.tsx +156 -62
- package/src/components/Modals/SettingsModals/ProfileShares/ProfileShares.tsx +22 -19
- package/src/components/Modals/SettingsModals/Referrals/Referrals.tsx +48 -45
- package/src/components/Modals/SettingsModals/SharedStyledComponents.ts +11 -0
- package/src/components/Modals/SettingsModals/Visibility/VisibilityModal.tsx +63 -60
- package/src/components/Modals/UserSettingsModal/UserSettingsModal.tsx +11 -3
- 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 +306 -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/user.api.ts +28 -2
- 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 +17 -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
|
@@ -4,16 +4,42 @@ import { useMessageHeapState } from './useMessageHeapState';
|
|
|
4
4
|
import { removeMessageFromHeapById } from '../roomStore/roomHeapSlice';
|
|
5
5
|
import XmppClient from '../networking/xmppClient';
|
|
6
6
|
|
|
7
|
+
// "Joining works" is enough to drain the heap: the first wave of the join
|
|
8
|
+
// sweep (open room + one pool width). Waiting for the WHOLE sweep would hold
|
|
9
|
+
// queued messages behind joins of rooms nobody is writing to. Clients that
|
|
10
|
+
// do not expose the priority flag fall back to the full-sweep flag.
|
|
11
|
+
const isJoinReady = (client: XmppClient | null): boolean => {
|
|
12
|
+
if (!client) {return false;}
|
|
13
|
+
const priority = (client as any).priorityPresencesReady;
|
|
14
|
+
return typeof priority === 'boolean' ? priority : !!client.presencesReady;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// The flags are plain fields on the client (no re-render when they flip), so
|
|
18
|
+
// a drain that finds the gate closed, or a room it could not join, tries
|
|
19
|
+
// again on its own.
|
|
20
|
+
const RETRY_MS = 1000;
|
|
21
|
+
|
|
7
22
|
export const useHeapSender = (client: XmppClient | null) => {
|
|
8
23
|
const dispatch = useDispatch();
|
|
9
24
|
const { queue } = useMessageHeapState();
|
|
10
25
|
const sendingRef = useRef(false);
|
|
11
26
|
const inFlightRef = useRef<Map<string, number>>(new Map());
|
|
27
|
+
const retryTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
28
|
+
const sendRef = useRef<() => Promise<void>>(async () => {});
|
|
29
|
+
|
|
30
|
+
const scheduleRetry = () => {
|
|
31
|
+
if (retryTimerRef.current) {return;}
|
|
32
|
+
retryTimerRef.current = setTimeout(() => {
|
|
33
|
+
retryTimerRef.current = null;
|
|
34
|
+
sendRef.current().catch(() => undefined);
|
|
35
|
+
}, RETRY_MS);
|
|
36
|
+
};
|
|
12
37
|
|
|
13
38
|
const sendHeapMessages = useCallback(async () => {
|
|
14
39
|
if (!client || queue.length === 0) {return;}
|
|
15
|
-
if (!client
|
|
40
|
+
if (!isJoinReady(client)) {
|
|
16
41
|
console.warn('Presences not ready, delaying heap send');
|
|
42
|
+
scheduleRetry();
|
|
17
43
|
return;
|
|
18
44
|
}
|
|
19
45
|
if (sendingRef.current) {return;}
|
|
@@ -24,6 +50,19 @@ export const useHeapSender = (client: XmppClient | null) => {
|
|
|
24
50
|
if (lastAttempt && Date.now() - lastAttempt < 15000) {
|
|
25
51
|
continue;
|
|
26
52
|
}
|
|
53
|
+
// Join the message's own room first (deduped, a no-op for a room the
|
|
54
|
+
// sweep already joined). A room that cannot be joined keeps the
|
|
55
|
+
// message queued; it is retried on the next pass.
|
|
56
|
+
let joined: boolean | undefined = true;
|
|
57
|
+
try {
|
|
58
|
+
joined = await client.presenceInRoomStanza?.(msg.roomJid);
|
|
59
|
+
} catch {
|
|
60
|
+
joined = false;
|
|
61
|
+
}
|
|
62
|
+
if (joined === false) {
|
|
63
|
+
scheduleRetry();
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
27
66
|
inFlightRef.current.set(msg.id, Date.now());
|
|
28
67
|
try {
|
|
29
68
|
if (msg.langSource) {
|
|
@@ -67,15 +106,27 @@ export const useHeapSender = (client: XmppClient | null) => {
|
|
|
67
106
|
}
|
|
68
107
|
}, [client, queue, dispatch]);
|
|
69
108
|
|
|
109
|
+
sendRef.current = sendHeapMessages;
|
|
110
|
+
useEffect(
|
|
111
|
+
() => () => {
|
|
112
|
+
if (retryTimerRef.current) {clearTimeout(retryTimerRef.current);}
|
|
113
|
+
retryTimerRef.current = null;
|
|
114
|
+
},
|
|
115
|
+
[]
|
|
116
|
+
);
|
|
117
|
+
|
|
70
118
|
const prevReadyRef = useRef<boolean>(false);
|
|
71
119
|
useEffect(() => {
|
|
72
|
-
const nowReady =
|
|
120
|
+
const nowReady = isJoinReady(client);
|
|
73
121
|
const wasReady = prevReadyRef.current;
|
|
74
122
|
prevReadyRef.current = nowReady;
|
|
75
123
|
if (!wasReady && nowReady && queue.length > 0) {
|
|
76
124
|
sendHeapMessages();
|
|
125
|
+
} else if (!nowReady && queue.length > 0) {
|
|
126
|
+
// The ready flag flips on the client without a re-render: poll.
|
|
127
|
+
scheduleRetry();
|
|
77
128
|
}
|
|
78
|
-
}, [client?.presencesReady, queue.length, sendHeapMessages]);
|
|
129
|
+
}, [client?.presencesReady, client?.priorityPresencesReady, queue.length, sendHeapMessages]);
|
|
79
130
|
|
|
80
131
|
useEffect(() => {
|
|
81
132
|
const currentIds = new Set(queue.map((m) => m.id));
|
|
@@ -0,0 +1,538 @@
|
|
|
1
|
+
import { MutableRefObject, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { useDispatch, useSelector, useStore } from 'react-redux';
|
|
3
|
+
import { RootState } from '../roomStore';
|
|
4
|
+
import {
|
|
5
|
+
PendingJump,
|
|
6
|
+
clearJumpWindow,
|
|
7
|
+
clearPendingJump,
|
|
8
|
+
showArchivedMessage,
|
|
9
|
+
} from '../roomStore/roomsSlice';
|
|
10
|
+
import { IMessage } from '../types/types';
|
|
11
|
+
import { toastEmitter } from '../utils/toastEmitter';
|
|
12
|
+
import { useT } from '../i18n/useT';
|
|
13
|
+
import { JumpContent } from '../helpers/jumpWindow';
|
|
14
|
+
import {
|
|
15
|
+
findMessageIndex,
|
|
16
|
+
JUMP_TTL_MS,
|
|
17
|
+
ownerThreadFor,
|
|
18
|
+
replyParentId,
|
|
19
|
+
useJumpThread,
|
|
20
|
+
} from '../helpers/jumpThread';
|
|
21
|
+
import { HIGHLIGHT_MS } from '../helpers/bubbleHighlight';
|
|
22
|
+
|
|
23
|
+
export { findMessageIndex, JUMP_TTL_MS, HIGHLIGHT_MS };
|
|
24
|
+
|
|
25
|
+
// How far back the paging fallback goes before giving up. A request may stay
|
|
26
|
+
// alive for JUMP_TTL_MS at all (a room that never finishes opening must not
|
|
27
|
+
// leave one armed to fire at some unrelated later moment).
|
|
28
|
+
export const MAX_HISTORY_PAGES = 40;
|
|
29
|
+
export const JUMP_PAGE_SIZE = 100;
|
|
30
|
+
// A page request that fails is retried this many times in a row before the
|
|
31
|
+
// history is treated as unreachable.
|
|
32
|
+
export const MAX_PAGE_FAILURES = 3;
|
|
33
|
+
// A target already in the store and at most this far from the newest message
|
|
34
|
+
// is reached by scrolling the live list. Anything farther is fetched as a
|
|
35
|
+
// small window around it instead: re-merging a thousand rows to reach it is
|
|
36
|
+
// what made a far jump lag.
|
|
37
|
+
export const NEAR_LIVE_MESSAGES = 300;
|
|
38
|
+
// A jump into a room that is still opening waits this long for its live list
|
|
39
|
+
// before it stops waiting for it and asks the archive directly.
|
|
40
|
+
export const ROOM_OPENING_GRACE_MS = 4000;
|
|
41
|
+
// Pause between checks while waiting for a room that is still opening, and
|
|
42
|
+
// how many times a window request that could not be asked is repeated.
|
|
43
|
+
export const ROOM_OPENING_POLL_MS = 700;
|
|
44
|
+
export const MAX_WINDOW_RETRIES = 6;
|
|
45
|
+
// The highlight starts once the list has laid out the rows around the target
|
|
46
|
+
// and the scroll (with its retries, see MessageList) has settled.
|
|
47
|
+
export const HIGHLIGHT_SETTLE_MS = 450;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* How the attempt to open a window around the target went:
|
|
51
|
+
* - found: the window is in the store; the list now renders it;
|
|
52
|
+
* - missing: the server answered and the target is not in its archive;
|
|
53
|
+
* - unavailable: could not ask (no archive id, request failed): page instead.
|
|
54
|
+
*/
|
|
55
|
+
export type WindowFetchResult = 'found' | 'missing' | 'unavailable';
|
|
56
|
+
|
|
57
|
+
/** What the server said about one page of older history. */
|
|
58
|
+
export interface OlderPage {
|
|
59
|
+
/** False when the request failed. */
|
|
60
|
+
ok: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* The RSM `<first>` of the page: the id (microseconds) of the oldest ROW the
|
|
63
|
+
* server returned. The next page continues from here. It is NOT the oldest
|
|
64
|
+
* message that got displayed: a page can be made entirely of receipts or
|
|
65
|
+
* reactions, display nothing, and still be followed by plenty of history.
|
|
66
|
+
*/
|
|
67
|
+
cursor?: number | null;
|
|
68
|
+
/** The server's `<fin complete>`: there is nothing older. */
|
|
69
|
+
complete?: boolean;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface Options {
|
|
73
|
+
roomJID: string;
|
|
74
|
+
/** The list's messages in chronological order (oldest first). */
|
|
75
|
+
messages: IMessage[];
|
|
76
|
+
/** The rows the list renders, in render order (newest first when inverted). */
|
|
77
|
+
listData: IMessage[];
|
|
78
|
+
/** Scroll the list to a row of `listData`. */
|
|
79
|
+
scrollToIndex: (index: number) => void;
|
|
80
|
+
/** Highlight the bubble of the message (id) or clear the highlight (null). */
|
|
81
|
+
onHighlight: (messageId: string | null) => void;
|
|
82
|
+
/**
|
|
83
|
+
* Older history through the room's loader. Used for the paging fallback
|
|
84
|
+
* when `fetchOlderPage` is not given.
|
|
85
|
+
*/
|
|
86
|
+
loadMoreMessages?: (
|
|
87
|
+
chatJID: string,
|
|
88
|
+
max: number,
|
|
89
|
+
amount?: number
|
|
90
|
+
) => Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Fetches the next page of older history and resolves once that page is in
|
|
93
|
+
* the store, with the server's own cursor for what it returned.
|
|
94
|
+
*/
|
|
95
|
+
fetchOlderPage?: (
|
|
96
|
+
roomJID: string,
|
|
97
|
+
before: number,
|
|
98
|
+
max: number
|
|
99
|
+
) => Promise<OlderPage>;
|
|
100
|
+
historyComplete?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* MessageList's "reader is at the bottom" flag. Cleared for the length of a
|
|
103
|
+
* jump: paging older history grows the list, and with the flag set the list
|
|
104
|
+
* would read that as live content and scroll back to the bottom, undoing
|
|
105
|
+
* the jump the moment the target loads.
|
|
106
|
+
*/
|
|
107
|
+
isUserAtBottomRef: MutableRefObject<boolean>;
|
|
108
|
+
/** `messages` is a jump window around an earlier target, not the live list. */
|
|
109
|
+
jumpWindowActive?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Opens a window around a far target (and puts it in the store). Omitted
|
|
112
|
+
* where windows do not apply (threads); the paging path is used then.
|
|
113
|
+
*/
|
|
114
|
+
fetchWindow?: (jump: PendingJump) => Promise<WindowFetchResult>;
|
|
115
|
+
/**
|
|
116
|
+
* Which list this instance is. A jump is fulfilled by exactly one list: the
|
|
117
|
+
* main list, or the thread its target is a reply in. The other instances
|
|
118
|
+
* stay inert for it, so one of them cannot give up (and show the archived
|
|
119
|
+
* card) while the owner is still working.
|
|
120
|
+
*/
|
|
121
|
+
scope?: 'main' | { threadId: string };
|
|
122
|
+
/**
|
|
123
|
+
* The room's messages BEFORE the main list's filter (which hides thread
|
|
124
|
+
* replies). Lets the main list recognise a target that is a thread reply.
|
|
125
|
+
*/
|
|
126
|
+
allMessages?: IMessage[];
|
|
127
|
+
/**
|
|
128
|
+
* Opens the thread a reply target belongs to (main list only). Resolves true
|
|
129
|
+
* when the thread is open and owns the jump from now on.
|
|
130
|
+
*/
|
|
131
|
+
resolveReply?: (jump: PendingJump, reply: IMessage) => Promise<boolean>;
|
|
132
|
+
/**
|
|
133
|
+
* The room is still opening (joining, loading its first history). While it
|
|
134
|
+
* is, a request that cannot be answered yet is waited out, not counted as a
|
|
135
|
+
* failure: the card is for "the server answered and the message is absent".
|
|
136
|
+
*/
|
|
137
|
+
roomOpening?: boolean;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Fulfils a pending "scroll to this message" request for this room.
|
|
142
|
+
*
|
|
143
|
+
* The target can be in one of three places, tried in this order:
|
|
144
|
+
* 1. in the list (virtualised, so mounted or not does not matter) and not
|
|
145
|
+
* far from the newest message: scroll to its row, then highlight its
|
|
146
|
+
* bubble;
|
|
147
|
+
* 2. not loaded, or loaded but far back: fetch a short window of the archive
|
|
148
|
+
* around it (the list shows that instead of the live list) and scroll to
|
|
149
|
+
* it there;
|
|
150
|
+
* 3. no window possible (no archive id, request failed): page older history
|
|
151
|
+
* by the server's own cursor until it shows up or the history ends.
|
|
152
|
+
* If the server says the message is not in its archive, show the message
|
|
153
|
+
* itself in a card (a search hit always ends with the message on screen); a
|
|
154
|
+
* request with nothing to show says it could not be found.
|
|
155
|
+
*
|
|
156
|
+
* Exactly one list owns a request (see `scope`).
|
|
157
|
+
*/
|
|
158
|
+
export function useJumpToMessage({
|
|
159
|
+
roomJID,
|
|
160
|
+
messages,
|
|
161
|
+
listData,
|
|
162
|
+
scrollToIndex,
|
|
163
|
+
onHighlight,
|
|
164
|
+
loadMoreMessages,
|
|
165
|
+
fetchOlderPage,
|
|
166
|
+
historyComplete,
|
|
167
|
+
isUserAtBottomRef,
|
|
168
|
+
jumpWindowActive = false,
|
|
169
|
+
fetchWindow,
|
|
170
|
+
scope = 'main',
|
|
171
|
+
allMessages,
|
|
172
|
+
resolveReply,
|
|
173
|
+
roomOpening = false,
|
|
174
|
+
}: Options) {
|
|
175
|
+
const dispatch = useDispatch();
|
|
176
|
+
const reduxStore = useStore<RootState>();
|
|
177
|
+
const t = useT();
|
|
178
|
+
const jump = useSelector((state: RootState) => state.rooms.pendingJump);
|
|
179
|
+
const jumpThread = useJumpThread();
|
|
180
|
+
const ownerThreadId = ownerThreadFor(jumpThread, jump?.at);
|
|
181
|
+
const scopeThreadId = scope === 'main' ? null : scope.threadId;
|
|
182
|
+
const isOwner =
|
|
183
|
+
scopeThreadId === null
|
|
184
|
+
? ownerThreadId === null
|
|
185
|
+
: ownerThreadId === scopeThreadId;
|
|
186
|
+
|
|
187
|
+
const attemptsRef = useRef(0);
|
|
188
|
+
const loadingRef = useRef(false);
|
|
189
|
+
// Callbacks that change identity on render live in a ref so they do not
|
|
190
|
+
// retrigger the effect below.
|
|
191
|
+
const latest = useRef({
|
|
192
|
+
t,
|
|
193
|
+
loadMoreMessages,
|
|
194
|
+
fetchOlderPage,
|
|
195
|
+
scrollToIndex,
|
|
196
|
+
onHighlight,
|
|
197
|
+
fetchWindow,
|
|
198
|
+
resolveReply,
|
|
199
|
+
allMessages,
|
|
200
|
+
roomOpening,
|
|
201
|
+
});
|
|
202
|
+
latest.current = {
|
|
203
|
+
t,
|
|
204
|
+
loadMoreMessages,
|
|
205
|
+
fetchOlderPage,
|
|
206
|
+
scrollToIndex,
|
|
207
|
+
onHighlight,
|
|
208
|
+
fetchWindow,
|
|
209
|
+
resolveReply,
|
|
210
|
+
allMessages,
|
|
211
|
+
roomOpening,
|
|
212
|
+
};
|
|
213
|
+
const replyResolvedAtRef = useRef<number | null>(null);
|
|
214
|
+
const windowRetriesRef = useRef(0);
|
|
215
|
+
// Per request: whether a window was already tried, and whether the server
|
|
216
|
+
// said the target does not exist.
|
|
217
|
+
const windowTriedAtRef = useRef<number | null>(null);
|
|
218
|
+
const windowMissingAtRef = useRef<number | null>(null);
|
|
219
|
+
const currentJumpAtRef = useRef<number | null>(null);
|
|
220
|
+
currentJumpAtRef.current = jump?.at ?? null;
|
|
221
|
+
// The request whose scroll is already scheduled. Re-runs of the effect must
|
|
222
|
+
// not schedule it a second time.
|
|
223
|
+
const scheduledAtRef = useRef<number | null>(null);
|
|
224
|
+
// Where the next page of older history starts: the server's cursor from the
|
|
225
|
+
// previous page, or (first page) the oldest of what the room already knows.
|
|
226
|
+
const cursorRef = useRef<number | null>(null);
|
|
227
|
+
// The server has nothing older, or paging stopped making progress.
|
|
228
|
+
const exhaustedRef = useRef(false);
|
|
229
|
+
const failuresRef = useRef(0);
|
|
230
|
+
const timersRef = useRef<{
|
|
231
|
+
scroll?: ReturnType<typeof setTimeout>;
|
|
232
|
+
settle?: ReturnType<typeof setTimeout>;
|
|
233
|
+
clear?: ReturnType<typeof setTimeout>;
|
|
234
|
+
retry?: ReturnType<typeof setTimeout>;
|
|
235
|
+
}>({});
|
|
236
|
+
const [tick, setTick] = useState(0);
|
|
237
|
+
|
|
238
|
+
useEffect(
|
|
239
|
+
() => () => {
|
|
240
|
+
const timers = timersRef.current;
|
|
241
|
+
if (timers.scroll) {clearTimeout(timers.scroll);}
|
|
242
|
+
if (timers.settle) {clearTimeout(timers.settle);}
|
|
243
|
+
if (timers.clear) {clearTimeout(timers.clear);}
|
|
244
|
+
if (timers.retry) {clearTimeout(timers.retry);}
|
|
245
|
+
},
|
|
246
|
+
[]
|
|
247
|
+
);
|
|
248
|
+
|
|
249
|
+
// A new request starts its own page budget.
|
|
250
|
+
useEffect(() => {
|
|
251
|
+
attemptsRef.current = 0;
|
|
252
|
+
cursorRef.current = null;
|
|
253
|
+
exhaustedRef.current = false;
|
|
254
|
+
failuresRef.current = 0;
|
|
255
|
+
windowRetriesRef.current = 0;
|
|
256
|
+
}, [jump?.at]);
|
|
257
|
+
|
|
258
|
+
useEffect(() => {
|
|
259
|
+
if (!jump || jump.roomJID !== roomJID || !isOwner) {return;}
|
|
260
|
+
isUserAtBottomRef.current = false;
|
|
261
|
+
|
|
262
|
+
const finish = (reached: boolean) => {
|
|
263
|
+
dispatch(clearPendingJump());
|
|
264
|
+
if (reached) {return;}
|
|
265
|
+
|
|
266
|
+
// Not reachable in the transcript. If the request knows what the
|
|
267
|
+
// message says (every search hit does), show IT, so the tap always ends
|
|
268
|
+
// with the message in front of the reader and nothing that reads as an
|
|
269
|
+
// error. Only a jump with no message to show (a notification or a link)
|
|
270
|
+
// falls back to saying it could not be found.
|
|
271
|
+
if (jump.preview) {
|
|
272
|
+
dispatch(showArchivedMessage(jump.preview));
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
const { t: tr } = latest.current;
|
|
276
|
+
toastEmitter.emit({
|
|
277
|
+
id: `jump-to-message-missing-${Date.now()}`,
|
|
278
|
+
title: tr('search.messages.title'),
|
|
279
|
+
message: tr('search.messages.notFound'),
|
|
280
|
+
type: 'info',
|
|
281
|
+
});
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
if (Date.now() - jump.at > JUMP_TTL_MS) {
|
|
285
|
+
// Expired, but the message is in the list: nothing is missing, so no
|
|
286
|
+
// "archived" card.
|
|
287
|
+
finish(
|
|
288
|
+
findMessageIndex(messages, jump.ids, {
|
|
289
|
+
createdAt: jump.createdAt,
|
|
290
|
+
body: jump.body,
|
|
291
|
+
}) >= 0
|
|
292
|
+
);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// Waiting on something the store will not announce (a room still opening):
|
|
297
|
+
// look again shortly. The TTL above bounds how long this can go on.
|
|
298
|
+
const recheckSoon = () => {
|
|
299
|
+
if (timersRef.current.retry) {clearTimeout(timersRef.current.retry);}
|
|
300
|
+
timersRef.current.retry = setTimeout(
|
|
301
|
+
() => setTick((value) => value + 1),
|
|
302
|
+
ROOM_OPENING_POLL_MS
|
|
303
|
+
);
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
const content: JumpContent = {
|
|
307
|
+
createdAt: jump.createdAt,
|
|
308
|
+
body: jump.body,
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
// A target that is a thread reply is not in this (main) list at all: it
|
|
312
|
+
// lives in its parent's thread. Open that thread, which takes the jump over.
|
|
313
|
+
if (
|
|
314
|
+
scopeThreadId === null &&
|
|
315
|
+
latest.current.resolveReply &&
|
|
316
|
+
replyResolvedAtRef.current !== jump.at
|
|
317
|
+
) {
|
|
318
|
+
const pool = latest.current.allMessages ?? messages;
|
|
319
|
+
const rawIndex = findMessageIndex(pool, jump.ids, content);
|
|
320
|
+
const raw = rawIndex >= 0 ? pool[rawIndex] : null;
|
|
321
|
+
if (raw && replyParentId(raw)) {
|
|
322
|
+
replyResolvedAtRef.current = jump.at;
|
|
323
|
+
loadingRef.current = true;
|
|
324
|
+
const requestedAt = jump.at;
|
|
325
|
+
latest.current
|
|
326
|
+
.resolveReply(jump, raw)
|
|
327
|
+
.catch(() => false)
|
|
328
|
+
.then((opened) => {
|
|
329
|
+
loadingRef.current = false;
|
|
330
|
+
if (currentJumpAtRef.current !== requestedAt) {return;}
|
|
331
|
+
if (!opened) {finish(false);}
|
|
332
|
+
else {setTick((value) => value + 1);}
|
|
333
|
+
});
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
const index = findMessageIndex(messages, jump.ids, content);
|
|
339
|
+
|
|
340
|
+
const windowAvailable =
|
|
341
|
+
Boolean(latest.current.fetchWindow) &&
|
|
342
|
+
windowTriedAtRef.current !== jump.at;
|
|
343
|
+
|
|
344
|
+
if (
|
|
345
|
+
index >= 0 &&
|
|
346
|
+
(jumpWindowActive ||
|
|
347
|
+
messages.length - index <= NEAR_LIVE_MESSAGES ||
|
|
348
|
+
!windowAvailable)
|
|
349
|
+
) {
|
|
350
|
+
const targetId = String(messages[index].id);
|
|
351
|
+
const rowIndex = listData.findIndex(
|
|
352
|
+
(message) => String(message.id) === targetId
|
|
353
|
+
);
|
|
354
|
+
// The list has not caught up with the messages yet: look again when it
|
|
355
|
+
// has (this effect re-runs with it).
|
|
356
|
+
if (rowIndex < 0) {return;}
|
|
357
|
+
if (scheduledAtRef.current === jump.at) {return;}
|
|
358
|
+
scheduledAtRef.current = jump.at;
|
|
359
|
+
|
|
360
|
+
// Next tick: let the list lay out whatever the room switch, page load or
|
|
361
|
+
// window just handed it before measuring against it. The highlight
|
|
362
|
+
// starts only after the scroll has settled, and its clock starts then.
|
|
363
|
+
timersRef.current.scroll = setTimeout(() => {
|
|
364
|
+
latest.current.scrollToIndex(rowIndex);
|
|
365
|
+
timersRef.current.settle = setTimeout(() => {
|
|
366
|
+
latest.current.onHighlight(targetId);
|
|
367
|
+
timersRef.current.clear = setTimeout(
|
|
368
|
+
() => latest.current.onHighlight(null),
|
|
369
|
+
HIGHLIGHT_MS
|
|
370
|
+
);
|
|
371
|
+
}, HIGHLIGHT_SETTLE_MS);
|
|
372
|
+
}, 0);
|
|
373
|
+
finish(true);
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
// A new request for a message outside the window now on screen: go back
|
|
378
|
+
// to the live list first (this effect re-runs with it).
|
|
379
|
+
if (jumpWindowActive) {
|
|
380
|
+
dispatch(clearJumpWindow());
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// Not loaded, or loaded but far back. An empty list means the room is
|
|
385
|
+
// still opening: give its live list a moment (the target is usually in it),
|
|
386
|
+
// then ask the archive directly rather than wait for a history that can
|
|
387
|
+
// take ten seconds. The TTL above bounds all of it.
|
|
388
|
+
if (loadingRef.current) {return;}
|
|
389
|
+
if (
|
|
390
|
+
messages.length === 0 &&
|
|
391
|
+
(!latest.current.fetchWindow ||
|
|
392
|
+
(latest.current.roomOpening &&
|
|
393
|
+
Date.now() - jump.at < ROOM_OPENING_GRACE_MS))
|
|
394
|
+
) {
|
|
395
|
+
recheckSoon();
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
if (windowMissingAtRef.current === jump.at && index < 0) {
|
|
400
|
+
finish(false);
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// Fetch only a window around the target instead of paging the whole
|
|
405
|
+
// stretch of history between it and the live tail.
|
|
406
|
+
if (windowAvailable && latest.current.fetchWindow) {
|
|
407
|
+
windowTriedAtRef.current = jump.at;
|
|
408
|
+
loadingRef.current = true;
|
|
409
|
+
const requestedAt = jump.at;
|
|
410
|
+
latest.current
|
|
411
|
+
.fetchWindow(jump)
|
|
412
|
+
.catch((): WindowFetchResult => 'unavailable')
|
|
413
|
+
.then((result) => {
|
|
414
|
+
loadingRef.current = false;
|
|
415
|
+
if (currentJumpAtRef.current !== requestedAt) {return;}
|
|
416
|
+
if (result === 'missing') {windowMissingAtRef.current = requestedAt;}
|
|
417
|
+
if (
|
|
418
|
+
result === 'unavailable' &&
|
|
419
|
+
latest.current.roomOpening &&
|
|
420
|
+
windowRetriesRef.current < MAX_WINDOW_RETRIES
|
|
421
|
+
) {
|
|
422
|
+
// Could not ask yet (connection or room still coming up): ask
|
|
423
|
+
// again, instead of falling back to paging a room with no history.
|
|
424
|
+
windowRetriesRef.current += 1;
|
|
425
|
+
windowTriedAtRef.current = null;
|
|
426
|
+
recheckSoon();
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
setTick((value) => value + 1);
|
|
430
|
+
});
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
if (messages.length === 0) {
|
|
435
|
+
recheckSoon();
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
const firstReal = messages.find(
|
|
440
|
+
(message) => !String(message.id).startsWith('delimiter-new')
|
|
441
|
+
);
|
|
442
|
+
if (!firstReal) {return;}
|
|
443
|
+
|
|
444
|
+
if (
|
|
445
|
+
exhaustedRef.current ||
|
|
446
|
+
historyComplete ||
|
|
447
|
+
attemptsRef.current >= MAX_HISTORY_PAGES
|
|
448
|
+
) {
|
|
449
|
+
finish(false);
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// Page back through the archive by the server's own cursor. Each request
|
|
454
|
+
// resolves only once its page is in the store, so there is nothing to wait
|
|
455
|
+
// out and no guessing from the list: the answer to "is there more" is the
|
|
456
|
+
// server's, not "did the oldest displayed message change". The first page
|
|
457
|
+
// starts from the server cursor the room already holds when that is
|
|
458
|
+
// older than the oldest displayed message (a page of receipts displays
|
|
459
|
+
// nothing but still moved the cursor).
|
|
460
|
+
const oldestDisplayed = Number(firstReal.id);
|
|
461
|
+
const roomCursor =
|
|
462
|
+
reduxStore.getState().rooms.rooms?.[roomJID]?.messageStats
|
|
463
|
+
?.firstMessageTimestamp;
|
|
464
|
+
const startFrom =
|
|
465
|
+
typeof roomCursor === 'number' &&
|
|
466
|
+
Number.isFinite(roomCursor) &&
|
|
467
|
+
(!Number.isFinite(oldestDisplayed) || roomCursor < oldestDisplayed)
|
|
468
|
+
? roomCursor
|
|
469
|
+
: oldestDisplayed;
|
|
470
|
+
const before = cursorRef.current ?? startFrom;
|
|
471
|
+
if (!Number.isFinite(before)) {
|
|
472
|
+
finish(false);
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
attemptsRef.current += 1;
|
|
476
|
+
loadingRef.current = true;
|
|
477
|
+
|
|
478
|
+
const fetchPage: (
|
|
479
|
+
jid: string,
|
|
480
|
+
from: number,
|
|
481
|
+
max: number
|
|
482
|
+
) => Promise<OlderPage> =
|
|
483
|
+
latest.current.fetchOlderPage ??
|
|
484
|
+
(async (jid, from, max) => {
|
|
485
|
+
const loadMore = latest.current.loadMoreMessages;
|
|
486
|
+
if (!loadMore) {return { ok: false };}
|
|
487
|
+
await loadMore(jid, max, from);
|
|
488
|
+
const room = reduxStore.getState().rooms.rooms?.[jid];
|
|
489
|
+
return {
|
|
490
|
+
ok: true,
|
|
491
|
+
cursor: room?.messageStats?.firstMessageTimestamp,
|
|
492
|
+
complete: Boolean(room?.historyComplete),
|
|
493
|
+
};
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
fetchPage(roomJID, before, JUMP_PAGE_SIZE)
|
|
497
|
+
.catch((): OlderPage => ({ ok: false }))
|
|
498
|
+
.then((page) => {
|
|
499
|
+
loadingRef.current = false;
|
|
500
|
+
if (!page.ok) {
|
|
501
|
+
// A room that is still opening cannot answer yet: that is not the
|
|
502
|
+
// history being unreachable, so it does not count.
|
|
503
|
+
if (latest.current.roomOpening) {
|
|
504
|
+
recheckSoon();
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
failuresRef.current += 1;
|
|
508
|
+
if (failuresRef.current >= MAX_PAGE_FAILURES) {
|
|
509
|
+
exhaustedRef.current = true;
|
|
510
|
+
}
|
|
511
|
+
} else {
|
|
512
|
+
failuresRef.current = 0;
|
|
513
|
+
if (page.complete) {exhaustedRef.current = true;}
|
|
514
|
+
if (typeof page.cursor === 'number' && page.cursor < before) {
|
|
515
|
+
cursorRef.current = page.cursor;
|
|
516
|
+
} else if (!page.complete) {
|
|
517
|
+
// Same cursor back: this page made no progress, and asking again
|
|
518
|
+
// would repeat it forever.
|
|
519
|
+
exhaustedRef.current = true;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
setTick((value) => value + 1);
|
|
523
|
+
});
|
|
524
|
+
}, [
|
|
525
|
+
jump,
|
|
526
|
+
roomJID,
|
|
527
|
+
messages,
|
|
528
|
+
listData,
|
|
529
|
+
historyComplete,
|
|
530
|
+
jumpWindowActive,
|
|
531
|
+
tick,
|
|
532
|
+
isOwner,
|
|
533
|
+
scopeThreadId,
|
|
534
|
+
isUserAtBottomRef,
|
|
535
|
+
dispatch,
|
|
536
|
+
reduxStore,
|
|
537
|
+
]);
|
|
538
|
+
}
|
|
@@ -5,6 +5,20 @@ const DEFAULT_BATCH_SIZE = 5;
|
|
|
5
5
|
const DEFAULT_PAGE_SIZE = 10;
|
|
6
6
|
const DEFAULT_POLL_INTERVAL = 1_000;
|
|
7
7
|
|
|
8
|
+
// A load that never answers must not hold the sweep (and so every later
|
|
9
|
+
// tick) forever: past this the room is given up for this round.
|
|
10
|
+
const LOAD_DEADLINE_MS = 20_000;
|
|
11
|
+
|
|
12
|
+
const withDeadline = <T,>(work: Promise<T>, ms: number): Promise<T | void> => {
|
|
13
|
+
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
14
|
+
const deadline = new Promise<void>((resolve) => {
|
|
15
|
+
timer = setTimeout(resolve, ms);
|
|
16
|
+
});
|
|
17
|
+
return Promise.race([work, deadline]).finally(() => {
|
|
18
|
+
if (timer) {clearTimeout(timer);}
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
8
22
|
const roomHasMoreMessages = (room: IRoom, max: number = 20) =>
|
|
9
23
|
(room.messages?.length ?? 0) < max;
|
|
10
24
|
|
|
@@ -20,10 +34,12 @@ const useMessageLoaderQueue = (
|
|
|
20
34
|
) => {
|
|
21
35
|
const processedChats = useRef<Set<string>>(new Set());
|
|
22
36
|
const intervalRef = useRef<NodeJS.Timeout | null>(null);
|
|
37
|
+
// One sweep at a time: a sweep can outlast the poll interval (a slow
|
|
38
|
+
// archive answers in seconds), and an overlapping tick would ask for the
|
|
39
|
+
// very rooms the running one is still waiting on.
|
|
40
|
+
const sweepingRef = useRef(false);
|
|
23
41
|
|
|
24
|
-
const
|
|
25
|
-
if (globalLoading || loading) {return;}
|
|
26
|
-
|
|
42
|
+
const sweep = useCallback(async () => {
|
|
27
43
|
const unprocessed = roomsList.filter(
|
|
28
44
|
(jid) => !processedChats.current.has(jid)
|
|
29
45
|
);
|
|
@@ -49,7 +65,10 @@ const useMessageLoaderQueue = (
|
|
|
49
65
|
!room.historyComplete
|
|
50
66
|
) {
|
|
51
67
|
try {
|
|
52
|
-
await
|
|
68
|
+
await withDeadline(
|
|
69
|
+
loadMoreMessages(jid, pageSize),
|
|
70
|
+
LOAD_DEADLINE_MS
|
|
71
|
+
);
|
|
53
72
|
} catch (err) {
|
|
54
73
|
console.error(`Error loading messages for ${jid}`, err);
|
|
55
74
|
}
|
|
@@ -69,6 +88,23 @@ const useMessageLoaderQueue = (
|
|
|
69
88
|
pageSize,
|
|
70
89
|
]);
|
|
71
90
|
|
|
91
|
+
const processQueue = useCallback(async () => {
|
|
92
|
+
if (globalLoading || loading || sweepingRef.current) {return;}
|
|
93
|
+
sweepingRef.current = true;
|
|
94
|
+
try {
|
|
95
|
+
await sweep();
|
|
96
|
+
} finally {
|
|
97
|
+
sweepingRef.current = false;
|
|
98
|
+
}
|
|
99
|
+
}, [
|
|
100
|
+
roomsList?.length,
|
|
101
|
+
globalLoading,
|
|
102
|
+
loading,
|
|
103
|
+
loadMoreMessages,
|
|
104
|
+
batchSize,
|
|
105
|
+
pageSize,
|
|
106
|
+
]);
|
|
107
|
+
|
|
72
108
|
useEffect(() => {
|
|
73
109
|
if (intervalRef.current) {
|
|
74
110
|
clearInterval(intervalRef.current);
|