@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,12 +4,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
Object.defineProperty(exports, "loadRoomsThenJoinInBackground", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _backgroundJoinSweep.loadRoomsThenJoinInBackground;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "startBackgroundJoinSweep", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _backgroundJoinSweep.startBackgroundJoinSweep;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
7
19
|
var _react = require("react");
|
|
8
20
|
var _reactRedux = require("react-redux");
|
|
9
21
|
var _resolveLangSource = require("../helpers/resolveLangSource");
|
|
10
22
|
var _xmppProvider = require("../context/xmppProvider");
|
|
11
23
|
var _chatAutoEnterer = require("../helpers/chatAutoEnterer");
|
|
12
24
|
var _initRoomsPresence = require("../helpers/initRoomsPresence");
|
|
25
|
+
var _backgroundJoinSweep = require("../helpers/backgroundJoinSweep");
|
|
13
26
|
var _updateMessagesTillLast = require("../helpers/updateMessagesTillLast");
|
|
14
27
|
var _authRefresh = require("../networking/authRefresh");
|
|
15
28
|
var _chatSettingsSlice = require("../roomStore/chatSettingsSlice");
|
|
@@ -24,6 +37,9 @@ var _shallowEqual = require("../helpers/shallowEqual");
|
|
|
24
37
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
25
38
|
/** @format */
|
|
26
39
|
|
|
40
|
+
// The room list ends its loading state right after /chats/my; joining every
|
|
41
|
+
// room is a background sweep nobody waits for (see helpers/backgroundJoinSweep).
|
|
42
|
+
|
|
27
43
|
const useChatWrapperInit = ({
|
|
28
44
|
roomJID,
|
|
29
45
|
wasAutoSelected,
|
|
@@ -87,12 +103,13 @@ const useChatWrapperInit = ({
|
|
|
87
103
|
loading: true,
|
|
88
104
|
loadingText: 'Loading rooms...'
|
|
89
105
|
}));
|
|
90
|
-
|
|
91
|
-
|
|
106
|
+
// The list is usable as soon as the rooms fetch returns (rooms come
|
|
107
|
+
// seeded with lastMessage / unread). Joining them all runs in the
|
|
108
|
+
// background, open room first.
|
|
109
|
+
return (0, _backgroundJoinSweep.loadRoomsThenJoinInBackground)(client, () => syncRooms(client, config), () => dispatch((0, _roomsSlice.setIsLoading)({
|
|
92
110
|
loading: false,
|
|
93
111
|
loadingText: undefined
|
|
94
|
-
}));
|
|
95
|
-
return rooms;
|
|
112
|
+
})));
|
|
96
113
|
};
|
|
97
114
|
(0, _react.useEffect)(() => {
|
|
98
115
|
let retryTimeout;
|
|
@@ -126,7 +143,9 @@ const useChatWrapperInit = ({
|
|
|
126
143
|
if (roomsList && Object.keys(roomsList).length > 0) {
|
|
127
144
|
console.log(' Using existing roomsList', Object.keys(roomsList).length);
|
|
128
145
|
setInited(true);
|
|
129
|
-
|
|
146
|
+
// Persisted rooms: join (background sweep) + push subscribe
|
|
147
|
+
// without holding the private-store / unread step behind it.
|
|
148
|
+
(0, _initRoomsPresence.initRoomsPresence)(newClient, roomsList).catch(() => undefined);
|
|
130
149
|
} else {
|
|
131
150
|
if (config?.newArch) {
|
|
132
151
|
console.log(' Loading rooms with newArch');
|
|
@@ -189,6 +208,9 @@ const useChatWrapperInit = ({
|
|
|
189
208
|
}
|
|
190
209
|
}
|
|
191
210
|
setInited(true);
|
|
211
|
+
// Rooms that appeared since the bootstrap sweep (a /chats/my that
|
|
212
|
+
// returned late) get joined too; a no-op when nothing is left.
|
|
213
|
+
(0, _backgroundJoinSweep.startBackgroundJoinSweep)(client);
|
|
192
214
|
console.log(' Getting chats private store for existing client');
|
|
193
215
|
try {
|
|
194
216
|
// See the "new client" branch above: getChatsPrivateStoreRequestStanza
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactRedux","_resolveLangSource","_xmppProvider","_chatAutoEnterer","_initRoomsPresence","_updateMessagesTillLast","_authRefresh","_chatSettingsSlice","_languageSettings","_roomsSlice","_useRoomState","_useChatSettingState","_isChatIdPresentInArray","_useGetNewArchRoom","_interopRequireDefault","_getRoomsWithRetry","_shallowEqual","e","__esModule","default","useChatWrapperInit","roomJID","wasAutoSelected","config","dispatch","useDispatch","inited","setInited","useState","showModal","setShowModal","isConnectionLost","setConnectionLost","isRetrying","setIsRetrying","hasSyncedHistoryRef","useRef","client","initializeClient","setClient","useXmppClient","syncRooms","useGetNewArchRoom","rooms","useSelector","state","roomsList","useRoomState","user","useChatSettingState","useEffect","xmppPassword","console","log","close","lastSyncedConfigRef","undefined","shallowEqual","current","setConfig","getRoomsWithRertyRequest","retryRooms","getRoomsWithRetry","loadRooms","disableLoad","setIsLoading","loading","loadingText","retryTimeout","initXmmpClient","legacyLangSource","resolveLegacyTranslatesLangSource","translates","setLangSource","applyProfileLanguages","xmppUsername","error","chatAutoEnterer","newClient","defaultWallet","walletAddress","xmppSettings","status","Object","keys","length","initRoomsPresence","newArch","loadedRooms","enableRoomsRetry","enabled","isSelectedRoomPresent","isChatIdPresentInArray","getRoomsStanza","roomTimestampObject","getChatsPrivateStoreRequestStanza","updateMessagesTillLast","err","warn","refreshTokens","refreshAuthTokensQuietly","setTimeout","clearTimeout","_default","exports"],"sourceRoot":"../../../src","sources":["hooks/useChatWrapperInit.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_react","require","_reactRedux","_resolveLangSource","_xmppProvider","_chatAutoEnterer","_initRoomsPresence","_backgroundJoinSweep","_updateMessagesTillLast","_authRefresh","_chatSettingsSlice","_languageSettings","_roomsSlice","_useRoomState","_useChatSettingState","_isChatIdPresentInArray","_useGetNewArchRoom","_interopRequireDefault","_getRoomsWithRetry","_shallowEqual","e","__esModule","default","useChatWrapperInit","roomJID","wasAutoSelected","config","dispatch","useDispatch","inited","setInited","useState","showModal","setShowModal","isConnectionLost","setConnectionLost","isRetrying","setIsRetrying","hasSyncedHistoryRef","useRef","client","initializeClient","setClient","useXmppClient","syncRooms","useGetNewArchRoom","rooms","useSelector","state","roomsList","useRoomState","user","useChatSettingState","useEffect","xmppPassword","console","log","close","lastSyncedConfigRef","undefined","shallowEqual","current","setConfig","getRoomsWithRertyRequest","retryRooms","getRoomsWithRetry","loadRooms","disableLoad","setIsLoading","loading","loadingText","loadRoomsThenJoinInBackground","retryTimeout","initXmmpClient","legacyLangSource","resolveLegacyTranslatesLangSource","translates","setLangSource","applyProfileLanguages","xmppUsername","error","chatAutoEnterer","newClient","defaultWallet","walletAddress","xmppSettings","status","Object","keys","length","initRoomsPresence","catch","newArch","loadedRooms","enableRoomsRetry","enabled","isSelectedRoomPresent","isChatIdPresentInArray","getRoomsStanza","roomTimestampObject","getChatsPrivateStoreRequestStanza","updateMessagesTillLast","err","warn","refreshTokens","refreshAuthTokensQuietly","setTimeout","startBackgroundJoinSweep","clearTimeout","_default","exports"],"sourceRoot":"../../../src","sources":["hooks/useChatWrapperInit.ts"],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EAAET,OAAO,IAAI,IAAAU,qCAAwB,EAAC,CAAC;YAC9D;UACF;QACF;QACA9E,QAAQ,CAAC,IAAAyC,wBAAY,EAAC;UAAEC,OAAO,EAAE;QAAM,CAAC,CAAC,CAAC;MAC5C,CAAC,CAAC,OAAOW,KAAK,EAAE;QACdzB,OAAO,CAACyB,KAAK,CAAC,cAAc,EAAEA,KAAK,CAAC;QACpC/C,YAAY,CAAC,KAAK,CAAC;QACnBE,iBAAiB,CAAC,IAAI,CAAC;QACvBL,SAAS,CAAC,KAAK,CAAC;QAChBH,QAAQ,CAAC,IAAAyC,wBAAY,EAAC;UAAEC,OAAO,EAAE;QAAM,CAAC,CAAC,CAAC;QAC1CG,YAAY,GAAGkC,UAAU,CAACjC,cAAc,EAAE,IAAI,CAAC;MACjD;IACF,CAAC;IAEDA,cAAc,CAAC,CAAC;IAEhB,OAAO,MAAM;MACXmC,YAAY,CAACpC,YAAY,CAAC;IAC5B,CAAC;EACH,CAAC,EAAE,CAACrB,IAAI,CAACG,YAAY,EAAEH,IAAI,CAAC4B,YAAY,CAAC,CAAC;EAE1C,OAAO;IACLvC,MAAM;IACNX,MAAM;IACNO,UAAU;IACVJ,SAAS;IACTE,gBAAgB;IAChBQ,SAAS,EAAEA,SAAgB;IAC3BZ,SAAS;IACTG;EACF,CAAC;AACH,CAAC;AAAC,IAAA4E,QAAA,GAAAC,OAAA,CAAAxF,OAAA,GAEaC,kBAAkB","ignoreList":[]}
|
|
@@ -7,6 +7,22 @@ exports.useHeapSender = void 0;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _reactRedux = require("react-redux");
|
|
9
9
|
var _useMessageHeapState = require("./useMessageHeapState");
|
|
10
|
+
// "Joining works" is enough to drain the heap: the first wave of the join
|
|
11
|
+
// sweep (open room + one pool width). Waiting for the WHOLE sweep would hold
|
|
12
|
+
// queued messages behind joins of rooms nobody is writing to. Clients that
|
|
13
|
+
// do not expose the priority flag fall back to the full-sweep flag.
|
|
14
|
+
const isJoinReady = client => {
|
|
15
|
+
if (!client) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
const priority = client.priorityPresencesReady;
|
|
19
|
+
return typeof priority === 'boolean' ? priority : !!client.presencesReady;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// The flags are plain fields on the client (no re-render when they flip), so
|
|
23
|
+
// a drain that finds the gate closed, or a room it could not join, tries
|
|
24
|
+
// again on its own.
|
|
25
|
+
const RETRY_MS = 1000;
|
|
10
26
|
const useHeapSender = client => {
|
|
11
27
|
const dispatch = (0, _reactRedux.useDispatch)();
|
|
12
28
|
const {
|
|
@@ -14,12 +30,24 @@ const useHeapSender = client => {
|
|
|
14
30
|
} = (0, _useMessageHeapState.useMessageHeapState)();
|
|
15
31
|
const sendingRef = (0, _react.useRef)(false);
|
|
16
32
|
const inFlightRef = (0, _react.useRef)(new Map());
|
|
33
|
+
const retryTimerRef = (0, _react.useRef)(null);
|
|
34
|
+
const sendRef = (0, _react.useRef)(async () => {});
|
|
35
|
+
const scheduleRetry = () => {
|
|
36
|
+
if (retryTimerRef.current) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
retryTimerRef.current = setTimeout(() => {
|
|
40
|
+
retryTimerRef.current = null;
|
|
41
|
+
sendRef.current().catch(() => undefined);
|
|
42
|
+
}, RETRY_MS);
|
|
43
|
+
};
|
|
17
44
|
const sendHeapMessages = (0, _react.useCallback)(async () => {
|
|
18
45
|
if (!client || queue.length === 0) {
|
|
19
46
|
return;
|
|
20
47
|
}
|
|
21
|
-
if (!client
|
|
48
|
+
if (!isJoinReady(client)) {
|
|
22
49
|
console.warn('Presences not ready, delaying heap send');
|
|
50
|
+
scheduleRetry();
|
|
23
51
|
return;
|
|
24
52
|
}
|
|
25
53
|
if (sendingRef.current) {
|
|
@@ -32,6 +60,19 @@ const useHeapSender = client => {
|
|
|
32
60
|
if (lastAttempt && Date.now() - lastAttempt < 15000) {
|
|
33
61
|
continue;
|
|
34
62
|
}
|
|
63
|
+
// Join the message's own room first (deduped, a no-op for a room the
|
|
64
|
+
// sweep already joined). A room that cannot be joined keeps the
|
|
65
|
+
// message queued; it is retried on the next pass.
|
|
66
|
+
let joined = true;
|
|
67
|
+
try {
|
|
68
|
+
joined = await client.presenceInRoomStanza?.(msg.roomJid);
|
|
69
|
+
} catch {
|
|
70
|
+
joined = false;
|
|
71
|
+
}
|
|
72
|
+
if (joined === false) {
|
|
73
|
+
scheduleRetry();
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
35
76
|
inFlightRef.current.set(msg.id, Date.now());
|
|
36
77
|
try {
|
|
37
78
|
if (msg.langSource) {
|
|
@@ -50,15 +91,25 @@ const useHeapSender = client => {
|
|
|
50
91
|
sendingRef.current = false;
|
|
51
92
|
}
|
|
52
93
|
}, [client, queue, dispatch]);
|
|
94
|
+
sendRef.current = sendHeapMessages;
|
|
95
|
+
(0, _react.useEffect)(() => () => {
|
|
96
|
+
if (retryTimerRef.current) {
|
|
97
|
+
clearTimeout(retryTimerRef.current);
|
|
98
|
+
}
|
|
99
|
+
retryTimerRef.current = null;
|
|
100
|
+
}, []);
|
|
53
101
|
const prevReadyRef = (0, _react.useRef)(false);
|
|
54
102
|
(0, _react.useEffect)(() => {
|
|
55
|
-
const nowReady =
|
|
103
|
+
const nowReady = isJoinReady(client);
|
|
56
104
|
const wasReady = prevReadyRef.current;
|
|
57
105
|
prevReadyRef.current = nowReady;
|
|
58
106
|
if (!wasReady && nowReady && queue.length > 0) {
|
|
59
107
|
sendHeapMessages();
|
|
108
|
+
} else if (!nowReady && queue.length > 0) {
|
|
109
|
+
// The ready flag flips on the client without a re-render: poll.
|
|
110
|
+
scheduleRetry();
|
|
60
111
|
}
|
|
61
|
-
}, [client?.presencesReady, queue.length, sendHeapMessages]);
|
|
112
|
+
}, [client?.presencesReady, client?.priorityPresencesReady, queue.length, sendHeapMessages]);
|
|
62
113
|
(0, _react.useEffect)(() => {
|
|
63
114
|
const currentIds = new Set(queue.map(m => m.id));
|
|
64
115
|
for (const id of Array.from(inFlightRef.current.keys())) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactRedux","_useMessageHeapState","
|
|
1
|
+
{"version":3,"names":["_react","require","_reactRedux","_useMessageHeapState","isJoinReady","client","priority","priorityPresencesReady","presencesReady","RETRY_MS","useHeapSender","dispatch","useDispatch","queue","useMessageHeapState","sendingRef","useRef","inFlightRef","Map","retryTimerRef","sendRef","scheduleRetry","current","setTimeout","catch","undefined","sendHeapMessages","useCallback","length","console","warn","msg","lastAttempt","get","id","Date","now","joined","presenceInRoomStanza","roomJid","set","langSource","sendTextMessageWithTranslateTagStanza","user","firstName","name","split","lastName","walletAddress","body","isReply","showInChannel","mainMessage","sendMessage","String","err","delete","useEffect","clearTimeout","prevReadyRef","nowReady","wasReady","currentIds","Set","map","m","Array","from","keys","has","exports"],"sourceRoot":"../../../src","sources":["hooks/useHeapSender.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,oBAAA,GAAAF,OAAA;AAIA;AACA;AACA;AACA;AACA,MAAMG,WAAW,GAAIC,MAAyB,IAAc;EAC1D,IAAI,CAACA,MAAM,EAAE;IAAC,OAAO,KAAK;EAAC;EAC3B,MAAMC,QAAQ,GAAID,MAAM,CAASE,sBAAsB;EACvD,OAAO,OAAOD,QAAQ,KAAK,SAAS,GAAGA,QAAQ,GAAG,CAAC,CAACD,MAAM,CAACG,cAAc;AAC3E,CAAC;;AAED;AACA;AACA;AACA,MAAMC,QAAQ,GAAG,IAAI;AAEd,MAAMC,aAAa,GAAIL,MAAyB,IAAK;EAC1D,MAAMM,QAAQ,GAAG,IAAAC,uBAAW,EAAC,CAAC;EAC9B,MAAM;IAAEC;EAAM,CAAC,GAAG,IAAAC,wCAAmB,EAAC,CAAC;EACvC,MAAMC,UAAU,GAAG,IAAAC,aAAM,EAAC,KAAK,CAAC;EACh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,CAACkC,QAAQ,IAAI/C,KAAK,CAACe,MAAM,GAAG,CAAC,EAAE;MACxC;MACAP,aAAa,CAAC,CAAC;IACjB;EACF,CAAC,EAAE,CAAChB,MAAM,EAAEG,cAAc,EAAEH,MAAM,EAAEE,sBAAsB,EAAEM,KAAK,CAACe,MAAM,EAAEF,gBAAgB,CAAC,CAAC;EAE5F,IAAA+B,gBAAS,EAAC,MAAM;IACd,MAAMK,UAAU,GAAG,IAAIC,GAAG,CAAClD,KAAK,CAACmD,GAAG,CAAEC,CAAC,IAAKA,CAAC,CAAC/B,EAAE,CAAC,CAAC;IAClD,KAAK,MAAMA,EAAE,IAAIgC,KAAK,CAACC,IAAI,CAAClD,WAAW,CAACK,OAAO,CAAC8C,IAAI,CAAC,CAAC,CAAC,EAAE;MACvD,IAAI,CAACN,UAAU,CAACO,GAAG,CAACnC,EAAE,CAAC,EAAE;QACvBjB,WAAW,CAACK,OAAO,CAACkC,MAAM,CAACtB,EAAE,CAAC;MAChC;IACF;EACF,CAAC,EAAE,CAACrB,KAAK,CAAC,CAAC;EAEX,OAAO;IAAEa;EAAiB,CAAC;AAC7B,CAAC;AAAC4C,OAAA,CAAA5D,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "HIGHLIGHT_MS", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _bubbleHighlight.HIGHLIGHT_MS;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
exports.JUMP_PAGE_SIZE = exports.HIGHLIGHT_SETTLE_MS = void 0;
|
|
13
|
+
Object.defineProperty(exports, "JUMP_TTL_MS", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _jumpThread.JUMP_TTL_MS;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
exports.ROOM_OPENING_POLL_MS = exports.ROOM_OPENING_GRACE_MS = exports.NEAR_LIVE_MESSAGES = exports.MAX_WINDOW_RETRIES = exports.MAX_PAGE_FAILURES = exports.MAX_HISTORY_PAGES = void 0;
|
|
20
|
+
Object.defineProperty(exports, "findMessageIndex", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () {
|
|
23
|
+
return _jumpThread.findMessageIndex;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
exports.useJumpToMessage = useJumpToMessage;
|
|
27
|
+
var _react = require("react");
|
|
28
|
+
var _reactRedux = require("react-redux");
|
|
29
|
+
var _roomsSlice = require("../roomStore/roomsSlice");
|
|
30
|
+
var _toastEmitter = require("../utils/toastEmitter");
|
|
31
|
+
var _useT = require("../i18n/useT");
|
|
32
|
+
var _jumpThread = require("../helpers/jumpThread");
|
|
33
|
+
var _bubbleHighlight = require("../helpers/bubbleHighlight");
|
|
34
|
+
// How far back the paging fallback goes before giving up. A request may stay
|
|
35
|
+
// alive for JUMP_TTL_MS at all (a room that never finishes opening must not
|
|
36
|
+
// leave one armed to fire at some unrelated later moment).
|
|
37
|
+
const MAX_HISTORY_PAGES = exports.MAX_HISTORY_PAGES = 40;
|
|
38
|
+
const JUMP_PAGE_SIZE = exports.JUMP_PAGE_SIZE = 100;
|
|
39
|
+
// A page request that fails is retried this many times in a row before the
|
|
40
|
+
// history is treated as unreachable.
|
|
41
|
+
const MAX_PAGE_FAILURES = exports.MAX_PAGE_FAILURES = 3;
|
|
42
|
+
// A target already in the store and at most this far from the newest message
|
|
43
|
+
// is reached by scrolling the live list. Anything farther is fetched as a
|
|
44
|
+
// small window around it instead: re-merging a thousand rows to reach it is
|
|
45
|
+
// what made a far jump lag.
|
|
46
|
+
const NEAR_LIVE_MESSAGES = exports.NEAR_LIVE_MESSAGES = 300;
|
|
47
|
+
// A jump into a room that is still opening waits this long for its live list
|
|
48
|
+
// before it stops waiting for it and asks the archive directly.
|
|
49
|
+
const ROOM_OPENING_GRACE_MS = exports.ROOM_OPENING_GRACE_MS = 4000;
|
|
50
|
+
// Pause between checks while waiting for a room that is still opening, and
|
|
51
|
+
// how many times a window request that could not be asked is repeated.
|
|
52
|
+
const ROOM_OPENING_POLL_MS = exports.ROOM_OPENING_POLL_MS = 700;
|
|
53
|
+
const MAX_WINDOW_RETRIES = exports.MAX_WINDOW_RETRIES = 6;
|
|
54
|
+
// The highlight starts once the list has laid out the rows around the target
|
|
55
|
+
// and the scroll (with its retries, see MessageList) has settled.
|
|
56
|
+
const HIGHLIGHT_SETTLE_MS = exports.HIGHLIGHT_SETTLE_MS = 450;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* How the attempt to open a window around the target went:
|
|
60
|
+
* - found: the window is in the store; the list now renders it;
|
|
61
|
+
* - missing: the server answered and the target is not in its archive;
|
|
62
|
+
* - unavailable: could not ask (no archive id, request failed): page instead.
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
/** What the server said about one page of older history. */
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Fulfils a pending "scroll to this message" request for this room.
|
|
69
|
+
*
|
|
70
|
+
* The target can be in one of three places, tried in this order:
|
|
71
|
+
* 1. in the list (virtualised, so mounted or not does not matter) and not
|
|
72
|
+
* far from the newest message: scroll to its row, then highlight its
|
|
73
|
+
* bubble;
|
|
74
|
+
* 2. not loaded, or loaded but far back: fetch a short window of the archive
|
|
75
|
+
* around it (the list shows that instead of the live list) and scroll to
|
|
76
|
+
* it there;
|
|
77
|
+
* 3. no window possible (no archive id, request failed): page older history
|
|
78
|
+
* by the server's own cursor until it shows up or the history ends.
|
|
79
|
+
* If the server says the message is not in its archive, show the message
|
|
80
|
+
* itself in a card (a search hit always ends with the message on screen); a
|
|
81
|
+
* request with nothing to show says it could not be found.
|
|
82
|
+
*
|
|
83
|
+
* Exactly one list owns a request (see `scope`).
|
|
84
|
+
*/
|
|
85
|
+
function useJumpToMessage({
|
|
86
|
+
roomJID,
|
|
87
|
+
messages,
|
|
88
|
+
listData,
|
|
89
|
+
scrollToIndex,
|
|
90
|
+
onHighlight,
|
|
91
|
+
loadMoreMessages,
|
|
92
|
+
fetchOlderPage,
|
|
93
|
+
historyComplete,
|
|
94
|
+
isUserAtBottomRef,
|
|
95
|
+
jumpWindowActive = false,
|
|
96
|
+
fetchWindow,
|
|
97
|
+
scope = 'main',
|
|
98
|
+
allMessages,
|
|
99
|
+
resolveReply,
|
|
100
|
+
roomOpening = false
|
|
101
|
+
}) {
|
|
102
|
+
const dispatch = (0, _reactRedux.useDispatch)();
|
|
103
|
+
const reduxStore = (0, _reactRedux.useStore)();
|
|
104
|
+
const t = (0, _useT.useT)();
|
|
105
|
+
const jump = (0, _reactRedux.useSelector)(state => state.rooms.pendingJump);
|
|
106
|
+
const jumpThread = (0, _jumpThread.useJumpThread)();
|
|
107
|
+
const ownerThreadId = (0, _jumpThread.ownerThreadFor)(jumpThread, jump?.at);
|
|
108
|
+
const scopeThreadId = scope === 'main' ? null : scope.threadId;
|
|
109
|
+
const isOwner = scopeThreadId === null ? ownerThreadId === null : ownerThreadId === scopeThreadId;
|
|
110
|
+
const attemptsRef = (0, _react.useRef)(0);
|
|
111
|
+
const loadingRef = (0, _react.useRef)(false);
|
|
112
|
+
// Callbacks that change identity on render live in a ref so they do not
|
|
113
|
+
// retrigger the effect below.
|
|
114
|
+
const latest = (0, _react.useRef)({
|
|
115
|
+
t,
|
|
116
|
+
loadMoreMessages,
|
|
117
|
+
fetchOlderPage,
|
|
118
|
+
scrollToIndex,
|
|
119
|
+
onHighlight,
|
|
120
|
+
fetchWindow,
|
|
121
|
+
resolveReply,
|
|
122
|
+
allMessages,
|
|
123
|
+
roomOpening
|
|
124
|
+
});
|
|
125
|
+
latest.current = {
|
|
126
|
+
t,
|
|
127
|
+
loadMoreMessages,
|
|
128
|
+
fetchOlderPage,
|
|
129
|
+
scrollToIndex,
|
|
130
|
+
onHighlight,
|
|
131
|
+
fetchWindow,
|
|
132
|
+
resolveReply,
|
|
133
|
+
allMessages,
|
|
134
|
+
roomOpening
|
|
135
|
+
};
|
|
136
|
+
const replyResolvedAtRef = (0, _react.useRef)(null);
|
|
137
|
+
const windowRetriesRef = (0, _react.useRef)(0);
|
|
138
|
+
// Per request: whether a window was already tried, and whether the server
|
|
139
|
+
// said the target does not exist.
|
|
140
|
+
const windowTriedAtRef = (0, _react.useRef)(null);
|
|
141
|
+
const windowMissingAtRef = (0, _react.useRef)(null);
|
|
142
|
+
const currentJumpAtRef = (0, _react.useRef)(null);
|
|
143
|
+
currentJumpAtRef.current = jump?.at ?? null;
|
|
144
|
+
// The request whose scroll is already scheduled. Re-runs of the effect must
|
|
145
|
+
// not schedule it a second time.
|
|
146
|
+
const scheduledAtRef = (0, _react.useRef)(null);
|
|
147
|
+
// Where the next page of older history starts: the server's cursor from the
|
|
148
|
+
// previous page, or (first page) the oldest of what the room already knows.
|
|
149
|
+
const cursorRef = (0, _react.useRef)(null);
|
|
150
|
+
// The server has nothing older, or paging stopped making progress.
|
|
151
|
+
const exhaustedRef = (0, _react.useRef)(false);
|
|
152
|
+
const failuresRef = (0, _react.useRef)(0);
|
|
153
|
+
const timersRef = (0, _react.useRef)({});
|
|
154
|
+
const [tick, setTick] = (0, _react.useState)(0);
|
|
155
|
+
(0, _react.useEffect)(() => () => {
|
|
156
|
+
const timers = timersRef.current;
|
|
157
|
+
if (timers.scroll) {
|
|
158
|
+
clearTimeout(timers.scroll);
|
|
159
|
+
}
|
|
160
|
+
if (timers.settle) {
|
|
161
|
+
clearTimeout(timers.settle);
|
|
162
|
+
}
|
|
163
|
+
if (timers.clear) {
|
|
164
|
+
clearTimeout(timers.clear);
|
|
165
|
+
}
|
|
166
|
+
if (timers.retry) {
|
|
167
|
+
clearTimeout(timers.retry);
|
|
168
|
+
}
|
|
169
|
+
}, []);
|
|
170
|
+
|
|
171
|
+
// A new request starts its own page budget.
|
|
172
|
+
(0, _react.useEffect)(() => {
|
|
173
|
+
attemptsRef.current = 0;
|
|
174
|
+
cursorRef.current = null;
|
|
175
|
+
exhaustedRef.current = false;
|
|
176
|
+
failuresRef.current = 0;
|
|
177
|
+
windowRetriesRef.current = 0;
|
|
178
|
+
}, [jump?.at]);
|
|
179
|
+
(0, _react.useEffect)(() => {
|
|
180
|
+
if (!jump || jump.roomJID !== roomJID || !isOwner) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
isUserAtBottomRef.current = false;
|
|
184
|
+
const finish = reached => {
|
|
185
|
+
dispatch((0, _roomsSlice.clearPendingJump)());
|
|
186
|
+
if (reached) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Not reachable in the transcript. If the request knows what the
|
|
191
|
+
// message says (every search hit does), show IT, so the tap always ends
|
|
192
|
+
// with the message in front of the reader and nothing that reads as an
|
|
193
|
+
// error. Only a jump with no message to show (a notification or a link)
|
|
194
|
+
// falls back to saying it could not be found.
|
|
195
|
+
if (jump.preview) {
|
|
196
|
+
dispatch((0, _roomsSlice.showArchivedMessage)(jump.preview));
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const {
|
|
200
|
+
t: tr
|
|
201
|
+
} = latest.current;
|
|
202
|
+
_toastEmitter.toastEmitter.emit({
|
|
203
|
+
id: `jump-to-message-missing-${Date.now()}`,
|
|
204
|
+
title: tr('search.messages.title'),
|
|
205
|
+
message: tr('search.messages.notFound'),
|
|
206
|
+
type: 'info'
|
|
207
|
+
});
|
|
208
|
+
};
|
|
209
|
+
if (Date.now() - jump.at > _jumpThread.JUMP_TTL_MS) {
|
|
210
|
+
// Expired, but the message is in the list: nothing is missing, so no
|
|
211
|
+
// "archived" card.
|
|
212
|
+
finish((0, _jumpThread.findMessageIndex)(messages, jump.ids, {
|
|
213
|
+
createdAt: jump.createdAt,
|
|
214
|
+
body: jump.body
|
|
215
|
+
}) >= 0);
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Waiting on something the store will not announce (a room still opening):
|
|
220
|
+
// look again shortly. The TTL above bounds how long this can go on.
|
|
221
|
+
const recheckSoon = () => {
|
|
222
|
+
if (timersRef.current.retry) {
|
|
223
|
+
clearTimeout(timersRef.current.retry);
|
|
224
|
+
}
|
|
225
|
+
timersRef.current.retry = setTimeout(() => setTick(value => value + 1), ROOM_OPENING_POLL_MS);
|
|
226
|
+
};
|
|
227
|
+
const content = {
|
|
228
|
+
createdAt: jump.createdAt,
|
|
229
|
+
body: jump.body
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
// A target that is a thread reply is not in this (main) list at all: it
|
|
233
|
+
// lives in its parent's thread. Open that thread, which takes the jump over.
|
|
234
|
+
if (scopeThreadId === null && latest.current.resolveReply && replyResolvedAtRef.current !== jump.at) {
|
|
235
|
+
const pool = latest.current.allMessages ?? messages;
|
|
236
|
+
const rawIndex = (0, _jumpThread.findMessageIndex)(pool, jump.ids, content);
|
|
237
|
+
const raw = rawIndex >= 0 ? pool[rawIndex] : null;
|
|
238
|
+
if (raw && (0, _jumpThread.replyParentId)(raw)) {
|
|
239
|
+
replyResolvedAtRef.current = jump.at;
|
|
240
|
+
loadingRef.current = true;
|
|
241
|
+
const requestedAt = jump.at;
|
|
242
|
+
latest.current.resolveReply(jump, raw).catch(() => false).then(opened => {
|
|
243
|
+
loadingRef.current = false;
|
|
244
|
+
if (currentJumpAtRef.current !== requestedAt) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
if (!opened) {
|
|
248
|
+
finish(false);
|
|
249
|
+
} else {
|
|
250
|
+
setTick(value => value + 1);
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
const index = (0, _jumpThread.findMessageIndex)(messages, jump.ids, content);
|
|
257
|
+
const windowAvailable = Boolean(latest.current.fetchWindow) && windowTriedAtRef.current !== jump.at;
|
|
258
|
+
if (index >= 0 && (jumpWindowActive || messages.length - index <= NEAR_LIVE_MESSAGES || !windowAvailable)) {
|
|
259
|
+
const targetId = String(messages[index].id);
|
|
260
|
+
const rowIndex = listData.findIndex(message => String(message.id) === targetId);
|
|
261
|
+
// The list has not caught up with the messages yet: look again when it
|
|
262
|
+
// has (this effect re-runs with it).
|
|
263
|
+
if (rowIndex < 0) {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
if (scheduledAtRef.current === jump.at) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
scheduledAtRef.current = jump.at;
|
|
270
|
+
|
|
271
|
+
// Next tick: let the list lay out whatever the room switch, page load or
|
|
272
|
+
// window just handed it before measuring against it. The highlight
|
|
273
|
+
// starts only after the scroll has settled, and its clock starts then.
|
|
274
|
+
timersRef.current.scroll = setTimeout(() => {
|
|
275
|
+
latest.current.scrollToIndex(rowIndex);
|
|
276
|
+
timersRef.current.settle = setTimeout(() => {
|
|
277
|
+
latest.current.onHighlight(targetId);
|
|
278
|
+
timersRef.current.clear = setTimeout(() => latest.current.onHighlight(null), _bubbleHighlight.HIGHLIGHT_MS);
|
|
279
|
+
}, HIGHLIGHT_SETTLE_MS);
|
|
280
|
+
}, 0);
|
|
281
|
+
finish(true);
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// A new request for a message outside the window now on screen: go back
|
|
286
|
+
// to the live list first (this effect re-runs with it).
|
|
287
|
+
if (jumpWindowActive) {
|
|
288
|
+
dispatch((0, _roomsSlice.clearJumpWindow)());
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// Not loaded, or loaded but far back. An empty list means the room is
|
|
293
|
+
// still opening: give its live list a moment (the target is usually in it),
|
|
294
|
+
// then ask the archive directly rather than wait for a history that can
|
|
295
|
+
// take ten seconds. The TTL above bounds all of it.
|
|
296
|
+
if (loadingRef.current) {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
if (messages.length === 0 && (!latest.current.fetchWindow || latest.current.roomOpening && Date.now() - jump.at < ROOM_OPENING_GRACE_MS)) {
|
|
300
|
+
recheckSoon();
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
if (windowMissingAtRef.current === jump.at && index < 0) {
|
|
304
|
+
finish(false);
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// Fetch only a window around the target instead of paging the whole
|
|
309
|
+
// stretch of history between it and the live tail.
|
|
310
|
+
if (windowAvailable && latest.current.fetchWindow) {
|
|
311
|
+
windowTriedAtRef.current = jump.at;
|
|
312
|
+
loadingRef.current = true;
|
|
313
|
+
const requestedAt = jump.at;
|
|
314
|
+
latest.current.fetchWindow(jump).catch(() => 'unavailable').then(result => {
|
|
315
|
+
loadingRef.current = false;
|
|
316
|
+
if (currentJumpAtRef.current !== requestedAt) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
if (result === 'missing') {
|
|
320
|
+
windowMissingAtRef.current = requestedAt;
|
|
321
|
+
}
|
|
322
|
+
if (result === 'unavailable' && latest.current.roomOpening && windowRetriesRef.current < MAX_WINDOW_RETRIES) {
|
|
323
|
+
// Could not ask yet (connection or room still coming up): ask
|
|
324
|
+
// again, instead of falling back to paging a room with no history.
|
|
325
|
+
windowRetriesRef.current += 1;
|
|
326
|
+
windowTriedAtRef.current = null;
|
|
327
|
+
recheckSoon();
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
setTick(value => value + 1);
|
|
331
|
+
});
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
if (messages.length === 0) {
|
|
335
|
+
recheckSoon();
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
const firstReal = messages.find(message => !String(message.id).startsWith('delimiter-new'));
|
|
339
|
+
if (!firstReal) {
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
if (exhaustedRef.current || historyComplete || attemptsRef.current >= MAX_HISTORY_PAGES) {
|
|
343
|
+
finish(false);
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// Page back through the archive by the server's own cursor. Each request
|
|
348
|
+
// resolves only once its page is in the store, so there is nothing to wait
|
|
349
|
+
// out and no guessing from the list: the answer to "is there more" is the
|
|
350
|
+
// server's, not "did the oldest displayed message change". The first page
|
|
351
|
+
// starts from the server cursor the room already holds when that is
|
|
352
|
+
// older than the oldest displayed message (a page of receipts displays
|
|
353
|
+
// nothing but still moved the cursor).
|
|
354
|
+
const oldestDisplayed = Number(firstReal.id);
|
|
355
|
+
const roomCursor = reduxStore.getState().rooms.rooms?.[roomJID]?.messageStats?.firstMessageTimestamp;
|
|
356
|
+
const startFrom = typeof roomCursor === 'number' && Number.isFinite(roomCursor) && (!Number.isFinite(oldestDisplayed) || roomCursor < oldestDisplayed) ? roomCursor : oldestDisplayed;
|
|
357
|
+
const before = cursorRef.current ?? startFrom;
|
|
358
|
+
if (!Number.isFinite(before)) {
|
|
359
|
+
finish(false);
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
attemptsRef.current += 1;
|
|
363
|
+
loadingRef.current = true;
|
|
364
|
+
const fetchPage = latest.current.fetchOlderPage ?? (async (jid, from, max) => {
|
|
365
|
+
const loadMore = latest.current.loadMoreMessages;
|
|
366
|
+
if (!loadMore) {
|
|
367
|
+
return {
|
|
368
|
+
ok: false
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
await loadMore(jid, max, from);
|
|
372
|
+
const room = reduxStore.getState().rooms.rooms?.[jid];
|
|
373
|
+
return {
|
|
374
|
+
ok: true,
|
|
375
|
+
cursor: room?.messageStats?.firstMessageTimestamp,
|
|
376
|
+
complete: Boolean(room?.historyComplete)
|
|
377
|
+
};
|
|
378
|
+
});
|
|
379
|
+
fetchPage(roomJID, before, JUMP_PAGE_SIZE).catch(() => ({
|
|
380
|
+
ok: false
|
|
381
|
+
})).then(page => {
|
|
382
|
+
loadingRef.current = false;
|
|
383
|
+
if (!page.ok) {
|
|
384
|
+
// A room that is still opening cannot answer yet: that is not the
|
|
385
|
+
// history being unreachable, so it does not count.
|
|
386
|
+
if (latest.current.roomOpening) {
|
|
387
|
+
recheckSoon();
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
failuresRef.current += 1;
|
|
391
|
+
if (failuresRef.current >= MAX_PAGE_FAILURES) {
|
|
392
|
+
exhaustedRef.current = true;
|
|
393
|
+
}
|
|
394
|
+
} else {
|
|
395
|
+
failuresRef.current = 0;
|
|
396
|
+
if (page.complete) {
|
|
397
|
+
exhaustedRef.current = true;
|
|
398
|
+
}
|
|
399
|
+
if (typeof page.cursor === 'number' && page.cursor < before) {
|
|
400
|
+
cursorRef.current = page.cursor;
|
|
401
|
+
} else if (!page.complete) {
|
|
402
|
+
// Same cursor back: this page made no progress, and asking again
|
|
403
|
+
// would repeat it forever.
|
|
404
|
+
exhaustedRef.current = true;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
setTick(value => value + 1);
|
|
408
|
+
});
|
|
409
|
+
}, [jump, roomJID, messages, listData, historyComplete, jumpWindowActive, tick, isOwner, scopeThreadId, isUserAtBottomRef, dispatch, reduxStore]);
|
|
410
|
+
}
|
|
411
|
+
//# sourceMappingURL=useJumpToMessage.js.map
|