@ethora/chat-component-rn 26.9.1 → 26.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/README.md +19 -0
- package/lib/commonjs/assets/icons.js +2 -2
- package/lib/commonjs/assets/icons.js.map +1 -1
- package/lib/commonjs/components/Header/HeaderRoomList.js +22 -6
- package/lib/commonjs/components/Header/HeaderRoomList.js.map +1 -1
- package/lib/commonjs/components/InputComponents/Search.js +38 -1
- package/lib/commonjs/components/InputComponents/Search.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ArchivedMessageCard.js +166 -0
- package/lib/commonjs/components/MainComponents/ArchivedMessageCard.js.map +1 -0
- package/lib/commonjs/components/MainComponents/ChatHeader.js +22 -5
- package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatRoom.js +56 -25
- package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatWrapper.js +31 -1
- package/lib/commonjs/components/MainComponents/ChatWrapper.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MediaMessage.js +18 -3
- package/lib/commonjs/components/MainComponents/MediaMessage.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MessageList.js +739 -42
- package/lib/commonjs/components/MainComponents/MessageList.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MessageSearchButton.js +58 -0
- package/lib/commonjs/components/MainComponents/MessageSearchButton.js.map +1 -0
- package/lib/commonjs/components/MainComponents/ReduxWrapper.js +15 -6
- package/lib/commonjs/components/MainComponents/ReduxWrapper.js.map +1 -1
- package/lib/commonjs/components/MainComponents/RoomList.js +110 -1
- package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
- package/lib/commonjs/components/Menu/HeaderRoomListMenu.js +14 -3
- package/lib/commonjs/components/Menu/HeaderRoomListMenu.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/BubbleHighlight.js +112 -0
- package/lib/commonjs/components/MessageBubble/BubbleHighlight.js.map +1 -0
- package/lib/commonjs/components/MessageBubble/Message.js +169 -125
- package/lib/commonjs/components/MessageBubble/Message.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/MessageInteractions.js +98 -78
- package/lib/commonjs/components/MessageBubble/MessageInteractions.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/messageMenuLayout.js +50 -0
- package/lib/commonjs/components/MessageBubble/messageMenuLayout.js.map +1 -0
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +73 -37
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/MessageSearchModal/MessageHitResults.js +253 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/MessageHitResults.js.map +1 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/MessageSearchModal.js +488 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/MessageSearchModal.js.map +1 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/openHit.js +51 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/openHit.js.map +1 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/resolveSender.js +47 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/resolveSender.js.map +1 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/searchFilters.js +83 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/searchFilters.js.map +1 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/snippet.js +61 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/snippet.js.map +1 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/useMessageSearch.js +136 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/useMessageSearch.js.map +1 -0
- package/lib/commonjs/components/Modals/PublicChatsModal/PublicChatsModal.js +306 -0
- package/lib/commonjs/components/Modals/PublicChatsModal/PublicChatsModal.js.map +1 -0
- package/lib/commonjs/components/Modals/PublicChatsModal/publicChatsLogic.js +36 -0
- package/lib/commonjs/components/Modals/PublicChatsModal/publicChatsLogic.js.map +1 -0
- package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js +8 -1
- package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/ChatRoomItem.js +13 -2
- package/lib/commonjs/components/RoomComponents/ChatRoomItem.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/SwipeableRoomRow.js +38 -6
- package/lib/commonjs/components/RoomComponents/SwipeableRoomRow.js.map +1 -1
- package/lib/commonjs/components/Thread/ThreadHeader.js +3 -1
- package/lib/commonjs/components/Thread/ThreadHeader.js.map +1 -1
- package/lib/commonjs/components/Thread/ThreadWrapper.js +90 -10
- package/lib/commonjs/components/Thread/ThreadWrapper.js.map +1 -1
- package/lib/commonjs/components/styled/AudioDecoderHost.js +338 -0
- package/lib/commonjs/components/styled/AudioDecoderHost.js.map +1 -0
- package/lib/commonjs/components/styled/AudioMessage.js +493 -420
- package/lib/commonjs/components/styled/AudioMessage.js.map +1 -1
- package/lib/commonjs/components/styled/SendInput.js +31 -5
- package/lib/commonjs/components/styled/SendInput.js.map +1 -1
- package/lib/commonjs/context/MessageNotificationContext.js +14 -4
- package/lib/commonjs/context/MessageNotificationContext.js.map +1 -1
- package/lib/commonjs/context/xmppProvider.js +41 -77
- package/lib/commonjs/context/xmppProvider.js.map +1 -1
- package/lib/commonjs/helpers/audioWaveform.js +165 -0
- package/lib/commonjs/helpers/audioWaveform.js.map +1 -0
- package/lib/commonjs/helpers/backgroundJoinSweep.js +36 -0
- package/lib/commonjs/helpers/backgroundJoinSweep.js.map +1 -0
- package/lib/commonjs/helpers/bubbleHighlight.js +44 -0
- package/lib/commonjs/helpers/bubbleHighlight.js.map +1 -0
- package/lib/commonjs/helpers/checkUniqueUsers.js +14 -12
- package/lib/commonjs/helpers/checkUniqueUsers.js.map +1 -1
- package/lib/commonjs/helpers/constants/MODAL_COMPONENTS.js +5 -1
- package/lib/commonjs/helpers/constants/MODAL_COMPONENTS.js.map +1 -1
- package/lib/commonjs/helpers/constants/MODAL_TYPES.js +3 -1
- package/lib/commonjs/helpers/constants/MODAL_TYPES.js.map +1 -1
- package/lib/commonjs/helpers/createRoomFromApi.js +40 -3
- package/lib/commonjs/helpers/createRoomFromApi.js.map +1 -1
- package/lib/commonjs/helpers/dedupeMembers.js +34 -0
- package/lib/commonjs/helpers/dedupeMembers.js.map +1 -0
- package/lib/commonjs/helpers/ethoraLogger.js +56 -0
- package/lib/commonjs/helpers/ethoraLogger.js.map +1 -0
- package/lib/commonjs/helpers/getUnnamedUsers.js +9 -4
- package/lib/commonjs/helpers/getUnnamedUsers.js.map +1 -1
- package/lib/commonjs/helpers/historyPreloadConfig.js +44 -0
- package/lib/commonjs/helpers/historyPreloadConfig.js.map +1 -0
- package/lib/commonjs/helpers/historyPreloadScheduler.js +372 -137
- package/lib/commonjs/helpers/historyPreloadScheduler.js.map +1 -1
- package/lib/commonjs/helpers/initRoomsPresence.js +17 -5
- package/lib/commonjs/helpers/initRoomsPresence.js.map +1 -1
- package/lib/commonjs/helpers/insertMessageWithDelimiter.js +5 -0
- package/lib/commonjs/helpers/insertMessageWithDelimiter.js.map +1 -1
- package/lib/commonjs/helpers/isLikelyMucJid.js +67 -0
- package/lib/commonjs/helpers/isLikelyMucJid.js.map +1 -0
- package/lib/commonjs/helpers/isMessageSearchEnabled.js +18 -0
- package/lib/commonjs/helpers/isMessageSearchEnabled.js.map +1 -0
- package/lib/commonjs/helpers/joiningRoom.js +14 -0
- package/lib/commonjs/helpers/joiningRoom.js.map +1 -0
- package/lib/commonjs/helpers/jumpThread.js +100 -0
- package/lib/commonjs/helpers/jumpThread.js.map +1 -0
- package/lib/commonjs/helpers/jumpToMessage.js +58 -0
- package/lib/commonjs/helpers/jumpToMessage.js.map +1 -0
- package/lib/commonjs/helpers/jumpWindow.js +187 -0
- package/lib/commonjs/helpers/jumpWindow.js.map +1 -0
- package/lib/commonjs/helpers/loadRoomHistory.js +75 -0
- package/lib/commonjs/helpers/loadRoomHistory.js.map +1 -0
- package/lib/commonjs/helpers/notificationPolicy.js +77 -0
- package/lib/commonjs/helpers/notificationPolicy.js.map +1 -0
- package/lib/commonjs/helpers/openRoomAtMessage.js +47 -0
- package/lib/commonjs/helpers/openRoomAtMessage.js.map +1 -0
- package/lib/commonjs/helpers/openThreadForJump.js +72 -0
- package/lib/commonjs/helpers/openThreadForJump.js.map +1 -0
- package/lib/commonjs/helpers/parseMessageReference.js +27 -8
- package/lib/commonjs/helpers/parseMessageReference.js.map +1 -1
- package/lib/commonjs/helpers/publicChatsEntry.js +17 -0
- package/lib/commonjs/helpers/publicChatsEntry.js.map +1 -0
- package/lib/commonjs/helpers/roomActivityScore.js +37 -0
- package/lib/commonjs/helpers/roomActivityScore.js.map +1 -0
- package/lib/commonjs/helpers/roomUserCount.js +36 -0
- package/lib/commonjs/helpers/roomUserCount.js.map +1 -0
- package/lib/commonjs/helpers/runConfiguredHistoryPreload.js +68 -0
- package/lib/commonjs/helpers/runConfiguredHistoryPreload.js.map +1 -0
- package/lib/commonjs/helpers/sessionAppId.js +24 -0
- package/lib/commonjs/helpers/sessionAppId.js.map +1 -0
- package/lib/commonjs/helpers/timestamp.js +43 -0
- package/lib/commonjs/helpers/timestamp.js.map +1 -0
- package/lib/commonjs/helpers/userResolver.js +517 -0
- package/lib/commonjs/helpers/userResolver.js.map +1 -0
- package/lib/commonjs/helpers/xmppIdShape.js +52 -0
- package/lib/commonjs/helpers/xmppIdShape.js.map +1 -0
- package/lib/commonjs/hooks/useChatWrapperInit.js +27 -5
- package/lib/commonjs/hooks/useChatWrapperInit.js.map +1 -1
- package/lib/commonjs/hooks/useHeapSender.js +54 -3
- package/lib/commonjs/hooks/useHeapSender.js.map +1 -1
- package/lib/commonjs/hooks/useJumpToMessage.js +411 -0
- package/lib/commonjs/hooks/useJumpToMessage.js.map +1 -0
- package/lib/commonjs/hooks/useMessageLoaderQueue.js +32 -5
- package/lib/commonjs/hooks/useMessageLoaderQueue.js.map +1 -1
- package/lib/commonjs/hooks/useMessageQueue.js +13 -5
- package/lib/commonjs/hooks/useMessageQueue.js.map +1 -1
- package/lib/commonjs/hooks/useRoomDirectory.js +29 -0
- package/lib/commonjs/hooks/useRoomDirectory.js.map +1 -0
- package/lib/commonjs/hooks/useRoomInitialization.js +27 -5
- package/lib/commonjs/hooks/useRoomInitialization.js.map +1 -1
- package/lib/commonjs/hooks/useRoomMute.js +62 -0
- package/lib/commonjs/hooks/useRoomMute.js.map +1 -0
- package/lib/commonjs/hooks/useRoomState.js +3 -1
- package/lib/commonjs/hooks/useRoomState.js.map +1 -1
- package/lib/commonjs/hooks/useSendMessage.js +13 -3
- package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
- package/lib/commonjs/i18n/strings.js +288 -6
- package/lib/commonjs/i18n/strings.js.map +1 -1
- package/lib/commonjs/networking/api-requests/messageSearch.api.js +87 -0
- package/lib/commonjs/networking/api-requests/messageSearch.api.js.map +1 -0
- package/lib/commonjs/networking/api-requests/publicChats.api.js +48 -0
- package/lib/commonjs/networking/api-requests/publicChats.api.js.map +1 -0
- package/lib/commonjs/networking/api-requests/roomMembers.api.js +253 -4
- package/lib/commonjs/networking/api-requests/roomMembers.api.js.map +1 -1
- package/lib/commonjs/networking/api-requests/rooms.api.js +48 -12
- package/lib/commonjs/networking/api-requests/rooms.api.js.map +1 -1
- package/lib/commonjs/networking/api-requests/xmppToken.api.js +71 -0
- package/lib/commonjs/networking/api-requests/xmppToken.api.js.map +1 -0
- package/lib/commonjs/networking/ethoraEvents.js +227 -0
- package/lib/commonjs/networking/ethoraEvents.js.map +1 -0
- package/lib/commonjs/networking/stanzaHandlers.js +153 -16
- package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
- package/lib/commonjs/networking/xmpp/allRoomPresences.xmpp.js +124 -3
- package/lib/commonjs/networking/xmpp/allRoomPresences.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/getHistory.xmpp.js +319 -35
- package/lib/commonjs/networking/xmpp/getHistory.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/handleStanzas.xmpp.js +7 -0
- package/lib/commonjs/networking/xmpp/handleStanzas.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/historyCursor.js +101 -0
- package/lib/commonjs/networking/xmpp/historyCursor.js.map +1 -0
- package/lib/commonjs/networking/xmpp/mamQueryIds.js +17 -0
- package/lib/commonjs/networking/xmpp/mamQueryIds.js.map +1 -0
- package/lib/commonjs/networking/xmpp/mamRouter.js +24 -9
- package/lib/commonjs/networking/xmpp/mamRouter.js.map +1 -1
- package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js +70 -65
- package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/roomJoinSweep.js +389 -0
- package/lib/commonjs/networking/xmpp/roomJoinSweep.js.map +1 -0
- package/lib/commonjs/networking/xmpp/sendMediaMessage.xmpp.js +0 -1
- package/lib/commonjs/networking/xmpp/sendMediaMessage.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/sendTextMessage.xmpp.js +0 -1
- package/lib/commonjs/networking/xmpp/sendTextMessage.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js +0 -1
- package/lib/commonjs/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmppClient.js +269 -41
- package/lib/commonjs/networking/xmppClient.js.map +1 -1
- package/lib/commonjs/networking/xmppCredentials.js +80 -0
- package/lib/commonjs/networking/xmppCredentials.js.map +1 -0
- package/lib/commonjs/roomStore/Middleware/jumpThreadMiddleware.js +158 -0
- package/lib/commonjs/roomStore/Middleware/jumpThreadMiddleware.js.map +1 -0
- package/lib/commonjs/roomStore/Middleware/reactionsMiddleware.js +6 -0
- package/lib/commonjs/roomStore/Middleware/reactionsMiddleware.js.map +1 -1
- package/lib/commonjs/roomStore/Middleware/unreadMidlleware.js +45 -7
- package/lib/commonjs/roomStore/Middleware/unreadMidlleware.js.map +1 -1
- package/lib/commonjs/roomStore/chatSettingsSlice.js +15 -1
- package/lib/commonjs/roomStore/chatSettingsSlice.js.map +1 -1
- package/lib/commonjs/roomStore/index.js +13 -3
- package/lib/commonjs/roomStore/index.js.map +1 -1
- package/lib/commonjs/roomStore/persistence.js +48 -1
- package/lib/commonjs/roomStore/persistence.js.map +1 -1
- package/lib/commonjs/roomStore/roomsSlice.js +474 -60
- package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
- package/lib/commonjs/roomStore/safeKey.js +44 -0
- package/lib/commonjs/roomStore/safeKey.js.map +1 -0
- package/lib/commonjs/roomStore/usersSetCap.js +37 -0
- package/lib/commonjs/roomStore/usersSetCap.js.map +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/assets/icons.js +1 -1
- package/lib/module/assets/icons.js.map +1 -1
- package/lib/module/components/Header/HeaderRoomList.js +23 -7
- package/lib/module/components/Header/HeaderRoomList.js.map +1 -1
- package/lib/module/components/InputComponents/Search.js +39 -2
- package/lib/module/components/InputComponents/Search.js.map +1 -1
- package/lib/module/components/MainComponents/ArchivedMessageCard.js +161 -0
- package/lib/module/components/MainComponents/ArchivedMessageCard.js.map +1 -0
- package/lib/module/components/MainComponents/ChatHeader.js +22 -5
- package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/module/components/MainComponents/ChatRoom.js +57 -26
- package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/module/components/MainComponents/ChatWrapper.js +31 -1
- package/lib/module/components/MainComponents/ChatWrapper.js.map +1 -1
- package/lib/module/components/MainComponents/MediaMessage.js +18 -3
- package/lib/module/components/MainComponents/MediaMessage.js.map +1 -1
- package/lib/module/components/MainComponents/MessageList.js +740 -42
- package/lib/module/components/MainComponents/MessageList.js.map +1 -1
- package/lib/module/components/MainComponents/MessageSearchButton.js +48 -0
- package/lib/module/components/MainComponents/MessageSearchButton.js.map +1 -0
- package/lib/module/components/MainComponents/ReduxWrapper.js +15 -7
- package/lib/module/components/MainComponents/ReduxWrapper.js.map +1 -1
- package/lib/module/components/MainComponents/RoomList.js +111 -2
- package/lib/module/components/MainComponents/RoomList.js.map +1 -1
- package/lib/module/components/Menu/HeaderRoomListMenu.js +15 -4
- package/lib/module/components/Menu/HeaderRoomListMenu.js.map +1 -1
- package/lib/module/components/MessageBubble/BubbleHighlight.js +106 -0
- package/lib/module/components/MessageBubble/BubbleHighlight.js.map +1 -0
- package/lib/module/components/MessageBubble/Message.js +172 -127
- package/lib/module/components/MessageBubble/Message.js.map +1 -1
- package/lib/module/components/MessageBubble/MessageInteractions.js +98 -78
- package/lib/module/components/MessageBubble/MessageInteractions.js.map +1 -1
- package/lib/module/components/MessageBubble/messageMenuLayout.js +45 -0
- package/lib/module/components/MessageBubble/messageMenuLayout.js.map +1 -0
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +74 -38
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/module/components/Modals/MessageSearchModal/MessageHitResults.js +243 -0
- package/lib/module/components/Modals/MessageSearchModal/MessageHitResults.js.map +1 -0
- package/lib/module/components/Modals/MessageSearchModal/MessageSearchModal.js +482 -0
- package/lib/module/components/Modals/MessageSearchModal/MessageSearchModal.js.map +1 -0
- package/lib/module/components/Modals/MessageSearchModal/openHit.js +45 -0
- package/lib/module/components/Modals/MessageSearchModal/openHit.js.map +1 -0
- package/lib/module/components/Modals/MessageSearchModal/resolveSender.js +41 -0
- package/lib/module/components/Modals/MessageSearchModal/resolveSender.js.map +1 -0
- package/lib/module/components/Modals/MessageSearchModal/searchFilters.js +74 -0
- package/lib/module/components/Modals/MessageSearchModal/searchFilters.js.map +1 -0
- package/lib/module/components/Modals/MessageSearchModal/snippet.js +57 -0
- package/lib/module/components/Modals/MessageSearchModal/snippet.js.map +1 -0
- package/lib/module/components/Modals/MessageSearchModal/useMessageSearch.js +131 -0
- package/lib/module/components/Modals/MessageSearchModal/useMessageSearch.js.map +1 -0
- package/lib/module/components/Modals/PublicChatsModal/PublicChatsModal.js +300 -0
- package/lib/module/components/Modals/PublicChatsModal/PublicChatsModal.js.map +1 -0
- package/lib/module/components/Modals/PublicChatsModal/publicChatsLogic.js +30 -0
- package/lib/module/components/Modals/PublicChatsModal/publicChatsLogic.js.map +1 -0
- package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js +8 -1
- package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
- package/lib/module/components/RoomComponents/ChatRoomItem.js +14 -3
- package/lib/module/components/RoomComponents/ChatRoomItem.js.map +1 -1
- package/lib/module/components/RoomComponents/SwipeableRoomRow.js +39 -7
- package/lib/module/components/RoomComponents/SwipeableRoomRow.js.map +1 -1
- package/lib/module/components/Thread/ThreadHeader.js +3 -1
- package/lib/module/components/Thread/ThreadHeader.js.map +1 -1
- package/lib/module/components/Thread/ThreadWrapper.js +89 -9
- package/lib/module/components/Thread/ThreadWrapper.js.map +1 -1
- package/lib/module/components/styled/AudioDecoderHost.js +332 -0
- package/lib/module/components/styled/AudioDecoderHost.js.map +1 -0
- package/lib/module/components/styled/AudioMessage.js +495 -422
- package/lib/module/components/styled/AudioMessage.js.map +1 -1
- package/lib/module/components/styled/SendInput.js +32 -6
- package/lib/module/components/styled/SendInput.js.map +1 -1
- package/lib/module/context/MessageNotificationContext.js +15 -5
- package/lib/module/context/MessageNotificationContext.js.map +1 -1
- package/lib/module/context/xmppProvider.js +42 -78
- package/lib/module/context/xmppProvider.js.map +1 -1
- package/lib/module/helpers/audioWaveform.js +153 -0
- package/lib/module/helpers/audioWaveform.js.map +1 -0
- package/lib/module/helpers/backgroundJoinSweep.js +30 -0
- package/lib/module/helpers/backgroundJoinSweep.js.map +1 -0
- package/lib/module/helpers/bubbleHighlight.js +38 -0
- package/lib/module/helpers/bubbleHighlight.js.map +1 -0
- package/lib/module/helpers/checkUniqueUsers.js +15 -13
- package/lib/module/helpers/checkUniqueUsers.js.map +1 -1
- package/lib/module/helpers/constants/MODAL_COMPONENTS.js +5 -1
- package/lib/module/helpers/constants/MODAL_COMPONENTS.js.map +1 -1
- package/lib/module/helpers/constants/MODAL_TYPES.js +3 -1
- package/lib/module/helpers/constants/MODAL_TYPES.js.map +1 -1
- package/lib/module/helpers/createRoomFromApi.js +37 -3
- package/lib/module/helpers/createRoomFromApi.js.map +1 -1
- package/lib/module/helpers/dedupeMembers.js +28 -0
- package/lib/module/helpers/dedupeMembers.js.map +1 -0
- package/lib/module/helpers/ethoraLogger.js +52 -0
- package/lib/module/helpers/ethoraLogger.js.map +1 -0
- package/lib/module/helpers/getUnnamedUsers.js +9 -4
- package/lib/module/helpers/getUnnamedUsers.js.map +1 -1
- package/lib/module/helpers/historyPreloadConfig.js +39 -0
- package/lib/module/helpers/historyPreloadConfig.js.map +1 -0
- package/lib/module/helpers/historyPreloadScheduler.js +368 -134
- package/lib/module/helpers/historyPreloadScheduler.js.map +1 -1
- package/lib/module/helpers/initRoomsPresence.js +18 -5
- package/lib/module/helpers/initRoomsPresence.js.map +1 -1
- package/lib/module/helpers/insertMessageWithDelimiter.js +5 -0
- package/lib/module/helpers/insertMessageWithDelimiter.js.map +1 -1
- package/lib/module/helpers/isLikelyMucJid.js +60 -0
- package/lib/module/helpers/isLikelyMucJid.js.map +1 -0
- package/lib/module/helpers/isMessageSearchEnabled.js +13 -0
- package/lib/module/helpers/isMessageSearchEnabled.js.map +1 -0
- package/lib/module/helpers/joiningRoom.js +9 -0
- package/lib/module/helpers/joiningRoom.js.map +1 -0
- package/lib/module/helpers/jumpThread.js +83 -0
- package/lib/module/helpers/jumpThread.js.map +1 -0
- package/lib/module/helpers/jumpToMessage.js +52 -0
- package/lib/module/helpers/jumpToMessage.js.map +1 -0
- package/lib/module/helpers/jumpWindow.js +177 -0
- package/lib/module/helpers/jumpWindow.js.map +1 -0
- package/lib/module/helpers/loadRoomHistory.js +69 -0
- package/lib/module/helpers/loadRoomHistory.js.map +1 -0
- package/lib/module/helpers/notificationPolicy.js +70 -0
- package/lib/module/helpers/notificationPolicy.js.map +1 -0
- package/lib/module/helpers/openRoomAtMessage.js +41 -0
- package/lib/module/helpers/openRoomAtMessage.js.map +1 -0
- package/lib/module/helpers/openThreadForJump.js +68 -0
- package/lib/module/helpers/openThreadForJump.js.map +1 -0
- package/lib/module/helpers/parseMessageReference.js +26 -6
- package/lib/module/helpers/parseMessageReference.js.map +1 -1
- package/lib/module/helpers/publicChatsEntry.js +12 -0
- package/lib/module/helpers/publicChatsEntry.js.map +1 -0
- package/lib/module/helpers/roomActivityScore.js +30 -0
- package/lib/module/helpers/roomActivityScore.js.map +1 -0
- package/lib/module/helpers/roomUserCount.js +29 -0
- package/lib/module/helpers/roomUserCount.js.map +1 -0
- package/lib/module/helpers/runConfiguredHistoryPreload.js +63 -0
- package/lib/module/helpers/runConfiguredHistoryPreload.js.map +1 -0
- package/lib/module/helpers/sessionAppId.js +20 -0
- package/lib/module/helpers/sessionAppId.js.map +1 -0
- package/lib/module/helpers/timestamp.js +37 -0
- package/lib/module/helpers/timestamp.js.map +1 -0
- package/lib/module/helpers/userResolver.js +503 -0
- package/lib/module/helpers/userResolver.js.map +1 -0
- package/lib/module/helpers/xmppIdShape.js +46 -0
- package/lib/module/helpers/xmppIdShape.js.map +1 -0
- package/lib/module/hooks/useChatWrapperInit.js +16 -5
- package/lib/module/hooks/useChatWrapperInit.js.map +1 -1
- package/lib/module/hooks/useHeapSender.js +54 -3
- package/lib/module/hooks/useHeapSender.js.map +1 -1
- package/lib/module/hooks/useJumpToMessage.js +389 -0
- package/lib/module/hooks/useJumpToMessage.js.map +1 -0
- package/lib/module/hooks/useMessageLoaderQueue.js +32 -5
- package/lib/module/hooks/useMessageLoaderQueue.js.map +1 -1
- package/lib/module/hooks/useMessageQueue.js +13 -5
- package/lib/module/hooks/useMessageQueue.js.map +1 -1
- package/lib/module/hooks/useRoomDirectory.js +24 -0
- package/lib/module/hooks/useRoomDirectory.js.map +1 -0
- package/lib/module/hooks/useRoomInitialization.js +29 -7
- package/lib/module/hooks/useRoomInitialization.js.map +1 -1
- package/lib/module/hooks/useRoomMute.js +58 -0
- package/lib/module/hooks/useRoomMute.js.map +1 -0
- package/lib/module/hooks/useRoomState.js +3 -1
- package/lib/module/hooks/useRoomState.js.map +1 -1
- package/lib/module/hooks/useSendMessage.js +13 -3
- package/lib/module/hooks/useSendMessage.js.map +1 -1
- package/lib/module/i18n/strings.js +288 -6
- package/lib/module/i18n/strings.js.map +1 -1
- package/lib/module/networking/api-requests/messageSearch.api.js +81 -0
- package/lib/module/networking/api-requests/messageSearch.api.js.map +1 -0
- package/lib/module/networking/api-requests/publicChats.api.js +43 -0
- package/lib/module/networking/api-requests/publicChats.api.js.map +1 -0
- package/lib/module/networking/api-requests/roomMembers.api.js +248 -4
- package/lib/module/networking/api-requests/roomMembers.api.js.map +1 -1
- package/lib/module/networking/api-requests/rooms.api.js +48 -12
- package/lib/module/networking/api-requests/rooms.api.js.map +1 -1
- package/lib/module/networking/api-requests/xmppToken.api.js +66 -0
- package/lib/module/networking/api-requests/xmppToken.api.js.map +1 -0
- package/lib/module/networking/ethoraEvents.js +220 -0
- package/lib/module/networking/ethoraEvents.js.map +1 -0
- package/lib/module/networking/stanzaHandlers.js +155 -18
- package/lib/module/networking/stanzaHandlers.js.map +1 -1
- package/lib/module/networking/xmpp/allRoomPresences.xmpp.js +125 -3
- package/lib/module/networking/xmpp/allRoomPresences.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/getHistory.xmpp.js +318 -35
- package/lib/module/networking/xmpp/getHistory.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/handleStanzas.xmpp.js +7 -0
- package/lib/module/networking/xmpp/handleStanzas.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/historyCursor.js +95 -0
- package/lib/module/networking/xmpp/historyCursor.js.map +1 -0
- package/lib/module/networking/xmpp/mamQueryIds.js +12 -0
- package/lib/module/networking/xmpp/mamQueryIds.js.map +1 -0
- package/lib/module/networking/xmpp/mamRouter.js +22 -8
- package/lib/module/networking/xmpp/mamRouter.js.map +1 -1
- package/lib/module/networking/xmpp/presenceInRoom.xmpp.js +68 -62
- package/lib/module/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/roomJoinSweep.js +385 -0
- package/lib/module/networking/xmpp/roomJoinSweep.js.map +1 -0
- package/lib/module/networking/xmpp/sendMediaMessage.xmpp.js +0 -1
- package/lib/module/networking/xmpp/sendMediaMessage.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/sendTextMessage.xmpp.js +0 -1
- package/lib/module/networking/xmpp/sendTextMessage.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js +0 -1
- package/lib/module/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js.map +1 -1
- package/lib/module/networking/xmppClient.js +269 -41
- package/lib/module/networking/xmppClient.js.map +1 -1
- package/lib/module/networking/xmppCredentials.js +76 -0
- package/lib/module/networking/xmppCredentials.js.map +1 -0
- package/lib/module/roomStore/Middleware/jumpThreadMiddleware.js +153 -0
- package/lib/module/roomStore/Middleware/jumpThreadMiddleware.js.map +1 -0
- package/lib/module/roomStore/Middleware/reactionsMiddleware.js +6 -0
- package/lib/module/roomStore/Middleware/reactionsMiddleware.js.map +1 -1
- package/lib/module/roomStore/Middleware/unreadMidlleware.js +46 -7
- package/lib/module/roomStore/Middleware/unreadMidlleware.js.map +1 -1
- package/lib/module/roomStore/chatSettingsSlice.js +13 -0
- package/lib/module/roomStore/chatSettingsSlice.js.map +1 -1
- package/lib/module/roomStore/index.js +7 -3
- package/lib/module/roomStore/index.js.map +1 -1
- package/lib/module/roomStore/persistence.js +46 -1
- package/lib/module/roomStore/persistence.js.map +1 -1
- package/lib/module/roomStore/roomsSlice.js +459 -58
- package/lib/module/roomStore/roomsSlice.js.map +1 -1
- package/lib/module/roomStore/safeKey.js +37 -0
- package/lib/module/roomStore/safeKey.js.map +1 -0
- package/lib/module/roomStore/usersSetCap.js +32 -0
- package/lib/module/roomStore/usersSetCap.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/assets/icons.d.ts +4 -0
- package/lib/typescript/assets/icons.d.ts.map +1 -1
- package/lib/typescript/components/Header/HeaderRoomList.d.ts.map +1 -1
- package/lib/typescript/components/InputComponents/Search.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ArchivedMessageCard.d.ts +12 -0
- package/lib/typescript/components/MainComponents/ArchivedMessageCard.d.ts.map +1 -0
- package/lib/typescript/components/MainComponents/ChatHeader.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ChatRoom.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ChatWrapper.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/MediaMessage.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/MessageList.d.ts +22 -1
- package/lib/typescript/components/MainComponents/MessageList.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/MessageSearchButton.d.ts +7 -0
- package/lib/typescript/components/MainComponents/MessageSearchButton.d.ts.map +1 -0
- package/lib/typescript/components/MainComponents/ReduxWrapper.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
- package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/BubbleHighlight.d.ts +12 -0
- package/lib/typescript/components/MessageBubble/BubbleHighlight.d.ts.map +1 -0
- package/lib/typescript/components/MessageBubble/Message.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/MessageInteractions.d.ts +5 -0
- package/lib/typescript/components/MessageBubble/MessageInteractions.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/messageMenuLayout.d.ts +29 -0
- package/lib/typescript/components/MessageBubble/messageMenuLayout.d.ts.map +1 -0
- package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts +2 -0
- package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/MessageSearchModal/MessageHitResults.d.ts +44 -0
- package/lib/typescript/components/Modals/MessageSearchModal/MessageHitResults.d.ts.map +1 -0
- package/lib/typescript/components/Modals/MessageSearchModal/MessageSearchModal.d.ts +12 -0
- package/lib/typescript/components/Modals/MessageSearchModal/MessageSearchModal.d.ts.map +1 -0
- package/lib/typescript/components/Modals/MessageSearchModal/openHit.d.ts +15 -0
- package/lib/typescript/components/Modals/MessageSearchModal/openHit.d.ts.map +1 -0
- package/lib/typescript/components/Modals/MessageSearchModal/resolveSender.d.ts +34 -0
- package/lib/typescript/components/Modals/MessageSearchModal/resolveSender.d.ts.map +1 -0
- package/lib/typescript/components/Modals/MessageSearchModal/searchFilters.d.ts +41 -0
- package/lib/typescript/components/Modals/MessageSearchModal/searchFilters.d.ts.map +1 -0
- package/lib/typescript/components/Modals/MessageSearchModal/snippet.d.ts +15 -0
- package/lib/typescript/components/Modals/MessageSearchModal/snippet.d.ts.map +1 -0
- package/lib/typescript/components/Modals/MessageSearchModal/useMessageSearch.d.ts +23 -0
- package/lib/typescript/components/Modals/MessageSearchModal/useMessageSearch.d.ts.map +1 -0
- package/lib/typescript/components/Modals/PublicChatsModal/PublicChatsModal.d.ts +16 -0
- package/lib/typescript/components/Modals/PublicChatsModal/PublicChatsModal.d.ts.map +1 -0
- package/lib/typescript/components/Modals/PublicChatsModal/publicChatsLogic.d.ts +14 -0
- package/lib/typescript/components/Modals/PublicChatsModal/publicChatsLogic.d.ts.map +1 -0
- package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/SwipeableRoomRow.d.ts +5 -1
- package/lib/typescript/components/RoomComponents/SwipeableRoomRow.d.ts.map +1 -1
- package/lib/typescript/components/Thread/ThreadHeader.d.ts.map +1 -1
- package/lib/typescript/components/Thread/ThreadWrapper.d.ts +1 -0
- package/lib/typescript/components/Thread/ThreadWrapper.d.ts.map +1 -1
- package/lib/typescript/components/styled/AudioDecoderHost.d.ts +39 -0
- package/lib/typescript/components/styled/AudioDecoderHost.d.ts.map +1 -0
- package/lib/typescript/components/styled/AudioMessage.d.ts +14 -1
- package/lib/typescript/components/styled/AudioMessage.d.ts.map +1 -1
- package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
- package/lib/typescript/context/MessageNotificationContext.d.ts.map +1 -1
- package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
- package/lib/typescript/helpers/audioWaveform.d.ts +54 -0
- package/lib/typescript/helpers/audioWaveform.d.ts.map +1 -0
- package/lib/typescript/helpers/backgroundJoinSweep.d.ts +14 -0
- package/lib/typescript/helpers/backgroundJoinSweep.d.ts.map +1 -0
- package/lib/typescript/helpers/bubbleHighlight.d.ts +17 -0
- package/lib/typescript/helpers/bubbleHighlight.d.ts.map +1 -0
- package/lib/typescript/helpers/checkUniqueUsers.d.ts +2 -2
- package/lib/typescript/helpers/checkUniqueUsers.d.ts.map +1 -1
- package/lib/typescript/helpers/constants/MODAL_COMPONENTS.d.ts.map +1 -1
- package/lib/typescript/helpers/constants/MODAL_TYPES.d.ts +2 -0
- package/lib/typescript/helpers/constants/MODAL_TYPES.d.ts.map +1 -1
- package/lib/typescript/helpers/createRoomFromApi.d.ts +25 -0
- package/lib/typescript/helpers/createRoomFromApi.d.ts.map +1 -1
- package/lib/typescript/helpers/dedupeMembers.d.ts +11 -0
- package/lib/typescript/helpers/dedupeMembers.d.ts.map +1 -0
- package/lib/typescript/helpers/ethoraLogger.d.ts +13 -0
- package/lib/typescript/helpers/ethoraLogger.d.ts.map +1 -0
- package/lib/typescript/helpers/getUnnamedUsers.d.ts.map +1 -1
- package/lib/typescript/helpers/historyPreloadConfig.d.ts +26 -0
- package/lib/typescript/helpers/historyPreloadConfig.d.ts.map +1 -0
- package/lib/typescript/helpers/historyPreloadScheduler.d.ts +8 -4
- package/lib/typescript/helpers/historyPreloadScheduler.d.ts.map +1 -1
- package/lib/typescript/helpers/initRoomsPresence.d.ts +7 -0
- package/lib/typescript/helpers/initRoomsPresence.d.ts.map +1 -1
- package/lib/typescript/helpers/insertMessageWithDelimiter.d.ts.map +1 -1
- package/lib/typescript/helpers/isLikelyMucJid.d.ts +19 -0
- package/lib/typescript/helpers/isLikelyMucJid.d.ts.map +1 -0
- package/lib/typescript/helpers/isMessageSearchEnabled.d.ts +12 -0
- package/lib/typescript/helpers/isMessageSearchEnabled.d.ts.map +1 -0
- package/lib/typescript/helpers/joiningRoom.d.ts +7 -0
- package/lib/typescript/helpers/joiningRoom.d.ts.map +1 -0
- package/lib/typescript/helpers/jumpThread.d.ts +48 -0
- package/lib/typescript/helpers/jumpThread.d.ts.map +1 -0
- package/lib/typescript/helpers/jumpToMessage.d.ts +26 -0
- package/lib/typescript/helpers/jumpToMessage.d.ts.map +1 -0
- package/lib/typescript/helpers/jumpWindow.d.ts +74 -0
- package/lib/typescript/helpers/jumpWindow.d.ts.map +1 -0
- package/lib/typescript/helpers/loadRoomHistory.d.ts +34 -0
- package/lib/typescript/helpers/loadRoomHistory.d.ts.map +1 -0
- package/lib/typescript/helpers/notificationPolicy.d.ts +42 -0
- package/lib/typescript/helpers/notificationPolicy.d.ts.map +1 -0
- package/lib/typescript/helpers/openRoomAtMessage.d.ts +17 -0
- package/lib/typescript/helpers/openRoomAtMessage.d.ts.map +1 -0
- package/lib/typescript/helpers/openThreadForJump.d.ts +27 -0
- package/lib/typescript/helpers/openThreadForJump.d.ts.map +1 -0
- package/lib/typescript/helpers/parseMessageReference.d.ts +18 -5
- package/lib/typescript/helpers/parseMessageReference.d.ts.map +1 -1
- package/lib/typescript/helpers/publicChatsEntry.d.ts +11 -0
- package/lib/typescript/helpers/publicChatsEntry.d.ts.map +1 -0
- package/lib/typescript/helpers/roomActivityScore.d.ts +5 -0
- package/lib/typescript/helpers/roomActivityScore.d.ts.map +1 -0
- package/lib/typescript/helpers/roomUserCount.d.ts +20 -0
- package/lib/typescript/helpers/roomUserCount.d.ts.map +1 -0
- package/lib/typescript/helpers/runConfiguredHistoryPreload.d.ts +21 -0
- package/lib/typescript/helpers/runConfiguredHistoryPreload.d.ts.map +1 -0
- package/lib/typescript/helpers/sessionAppId.d.ts +8 -0
- package/lib/typescript/helpers/sessionAppId.d.ts.map +1 -0
- package/lib/typescript/helpers/timestamp.d.ts +3 -0
- package/lib/typescript/helpers/timestamp.d.ts.map +1 -0
- package/lib/typescript/helpers/userResolver.d.ts +58 -0
- package/lib/typescript/helpers/userResolver.d.ts.map +1 -0
- package/lib/typescript/helpers/xmppIdShape.d.ts +10 -0
- package/lib/typescript/helpers/xmppIdShape.d.ts.map +1 -0
- package/lib/typescript/hooks/useChatWrapperInit.d.ts +2 -0
- package/lib/typescript/hooks/useChatWrapperInit.d.ts.map +1 -1
- package/lib/typescript/hooks/useHeapSender.d.ts.map +1 -1
- package/lib/typescript/hooks/useJumpToMessage.d.ts +116 -0
- package/lib/typescript/hooks/useJumpToMessage.d.ts.map +1 -0
- package/lib/typescript/hooks/useMessageLoaderQueue.d.ts.map +1 -1
- package/lib/typescript/hooks/useMessageQueue.d.ts.map +1 -1
- package/lib/typescript/hooks/useRoomDirectory.d.ts +12 -0
- package/lib/typescript/hooks/useRoomDirectory.d.ts.map +1 -0
- package/lib/typescript/hooks/useRoomInitialization.d.ts.map +1 -1
- package/lib/typescript/hooks/useRoomMute.d.ts +8 -0
- package/lib/typescript/hooks/useRoomMute.d.ts.map +1 -0
- package/lib/typescript/hooks/useRoomState.d.ts +1 -0
- package/lib/typescript/hooks/useRoomState.d.ts.map +1 -1
- package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
- package/lib/typescript/i18n/strings.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/messageSearch.api.d.ts +57 -0
- package/lib/typescript/networking/api-requests/messageSearch.api.d.ts.map +1 -0
- package/lib/typescript/networking/api-requests/publicChats.api.d.ts +24 -0
- package/lib/typescript/networking/api-requests/publicChats.api.d.ts.map +1 -0
- package/lib/typescript/networking/api-requests/roomMembers.api.d.ts +19 -1
- package/lib/typescript/networking/api-requests/roomMembers.api.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/rooms.api.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/xmppToken.api.d.ts +2 -0
- package/lib/typescript/networking/api-requests/xmppToken.api.d.ts.map +1 -0
- package/lib/typescript/networking/ethoraEvents.d.ts +45 -0
- package/lib/typescript/networking/ethoraEvents.d.ts.map +1 -0
- package/lib/typescript/networking/stanzaHandlers.d.ts +1 -1
- package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/allRoomPresences.xmpp.d.ts +32 -1
- package/lib/typescript/networking/xmpp/allRoomPresences.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/getHistory.xmpp.d.ts +64 -0
- package/lib/typescript/networking/xmpp/getHistory.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/handleStanzas.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/historyCursor.d.ts +35 -0
- package/lib/typescript/networking/xmpp/historyCursor.d.ts.map +1 -0
- package/lib/typescript/networking/xmpp/mamQueryIds.d.ts +10 -0
- package/lib/typescript/networking/xmpp/mamQueryIds.d.ts.map +1 -0
- package/lib/typescript/networking/xmpp/mamRouter.d.ts +7 -0
- package/lib/typescript/networking/xmpp/mamRouter.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/presenceInRoom.xmpp.d.ts +13 -2
- package/lib/typescript/networking/xmpp/presenceInRoom.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/roomJoinSweep.d.ts +82 -0
- package/lib/typescript/networking/xmpp/roomJoinSweep.d.ts.map +1 -0
- package/lib/typescript/networking/xmpp/sendMediaMessage.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/sendTextMessage.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmppClient.d.ts +90 -4
- package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
- package/lib/typescript/networking/xmppCredentials.d.ts +12 -0
- package/lib/typescript/networking/xmppCredentials.d.ts.map +1 -0
- package/lib/typescript/roomStore/Middleware/jumpThreadMiddleware.d.ts +3 -0
- package/lib/typescript/roomStore/Middleware/jumpThreadMiddleware.d.ts.map +1 -0
- package/lib/typescript/roomStore/Middleware/reactionsMiddleware.d.ts.map +1 -1
- package/lib/typescript/roomStore/Middleware/unreadMidlleware.d.ts.map +1 -1
- package/lib/typescript/roomStore/chatSettingsSlice.d.ts +8 -1
- package/lib/typescript/roomStore/chatSettingsSlice.d.ts.map +1 -1
- package/lib/typescript/roomStore/index.d.ts +2 -1
- package/lib/typescript/roomStore/index.d.ts.map +1 -1
- package/lib/typescript/roomStore/persistence.d.ts +8 -0
- package/lib/typescript/roomStore/persistence.d.ts.map +1 -1
- package/lib/typescript/roomStore/roomsSlice.d.ts +138 -2
- package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
- package/lib/typescript/roomStore/safeKey.d.ts +13 -0
- package/lib/typescript/roomStore/safeKey.d.ts.map +1 -0
- package/lib/typescript/roomStore/usersSetCap.d.ts +16 -0
- package/lib/typescript/roomStore/usersSetCap.d.ts.map +1 -0
- package/lib/typescript/types/models/media.model.d.ts +2 -0
- package/lib/typescript/types/models/media.model.d.ts.map +1 -1
- package/lib/typescript/types/models/room.model.d.ts +18 -5
- package/lib/typescript/types/models/room.model.d.ts.map +1 -1
- package/lib/typescript/types/models/xmpp.model.d.ts +8 -1
- package/lib/typescript/types/models/xmpp.model.d.ts.map +1 -1
- package/lib/typescript/types/types.d.ts +88 -5
- package/lib/typescript/types/types.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/lib/typescript/version.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/assets/icons.tsx +13 -0
- package/src/components/Header/HeaderRoomList.tsx +21 -4
- package/src/components/InputComponents/Search.tsx +33 -0
- package/src/components/MainComponents/ArchivedMessageCard.tsx +139 -0
- package/src/components/MainComponents/ChatHeader.tsx +19 -3
- package/src/components/MainComponents/ChatRoom.tsx +60 -23
- package/src/components/MainComponents/ChatWrapper.tsx +23 -4
- package/src/components/MainComponents/MediaMessage.tsx +17 -0
- package/src/components/MainComponents/MessageList.tsx +823 -84
- package/src/components/MainComponents/MessageSearchButton.tsx +48 -0
- package/src/components/MainComponents/ReduxWrapper.tsx +16 -5
- package/src/components/MainComponents/RoomList.tsx +125 -0
- package/src/components/Menu/HeaderRoomListMenu.tsx +26 -2
- package/src/components/MessageBubble/BubbleHighlight.tsx +106 -0
- package/src/components/MessageBubble/Message.tsx +265 -177
- package/src/components/MessageBubble/MessageInteractions.tsx +109 -86
- package/src/components/MessageBubble/messageMenuLayout.ts +59 -0
- package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +92 -21
- package/src/components/Modals/MessageSearchModal/MessageHitResults.tsx +271 -0
- package/src/components/Modals/MessageSearchModal/MessageSearchModal.tsx +487 -0
- package/src/components/Modals/MessageSearchModal/openHit.ts +50 -0
- package/src/components/Modals/MessageSearchModal/resolveSender.ts +57 -0
- package/src/components/Modals/MessageSearchModal/searchFilters.ts +109 -0
- package/src/components/Modals/MessageSearchModal/snippet.ts +58 -0
- package/src/components/Modals/MessageSearchModal/useMessageSearch.ts +151 -0
- package/src/components/Modals/PublicChatsModal/PublicChatsModal.tsx +288 -0
- package/src/components/Modals/PublicChatsModal/publicChatsLogic.ts +36 -0
- package/src/components/Modals/SelectUsersModal/SelectUsersModal.tsx +8 -1
- package/src/components/RoomComponents/ChatRoomItem.tsx +16 -3
- package/src/components/RoomComponents/SwipeableRoomRow.tsx +39 -6
- package/src/components/Thread/ThreadHeader.tsx +3 -1
- package/src/components/Thread/ThreadWrapper.tsx +96 -10
- package/src/components/styled/AudioDecoderHost.tsx +351 -0
- package/src/components/styled/AudioMessage.tsx +482 -425
- package/src/components/styled/SendInput.tsx +42 -4
- package/src/context/MessageNotificationContext.tsx +19 -5
- package/src/context/xmppProvider.tsx +44 -91
- package/src/helpers/audioWaveform.ts +142 -0
- package/src/helpers/backgroundJoinSweep.ts +35 -0
- package/src/helpers/bubbleHighlight.ts +47 -0
- package/src/helpers/checkUniqueUsers.tsx +15 -17
- package/src/helpers/constants/MODAL_COMPONENTS.tsx +4 -0
- package/src/helpers/constants/MODAL_TYPES.ts +3 -0
- package/src/helpers/createRoomFromApi.tsx +45 -4
- package/src/helpers/dedupeMembers.ts +29 -0
- package/src/helpers/ethoraLogger.ts +50 -0
- package/src/helpers/getUnnamedUsers.ts +7 -4
- package/src/helpers/historyPreloadConfig.ts +68 -0
- package/src/helpers/historyPreloadScheduler.ts +437 -199
- package/src/helpers/initRoomsPresence.ts +20 -7
- package/src/helpers/insertMessageWithDelimiter.ts +3 -0
- package/src/helpers/isLikelyMucJid.ts +72 -0
- package/src/helpers/isMessageSearchEnabled.ts +18 -0
- package/src/helpers/joiningRoom.ts +13 -0
- package/src/helpers/jumpThread.ts +102 -0
- package/src/helpers/jumpToMessage.ts +57 -0
- package/src/helpers/jumpWindow.ts +212 -0
- package/src/helpers/loadRoomHistory.ts +83 -0
- package/src/helpers/notificationPolicy.ts +82 -0
- package/src/helpers/openRoomAtMessage.ts +38 -0
- package/src/helpers/openThreadForJump.ts +96 -0
- package/src/helpers/parseMessageReference.ts +37 -8
- package/src/helpers/publicChatsEntry.ts +15 -0
- package/src/helpers/roomActivityScore.ts +45 -0
- package/src/helpers/roomUserCount.ts +44 -0
- package/src/helpers/runConfiguredHistoryPreload.ts +76 -0
- package/src/helpers/sessionAppId.ts +17 -0
- package/src/helpers/timestamp.ts +44 -0
- package/src/helpers/userResolver.ts +542 -0
- package/src/helpers/xmppIdShape.ts +46 -0
- package/src/hooks/useChatWrapperInit.ts +22 -4
- package/src/hooks/useHeapSender.tsx +54 -3
- package/src/hooks/useJumpToMessage.ts +538 -0
- package/src/hooks/useMessageLoaderQueue.tsx +40 -4
- package/src/hooks/useMessageQueue.ts +9 -5
- package/src/hooks/useRoomDirectory.ts +39 -0
- package/src/hooks/useRoomInitialization.tsx +33 -7
- package/src/hooks/useRoomMute.ts +42 -0
- package/src/hooks/useRoomState.tsx +6 -0
- package/src/hooks/useSendMessage.tsx +14 -2
- package/src/i18n/strings.ts +282 -0
- package/src/networking/api-requests/messageSearch.api.ts +130 -0
- package/src/networking/api-requests/publicChats.api.ts +71 -0
- package/src/networking/api-requests/roomMembers.api.ts +263 -11
- package/src/networking/api-requests/rooms.api.ts +52 -12
- package/src/networking/api-requests/xmppToken.api.ts +62 -0
- package/src/networking/ethoraEvents.ts +262 -0
- package/src/networking/stanzaHandlers.ts +145 -19
- package/src/networking/xmpp/allRoomPresences.xmpp.ts +155 -5
- package/src/networking/xmpp/getHistory.xmpp.ts +433 -47
- package/src/networking/xmpp/handleStanzas.xmpp.ts +8 -0
- package/src/networking/xmpp/historyCursor.ts +124 -0
- package/src/networking/xmpp/mamQueryIds.ts +11 -0
- package/src/networking/xmpp/mamRouter.ts +24 -10
- package/src/networking/xmpp/presenceInRoom.xmpp.ts +91 -68
- package/src/networking/xmpp/roomJoinSweep.ts +412 -0
- package/src/networking/xmpp/sendMediaMessage.xmpp.ts +0 -1
- package/src/networking/xmpp/sendTextMessage.xmpp.ts +0 -1
- package/src/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.ts +0 -1
- package/src/networking/xmppClient.ts +323 -47
- package/src/networking/xmppCredentials.ts +87 -0
- package/src/roomStore/Middleware/jumpThreadMiddleware.ts +163 -0
- package/src/roomStore/Middleware/reactionsMiddleware.tsx +4 -0
- package/src/roomStore/Middleware/unreadMidlleware.tsx +59 -11
- package/src/roomStore/chatSettingsSlice.ts +11 -0
- package/src/roomStore/index.ts +10 -3
- package/src/roomStore/persistence.ts +54 -0
- package/src/roomStore/roomsSlice.ts +547 -65
- package/src/roomStore/safeKey.ts +49 -0
- package/src/roomStore/usersSetCap.ts +37 -0
- package/src/types/models/media.model.ts +4 -0
- package/src/types/models/room.model.ts +18 -5
- package/src/types/models/xmpp.model.ts +15 -1
- package/src/types/types.ts +93 -5
- package/src/version.ts +1 -1
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
1
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import { withFileToken } from '../../helpers/secureFileUrl';
|
|
3
3
|
import {
|
|
4
4
|
View,
|
|
5
|
-
|
|
5
|
+
Pressable,
|
|
6
6
|
Text,
|
|
7
7
|
StyleSheet,
|
|
8
8
|
ActivityIndicator,
|
|
9
9
|
Platform,
|
|
10
|
+
type GestureResponderEvent,
|
|
11
|
+
type LayoutChangeEvent,
|
|
10
12
|
} from 'react-native';
|
|
11
13
|
import {
|
|
12
14
|
createAudioPlayer,
|
|
@@ -15,27 +17,31 @@ import {
|
|
|
15
17
|
type AudioStatus,
|
|
16
18
|
} from 'expo-audio';
|
|
17
19
|
import * as FileSystem from 'expo-file-system/legacy';
|
|
18
|
-
import {
|
|
19
|
-
import { PauseIcon, PlayIcon } from '../../assets/icons';
|
|
20
|
+
import Svg, { Path, Rect } from 'react-native-svg';
|
|
20
21
|
import { useTheme } from '../../hooks/useTheme';
|
|
22
|
+
import { useT } from '../../i18n/useT';
|
|
21
23
|
import { getIosAudioPlaybackCacheExtension } from '../../helpers/mimeToExtension';
|
|
24
|
+
import {
|
|
25
|
+
MIN_BAR,
|
|
26
|
+
formatClipTime,
|
|
27
|
+
parseDurationSeconds,
|
|
28
|
+
parseWaveForm,
|
|
29
|
+
resamplePeaks,
|
|
30
|
+
} from '../../helpers/audioWaveform';
|
|
22
31
|
import { pushLog as devPushLog } from '../../utils/devLogger';
|
|
23
|
-
|
|
24
|
-
const formatTime = (millis: number) => {
|
|
25
|
-
const safe = Number.isFinite(millis) && millis > 0 ? millis : 0;
|
|
26
|
-
const totalSec = Math.floor(safe / 1000);
|
|
27
|
-
const min = Math.floor(totalSec / 60);
|
|
28
|
-
const sec = totalSec % 60;
|
|
29
|
-
return `${min}:${sec.toString().padStart(2, '0')}`;
|
|
30
|
-
};
|
|
32
|
+
import { MAX_DECODE_BYTES, decodeAudioClip } from './AudioDecoderHost';
|
|
31
33
|
|
|
32
34
|
type AudioMessageProps = {
|
|
33
35
|
src: string;
|
|
34
36
|
mimeType?: string;
|
|
35
37
|
fileName?: string;
|
|
36
38
|
originalName?: string;
|
|
39
|
+
/** Seconds, when the sender attached it. */
|
|
37
40
|
duration?: number | string;
|
|
41
|
+
/** Bars the sender attached (see helpers/audioWaveform). */
|
|
38
42
|
waveForm?: string;
|
|
43
|
+
/** Own message: the player takes the bubble's ink instead of the brand. */
|
|
44
|
+
isUser?: boolean;
|
|
39
45
|
};
|
|
40
46
|
|
|
41
47
|
type AudioContainer =
|
|
@@ -50,19 +56,25 @@ type AudioContainer =
|
|
|
50
56
|
type PreparedSource = {
|
|
51
57
|
localUri: string;
|
|
52
58
|
container: AudioContainer;
|
|
53
|
-
|
|
59
|
+
/** The local file is already a natively playable copy (decoded WAV). */
|
|
60
|
+
playable?: boolean;
|
|
54
61
|
};
|
|
55
62
|
|
|
56
|
-
type
|
|
57
|
-
| { type: 'bridge_ready' }
|
|
58
|
-
| { type: 'decoded'; durationMillis: number; wavBase64: string }
|
|
59
|
-
| { type: 'error'; message?: string };
|
|
63
|
+
type Analysis = { peaks: number[]; durationMillis: number };
|
|
60
64
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
const SPEEDS = [1, 1.5, 2];
|
|
66
|
+
const BAR_WIDTH = 3;
|
|
67
|
+
const BAR_GAP = 2;
|
|
68
|
+
const WAVE_HEIGHT = 24;
|
|
69
|
+
|
|
70
|
+
/** Waveforms already worked out this session, by source URL. */
|
|
71
|
+
const analysisCache = new Map<string, Analysis>();
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Only one voice note plays at a time, as in the messengers: starting one
|
|
75
|
+
* pauses whichever was playing.
|
|
76
|
+
*/
|
|
77
|
+
let pauseActive: (() => void) | null = null;
|
|
66
78
|
|
|
67
79
|
const hashString = (value: string) => {
|
|
68
80
|
let hash = 0;
|
|
@@ -210,139 +222,76 @@ const getContainerExtension = (container: AudioContainer) => {
|
|
|
210
222
|
const requiresWebAudioDecode = (container: AudioContainer) =>
|
|
211
223
|
Platform.OS === 'ios' && (container === 'webm' || container === 'ogg');
|
|
212
224
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
<
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
};
|
|
239
|
-
var ctx = null;
|
|
240
|
-
var encodeWav = function (buffer) {
|
|
241
|
-
var numCh = buffer.numberOfChannels;
|
|
242
|
-
var frames = buffer.length;
|
|
243
|
-
var sr = buffer.sampleRate;
|
|
244
|
-
var bytesLen = 44 + frames * numCh * 2;
|
|
245
|
-
var ab = new ArrayBuffer(bytesLen);
|
|
246
|
-
var view = new DataView(ab);
|
|
247
|
-
var off = 0;
|
|
248
|
-
var ws = function (s) { for (var i = 0; i < s.length; i += 1) { view.setUint8(off++, s.charCodeAt(i)); } };
|
|
249
|
-
var u32 = function (d) { view.setUint32(off, d, true); off += 4; };
|
|
250
|
-
var u16 = function (d) { view.setUint16(off, d, true); off += 2; };
|
|
251
|
-
ws('RIFF'); u32(bytesLen - 8); ws('WAVE');
|
|
252
|
-
ws('fmt '); u32(16); u16(1); u16(numCh); u32(sr); u32(sr * numCh * 2); u16(numCh * 2); u16(16);
|
|
253
|
-
ws('data'); u32(frames * numCh * 2);
|
|
254
|
-
var chans = [];
|
|
255
|
-
for (var c = 0; c < numCh; c += 1) { chans.push(buffer.getChannelData(c)); }
|
|
256
|
-
for (var f = 0; f < frames; f += 1) {
|
|
257
|
-
for (var c2 = 0; c2 < numCh; c2 += 1) {
|
|
258
|
-
var s = Math.max(-1, Math.min(1, chans[c2][f]));
|
|
259
|
-
view.setInt16(off, s < 0 ? s * 0x8000 : s * 0x7fff, true);
|
|
260
|
-
off += 2;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
return ab;
|
|
264
|
-
};
|
|
265
|
-
var abToBase64 = function (ab) {
|
|
266
|
-
var bytes = new Uint8Array(ab);
|
|
267
|
-
var binary = '';
|
|
268
|
-
var chunk = 0x8000;
|
|
269
|
-
for (var i = 0; i < bytes.length; i += chunk) {
|
|
270
|
-
binary += String.fromCharCode.apply(null, bytes.subarray(i, i + chunk));
|
|
271
|
-
}
|
|
272
|
-
return window.btoa(binary);
|
|
273
|
-
};
|
|
274
|
-
window.__decodeAudio = function (base64) {
|
|
275
|
-
try {
|
|
276
|
-
if (!ctx) {
|
|
277
|
-
var Ctx = window.AudioContext || window.webkitAudioContext;
|
|
278
|
-
ctx = new Ctx();
|
|
279
|
-
}
|
|
280
|
-
var bin = window.atob(base64);
|
|
281
|
-
var len = bin.length;
|
|
282
|
-
var bytes = new Uint8Array(len);
|
|
283
|
-
for (var i = 0; i < len; i += 1) { bytes[i] = bin.charCodeAt(i); }
|
|
284
|
-
ctx.decodeAudioData(
|
|
285
|
-
bytes.buffer,
|
|
286
|
-
function (decoded) {
|
|
287
|
-
try {
|
|
288
|
-
var wav = encodeWav(decoded);
|
|
289
|
-
if (wav.byteLength > MAX_WAV) {
|
|
290
|
-
post({ type: 'error', message: 'audio_too_long' });
|
|
291
|
-
return;
|
|
292
|
-
}
|
|
293
|
-
post({
|
|
294
|
-
type: 'decoded',
|
|
295
|
-
durationMillis: Math.floor(decoded.duration * 1000),
|
|
296
|
-
wavBase64: abToBase64(wav),
|
|
297
|
-
});
|
|
298
|
-
} catch (e) {
|
|
299
|
-
post({ type: 'error', message: 'encode_failed:' + (e && e.message ? e.message : e) });
|
|
300
|
-
}
|
|
301
|
-
},
|
|
302
|
-
function (err) {
|
|
303
|
-
post({ type: 'error', message: 'decode_failed:' + (err && err.message ? err.message : err) });
|
|
304
|
-
}
|
|
305
|
-
);
|
|
306
|
-
} catch (e) {
|
|
307
|
-
post({ type: 'error', message: 'load_failed:' + (e && e.message ? e.message : e) });
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
post({ type: 'bridge_ready' });
|
|
311
|
-
})();
|
|
312
|
-
</script>
|
|
313
|
-
</body>
|
|
314
|
-
</html>`;
|
|
315
|
-
|
|
225
|
+
const PlayGlyph = ({ color }: { color: string }) => (
|
|
226
|
+
<Svg width={26} height={26} viewBox="0 0 24 24">
|
|
227
|
+
<Path
|
|
228
|
+
d="M7.5 5.2v13.6c0 .95 1.05 1.5 1.8.95l9.9-6.8c.65-.45.65-1.45 0-1.9L9.3 4.25c-.75-.55-1.8 0-1.8.95z"
|
|
229
|
+
fill={color}
|
|
230
|
+
/>
|
|
231
|
+
</Svg>
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
const PauseGlyph = ({ color }: { color: string }) => (
|
|
235
|
+
<Svg width={24} height={24} viewBox="0 0 24 24">
|
|
236
|
+
<Rect x={6.5} y={5} width={4} height={14} rx={1.4} fill={color} />
|
|
237
|
+
<Rect x={13.5} y={5} width={4} height={14} rx={1.4} fill={color} />
|
|
238
|
+
</Svg>
|
|
239
|
+
);
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* A voice message the way the messengers draw it: a round play button,
|
|
243
|
+
* the clip's waveform filling in as it plays (tap it to jump), and its
|
|
244
|
+
* length — elapsed while playing — under the bars.
|
|
245
|
+
*
|
|
246
|
+
* The bars come from the sender's `waveForm` when there is one, otherwise
|
|
247
|
+
* from decoding the file in the shared decoder (AudioDecoderHost), which
|
|
248
|
+
* is also what makes the web client's WebM/Opus playable on iOS.
|
|
249
|
+
*/
|
|
316
250
|
const AudioMessage = ({
|
|
317
251
|
src,
|
|
318
252
|
mimeType,
|
|
319
253
|
fileName,
|
|
320
254
|
originalName,
|
|
255
|
+
duration: durationProp,
|
|
256
|
+
waveForm,
|
|
257
|
+
isUser = false,
|
|
321
258
|
}: AudioMessageProps) => {
|
|
322
259
|
const theme = useTheme();
|
|
260
|
+
const t = useT();
|
|
323
261
|
const soundRef = useRef<AudioPlayer | null>(null);
|
|
324
|
-
// expo-audio delivers progress through an event subscription
|
|
325
|
-
//
|
|
326
|
-
// to be held and removed alongside the player itself.
|
|
262
|
+
// expo-audio delivers progress through an event subscription, so the
|
|
263
|
+
// handle has to be held and removed alongside the player itself.
|
|
327
264
|
const statusSubRef = useRef<{ remove: () => void } | null>(null);
|
|
328
|
-
const webViewRef = useRef<WebView | null>(null);
|
|
329
265
|
const preparedRef = useRef<PreparedSource | null>(null);
|
|
330
|
-
const
|
|
331
|
-
const injectedRef = useRef(false);
|
|
266
|
+
const preparingRef = useRef<Promise<PreparedSource> | null>(null);
|
|
332
267
|
const didFinishRef = useRef(false);
|
|
333
268
|
const unmountedRef = useRef(false);
|
|
334
269
|
const loadingTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
270
|
+
// Where to start once the player is up (a tap on the bars before play).
|
|
271
|
+
const pendingSeekRef = useRef<number | null>(null);
|
|
272
|
+
const rateRef = useRef(1);
|
|
273
|
+
|
|
274
|
+
// The file's identity without its (rotating) access token, so caches
|
|
275
|
+
// survive a token refresh.
|
|
276
|
+
const cacheKey = src.split(/[?#]/)[0] || src;
|
|
277
|
+
const metaPeaks = useMemo(() => parseWaveForm(waveForm), [waveForm]);
|
|
278
|
+
const metaDuration = parseDurationSeconds(durationProp) * 1000;
|
|
335
279
|
|
|
336
280
|
const [isPlaying, setIsPlaying] = useState(false);
|
|
337
281
|
const [isLoading, setIsLoading] = useState(false);
|
|
338
282
|
const [playbackError, setPlaybackError] = useState(false);
|
|
339
283
|
const [position, setPosition] = useState(0);
|
|
340
|
-
const [duration, setDuration] = useState(
|
|
341
|
-
const [
|
|
342
|
-
const
|
|
343
|
-
const
|
|
344
|
-
|
|
345
|
-
|
|
284
|
+
const [duration, setDuration] = useState(metaDuration);
|
|
285
|
+
const [peaks, setPeaks] = useState<number[] | null>(metaPeaks);
|
|
286
|
+
const [rate, setRate] = useState(1);
|
|
287
|
+
const [waveWidth, setWaveWidth] = useState(0);
|
|
288
|
+
|
|
289
|
+
// The brand colour from the config (the same tint as the composer's mic
|
|
290
|
+
// and send buttons), on own and others' bubbles alike.
|
|
291
|
+
const ink = theme.icon;
|
|
292
|
+
const buttonFill = ink;
|
|
293
|
+
const buttonGlyph = theme.textOnPrimary;
|
|
294
|
+
const metaColor = isUser ? theme.messageTextUser : theme.textSecondary;
|
|
346
295
|
|
|
347
296
|
const clearLoadingGuard = () => {
|
|
348
297
|
if (loadingTimerRef.current) {
|
|
@@ -353,8 +302,7 @@ const AudioMessage = ({
|
|
|
353
302
|
|
|
354
303
|
// expo-audio players are native shared objects: they are NOT garbage
|
|
355
304
|
// collected with the component, so every one we create has to be
|
|
356
|
-
// explicitly `remove()`d
|
|
357
|
-
// status subscription torn down first.
|
|
305
|
+
// explicitly `remove()`d and its status subscription torn down first.
|
|
358
306
|
const releasePlayer = () => {
|
|
359
307
|
statusSubRef.current?.remove();
|
|
360
308
|
statusSubRef.current = null;
|
|
@@ -374,6 +322,22 @@ const AudioMessage = ({
|
|
|
374
322
|
}
|
|
375
323
|
};
|
|
376
324
|
|
|
325
|
+
// Stable for this bubble's lifetime: what another bubble calls to pause
|
|
326
|
+
// this one when it starts playing.
|
|
327
|
+
const pauseSelf = useRef(() => {
|
|
328
|
+
try {
|
|
329
|
+
soundRef.current?.pause();
|
|
330
|
+
} catch {
|
|
331
|
+
/* released */
|
|
332
|
+
}
|
|
333
|
+
if (!unmountedRef.current) {setIsPlaying(false);}
|
|
334
|
+
}).current;
|
|
335
|
+
|
|
336
|
+
const claimPlayback = () => {
|
|
337
|
+
if (pauseActive && pauseActive !== pauseSelf) {pauseActive();}
|
|
338
|
+
pauseActive = pauseSelf;
|
|
339
|
+
};
|
|
340
|
+
|
|
377
341
|
const fail = (reason: unknown) => {
|
|
378
342
|
clearLoadingGuard();
|
|
379
343
|
if (unmountedRef.current) {
|
|
@@ -396,76 +360,75 @@ const AudioMessage = ({
|
|
|
396
360
|
};
|
|
397
361
|
|
|
398
362
|
// Hard ceiling on the loading spinner — whatever stalls (a hung network
|
|
399
|
-
// request, a
|
|
400
|
-
//
|
|
401
|
-
// (the customer-reported "stuck spinner").
|
|
363
|
+
// request, a decode that never returns, a player that never loads) the
|
|
364
|
+
// control resolves to an error state instead of spinning forever.
|
|
402
365
|
const armLoadingGuard = () => {
|
|
403
366
|
clearLoadingGuard();
|
|
404
367
|
loadingTimerRef.current = setTimeout(() => {
|
|
405
368
|
if (!unmountedRef.current && !soundRef.current) {
|
|
406
369
|
fail(new Error('audio_timeout'));
|
|
407
370
|
}
|
|
408
|
-
},
|
|
371
|
+
}, 25000);
|
|
409
372
|
};
|
|
410
373
|
|
|
411
|
-
const
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
if (!/^https?:\/\//i.test(src)) {
|
|
416
|
-
const prepared: PreparedSource = { localUri: src, container: 'unknown' };
|
|
417
|
-
preparedRef.current = prepared;
|
|
418
|
-
return prepared;
|
|
419
|
-
}
|
|
420
|
-
const cacheDirectory = FileSystem.cacheDirectory;
|
|
421
|
-
if (!cacheDirectory) {
|
|
422
|
-
const prepared: PreparedSource = { localUri: src, container: 'unknown' };
|
|
423
|
-
preparedRef.current = prepared;
|
|
424
|
-
return prepared;
|
|
425
|
-
}
|
|
374
|
+
const cacheBase = () =>
|
|
375
|
+
FileSystem.cacheDirectory
|
|
376
|
+
? `${FileSystem.cacheDirectory}ethora-audio-${hashString(cacheKey)}`
|
|
377
|
+
: null;
|
|
426
378
|
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
12000,
|
|
434
|
-
'audio_download_timeout'
|
|
435
|
-
);
|
|
436
|
-
logAudioDebug('audio downloaded', {
|
|
437
|
-
src,
|
|
438
|
-
uri: download.status === 200 ? download.uri : undefined,
|
|
439
|
-
status: download.status,
|
|
379
|
+
const sniff = async (uri: string): Promise<AudioContainer> => {
|
|
380
|
+
try {
|
|
381
|
+
const head = await FileSystem.readAsStringAsync(uri, {
|
|
382
|
+
encoding: FileSystem.EncodingType.Base64,
|
|
383
|
+
position: 0,
|
|
384
|
+
length: 32,
|
|
440
385
|
});
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
386
|
+
return detectContainer(decodeBase64Head(head, 16));
|
|
387
|
+
} catch {
|
|
388
|
+
return 'unknown';
|
|
444
389
|
}
|
|
390
|
+
};
|
|
445
391
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
const
|
|
459
|
-
if (
|
|
460
|
-
|
|
392
|
+
// Download once (shared by the waveform and playback), sniff the real
|
|
393
|
+
// container, and give the cached file a real extension so AVFoundation /
|
|
394
|
+
// ExoPlayer pick the right demuxer instead of choking on an opaque
|
|
395
|
+
// `.blob` (the original `audio_timeout` cause).
|
|
396
|
+
const prepareSource = (): Promise<PreparedSource> => {
|
|
397
|
+
if (preparedRef.current) {
|
|
398
|
+
return Promise.resolve(preparedRef.current);
|
|
399
|
+
}
|
|
400
|
+
if (preparingRef.current) {
|
|
401
|
+
return preparingRef.current;
|
|
402
|
+
}
|
|
403
|
+
const run = async (): Promise<PreparedSource> => {
|
|
404
|
+
const base = cacheBase();
|
|
405
|
+
if (!/^https?:\/\//i.test(src) || !base) {
|
|
406
|
+
// Local file (the sender's own clip while it uploads).
|
|
407
|
+
return { localUri: src, container: await sniff(src) };
|
|
408
|
+
}
|
|
409
|
+
const wav = `${base}.wav`;
|
|
410
|
+
if ((await FileSystem.getInfoAsync(wav)).exists) {
|
|
411
|
+
return { localUri: wav, container: 'wav', playable: true };
|
|
412
|
+
}
|
|
413
|
+
const part = `${base}.part`;
|
|
414
|
+
if (!(await FileSystem.getInfoAsync(part)).exists) {
|
|
415
|
+
const download = await withTimeout(
|
|
416
|
+
FileSystem.downloadAsync(withFileToken(src), part),
|
|
417
|
+
12000,
|
|
418
|
+
'audio_download_timeout'
|
|
419
|
+
);
|
|
420
|
+
if (download.status !== 200) {
|
|
421
|
+
await FileSystem.deleteAsync(part, { idempotent: true }).catch(
|
|
422
|
+
() => {}
|
|
423
|
+
);
|
|
424
|
+
throw new Error(`audio_download_status_${download.status}`);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
const container = await sniff(part);
|
|
428
|
+
if (requiresWebAudioDecode(container)) {
|
|
429
|
+
// Decoded to WAV before playing; the extension is irrelevant.
|
|
430
|
+
return { localUri: part, container };
|
|
461
431
|
}
|
|
462
|
-
base64 = await FileSystem.readAsStringAsync(part, {
|
|
463
|
-
encoding: FileSystem.EncodingType.Base64,
|
|
464
|
-
});
|
|
465
|
-
} else {
|
|
466
|
-
// Native path: give the cached file a real extension so AVFoundation
|
|
467
|
-
// / ExoPlayer pick the right demuxer instead of choking on an opaque
|
|
468
|
-
// `.blob` (the original `audio_timeout` cause).
|
|
469
432
|
const ext =
|
|
470
433
|
container !== 'unknown'
|
|
471
434
|
? getContainerExtension(container)
|
|
@@ -476,55 +439,161 @@ const AudioMessage = ({
|
|
|
476
439
|
url: src,
|
|
477
440
|
});
|
|
478
441
|
const finalUri = `${base}${ext}`;
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
await FileSystem.deleteAsync(part, { idempotent: true }).catch(
|
|
482
|
-
() => {}
|
|
483
|
-
);
|
|
442
|
+
if ((await FileSystem.getInfoAsync(finalUri)).exists) {
|
|
443
|
+
await FileSystem.deleteAsync(part, { idempotent: true }).catch(() => {});
|
|
484
444
|
} else {
|
|
485
445
|
await FileSystem.moveAsync({ from: part, to: finalUri });
|
|
486
446
|
}
|
|
487
|
-
localUri
|
|
488
|
-
}
|
|
447
|
+
return { localUri: finalUri, container };
|
|
448
|
+
};
|
|
449
|
+
const pending = run().then(
|
|
450
|
+
(prepared) => {
|
|
451
|
+
preparedRef.current = prepared;
|
|
452
|
+
preparingRef.current = null;
|
|
453
|
+
logAudioDebug('audio prepared', {
|
|
454
|
+
src,
|
|
455
|
+
container: prepared.container,
|
|
456
|
+
platform: Platform.OS,
|
|
457
|
+
});
|
|
458
|
+
return prepared;
|
|
459
|
+
},
|
|
460
|
+
(error) => {
|
|
461
|
+
preparingRef.current = null;
|
|
462
|
+
throw error;
|
|
463
|
+
}
|
|
464
|
+
);
|
|
465
|
+
preparingRef.current = pending;
|
|
466
|
+
return pending;
|
|
467
|
+
};
|
|
489
468
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
platform: Platform.OS,
|
|
499
|
-
decode: requiresWebAudioDecode(container) ? 'web-audio' : 'native',
|
|
469
|
+
const readBase64 = async (uri: string) => {
|
|
470
|
+
const info = await FileSystem.getInfoAsync(uri);
|
|
471
|
+
const size = 'size' in info ? info.size ?? 0 : 0;
|
|
472
|
+
if (size > MAX_DECODE_BYTES) {
|
|
473
|
+
throw new Error('audio_too_large_to_decode');
|
|
474
|
+
}
|
|
475
|
+
return FileSystem.readAsStringAsync(uri, {
|
|
476
|
+
encoding: FileSystem.EncodingType.Base64,
|
|
500
477
|
});
|
|
501
|
-
return prepared;
|
|
502
478
|
};
|
|
503
479
|
|
|
504
|
-
const
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
480
|
+
const remember = (analysis: Analysis) => {
|
|
481
|
+
analysisCache.set(cacheKey, analysis);
|
|
482
|
+
const base = cacheBase();
|
|
483
|
+
if (base) {
|
|
484
|
+
FileSystem.writeAsStringAsync(
|
|
485
|
+
`${base}.wave.json`,
|
|
486
|
+
JSON.stringify(analysis)
|
|
487
|
+
).catch(() => {});
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
const applyAnalysis = (analysis: Analysis) => {
|
|
492
|
+
if (unmountedRef.current) {return;}
|
|
493
|
+
if (!metaPeaks && analysis.peaks.length) {setPeaks(analysis.peaks);}
|
|
494
|
+
if (analysis.durationMillis > 0) {
|
|
495
|
+
setDuration((current) => current || analysis.durationMillis);
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
// Decode the clip once: its bars, its real length (MediaRecorder writes
|
|
500
|
+
// WebM without a duration header), and — where the native player cannot
|
|
501
|
+
// read it — a WAV copy to play.
|
|
502
|
+
const decodeClip = async (prepared: PreparedSource) => {
|
|
503
|
+
const wantWav = requiresWebAudioDecode(prepared.container) && !prepared.playable;
|
|
504
|
+
const clip = await decodeAudioClip(await readBase64(prepared.localUri), {
|
|
505
|
+
wantWav,
|
|
506
|
+
});
|
|
507
|
+
const analysis = { peaks: clip.peaks, durationMillis: clip.durationMillis };
|
|
508
|
+
remember(analysis);
|
|
509
|
+
applyAnalysis(analysis);
|
|
510
|
+
const base = cacheBase();
|
|
511
|
+
if (clip.wavBase64 && base) {
|
|
512
|
+
const wavUri = `${base}.wav`;
|
|
513
|
+
await FileSystem.writeAsStringAsync(wavUri, clip.wavBase64, {
|
|
514
|
+
encoding: FileSystem.EncodingType.Base64,
|
|
515
|
+
});
|
|
516
|
+
await FileSystem.deleteAsync(prepared.localUri, { idempotent: true }).catch(
|
|
517
|
+
() => {}
|
|
515
518
|
);
|
|
519
|
+
preparedRef.current = { localUri: wavUri, container: 'wav', playable: true };
|
|
516
520
|
}
|
|
521
|
+
return preparedRef.current ?? prepared;
|
|
517
522
|
};
|
|
518
523
|
|
|
519
|
-
//
|
|
520
|
-
//
|
|
521
|
-
|
|
524
|
+
// Full reset whenever the source changes (component reused for a new
|
|
525
|
+
// message / re-render with a different src).
|
|
526
|
+
const lastSrcRef = useRef(src);
|
|
527
|
+
useEffect(() => {
|
|
528
|
+
if (lastSrcRef.current === src) {return;}
|
|
529
|
+
lastSrcRef.current = src;
|
|
530
|
+
releasePlayer();
|
|
531
|
+
preparedRef.current = null;
|
|
532
|
+
preparingRef.current = null;
|
|
533
|
+
didFinishRef.current = false;
|
|
534
|
+
pendingSeekRef.current = null;
|
|
535
|
+
clearLoadingGuard();
|
|
536
|
+
setIsPlaying(false);
|
|
537
|
+
setIsLoading(false);
|
|
538
|
+
setPlaybackError(false);
|
|
539
|
+
setPosition(0);
|
|
540
|
+
setDuration(metaDuration);
|
|
541
|
+
setPeaks(metaPeaks);
|
|
542
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
543
|
+
}, [src]);
|
|
544
|
+
|
|
545
|
+
// The waveform, as soon as the bubble shows: from the message itself,
|
|
546
|
+
// from this session's cache, from the disk cache, or by decoding.
|
|
547
|
+
useEffect(() => {
|
|
548
|
+
if (!src || (metaPeaks && metaDuration > 0)) {return;}
|
|
549
|
+
const cached = analysisCache.get(cacheKey);
|
|
550
|
+
if (cached) {
|
|
551
|
+
applyAnalysis(cached);
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
554
|
+
let cancelled = false;
|
|
555
|
+
(async () => {
|
|
556
|
+
const base = cacheBase();
|
|
557
|
+
if (base) {
|
|
558
|
+
try {
|
|
559
|
+
const stored = await FileSystem.readAsStringAsync(`${base}.wave.json`);
|
|
560
|
+
const parsed = JSON.parse(stored) as Analysis;
|
|
561
|
+
if (Array.isArray(parsed?.peaks)) {
|
|
562
|
+
analysisCache.set(cacheKey, parsed);
|
|
563
|
+
if (!cancelled) {applyAnalysis(parsed);}
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
} catch {
|
|
567
|
+
/* not analysed yet */
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
try {
|
|
571
|
+
const prepared = await prepareSource();
|
|
572
|
+
if (cancelled) {return;}
|
|
573
|
+
await decodeClip(prepared);
|
|
574
|
+
} catch (error) {
|
|
575
|
+
// Not fatal: the bubble keeps flat bars and still plays.
|
|
576
|
+
logAudioDebug('audio waveform unavailable', {
|
|
577
|
+
src,
|
|
578
|
+
error: error instanceof Error ? error.message : String(error),
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
})();
|
|
582
|
+
return () => {
|
|
583
|
+
cancelled = true;
|
|
584
|
+
};
|
|
585
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
586
|
+
}, [src]);
|
|
587
|
+
|
|
588
|
+
// expo-audio reports times in SECONDS; the UI is millisecond-based, so
|
|
589
|
+
// convert at this boundary and nowhere else.
|
|
522
590
|
const onPlaybackStatusUpdate = (status: AudioStatus) => {
|
|
523
|
-
if (!status.isLoaded) {
|
|
591
|
+
if (!status.isLoaded || unmountedRef.current) {
|
|
524
592
|
return;
|
|
525
593
|
}
|
|
526
594
|
setPosition(Math.max(0, status.currentTime * 1000));
|
|
527
|
-
|
|
595
|
+
// A WebM without a duration header reports 0 here: keep the decoded one.
|
|
596
|
+
if (status.duration > 0) {setDuration(status.duration * 1000);}
|
|
528
597
|
setIsPlaying(status.playing);
|
|
529
598
|
if (status.didJustFinish) {
|
|
530
599
|
didFinishRef.current = true;
|
|
@@ -544,12 +613,10 @@ const AudioMessage = ({
|
|
|
544
613
|
} catch {
|
|
545
614
|
/* non-fatal — still plays through the ringer channel */
|
|
546
615
|
}
|
|
547
|
-
// expo-audio has no awaitable
|
|
548
|
-
//
|
|
549
|
-
// the
|
|
550
|
-
|
|
551
|
-
// real playback or the error state, never to a silent dead button.
|
|
552
|
-
const player = createAudioPlayer({ uri: localUri }, { updateInterval: 250 });
|
|
616
|
+
// expo-audio has no awaitable create: the player loads in the
|
|
617
|
+
// background and reports `isLoaded` via the status event. Wait for it
|
|
618
|
+
// so the spinner resolves to real playback or the error state.
|
|
619
|
+
const player = createAudioPlayer({ uri: localUri }, { updateInterval: 100 });
|
|
553
620
|
let settleLoaded: (() => void) | null = null;
|
|
554
621
|
const loaded = new Promise<void>((resolve) => {
|
|
555
622
|
settleLoaded = resolve;
|
|
@@ -579,67 +646,21 @@ const AudioMessage = ({
|
|
|
579
646
|
}
|
|
580
647
|
soundRef.current = player;
|
|
581
648
|
statusSubRef.current = subscription;
|
|
649
|
+
if (rateRef.current !== 1) {
|
|
650
|
+
player.shouldCorrectPitch = true;
|
|
651
|
+
player.setPlaybackRate(rateRef.current);
|
|
652
|
+
}
|
|
653
|
+
const seek = pendingSeekRef.current;
|
|
654
|
+
pendingSeekRef.current = null;
|
|
655
|
+
if (seek !== null && player.duration > 0) {
|
|
656
|
+
await player.seekTo(seek * player.duration);
|
|
657
|
+
}
|
|
658
|
+
claimPlayback();
|
|
582
659
|
player.play();
|
|
583
660
|
clearLoadingGuard();
|
|
584
661
|
setIsLoading(false);
|
|
585
662
|
setPlaybackError(false);
|
|
586
663
|
setIsPlaying(true);
|
|
587
|
-
logAudioDebug('native audio playback started', {
|
|
588
|
-
src,
|
|
589
|
-
container: preparedRef.current?.container,
|
|
590
|
-
localUri,
|
|
591
|
-
});
|
|
592
|
-
};
|
|
593
|
-
|
|
594
|
-
// WebView finished decoding Opus → WAV: persist the WAV and play it
|
|
595
|
-
// natively. From here it is indistinguishable from any other native clip.
|
|
596
|
-
const onDecoded = async (durationMillis: number, wavBase64: string) => {
|
|
597
|
-
try {
|
|
598
|
-
const cacheDirectory = FileSystem.cacheDirectory || '';
|
|
599
|
-
const wavUri = `${cacheDirectory}ethora-audio-${hashString(src)}.wav`;
|
|
600
|
-
await FileSystem.writeAsStringAsync(wavUri, wavBase64, {
|
|
601
|
-
encoding: FileSystem.EncodingType.Base64,
|
|
602
|
-
});
|
|
603
|
-
if (unmountedRef.current) {
|
|
604
|
-
return;
|
|
605
|
-
}
|
|
606
|
-
preparedRef.current = {
|
|
607
|
-
localUri: wavUri,
|
|
608
|
-
container: preparedRef.current?.container ?? 'webm',
|
|
609
|
-
};
|
|
610
|
-
if (durationMillis > 0) {
|
|
611
|
-
setDuration(durationMillis);
|
|
612
|
-
}
|
|
613
|
-
setWebViewEnabled(false); // decoder no longer needed
|
|
614
|
-
await startNativePlayback(wavUri);
|
|
615
|
-
} catch (error) {
|
|
616
|
-
fail(error);
|
|
617
|
-
}
|
|
618
|
-
};
|
|
619
|
-
|
|
620
|
-
const handleWebMessage = (event: WebViewMessageEvent) => {
|
|
621
|
-
let payload: WebDecoderMessage;
|
|
622
|
-
try {
|
|
623
|
-
payload = JSON.parse(event.nativeEvent.data) as WebDecoderMessage;
|
|
624
|
-
} catch {
|
|
625
|
-
return;
|
|
626
|
-
}
|
|
627
|
-
if (payload.type === 'bridge_ready') {
|
|
628
|
-
bridgeReadyRef.current = true;
|
|
629
|
-
maybeInjectDecode();
|
|
630
|
-
return;
|
|
631
|
-
}
|
|
632
|
-
if (payload.type === 'decoded') {
|
|
633
|
-
logAudioDebug('web audio decoded', {
|
|
634
|
-
src,
|
|
635
|
-
durationMillis: payload.durationMillis,
|
|
636
|
-
wavBytes: payload.wavBase64 ? payload.wavBase64.length : 0,
|
|
637
|
-
});
|
|
638
|
-
void onDecoded(payload.durationMillis, payload.wavBase64);
|
|
639
|
-
return;
|
|
640
|
-
}
|
|
641
|
-
// type === 'error'
|
|
642
|
-
fail(new Error(payload.message || 'web_audio_error'));
|
|
643
664
|
};
|
|
644
665
|
|
|
645
666
|
const togglePlayback = async () => {
|
|
@@ -647,15 +668,12 @@ const AudioMessage = ({
|
|
|
647
668
|
return;
|
|
648
669
|
}
|
|
649
670
|
|
|
650
|
-
// Already-loaded
|
|
651
|
-
// decoded-WAV from the WebView path) → plain toggle.
|
|
671
|
+
// Already-loaded player → plain toggle.
|
|
652
672
|
if (soundRef.current) {
|
|
653
673
|
try {
|
|
654
|
-
// `play()` / `pause()` emit
|
|
655
|
-
//
|
|
656
|
-
//
|
|
657
|
-
// stops while paused — so without setting this here the button
|
|
658
|
-
// would latch on "pause" forever and never resume.
|
|
674
|
+
// `play()` / `pause()` emit no status event of their own, and the
|
|
675
|
+
// time observer stops while paused — so set the state here or the
|
|
676
|
+
// button latches on "pause" forever.
|
|
659
677
|
if (isPlaying) {
|
|
660
678
|
soundRef.current.pause();
|
|
661
679
|
setIsPlaying(false);
|
|
@@ -664,6 +682,7 @@ const AudioMessage = ({
|
|
|
664
682
|
await soundRef.current.seekTo(0);
|
|
665
683
|
didFinishRef.current = false;
|
|
666
684
|
}
|
|
685
|
+
claimPlayback();
|
|
667
686
|
soundRef.current.play();
|
|
668
687
|
setIsPlaying(true);
|
|
669
688
|
}
|
|
@@ -673,26 +692,21 @@ const AudioMessage = ({
|
|
|
673
692
|
return;
|
|
674
693
|
}
|
|
675
694
|
|
|
676
|
-
// First tap →
|
|
695
|
+
// First tap → download (unless the waveform already did), decode where
|
|
696
|
+
// the native player cannot, then play.
|
|
677
697
|
setPlaybackError(false);
|
|
678
698
|
setIsLoading(true);
|
|
679
699
|
armLoadingGuard();
|
|
680
700
|
try {
|
|
681
|
-
|
|
701
|
+
let prepared = await withTimeout(
|
|
682
702
|
prepareSource(),
|
|
683
703
|
14000,
|
|
684
704
|
'audio_prepare_timeout'
|
|
685
705
|
);
|
|
686
|
-
if (
|
|
687
|
-
|
|
706
|
+
if (requiresWebAudioDecode(prepared.container) && !prepared.playable) {
|
|
707
|
+
prepared = await decodeClip(prepared);
|
|
688
708
|
}
|
|
689
|
-
if (
|
|
690
|
-
// Mount the decoder WebView; decoding + playback continue when the
|
|
691
|
-
// 'decoded' message arrives (→ onDecoded → startNativePlayback).
|
|
692
|
-
if (!webViewEnabled) {
|
|
693
|
-
setWebViewEnabled(true);
|
|
694
|
-
}
|
|
695
|
-
maybeInjectDecode();
|
|
709
|
+
if (unmountedRef.current) {
|
|
696
710
|
return;
|
|
697
711
|
}
|
|
698
712
|
await startNativePlayback(prepared.localUri);
|
|
@@ -701,98 +715,145 @@ const AudioMessage = ({
|
|
|
701
715
|
}
|
|
702
716
|
};
|
|
703
717
|
|
|
718
|
+
// A tap on the bars jumps there (and starts playing, as in Telegram).
|
|
719
|
+
const seekFromTap = (event: GestureResponderEvent) => {
|
|
720
|
+
if (!waveWidth || playbackError) {return;}
|
|
721
|
+
const ratio = Math.max(
|
|
722
|
+
0,
|
|
723
|
+
Math.min(1, event.nativeEvent.locationX / waveWidth)
|
|
724
|
+
);
|
|
725
|
+
const player = soundRef.current;
|
|
726
|
+
if (player && player.duration > 0) {
|
|
727
|
+
didFinishRef.current = false;
|
|
728
|
+
void player.seekTo(ratio * player.duration);
|
|
729
|
+
setPosition(ratio * player.duration * 1000);
|
|
730
|
+
if (!isPlaying) {
|
|
731
|
+
claimPlayback();
|
|
732
|
+
player.play();
|
|
733
|
+
setIsPlaying(true);
|
|
734
|
+
}
|
|
735
|
+
return;
|
|
736
|
+
}
|
|
737
|
+
if (isLoading) {return;}
|
|
738
|
+
pendingSeekRef.current = ratio;
|
|
739
|
+
void togglePlayback();
|
|
740
|
+
};
|
|
741
|
+
|
|
742
|
+
const cycleSpeed = () => {
|
|
743
|
+
const next = SPEEDS[(SPEEDS.indexOf(rate) + 1) % SPEEDS.length]!;
|
|
744
|
+
rateRef.current = next;
|
|
745
|
+
setRate(next);
|
|
746
|
+
const player = soundRef.current;
|
|
747
|
+
if (player) {
|
|
748
|
+
player.shouldCorrectPitch = true;
|
|
749
|
+
player.setPlaybackRate(next);
|
|
750
|
+
}
|
|
751
|
+
};
|
|
752
|
+
|
|
704
753
|
useEffect(() => {
|
|
705
754
|
unmountedRef.current = false;
|
|
706
755
|
return () => {
|
|
707
756
|
unmountedRef.current = true;
|
|
757
|
+
if (pauseActive === pauseSelf) {pauseActive = null;}
|
|
708
758
|
clearLoadingGuard();
|
|
709
759
|
releasePlayer();
|
|
710
760
|
};
|
|
711
761
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
712
762
|
}, []);
|
|
713
763
|
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
730
|
-
}, [src]);
|
|
764
|
+
const onWaveLayout = (event: LayoutChangeEvent) => {
|
|
765
|
+
const width = Math.floor(event.nativeEvent.layout.width);
|
|
766
|
+
if (width !== waveWidth) {setWaveWidth(width);}
|
|
767
|
+
};
|
|
768
|
+
|
|
769
|
+
const barCount = waveWidth
|
|
770
|
+
? Math.max(8, Math.floor((waveWidth + BAR_GAP) / (BAR_WIDTH + BAR_GAP)))
|
|
771
|
+
: 0;
|
|
772
|
+
const bars = useMemo(
|
|
773
|
+
() =>
|
|
774
|
+
barCount
|
|
775
|
+
? resamplePeaks(peaks ?? new Array(barCount).fill(MIN_BAR), barCount)
|
|
776
|
+
: [],
|
|
777
|
+
[peaks, barCount]
|
|
778
|
+
);
|
|
731
779
|
|
|
732
780
|
const progress = duration > 0 ? Math.min(1, position / duration) : 0;
|
|
781
|
+
const playedBars = Math.round(progress * bars.length);
|
|
782
|
+
const started = isPlaying || position > 0;
|
|
783
|
+
const timeLabel = playbackError
|
|
784
|
+
? t('media.audioUnavailable')
|
|
785
|
+
: started
|
|
786
|
+
? formatClipTime(position)
|
|
787
|
+
: duration > 0
|
|
788
|
+
? formatClipTime(duration)
|
|
789
|
+
: '';
|
|
733
790
|
|
|
734
791
|
return (
|
|
735
|
-
<View style={styles.
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
/>
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
<View style={styles.
|
|
757
|
-
<
|
|
758
|
-
testID="audio-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
onPress={
|
|
762
|
-
|
|
763
|
-
|
|
792
|
+
<View style={styles.container} testID="audio-message">
|
|
793
|
+
<Pressable
|
|
794
|
+
testID="audio-play-button"
|
|
795
|
+
accessibilityRole="button"
|
|
796
|
+
accessibilityLabel={t(isPlaying ? 'media.audioPause' : 'media.audioPlay')}
|
|
797
|
+
style={({ pressed }) => [
|
|
798
|
+
styles.playButton,
|
|
799
|
+
{ backgroundColor: buttonFill, opacity: pressed ? 0.85 : 1 },
|
|
800
|
+
]}
|
|
801
|
+
onPress={togglePlayback}
|
|
802
|
+
disabled={isLoading}
|
|
803
|
+
hitSlop={6}
|
|
804
|
+
>
|
|
805
|
+
{isLoading ? (
|
|
806
|
+
<ActivityIndicator size="small" color={buttonGlyph} />
|
|
807
|
+
) : isPlaying ? (
|
|
808
|
+
<PauseGlyph color={buttonGlyph} />
|
|
809
|
+
) : (
|
|
810
|
+
<PlayGlyph color={buttonGlyph} />
|
|
811
|
+
)}
|
|
812
|
+
</Pressable>
|
|
813
|
+
<View style={styles.track}>
|
|
814
|
+
<Pressable
|
|
815
|
+
testID="audio-waveform"
|
|
816
|
+
accessibilityElementsHidden
|
|
817
|
+
importantForAccessibility="no-hide-descendants"
|
|
818
|
+
onPress={seekFromTap}
|
|
819
|
+
onLayout={onWaveLayout}
|
|
820
|
+
style={styles.wave}
|
|
764
821
|
>
|
|
765
|
-
{
|
|
766
|
-
<ActivityIndicator size="small" color={onPrimary} />
|
|
767
|
-
) : (
|
|
768
|
-
<View style={styles.iconWrap}>
|
|
769
|
-
{isPlaying ? (
|
|
770
|
-
<PauseIcon width={18} height={18} color={onPrimary} />
|
|
771
|
-
) : (
|
|
772
|
-
<PlayIcon width={18} height={18} color={onPrimary} />
|
|
773
|
-
)}
|
|
774
|
-
</View>
|
|
775
|
-
)}
|
|
776
|
-
</TouchableOpacity>
|
|
777
|
-
<View style={styles.progressContainer}>
|
|
778
|
-
<View style={[styles.progressTrack, trackStyle]}>
|
|
822
|
+
{bars.map((value, index) => (
|
|
779
823
|
<View
|
|
824
|
+
key={index}
|
|
780
825
|
style={[
|
|
781
|
-
styles.
|
|
782
|
-
{
|
|
826
|
+
styles.bar,
|
|
827
|
+
{
|
|
828
|
+
height: Math.max(BAR_WIDTH, Math.round(value * WAVE_HEIGHT)),
|
|
829
|
+
backgroundColor: ink,
|
|
830
|
+
opacity: index < playedBars ? 1 : 0.35,
|
|
831
|
+
},
|
|
783
832
|
]}
|
|
784
833
|
/>
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
{
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
834
|
+
))}
|
|
835
|
+
</Pressable>
|
|
836
|
+
<View style={styles.metaRow}>
|
|
837
|
+
<Text
|
|
838
|
+
style={[styles.time, { color: metaColor }]}
|
|
839
|
+
numberOfLines={1}
|
|
840
|
+
>
|
|
841
|
+
{timeLabel}
|
|
842
|
+
</Text>
|
|
843
|
+
{started && !playbackError ? (
|
|
844
|
+
<Pressable
|
|
845
|
+
testID="audio-speed"
|
|
846
|
+
accessibilityRole="button"
|
|
847
|
+
accessibilityLabel={t('media.audioSpeed')}
|
|
848
|
+
onPress={cycleSpeed}
|
|
849
|
+
hitSlop={8}
|
|
850
|
+
style={[styles.speed, { backgroundColor: ink }]}
|
|
851
|
+
>
|
|
852
|
+
<Text style={[styles.speedText, { color: buttonGlyph }]}>
|
|
853
|
+
{`${rate}×`}
|
|
854
|
+
</Text>
|
|
855
|
+
</Pressable>
|
|
856
|
+
) : null}
|
|
796
857
|
</View>
|
|
797
858
|
</View>
|
|
798
859
|
</View>
|
|
@@ -802,65 +863,61 @@ const AudioMessage = ({
|
|
|
802
863
|
export default AudioMessage;
|
|
803
864
|
|
|
804
865
|
const styles = StyleSheet.create({
|
|
805
|
-
root: {
|
|
806
|
-
position: 'relative',
|
|
807
|
-
},
|
|
808
|
-
decoderHost: {
|
|
809
|
-
position: 'absolute',
|
|
810
|
-
top: 0,
|
|
811
|
-
left: 0,
|
|
812
|
-
width: 0,
|
|
813
|
-
height: 0,
|
|
814
|
-
overflow: 'hidden',
|
|
815
|
-
opacity: 0,
|
|
816
|
-
},
|
|
817
866
|
container: {
|
|
818
867
|
flexDirection: 'row',
|
|
819
868
|
alignItems: 'center',
|
|
820
|
-
gap:
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
869
|
+
gap: 10,
|
|
870
|
+
// Media bubbles carry no padding of their own (images run edge to
|
|
871
|
+
// edge), so the player brings the text bubble's inset with it.
|
|
872
|
+
paddingTop: 10,
|
|
873
|
+
paddingLeft: 10,
|
|
874
|
+
paddingRight: 12,
|
|
875
|
+
width: 250,
|
|
824
876
|
maxWidth: '100%',
|
|
825
877
|
},
|
|
826
878
|
playButton: {
|
|
827
|
-
width:
|
|
828
|
-
height:
|
|
829
|
-
borderRadius:
|
|
879
|
+
width: 46,
|
|
880
|
+
height: 46,
|
|
881
|
+
borderRadius: 23,
|
|
830
882
|
alignItems: 'center',
|
|
831
883
|
justifyContent: 'center',
|
|
832
884
|
},
|
|
833
|
-
|
|
834
|
-
marginLeft: 1,
|
|
835
|
-
},
|
|
836
|
-
progressContainer: {
|
|
885
|
+
track: {
|
|
837
886
|
flex: 1,
|
|
838
|
-
gap:
|
|
887
|
+
gap: 4,
|
|
839
888
|
},
|
|
840
|
-
|
|
889
|
+
wave: {
|
|
890
|
+
height: WAVE_HEIGHT,
|
|
841
891
|
flexDirection: 'row',
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
},
|
|
845
|
-
progressTrack: {
|
|
846
|
-
height: 6,
|
|
847
|
-
backgroundColor: '#D0D7E6',
|
|
848
|
-
borderRadius: 999,
|
|
892
|
+
alignItems: 'flex-end',
|
|
893
|
+
gap: BAR_GAP,
|
|
849
894
|
overflow: 'hidden',
|
|
850
895
|
},
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
height: 1,
|
|
855
|
-
opacity: 0,
|
|
896
|
+
bar: {
|
|
897
|
+
width: BAR_WIDTH,
|
|
898
|
+
borderRadius: BAR_WIDTH / 2,
|
|
856
899
|
},
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
900
|
+
metaRow: {
|
|
901
|
+
flexDirection: 'row',
|
|
902
|
+
alignItems: 'center',
|
|
903
|
+
gap: 6,
|
|
904
|
+
minHeight: 16,
|
|
860
905
|
},
|
|
861
906
|
time: {
|
|
862
907
|
fontSize: 12,
|
|
863
|
-
|
|
864
|
-
|
|
908
|
+
lineHeight: 16,
|
|
909
|
+
fontVariant: ['tabular-nums'],
|
|
910
|
+
opacity: 0.85,
|
|
911
|
+
},
|
|
912
|
+
speed: {
|
|
913
|
+
borderRadius: 8,
|
|
914
|
+
paddingHorizontal: 5,
|
|
915
|
+
paddingVertical: 1,
|
|
916
|
+
opacity: 0.85,
|
|
917
|
+
},
|
|
918
|
+
speedText: {
|
|
919
|
+
fontSize: 11,
|
|
920
|
+
lineHeight: 14,
|
|
921
|
+
fontWeight: '700',
|
|
865
922
|
},
|
|
866
923
|
});
|