@ethora/chat-component-rn 26.8.1 → 26.8.2
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 +96 -0
- package/README.md +43 -10
- package/lib/commonjs/assets/icons.js +7 -2
- package/lib/commonjs/assets/icons.js.map +1 -1
- package/lib/commonjs/components/AuthForms/Login.js +4 -4
- package/lib/commonjs/components/AuthForms/Login.js.map +1 -1
- package/lib/commonjs/components/Header/HeaderRoomList.js +29 -8
- package/lib/commonjs/components/Header/HeaderRoomList.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatHeader.js +9 -3
- package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatRoom.js +150 -14
- package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatWrapper.js +34 -13
- package/lib/commonjs/components/MainComponents/ChatWrapper.js.map +1 -1
- package/lib/commonjs/components/MainComponents/LoginWrapper.js +2 -1
- package/lib/commonjs/components/MainComponents/LoginWrapper.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MediaMessage.js +29 -9
- package/lib/commonjs/components/MainComponents/MediaMessage.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MessageContainer.js +5 -1
- package/lib/commonjs/components/MainComponents/MessageContainer.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MessageList.js +13 -5
- package/lib/commonjs/components/MainComponents/MessageList.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js +14 -13
- package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
- package/lib/commonjs/components/MainComponents/RoomList.js +208 -35
- package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
- package/lib/commonjs/components/Menu/HeaderRoomListMenu.js +317 -98
- package/lib/commonjs/components/Menu/HeaderRoomListMenu.js.map +1 -1
- package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js +322 -110
- package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +546 -203
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js +226 -0
- package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js.map +1 -0
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +69 -27
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
- package/lib/commonjs/components/Modals/FilePreviewModal/PdfView.js +2 -1
- package/lib/commonjs/components/Modals/FilePreviewModal/PdfView.js.map +1 -1
- package/lib/commonjs/components/Modals/Modal/Modal.js +8 -0
- package/lib/commonjs/components/Modals/Modal/Modal.js.map +1 -1
- package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js +2 -1
- package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js.map +1 -1
- package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js +202 -106
- package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
- package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js +8 -0
- package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
- package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js +563 -0
- package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js.map +1 -0
- package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js +210 -0
- package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js.map +1 -0
- package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js +4 -2
- package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
- package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js +7 -21
- package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
- package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js +507 -244
- package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js +74 -46
- package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
- package/lib/commonjs/components/Modals/styledModalComponents.js +9 -2
- package/lib/commonjs/components/Modals/styledModalComponents.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/ChatRoomItem.js +21 -7
- package/lib/commonjs/components/RoomComponents/ChatRoomItem.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/styled/LastMessageFile.js +22 -3
- package/lib/commonjs/components/RoomComponents/styled/LastMessageFile.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/styled/LastMessagePhoto.js +17 -3
- package/lib/commonjs/components/RoomComponents/styled/LastMessagePhoto.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/styled/LastMessageVideo.js +17 -3
- package/lib/commonjs/components/RoomComponents/styled/LastMessageVideo.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/VideoCallSession.js +6 -3
- package/lib/commonjs/components/VideoCalls/VideoCallSession.js.map +1 -1
- package/lib/commonjs/components/styled/AudioMessage.js +2 -1
- package/lib/commonjs/components/styled/AudioMessage.js.map +1 -1
- package/lib/commonjs/components/styled/MessageImage.js +37 -9
- package/lib/commonjs/components/styled/MessageImage.js.map +1 -1
- package/lib/commonjs/components/styled/SendInput.js +80 -11
- package/lib/commonjs/components/styled/SendInput.js.map +1 -1
- package/lib/commonjs/components/styled/StyledComponents.js +9 -3
- package/lib/commonjs/components/styled/StyledComponents.js.map +1 -1
- package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js +11 -4
- package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
- package/lib/commonjs/components/styled/UnsupportedType.js +14 -4
- package/lib/commonjs/components/styled/UnsupportedType.js.map +1 -1
- package/lib/commonjs/components/styled/VideoMessage.js +119 -61
- package/lib/commonjs/components/styled/VideoMessage.js.map +1 -1
- package/lib/commonjs/context/xmppProvider.js +184 -59
- package/lib/commonjs/context/xmppProvider.js.map +1 -1
- package/lib/commonjs/helpers/createMessageFromXml.js +19 -1
- package/lib/commonjs/helpers/createMessageFromXml.js.map +1 -1
- package/lib/commonjs/helpers/ensureScopedChatCache.js +2 -2
- package/lib/commonjs/helpers/ensureScopedChatCache.js.map +1 -1
- package/lib/commonjs/helpers/getChatBackground.js +23 -0
- package/lib/commonjs/helpers/getChatBackground.js.map +1 -0
- package/lib/commonjs/helpers/getDisplayFileName.js +79 -0
- package/lib/commonjs/helpers/getDisplayFileName.js.map +1 -0
- package/lib/commonjs/helpers/getServerReadTimestamp.js +188 -0
- package/lib/commonjs/helpers/getServerReadTimestamp.js.map +1 -0
- package/lib/commonjs/helpers/historyPreloadScheduler.js +65 -2
- package/lib/commonjs/helpers/historyPreloadScheduler.js.map +1 -1
- package/lib/commonjs/helpers/initXmppRooms.js +14 -8
- package/lib/commonjs/helpers/initXmppRooms.js.map +1 -1
- package/lib/commonjs/helpers/insertMessageWithDelimiter.js +51 -9
- package/lib/commonjs/helpers/insertMessageWithDelimiter.js.map +1 -1
- package/lib/commonjs/helpers/isOwnMessage.js +75 -0
- package/lib/commonjs/helpers/isOwnMessage.js.map +1 -0
- package/lib/commonjs/helpers/keyboardLayout.js +12 -2
- package/lib/commonjs/helpers/keyboardLayout.js.map +1 -1
- package/lib/commonjs/helpers/mediaLibraryRuntime.js +31 -0
- package/lib/commonjs/helpers/mediaLibraryRuntime.js.map +1 -0
- package/lib/commonjs/helpers/mimeToExtension.js +6 -14
- package/lib/commonjs/helpers/mimeToExtension.js.map +1 -1
- package/lib/commonjs/helpers/msgSortableMs.js +37 -0
- package/lib/commonjs/helpers/msgSortableMs.js.map +1 -0
- package/lib/commonjs/helpers/persistCrypto.js +122 -0
- package/lib/commonjs/helpers/persistCrypto.js.map +1 -0
- package/lib/commonjs/helpers/pickImageAsset.js +68 -0
- package/lib/commonjs/helpers/pickImageAsset.js.map +1 -0
- package/lib/commonjs/helpers/pushPayload.js +71 -0
- package/lib/commonjs/helpers/pushPayload.js.map +1 -0
- package/lib/commonjs/helpers/resolveInitBeforeLoadUser.js +130 -17
- package/lib/commonjs/helpers/resolveInitBeforeLoadUser.js.map +1 -1
- package/lib/commonjs/helpers/secureFileUrl.js +101 -0
- package/lib/commonjs/helpers/secureFileUrl.js.map +1 -0
- package/lib/commonjs/helpers/secureKeyValue.js +83 -0
- package/lib/commonjs/helpers/secureKeyValue.js.map +1 -0
- package/lib/commonjs/helpers/secureStoreRuntime.js +59 -0
- package/lib/commonjs/helpers/secureStoreRuntime.js.map +1 -0
- package/lib/commonjs/helpers/secureUserStorage.js +75 -0
- package/lib/commonjs/helpers/secureUserStorage.js.map +1 -0
- package/lib/commonjs/helpers/shallowEqual.js +36 -0
- package/lib/commonjs/helpers/shallowEqual.js.map +1 -0
- package/lib/commonjs/helpers/sheetGestures.js +32 -0
- package/lib/commonjs/helpers/sheetGestures.js.map +1 -0
- package/lib/commonjs/hooks/useChatRoomFocus.js +45 -12
- package/lib/commonjs/hooks/useChatRoomFocus.js.map +1 -1
- package/lib/commonjs/hooks/useChatWrapperInit.js +30 -10
- package/lib/commonjs/hooks/useChatWrapperInit.js.map +1 -1
- package/lib/commonjs/hooks/useComposing.js +27 -0
- package/lib/commonjs/hooks/useComposing.js.map +1 -1
- package/lib/commonjs/hooks/useFileToken.js +10 -0
- package/lib/commonjs/hooks/useFileToken.js.map +1 -0
- package/lib/commonjs/hooks/useLogout.js +23 -7
- package/lib/commonjs/hooks/useLogout.js.map +1 -1
- package/lib/commonjs/hooks/usePendingNotification.js +8 -11
- package/lib/commonjs/hooks/usePendingNotification.js.map +1 -1
- package/lib/commonjs/hooks/useSendMessage.js +50 -14
- package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
- package/lib/commonjs/hooks/useUnreadMessagesCounter.js +6 -1
- package/lib/commonjs/hooks/useUnreadMessagesCounter.js.map +1 -1
- package/lib/commonjs/i18n/strings.js +145 -37
- package/lib/commonjs/i18n/strings.js.map +1 -1
- package/lib/commonjs/main.js +44 -0
- package/lib/commonjs/main.js.map +1 -1
- package/lib/commonjs/networking/api-requests/auth.api.js +134 -60
- package/lib/commonjs/networking/api-requests/auth.api.js.map +1 -1
- package/lib/commonjs/networking/api-requests/roomMembers.api.js +1 -1
- package/lib/commonjs/networking/api-requests/roomMembers.api.js.map +1 -1
- package/lib/commonjs/networking/api-requests/rooms.api.js +9 -9
- package/lib/commonjs/networking/api-requests/rooms.api.js.map +1 -1
- package/lib/commonjs/networking/api-requests/user.api.js +68 -9
- package/lib/commonjs/networking/api-requests/user.api.js.map +1 -1
- package/lib/commonjs/networking/apiClient.js +62 -112
- package/lib/commonjs/networking/apiClient.js.map +1 -1
- package/lib/commonjs/networking/authRefresh.js +332 -0
- package/lib/commonjs/networking/authRefresh.js.map +1 -0
- package/lib/commonjs/networking/stanzaHandlers.js +41 -28
- package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
- package/lib/commonjs/networking/xmpp/flushLastViewedToPrivateStore.js +46 -8
- package/lib/commonjs/networking/xmpp/flushLastViewedToPrivateStore.js.map +1 -1
- package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js +8 -1
- package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/subscribeToRoomMessages.xmpp.js +5 -1
- package/lib/commonjs/networking/xmpp/subscribeToRoomMessages.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmppClient.js +124 -8
- package/lib/commonjs/networking/xmppClient.js.map +1 -1
- package/lib/commonjs/roomStore/chatSettingsSlice.js +26 -7
- package/lib/commonjs/roomStore/chatSettingsSlice.js.map +1 -1
- package/lib/commonjs/roomStore/index.js +35 -2
- package/lib/commonjs/roomStore/index.js.map +1 -1
- package/lib/commonjs/roomStore/persistence.js +226 -23
- package/lib/commonjs/roomStore/persistence.js.map +1 -1
- package/lib/commonjs/roomStore/roomsSlice.js +151 -38
- package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
- package/lib/commonjs/services/pushSubscriptionService.js +15 -13
- package/lib/commonjs/services/pushSubscriptionService.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/assets/icons.js +6 -1
- package/lib/module/assets/icons.js.map +1 -1
- package/lib/module/components/AuthForms/Login.js +4 -4
- package/lib/module/components/AuthForms/Login.js.map +1 -1
- package/lib/module/components/Header/HeaderRoomList.js +29 -8
- package/lib/module/components/Header/HeaderRoomList.js.map +1 -1
- package/lib/module/components/MainComponents/ChatHeader.js +9 -3
- package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/module/components/MainComponents/ChatRoom.js +152 -16
- package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/module/components/MainComponents/ChatWrapper.js +35 -14
- package/lib/module/components/MainComponents/ChatWrapper.js.map +1 -1
- package/lib/module/components/MainComponents/LoginWrapper.js +2 -1
- package/lib/module/components/MainComponents/LoginWrapper.js.map +1 -1
- package/lib/module/components/MainComponents/MediaMessage.js +30 -10
- package/lib/module/components/MainComponents/MediaMessage.js.map +1 -1
- package/lib/module/components/MainComponents/MessageContainer.js +5 -1
- package/lib/module/components/MainComponents/MessageContainer.js.map +1 -1
- package/lib/module/components/MainComponents/MessageList.js +13 -5
- package/lib/module/components/MainComponents/MessageList.js.map +1 -1
- package/lib/module/components/MainComponents/ProfileImagePlaceholder.js +14 -13
- package/lib/module/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
- package/lib/module/components/MainComponents/RoomList.js +207 -35
- package/lib/module/components/MainComponents/RoomList.js.map +1 -1
- package/lib/module/components/Menu/HeaderRoomListMenu.js +319 -101
- package/lib/module/components/Menu/HeaderRoomListMenu.js.map +1 -1
- package/lib/module/components/Modals/AttachSheet/AttachSheet.js +313 -113
- package/lib/module/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +549 -207
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js +223 -0
- package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js.map +1 -0
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +70 -28
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
- package/lib/module/components/Modals/FilePreviewModal/PdfView.js +2 -1
- package/lib/module/components/Modals/FilePreviewModal/PdfView.js.map +1 -1
- package/lib/module/components/Modals/Modal/Modal.js +9 -1
- package/lib/module/components/Modals/Modal/Modal.js.map +1 -1
- package/lib/module/components/Modals/NewChatModal/ModalContent.js +2 -1
- package/lib/module/components/Modals/NewChatModal/ModalContent.js.map +1 -1
- package/lib/module/components/Modals/NewChatModal/NewChatModal.js +205 -108
- package/lib/module/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
- package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js +8 -0
- package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
- package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js +555 -0
- package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js.map +1 -0
- package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js +205 -0
- package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js.map +1 -0
- package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js +4 -2
- package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
- package/lib/module/components/Modals/UserProfileModal/EditUserModal.js +9 -23
- package/lib/module/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
- package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js +509 -248
- package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
- package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js +76 -48
- package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
- package/lib/module/components/Modals/styledModalComponents.js +9 -2
- package/lib/module/components/Modals/styledModalComponents.js.map +1 -1
- package/lib/module/components/RoomComponents/ChatRoomItem.js +21 -7
- package/lib/module/components/RoomComponents/ChatRoomItem.js.map +1 -1
- package/lib/module/components/RoomComponents/styled/LastMessageFile.js +22 -3
- package/lib/module/components/RoomComponents/styled/LastMessageFile.js.map +1 -1
- package/lib/module/components/RoomComponents/styled/LastMessagePhoto.js +17 -3
- package/lib/module/components/RoomComponents/styled/LastMessagePhoto.js.map +1 -1
- package/lib/module/components/RoomComponents/styled/LastMessageVideo.js +17 -3
- package/lib/module/components/RoomComponents/styled/LastMessageVideo.js.map +1 -1
- package/lib/module/components/VideoCalls/VideoCallSession.js +6 -3
- package/lib/module/components/VideoCalls/VideoCallSession.js.map +1 -1
- package/lib/module/components/styled/AudioMessage.js +2 -1
- package/lib/module/components/styled/AudioMessage.js.map +1 -1
- package/lib/module/components/styled/MessageImage.js +37 -9
- package/lib/module/components/styled/MessageImage.js.map +1 -1
- package/lib/module/components/styled/SendInput.js +81 -12
- package/lib/module/components/styled/SendInput.js.map +1 -1
- package/lib/module/components/styled/StyledComponents.js +9 -3
- package/lib/module/components/styled/StyledComponents.js.map +1 -1
- package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js +11 -4
- package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
- package/lib/module/components/styled/UnsupportedType.js +14 -4
- package/lib/module/components/styled/UnsupportedType.js.map +1 -1
- package/lib/module/components/styled/VideoMessage.js +120 -62
- package/lib/module/components/styled/VideoMessage.js.map +1 -1
- package/lib/module/context/xmppProvider.js +184 -60
- package/lib/module/context/xmppProvider.js.map +1 -1
- package/lib/module/helpers/createMessageFromXml.js +19 -1
- package/lib/module/helpers/createMessageFromXml.js.map +1 -1
- package/lib/module/helpers/ensureScopedChatCache.js +2 -2
- package/lib/module/helpers/ensureScopedChatCache.js.map +1 -1
- package/lib/module/helpers/getChatBackground.js +18 -0
- package/lib/module/helpers/getChatBackground.js.map +1 -0
- package/lib/module/helpers/getDisplayFileName.js +73 -0
- package/lib/module/helpers/getDisplayFileName.js.map +1 -0
- package/lib/module/helpers/getServerReadTimestamp.js +181 -0
- package/lib/module/helpers/getServerReadTimestamp.js.map +1 -0
- package/lib/module/helpers/historyPreloadScheduler.js +66 -3
- package/lib/module/helpers/historyPreloadScheduler.js.map +1 -1
- package/lib/module/helpers/initXmppRooms.js +14 -8
- package/lib/module/helpers/initXmppRooms.js.map +1 -1
- package/lib/module/helpers/insertMessageWithDelimiter.js +52 -9
- package/lib/module/helpers/insertMessageWithDelimiter.js.map +1 -1
- package/lib/module/helpers/isOwnMessage.js +70 -0
- package/lib/module/helpers/isOwnMessage.js.map +1 -0
- package/lib/module/helpers/keyboardLayout.js +12 -2
- package/lib/module/helpers/keyboardLayout.js.map +1 -1
- package/lib/module/helpers/mediaLibraryRuntime.js +25 -0
- package/lib/module/helpers/mediaLibraryRuntime.js.map +1 -0
- package/lib/module/helpers/mimeToExtension.js +6 -13
- package/lib/module/helpers/mimeToExtension.js.map +1 -1
- package/lib/module/helpers/msgSortableMs.js +32 -0
- package/lib/module/helpers/msgSortableMs.js.map +1 -0
- package/lib/module/helpers/persistCrypto.js +115 -0
- package/lib/module/helpers/persistCrypto.js.map +1 -0
- package/lib/module/helpers/pickImageAsset.js +63 -0
- package/lib/module/helpers/pickImageAsset.js.map +1 -0
- package/lib/module/helpers/pushPayload.js +63 -0
- package/lib/module/helpers/pushPayload.js.map +1 -0
- package/lib/module/helpers/resolveInitBeforeLoadUser.js +130 -16
- package/lib/module/helpers/resolveInitBeforeLoadUser.js.map +1 -1
- package/lib/module/helpers/secureFileUrl.js +91 -0
- package/lib/module/helpers/secureFileUrl.js.map +1 -0
- package/lib/module/helpers/secureKeyValue.js +75 -0
- package/lib/module/helpers/secureKeyValue.js.map +1 -0
- package/lib/module/helpers/secureStoreRuntime.js +52 -0
- package/lib/module/helpers/secureStoreRuntime.js.map +1 -0
- package/lib/module/helpers/secureUserStorage.js +72 -0
- package/lib/module/helpers/secureUserStorage.js.map +1 -0
- package/lib/module/helpers/shallowEqual.js +31 -0
- package/lib/module/helpers/shallowEqual.js.map +1 -0
- package/lib/module/helpers/sheetGestures.js +26 -0
- package/lib/module/helpers/sheetGestures.js.map +1 -0
- package/lib/module/hooks/useChatRoomFocus.js +46 -13
- package/lib/module/hooks/useChatRoomFocus.js.map +1 -1
- package/lib/module/hooks/useChatWrapperInit.js +30 -10
- package/lib/module/hooks/useChatWrapperInit.js.map +1 -1
- package/lib/module/hooks/useComposing.js +28 -1
- package/lib/module/hooks/useComposing.js.map +1 -1
- package/lib/module/hooks/useFileToken.js +5 -0
- package/lib/module/hooks/useFileToken.js.map +1 -0
- package/lib/module/hooks/useLogout.js +23 -7
- package/lib/module/hooks/useLogout.js.map +1 -1
- package/lib/module/hooks/usePendingNotification.js +8 -11
- package/lib/module/hooks/usePendingNotification.js.map +1 -1
- package/lib/module/hooks/useSendMessage.js +52 -16
- package/lib/module/hooks/useSendMessage.js.map +1 -1
- package/lib/module/hooks/useUnreadMessagesCounter.js +6 -1
- package/lib/module/hooks/useUnreadMessagesCounter.js.map +1 -1
- package/lib/module/i18n/strings.js +145 -37
- package/lib/module/i18n/strings.js.map +1 -1
- package/lib/module/main.js +14 -2
- package/lib/module/main.js.map +1 -1
- package/lib/module/networking/api-requests/auth.api.js +131 -59
- package/lib/module/networking/api-requests/auth.api.js.map +1 -1
- package/lib/module/networking/api-requests/roomMembers.api.js +1 -1
- package/lib/module/networking/api-requests/roomMembers.api.js.map +1 -1
- package/lib/module/networking/api-requests/rooms.api.js +9 -9
- package/lib/module/networking/api-requests/rooms.api.js.map +1 -1
- package/lib/module/networking/api-requests/user.api.js +64 -7
- package/lib/module/networking/api-requests/user.api.js.map +1 -1
- package/lib/module/networking/apiClient.js +61 -113
- package/lib/module/networking/apiClient.js.map +1 -1
- package/lib/module/networking/authRefresh.js +321 -0
- package/lib/module/networking/authRefresh.js.map +1 -0
- package/lib/module/networking/stanzaHandlers.js +41 -28
- package/lib/module/networking/stanzaHandlers.js.map +1 -1
- package/lib/module/networking/xmpp/flushLastViewedToPrivateStore.js +46 -8
- package/lib/module/networking/xmpp/flushLastViewedToPrivateStore.js.map +1 -1
- package/lib/module/networking/xmpp/presenceInRoom.xmpp.js +8 -1
- package/lib/module/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/subscribeToRoomMessages.xmpp.js +5 -1
- package/lib/module/networking/xmpp/subscribeToRoomMessages.xmpp.js.map +1 -1
- package/lib/module/networking/xmppClient.js +124 -8
- package/lib/module/networking/xmppClient.js.map +1 -1
- package/lib/module/roomStore/chatSettingsSlice.js +26 -7
- package/lib/module/roomStore/chatSettingsSlice.js.map +1 -1
- package/lib/module/roomStore/index.js +37 -4
- package/lib/module/roomStore/index.js.map +1 -1
- package/lib/module/roomStore/persistence.js +223 -22
- package/lib/module/roomStore/persistence.js.map +1 -1
- package/lib/module/roomStore/roomsSlice.js +139 -34
- package/lib/module/roomStore/roomsSlice.js.map +1 -1
- package/lib/module/services/pushSubscriptionService.js +15 -13
- package/lib/module/services/pushSubscriptionService.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/assets/icons.d.ts +16 -0
- package/lib/typescript/assets/icons.d.ts.map +1 -1
- package/lib/typescript/components/AuthForms/Login.d.ts.map +1 -1
- package/lib/typescript/components/Header/HeaderRoomList.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ChatHeader.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ChatRoom.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ChatWrapper.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/LoginWrapper.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/MediaMessage.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/MessageContainer.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/MessageList.d.ts +10 -1
- package/lib/typescript/components/MainComponents/MessageList.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ProfileImagePlaceholder.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/RoomList.d.ts +7 -0
- package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
- package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts +3 -0
- package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts.map +1 -1
- package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts +9 -0
- package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts.map +1 -1
- package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts +10 -0
- package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts +9 -0
- package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts.map +1 -0
- package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/FilePreviewModal/PdfView.d.ts.map +1 -1
- package/lib/typescript/components/Modals/Modal/Modal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts +4 -2
- package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts.map +1 -1
- package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts +1 -1
- package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/NewChatModal/UpdNewChatModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts +75 -0
- package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts.map +1 -0
- package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts +25 -0
- package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts.map +1 -0
- package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts +6 -1
- package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserProfileModal/EditUserModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts +16 -0
- package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts +1 -0
- package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/styledModalComponents.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastMessageFile.d.ts +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastMessageFile.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastMessagePhoto.d.ts +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastMessagePhoto.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastMessageVideo.d.ts +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastMessageVideo.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/VideoCallSession.d.ts.map +1 -1
- package/lib/typescript/components/styled/AudioMessage.d.ts.map +1 -1
- package/lib/typescript/components/styled/MessageImage.d.ts +14 -0
- package/lib/typescript/components/styled/MessageImage.d.ts.map +1 -1
- package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
- package/lib/typescript/components/styled/StyledComponents.d.ts.map +1 -1
- package/lib/typescript/components/styled/StyledInputComponents/StyledInputComponents.d.ts.map +1 -1
- package/lib/typescript/components/styled/UnsupportedType.d.ts.map +1 -1
- package/lib/typescript/components/styled/VideoMessage.d.ts +8 -0
- package/lib/typescript/components/styled/VideoMessage.d.ts.map +1 -1
- package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
- package/lib/typescript/helpers/createMessageFromXml.d.ts.map +1 -1
- package/lib/typescript/helpers/getChatBackground.d.ts +15 -0
- package/lib/typescript/helpers/getChatBackground.d.ts.map +1 -0
- package/lib/typescript/helpers/getDisplayFileName.d.ts +49 -0
- package/lib/typescript/helpers/getDisplayFileName.d.ts.map +1 -0
- package/lib/typescript/helpers/getServerReadTimestamp.d.ts +108 -0
- package/lib/typescript/helpers/getServerReadTimestamp.d.ts.map +1 -0
- package/lib/typescript/helpers/historyPreloadScheduler.d.ts.map +1 -1
- package/lib/typescript/helpers/initXmppRooms.d.ts.map +1 -1
- package/lib/typescript/helpers/insertMessageWithDelimiter.d.ts +1 -1
- package/lib/typescript/helpers/insertMessageWithDelimiter.d.ts.map +1 -1
- package/lib/typescript/helpers/isOwnMessage.d.ts +36 -0
- package/lib/typescript/helpers/isOwnMessage.d.ts.map +1 -0
- package/lib/typescript/helpers/keyboardLayout.d.ts +5 -1
- package/lib/typescript/helpers/keyboardLayout.d.ts.map +1 -1
- package/lib/typescript/helpers/mediaLibraryRuntime.d.ts +3 -0
- package/lib/typescript/helpers/mediaLibraryRuntime.d.ts.map +1 -0
- package/lib/typescript/helpers/mimeToExtension.d.ts +0 -15
- package/lib/typescript/helpers/mimeToExtension.d.ts.map +1 -1
- package/lib/typescript/helpers/msgSortableMs.d.ts +2 -0
- package/lib/typescript/helpers/msgSortableMs.d.ts.map +1 -0
- package/lib/typescript/helpers/persistCrypto.d.ts +13 -0
- package/lib/typescript/helpers/persistCrypto.d.ts.map +1 -0
- package/lib/typescript/helpers/pickImageAsset.d.ts +27 -0
- package/lib/typescript/helpers/pickImageAsset.d.ts.map +1 -0
- package/lib/typescript/helpers/pushPayload.d.ts +7 -0
- package/lib/typescript/helpers/pushPayload.d.ts.map +1 -0
- package/lib/typescript/helpers/resolveInitBeforeLoadUser.d.ts.map +1 -1
- package/lib/typescript/helpers/secureFileUrl.d.ts +7 -0
- package/lib/typescript/helpers/secureFileUrl.d.ts.map +1 -0
- package/lib/typescript/helpers/secureKeyValue.d.ts +13 -0
- package/lib/typescript/helpers/secureKeyValue.d.ts.map +1 -0
- package/lib/typescript/helpers/secureStoreRuntime.d.ts +29 -0
- package/lib/typescript/helpers/secureStoreRuntime.d.ts.map +1 -0
- package/lib/typescript/helpers/secureUserStorage.d.ts +23 -0
- package/lib/typescript/helpers/secureUserStorage.d.ts.map +1 -0
- package/lib/typescript/helpers/shallowEqual.d.ts +11 -0
- package/lib/typescript/helpers/shallowEqual.d.ts.map +1 -0
- package/lib/typescript/helpers/sheetGestures.d.ts +20 -0
- package/lib/typescript/helpers/sheetGestures.d.ts.map +1 -0
- package/lib/typescript/hooks/useChatRoomFocus.d.ts +4 -1
- package/lib/typescript/hooks/useChatRoomFocus.d.ts.map +1 -1
- package/lib/typescript/hooks/useChatWrapperInit.d.ts.map +1 -1
- package/lib/typescript/hooks/useComposing.d.ts.map +1 -1
- package/lib/typescript/hooks/useFileToken.d.ts +2 -0
- package/lib/typescript/hooks/useFileToken.d.ts.map +1 -0
- package/lib/typescript/hooks/useLogout.d.ts.map +1 -1
- package/lib/typescript/hooks/usePendingNotification.d.ts.map +1 -1
- package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
- package/lib/typescript/hooks/useUnreadMessagesCounter.d.ts +1 -0
- package/lib/typescript/hooks/useUnreadMessagesCounter.d.ts.map +1 -1
- package/lib/typescript/i18n/strings.d.ts.map +1 -1
- package/lib/typescript/main.d.ts +9 -2
- package/lib/typescript/main.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/auth.api.d.ts +3 -1
- package/lib/typescript/networking/api-requests/auth.api.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/user.api.d.ts +27 -0
- package/lib/typescript/networking/api-requests/user.api.d.ts.map +1 -1
- package/lib/typescript/networking/apiClient.d.ts +12 -6
- package/lib/typescript/networking/apiClient.d.ts.map +1 -1
- package/lib/typescript/networking/authRefresh.d.ts +95 -0
- package/lib/typescript/networking/authRefresh.d.ts.map +1 -0
- package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/flushLastViewedToPrivateStore.d.ts +10 -2
- package/lib/typescript/networking/xmpp/flushLastViewedToPrivateStore.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/presenceInRoom.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/subscribeToRoomMessages.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmppClient.d.ts +14 -0
- package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
- package/lib/typescript/roomStore/chatSettingsSlice.d.ts +16 -0
- package/lib/typescript/roomStore/chatSettingsSlice.d.ts.map +1 -1
- package/lib/typescript/roomStore/index.d.ts.map +1 -1
- package/lib/typescript/roomStore/persistence.d.ts +18 -1
- package/lib/typescript/roomStore/persistence.d.ts.map +1 -1
- package/lib/typescript/roomStore/roomsSlice.d.ts +43 -3
- package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
- package/lib/typescript/services/pushSubscriptionService.d.ts +1 -1
- package/lib/typescript/services/pushSubscriptionService.d.ts.map +1 -1
- package/lib/typescript/types/types.d.ts +50 -5
- package/lib/typescript/types/types.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +41 -28
- package/src/assets/icons.tsx +48 -9
- package/src/components/AuthForms/Login.tsx +3 -3
- package/src/components/Header/HeaderRoomList.tsx +29 -7
- package/src/components/MainComponents/ChatHeader.tsx +9 -3
- package/src/components/MainComponents/ChatRoom.tsx +161 -15
- package/src/components/MainComponents/ChatWrapper.tsx +36 -20
- package/src/components/MainComponents/LoginWrapper.tsx +1 -0
- package/src/components/MainComponents/MediaMessage.tsx +26 -8
- package/src/components/MainComponents/MessageContainer.tsx +5 -1
- package/src/components/MainComponents/MessageList.tsx +23 -4
- package/src/components/MainComponents/ProfileImagePlaceholder.tsx +21 -14
- package/src/components/MainComponents/RoomList.tsx +236 -39
- package/src/components/Menu/HeaderRoomListMenu.tsx +328 -75
- package/src/components/Modals/AttachSheet/AttachSheet.tsx +333 -97
- package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +600 -282
- package/src/components/Modals/ChatProfileModal/ReportChatModal.tsx +244 -0
- package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +79 -38
- package/src/components/Modals/FilePreviewModal/PdfView.tsx +2 -1
- package/src/components/Modals/Modal/Modal.tsx +7 -0
- package/src/components/Modals/NewChatModal/ModalContent.tsx +6 -3
- package/src/components/Modals/NewChatModal/NewChatModal.tsx +219 -119
- package/src/components/Modals/NewChatModal/UpdNewChatModal.tsx +12 -1
- package/src/components/Modals/ProfileHeader/ProfileHeader.tsx +624 -0
- package/src/components/Modals/ProfileHeader/ProfileMenu.tsx +217 -0
- package/src/components/Modals/SelectUsersModal/SelectUsersModal.tsx +14 -4
- package/src/components/Modals/UserProfileModal/EditUserModal.tsx +9 -25
- package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +617 -307
- package/src/components/Modals/UserSettingsModal/UserSettingsModal.tsx +75 -58
- package/src/components/Modals/styledModalComponents.tsx +9 -2
- package/src/components/RoomComponents/ChatRoomItem.tsx +18 -3
- package/src/components/RoomComponents/styled/LastMessageFile.tsx +28 -4
- package/src/components/RoomComponents/styled/LastMessagePhoto.tsx +18 -3
- package/src/components/RoomComponents/styled/LastMessageVideo.tsx +18 -3
- package/src/components/VideoCalls/VideoCallSession.tsx +8 -3
- package/src/components/styled/AudioMessage.tsx +2 -1
- package/src/components/styled/MessageImage.tsx +53 -7
- package/src/components/styled/SendInput.tsx +83 -12
- package/src/components/styled/StyledComponents.ts +9 -3
- package/src/components/styled/StyledInputComponents/StyledInputComponents.tsx +11 -4
- package/src/components/styled/UnsupportedType.tsx +14 -4
- package/src/components/styled/VideoMessage.tsx +131 -54
- package/src/context/xmppProvider.tsx +216 -57
- package/src/helpers/createMessageFromXml.ts +20 -1
- package/src/helpers/ensureScopedChatCache.ts +2 -2
- package/src/helpers/getChatBackground.ts +18 -0
- package/src/helpers/getDisplayFileName.ts +87 -0
- package/src/helpers/getServerReadTimestamp.ts +197 -0
- package/src/helpers/historyPreloadScheduler.ts +80 -3
- package/src/helpers/initXmppRooms.tsx +14 -10
- package/src/helpers/insertMessageWithDelimiter.ts +55 -19
- package/src/helpers/isOwnMessage.ts +90 -0
- package/src/helpers/keyboardLayout.ts +23 -2
- package/src/helpers/mediaLibraryRuntime.ts +25 -0
- package/src/helpers/mimeToExtension.ts +6 -22
- package/src/helpers/msgSortableMs.ts +25 -0
- package/src/helpers/persistCrypto.ts +127 -0
- package/src/helpers/pickImageAsset.ts +68 -0
- package/src/helpers/pushPayload.ts +62 -0
- package/src/helpers/resolveInitBeforeLoadUser.ts +125 -18
- package/src/helpers/secureFileUrl.ts +103 -0
- package/src/helpers/secureKeyValue.ts +80 -0
- package/src/helpers/secureStoreRuntime.ts +62 -0
- package/src/helpers/secureUserStorage.ts +80 -0
- package/src/helpers/shallowEqual.ts +33 -0
- package/src/helpers/sheetGestures.ts +25 -0
- package/src/hooks/useChatRoomFocus.ts +49 -9
- package/src/hooks/useChatWrapperInit.ts +30 -10
- package/src/hooks/useComposing.tsx +37 -1
- package/src/hooks/useFileToken.ts +7 -0
- package/src/hooks/useLogout.tsx +29 -9
- package/src/hooks/usePendingNotification.ts +5 -11
- package/src/hooks/useSendMessage.tsx +60 -15
- package/src/hooks/useUnreadMessagesCounter.ts +11 -0
- package/src/i18n/strings.ts +145 -37
- package/src/main.ts +26 -2
- package/src/networking/api-requests/auth.api.ts +156 -48
- package/src/networking/api-requests/roomMembers.api.ts +1 -1
- package/src/networking/api-requests/rooms.api.ts +9 -9
- package/src/networking/api-requests/user.api.ts +79 -7
- package/src/networking/apiClient.ts +68 -123
- package/src/networking/authRefresh.ts +451 -0
- package/src/networking/stanzaHandlers.ts +44 -28
- package/src/networking/xmpp/flushLastViewedToPrivateStore.ts +71 -10
- package/src/networking/xmpp/presenceInRoom.xmpp.ts +6 -1
- package/src/networking/xmpp/subscribeToRoomMessages.xmpp.ts +12 -1
- package/src/networking/xmppClient.ts +141 -9
- package/src/roomStore/chatSettingsSlice.ts +34 -10
- package/src/roomStore/index.ts +40 -4
- package/src/roomStore/persistence.ts +234 -24
- package/src/roomStore/roomsSlice.ts +161 -29
- package/src/services/pushSubscriptionService.ts +18 -13
- package/src/types/types.ts +72 -5
- package/src/version.ts +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/** @format */
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Shared thresholds for the drag-to-dismiss gesture on bottom sheets (the
|
|
7
|
+
* attach sheet, the profile headers, the room-list menu). Kept in one
|
|
8
|
+
* place so a pull feels identical wherever the user does it — and so the
|
|
9
|
+
* numbers are unit-testable without a touch event.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** Drag past this many points and letting go dismisses the sheet. */
|
|
13
|
+
export const DISMISS_DISTANCE = 90;
|
|
14
|
+
/** …or flick faster than this, however short the drag. */
|
|
15
|
+
export const DISMISS_VELOCITY = 0.8;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Claim a drag only once it is clearly a downward pull, so a tap on a row
|
|
19
|
+
* still registers and a horizontal swipe stays with whatever scrolls
|
|
20
|
+
* sideways inside the sheet.
|
|
21
|
+
*/
|
|
22
|
+
export const shouldClaimVerticalDrag = (dy, dx) => dy > 6 && Math.abs(dy) > Math.abs(dx) * 1.5;
|
|
23
|
+
|
|
24
|
+
/** Far enough / fast enough to let go of the sheet. */
|
|
25
|
+
export const shouldDismissOnDrag = (dy, vy) => dy > DISMISS_DISTANCE || vy > DISMISS_VELOCITY;
|
|
26
|
+
//# sourceMappingURL=sheetGestures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DISMISS_DISTANCE","DISMISS_VELOCITY","shouldClaimVerticalDrag","dy","dx","Math","abs","shouldDismissOnDrag","vy"],"sourceRoot":"../../../src","sources":["helpers/sheetGestures.ts"],"mappings":";;AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,OAAO,MAAMA,gBAAgB,GAAG,EAAE;AAClC;AACA,OAAO,MAAMC,gBAAgB,GAAG,GAAG;;AAEnC;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAGA,CAACC,EAAU,EAAEC,EAAU,KAC5DD,EAAE,GAAG,CAAC,IAAIE,IAAI,CAACC,GAAG,CAACH,EAAE,CAAC,GAAGE,IAAI,CAACC,GAAG,CAACF,EAAE,CAAC,GAAG,GAAG;;AAE7C;AACA,OAAO,MAAMG,mBAAmB,GAAGA,CAACJ,EAAU,EAAEK,EAAU,KACxDL,EAAE,GAAGH,gBAAgB,IAAIQ,EAAE,GAAGP,gBAAgB","ignoreList":[]}
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import { useEffect, useRef } from 'react';
|
|
4
4
|
import { useDispatch } from 'react-redux';
|
|
5
|
-
import { clearVisibleRoom, setCurrentRoom, setLastViewedTimestamp, setVisibleRoom } from '../roomStore/roomsSlice';
|
|
5
|
+
import { clearReadBoundary, clearVisibleRoom, setCurrentRoom, setLastViewedTimestamp, setVisibleRoom } from '../roomStore/roomsSlice';
|
|
6
6
|
import { store } from '../roomStore';
|
|
7
|
+
import { getFlushBoundaryTs, getReadMarkerTimestamp } from '../helpers/getServerReadTimestamp';
|
|
7
8
|
/**
|
|
8
9
|
* Public hook for consumers embedding `<ChatRoom>` inside a tab-based
|
|
9
10
|
* navigator. Mirrors the mount/unmount unread-tracking that ChatRoom
|
|
@@ -14,7 +15,10 @@ import { store } from '../roomStore';
|
|
|
14
15
|
* Without this hook, `useUnread()` will always return 0 for the chat
|
|
15
16
|
* room because the SDK assumes "mounted == active". With this hook,
|
|
16
17
|
* focus marks the room visible (clearing the badge) and blur stamps
|
|
17
|
-
* `lastViewedTimestamp
|
|
18
|
+
* `lastViewedTimestamp` to the newest SERVER-acknowledged message so
|
|
19
|
+
* future messages count as unread. Deliberately not `Date.now()`: a
|
|
20
|
+
* device clock running ahead would write a future marker that the
|
|
21
|
+
* forward-only private-store merge could never correct again (bug #38).
|
|
18
22
|
*
|
|
19
23
|
* Usage with React Navigation:
|
|
20
24
|
*
|
|
@@ -39,22 +43,51 @@ export const useChatRoomFocus = ({
|
|
|
39
43
|
roomJID: null,
|
|
40
44
|
isFocused: false
|
|
41
45
|
});
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
|
|
47
|
+
// `clearBoundary`: pass true only when the room the user is leaving is
|
|
48
|
+
// genuinely being released (switching to a different room, or this
|
|
49
|
+
// hook unmounting) - not on a mere same-room blur. `<ChatRoom>`'s
|
|
50
|
+
// MessageList typically stays mounted across a same-room focus loss
|
|
51
|
+
// (the whole point of this hook is that the host keeps `<Chat>`
|
|
52
|
+
// mounted in a hidden tab), so its own scroll-tracking ref is still
|
|
53
|
+
// intact and the redux boundary must stay in sync with it - clearing
|
|
54
|
+
// it here would desync the two.
|
|
55
|
+
const leaveRoom = (jid, clearBoundary) => {
|
|
56
|
+
const state = store.getState();
|
|
57
|
+
const rooms = state.rooms?.rooms;
|
|
58
|
+
const boundaryTs = state.rooms?.readBoundaries?.[jid] ?? null;
|
|
59
|
+
// getReadMarkerTimestamp: honour the boundary (the newest message the
|
|
60
|
+
// user actually reached) when the user left this room scrolled up,
|
|
61
|
+
// otherwise fall back to the newest server-acked message. Only stamp
|
|
62
|
+
// when we actually have something to anchor to - skip rather than
|
|
63
|
+
// fall back to the device clock (bug #38). Ignoring the boundary here
|
|
64
|
+
// would stamp "everything read" regardless of scroll position (bug
|
|
65
|
+
// #42, a regression of #33 reintroduced by #38).
|
|
66
|
+
const timestamp = getReadMarkerTimestamp(rooms?.[jid], state.roomHeapSlice, boundaryTs);
|
|
67
|
+
if (timestamp > 0) {
|
|
68
|
+
dispatch(setLastViewedTimestamp({
|
|
69
|
+
chatJID: jid,
|
|
70
|
+
timestamp
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
48
73
|
dispatch(clearVisibleRoom());
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
74
|
+
state.chatSettingStore?.client?.flushLastViewedToPrivateStoreStanza(rooms, {
|
|
75
|
+
visibleRoomJID: jid,
|
|
76
|
+
// Carry the same boundary to the SERVER marker - without it the
|
|
77
|
+
// flush defaults to "everything" for the visible room. Clamped
|
|
78
|
+
// through the same helper as the local stamp above.
|
|
79
|
+
visibleRoomTs: getFlushBoundaryTs(rooms?.[jid], state.roomHeapSlice, boundaryTs)
|
|
52
80
|
}).catch(() => {});
|
|
81
|
+
if (clearBoundary) {
|
|
82
|
+
dispatch(clearReadBoundary({
|
|
83
|
+
jid
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
53
86
|
};
|
|
54
87
|
useEffect(() => {
|
|
55
88
|
const prev = prevRef.current;
|
|
56
89
|
if (prev.isFocused && prev.roomJID && (prev.roomJID !== roomJID || !isFocused)) {
|
|
57
|
-
leaveRoom(prev.roomJID);
|
|
90
|
+
leaveRoom(prev.roomJID, prev.roomJID !== roomJID);
|
|
58
91
|
}
|
|
59
92
|
if (roomJID && isFocused) {
|
|
60
93
|
dispatch(setCurrentRoom({
|
|
@@ -73,7 +106,7 @@ export const useChatRoomFocus = ({
|
|
|
73
106
|
return () => {
|
|
74
107
|
const prev = prevRef.current;
|
|
75
108
|
if (prev.isFocused && prev.roomJID) {
|
|
76
|
-
leaveRoom(prev.roomJID);
|
|
109
|
+
leaveRoom(prev.roomJID, true);
|
|
77
110
|
}
|
|
78
111
|
};
|
|
79
112
|
}, []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useRef","useDispatch","clearVisibleRoom","setCurrentRoom","setLastViewedTimestamp","setVisibleRoom","store","useChatRoomFocus","roomJID","isFocused","dispatch","prevRef","leaveRoom","jid","
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","useDispatch","clearReadBoundary","clearVisibleRoom","setCurrentRoom","setLastViewedTimestamp","setVisibleRoom","store","getFlushBoundaryTs","getReadMarkerTimestamp","useChatRoomFocus","roomJID","isFocused","dispatch","prevRef","leaveRoom","jid","clearBoundary","state","getState","rooms","boundaryTs","readBoundaries","timestamp","roomHeapSlice","chatJID","chatSettingStore","client","flushLastViewedToPrivateStoreStanza","visibleRoomJID","visibleRoomTs","catch","prev","current"],"sourceRoot":"../../../src","sources":["hooks/useChatRoomFocus.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SAASC,WAAW,QAAQ,aAAa;AACzC,SACEC,iBAAiB,EACjBC,gBAAgB,EAChBC,cAAc,EACdC,sBAAsB,EACtBC,cAAc,QACT,yBAAyB;AAChC,SAASC,KAAK,QAAQ,cAAc;AACpC,SACEC,kBAAkB,EAClBC,sBAAsB,QACjB,mCAAmC;AAgB1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAGA,CAAC;EAC/BC,OAAO;EACPC;AACuB,CAAC,KAAK;EAC7B,MAAMC,QAAQ,GAAGZ,WAAW,CAAC,CAAC;EAC9B,MAAMa,OAAO,GAAGd,MAAM,CAAiD;IACrEW,OAAO,EAAE,IAAI;IACbC,SAAS,EAAE;EACb,CAAC,CAAC;;EAEF;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,MAAMG,SAAS,GAAGA,CAACC,GAAW,EAAEC,aAAsB,KAAK;IACzD,MAAMC,KAAK,GAAGX,KAAK,CAACY,QAAQ,CAAC,CAAC;IAC9B,MAAMC,KAAK,GAAGF,KAAK,CAACE,KAAK,EAAEA,KAAK;IAChC,MAAMC,UAAU,GAAGH,KAAK,CAACE,KAAK,EAAEE,cAAc,GAAGN,GAAG,CAAC,IAAI,IAAI;IAC7D;IACA;IACA;IACA;IACA;IACA;IACA;IACA,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U,CAAC;EAC3D,CAAC,EAAE,CAACD,OAAO,EAAEC,SAAS,EAAEC,QAAQ,CAAC,CAAC;EAElCd,SAAS,CAAC,MAAM;IACd,OAAO,MAAM;MACX,MAAMiC,IAAI,GAAGlB,OAAO,CAACmB,OAAO;MAC5B,IAAID,IAAI,CAACpB,SAAS,IAAIoB,IAAI,CAACrB,OAAO,EAAE;QAClCI,SAAS,CAACiB,IAAI,CAACrB,OAAO,EAAE,IAAI,CAAC;MAC/B;IACF,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;AACR,CAAC;AAED,eAAeD,gBAAgB","ignoreList":[]}
|
|
@@ -8,9 +8,8 @@ import { resolveLegacyTranslatesLangSource } from '../helpers/resolveLangSource'
|
|
|
8
8
|
import { useXmppClient } from '../context/xmppProvider';
|
|
9
9
|
import { chatAutoEnterer } from '../helpers/chatAutoEnterer';
|
|
10
10
|
import { initRoomsPresence } from '../helpers/initRoomsPresence';
|
|
11
|
-
import { updatedChatLastTimestamps } from '../helpers/updatedChatLastTimestamps';
|
|
12
11
|
import { updateMessagesTillLast } from '../helpers/updateMessagesTillLast';
|
|
13
|
-
import {
|
|
12
|
+
import { refreshAuthTokensQuietly } from '../networking/authRefresh';
|
|
14
13
|
import { setLangSource, setConfig } from '../roomStore/chatSettingsSlice';
|
|
15
14
|
import { setIsLoading } from '../roomStore/roomsSlice';
|
|
16
15
|
import { useRoomState } from './useRoomState';
|
|
@@ -18,6 +17,7 @@ import { useChatSettingState } from './useChatSettingState';
|
|
|
18
17
|
import { isChatIdPresentInArray } from '../helpers/isChatIdPresentInArray';
|
|
19
18
|
import useGetNewArchRoom from './useGetNewArchRoom';
|
|
20
19
|
import { getRoomsWithRetry } from '../helpers/getRoomsWithRetry';
|
|
20
|
+
import { shallowEqual } from '../helpers/shallowEqual';
|
|
21
21
|
const useChatWrapperInit = ({
|
|
22
22
|
roomJID,
|
|
23
23
|
wasAutoSelected,
|
|
@@ -53,6 +53,20 @@ const useChatWrapperInit = ({
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
}, [user.xmppPassword]);
|
|
56
|
+
|
|
57
|
+
// Presentational config flags (e.g. `disableHeader`) can change while the
|
|
58
|
+
// chat stays mounted — sync them to redux whenever `config` actually
|
|
59
|
+
// changes, not just at init. Shallow-equal guard: an inline object
|
|
60
|
+
// literal from the host is a fresh reference every render even when
|
|
61
|
+
// nothing in it changed, and dispatching unconditionally would re-render
|
|
62
|
+
// every config consumer on every host render.
|
|
63
|
+
const lastSyncedConfigRef = useRef(undefined);
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if (!shallowEqual(lastSyncedConfigRef.current, config)) {
|
|
66
|
+
lastSyncedConfigRef.current = config;
|
|
67
|
+
dispatch(setConfig(config));
|
|
68
|
+
}
|
|
69
|
+
}, [config, dispatch]);
|
|
56
70
|
const getRoomsWithRertyRequest = async () => {
|
|
57
71
|
setIsRetrying(true);
|
|
58
72
|
const retryRooms = await getRoomsWithRetry(client, config, syncRooms, roomJID);
|
|
@@ -123,11 +137,17 @@ const useChatWrapperInit = ({
|
|
|
123
137
|
}
|
|
124
138
|
}
|
|
125
139
|
try {
|
|
140
|
+
// getChatsPrivateStoreRequestStanza hydrates redux itself
|
|
141
|
+
// (dispatch(applyPrivateStoreMarkers(...)) internally,
|
|
142
|
+
// clamped + forward-only) - do not also apply the raw
|
|
143
|
+
// return value here. That used to double-dispatch via
|
|
144
|
+
// updatedChatLastTimestamps' unconditional
|
|
145
|
+
// setLastViewedTimestamp, which has neither the
|
|
146
|
+
// forward-only guard nor the future-marker clamp, so on
|
|
147
|
+
// every reconnect it could silently re-clobber a value
|
|
148
|
+
// the clamp had just corrected (bug #38).
|
|
126
149
|
const roomTimestampObject = await newClient.getChatsPrivateStoreRequestStanza();
|
|
127
150
|
console.log('Got chats private store', roomTimestampObject?.length || 0);
|
|
128
|
-
if (roomTimestampObject) {
|
|
129
|
-
updatedChatLastTimestamps(roomTimestampObject, dispatch);
|
|
130
|
-
}
|
|
131
151
|
if (!hasSyncedHistoryRef.current) {
|
|
132
152
|
console.log('Updating messages till last');
|
|
133
153
|
await updateMessagesTillLast(rooms, newClient);
|
|
@@ -142,7 +162,7 @@ const useChatWrapperInit = ({
|
|
|
142
162
|
setConnectionLost(false);
|
|
143
163
|
}
|
|
144
164
|
{
|
|
145
|
-
config?.refreshTokens?.enabled &&
|
|
165
|
+
config?.refreshTokens?.enabled && refreshAuthTokensQuietly();
|
|
146
166
|
}
|
|
147
167
|
} catch (error) {
|
|
148
168
|
console.error(' Error during initialization', error);
|
|
@@ -162,11 +182,11 @@ const useChatWrapperInit = ({
|
|
|
162
182
|
setInited(true);
|
|
163
183
|
console.log(' Getting chats private store for existing client');
|
|
164
184
|
try {
|
|
185
|
+
// See the "new client" branch above: getChatsPrivateStoreRequestStanza
|
|
186
|
+
// already hydrates redux (clamped + forward-only); do not
|
|
187
|
+
// also apply the raw return value here.
|
|
165
188
|
const roomTimestampObject = await client.getChatsPrivateStoreRequestStanza();
|
|
166
189
|
console.log('Got chats private store for existing client', roomTimestampObject?.length || 0);
|
|
167
|
-
if (roomTimestampObject) {
|
|
168
|
-
updatedChatLastTimestamps(roomTimestampObject, dispatch);
|
|
169
|
-
}
|
|
170
190
|
if (!hasSyncedHistoryRef.current) {
|
|
171
191
|
console.log('Updating messages till last for existing client');
|
|
172
192
|
await updateMessagesTillLast(rooms, client);
|
|
@@ -181,7 +201,7 @@ const useChatWrapperInit = ({
|
|
|
181
201
|
setConnectionLost(false);
|
|
182
202
|
}
|
|
183
203
|
{
|
|
184
|
-
config?.refreshTokens?.enabled &&
|
|
204
|
+
config?.refreshTokens?.enabled && refreshAuthTokensQuietly();
|
|
185
205
|
}
|
|
186
206
|
}
|
|
187
207
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useRef","useState","useDispatch","useSelector","resolveLegacyTranslatesLangSource","useXmppClient","chatAutoEnterer","initRoomsPresence","
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","useState","useDispatch","useSelector","resolveLegacyTranslatesLangSource","useXmppClient","chatAutoEnterer","initRoomsPresence","updateMessagesTillLast","refreshAuthTokensQuietly","setLangSource","setConfig","setIsLoading","useRoomState","useChatSettingState","isChatIdPresentInArray","useGetNewArchRoom","getRoomsWithRetry","shallowEqual","useChatWrapperInit","roomJID","wasAutoSelected","config","dispatch","inited","setInited","showModal","setShowModal","isConnectionLost","setConnectionLost","isRetrying","setIsRetrying","hasSyncedHistoryRef","client","initializeClient","setClient","syncRooms","rooms","state","roomsList","user","xmppPassword","console","log","close","lastSyncedConfigRef","undefined","current","getRoomsWithRertyRequest","retryRooms","loadRooms","disableLoad","loading","loadingText","retryTimeout","initXmmpClient","legacyLangSource","translates","xmppUsername","error","newClient","defaultWallet","walletAddress","xmppSettings","status","Object","keys","length","newArch","loadedRooms","enableRoomsRetry","enabled","isSelectedRoomPresent","getRoomsStanza","roomTimestampObject","getChatsPrivateStoreRequestStanza","err","warn","refreshTokens","setTimeout","clearTimeout"],"sourceRoot":"../../../src","sources":["hooks/useChatWrapperInit.ts"],"mappings":";;AAAA;;AAEA,SAASA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACnD,SAASC,WAAW,EAAEC,WAAW,QAAQ,aAAa;AAEtD,SAASC,iCAAiC,QAAQ,8BAA8B;AAGhF,SAASC,aAAa,QAAQ,yBAAyB;AACvD,SAASC,eAAe,QAAQ,4BAA4B;AAC5D,SAASC,iBAAiB,QAAQ,8BAA8B;AAChE,SAASC,sBAAsB,QAAQ,mCAAmC;AAC1E,SAASC,wBAAwB,QAAQ,2BAA2B;AACpE,SAASC,aAAa,EAAEC,SAAS,QAAQ,gCAAgC;AACzE,SAASC,YAAY,QAAQ,yBAAyB;AACtD,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,sBAAsB,QAAQ,mCAAmC;AAC1E,OAAOC,iBAAiB,MAAM,qBAAqB;AACn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;cACZlC,OAAO,CAACmC,IAAI,CACV,kDAAkD,EAClDD,GACF,CAAC;cACDzC,SAAS,CAACF,MAAM,CAAC;cACjBJ,iBAAiB,CAAC,KAAK,CAAC;YAC1B;YACA;cACEP,MAAM,EAAEwD,aAAa,EAAEP,OAAO,IAAI9D,wBAAwB,CAAC,CAAC;YAC9D;UACF;QACF;QACAc,QAAQ,CAACX,YAAY,CAAC;UAAEwC,OAAO,EAAE;QAAM,CAAC,CAAC,CAAC;MAC5C,CAAC,CAAC,OAAOO,KAAK,EAAE;QACdjB,OAAO,CAACiB,KAAK,CAAC,cAAc,EAAEA,KAAK,CAAC;QACpChC,YAAY,CAAC,KAAK,CAAC;QACnBE,iBAAiB,CAAC,IAAI,CAAC;QACvBJ,SAAS,CAAC,KAAK,CAAC;QAChBF,QAAQ,CAACX,YAAY,CAAC;UAAEwC,OAAO,EAAE;QAAM,CAAC,CAAC,CAAC;QAC1CE,YAAY,GAAGyB,UAAU,CAACxB,cAAc,EAAE,IAAI,CAAC;MACjD;IACF,CAAC;IAEDA,cAAc,CAAC,CAAC;IAEhB,OAAO,MAAM;MACXyB,YAAY,CAAC1B,YAAY,CAAC;IAC5B,CAAC;EACH,CAAC,EAAE,CAACd,IAAI,CAACC,YAAY,EAAED,IAAI,CAACkB,YAAY,CAAC,CAAC;EAE1C,OAAO;IACLzB,MAAM;IACNT,MAAM;IACNM,UAAU;IACVJ,SAAS;IACTE,gBAAgB;IAChBO,SAAS,EAAEA,SAAgB;IAC3BV,SAAS;IACTE;EACF,CAAC;AACH,CAAC;AAED,eAAeR,kBAAkB","ignoreList":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { useCallback, useEffect } from 'react';
|
|
3
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
4
|
+
import { AppState } from 'react-native';
|
|
4
5
|
import { useXmppClient } from '../context/xmppProvider';
|
|
5
6
|
import { useSelector } from 'react-redux';
|
|
6
7
|
import { useChatSettingState } from './useChatSettingState';
|
|
@@ -14,7 +15,15 @@ const useComposing = config => {
|
|
|
14
15
|
const {
|
|
15
16
|
user
|
|
16
17
|
} = useChatSettingState();
|
|
18
|
+
// RN keeps a focused TextInput focused when the app is backgrounded or
|
|
19
|
+
// the device is locked — nothing fires `onBlur`, so without this the
|
|
20
|
+
// other participant sees "typing…" for as long as the user is away.
|
|
21
|
+
// Tracks whether the input is *currently* focused, independent of the
|
|
22
|
+
// foreground/background transition, so we know whether to resume
|
|
23
|
+
// composing on return.
|
|
24
|
+
const isFocusedRef = useRef(false);
|
|
17
25
|
const sendStartComposing = useCallback(() => {
|
|
26
|
+
isFocusedRef.current = true;
|
|
18
27
|
if (config?.disableTypingIndicator) {
|
|
19
28
|
return;
|
|
20
29
|
}
|
|
@@ -23,6 +32,7 @@ const useComposing = config => {
|
|
|
23
32
|
}
|
|
24
33
|
}, [activeRoomJID, client, config?.disableTypingIndicator, user.firstName, user.lastName]);
|
|
25
34
|
const sendEndComposing = useCallback(() => {
|
|
35
|
+
isFocusedRef.current = false;
|
|
26
36
|
if (config?.disableTypingIndicator) {
|
|
27
37
|
return;
|
|
28
38
|
}
|
|
@@ -36,6 +46,23 @@ const useComposing = config => {
|
|
|
36
46
|
}, 100);
|
|
37
47
|
return () => clearTimeout(timerId);
|
|
38
48
|
}, [sendEndComposing]);
|
|
49
|
+
|
|
50
|
+
// Foreground/background transition only — a pause in typing must NOT
|
|
51
|
+
// clear the indicator (that would flicker for a slowly-composing user),
|
|
52
|
+
// so this deliberately does not hook keystroke/idle timing at all.
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
const handleAppStateChange = nextState => {
|
|
55
|
+
if (nextState !== 'active') {
|
|
56
|
+
if (isFocusedRef.current && !config?.disableTypingIndicator && client) {
|
|
57
|
+
client.sendTypingRequestStanza(activeRoomJID || '', `${user.firstName} ${user.lastName}`, false);
|
|
58
|
+
}
|
|
59
|
+
} else if (isFocusedRef.current && !config?.disableTypingIndicator && client) {
|
|
60
|
+
client.sendTypingRequestStanza(activeRoomJID || '', `${user.firstName} ${user.lastName}`, true);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const subscription = AppState.addEventListener('change', handleAppStateChange);
|
|
64
|
+
return () => subscription.remove();
|
|
65
|
+
}, [activeRoomJID, client, config?.disableTypingIndicator, user.firstName, user.lastName]);
|
|
39
66
|
return {
|
|
40
67
|
sendStartComposing,
|
|
41
68
|
sendEndComposing
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCallback","useEffect","useXmppClient","useSelector","useChatSettingState","useComposing","config","client","activeRoomJID","state","rooms","user","sendStartComposing","disableTypingIndicator","sendTypingRequestStanza","firstName","lastName","sendEndComposing","timerId","setTimeout","clearTimeout"],"sourceRoot":"../../../src","sources":["hooks/useComposing.tsx"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,SAAS,
|
|
1
|
+
{"version":3,"names":["useCallback","useEffect","useRef","AppState","useXmppClient","useSelector","useChatSettingState","useComposing","config","client","activeRoomJID","state","rooms","user","isFocusedRef","sendStartComposing","current","disableTypingIndicator","sendTypingRequestStanza","firstName","lastName","sendEndComposing","timerId","setTimeout","clearTimeout","handleAppStateChange","nextState","subscription","addEventListener","remove"],"sourceRoot":"../../../src","sources":["hooks/useComposing.tsx"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACtD,SAASC,QAAQ,QAAwB,cAAc;AACvD,SAASC,aAAa,QAAQ,yBAAyB;AACvD,SAASC,WAAW,QAAQ,aAAa;AAEzC,SAASC,mBAAmB,QAAQ,uBAAuB;AAG3D,MAAMC,YAAY,GAAIC,MAAgB,IAAK;EACzC,MAAM;IAAEC;EAAO,CAAC,GAAGL,aAAa,CAAC,CAAC;EAClC,MAAM;IAAEM;EAAc,CAAC,GAAGL,WAAW,CAAEM,KAAgB,IAAKA,KAAK,CAACC,KAAK,CAAC;EACxE,MAAM;IAAEC;EAAK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CAAC,MAAM;IACd,MAAMwB,oBAAoB,GAAIC,SAAyB,IAAK;MAC1D,IAAIA,SAAS,KAAK,QAAQ,EAAE;QAC1B,IAAIZ,YAAY,CAACE,OAAO,IAAI,CAACR,MAAM,EAAES,sBAAsB,IAAIR,MAAM,EAAE;UACrEA,MAAM,CAACS,uBAAuB,CAC5BR,aAAa,IAAI,EAAE,EACnB,GAAGG,IAAI,CAACM,SAAS,IAAIN,IAAI,CAACO,QAAQ,EAAE,EACpC,KACF,CAAC;QACH;MACF,CAAC,MAAM,IAAIN,YAAY,CAACE,OAAO,IAAI,CAACR,MAAM,EAAES,sBAAsB,IAAIR,MAAM,EAAE;QAC5EA,MAAM,CAACS,uBAAuB,CAC5BR,aAAa,IAAI,EAAE,EACnB,GAAGG,IAAI,CAACM,SAAS,IAAIN,IAAI,CAACO,QAAQ,EAAE,EACpC,IACF,CAAC;MACH;IACF,CAAC;IAED,MAAMO,YAAY,GAAGxB,QAAQ,CAACyB,gBAAgB,CAAC,QAAQ,EAAEH,oBAAoB,CAAC;IAC9E,OAAO,MAAME,YAAY,CAACE,MAAM,CAAC,CAAC;EACpC,CAAC,EAAE,CAACnB,aAAa,EAAED,MAAM,EAAED,MAAM,EAAES,sBAAsB,EAAEJ,IAAI,CAACM,SAAS,EAAEN,IAAI,CAACO,QAAQ,CAAC,CAAC;EAE1F,OAAO;IAAEL,kBAAkB;IAAEM;EAAiB,CAAC;AACjD,CAAC;AAED,eAAed,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useSelector","useFileToken","state","chatSettingStore","user","fileToken"],"sourceRoot":"../../../src","sources":["hooks/useFileToken.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,aAAa;AAGzC,OAAO,MAAMC,YAAY,GAAGA,CAAA,KAC1BD,WAAW,CACRE,KAAgB,IAAKA,KAAK,CAACC,gBAAgB,CAACC,IAAI,EAAEC,SAAS,IAAI,EAClE,CAAC","ignoreList":[]}
|
|
@@ -11,7 +11,8 @@ import { clearHeap } from '../roomStore/roomHeapSlice';
|
|
|
11
11
|
import { pushSubscriptionService } from '../services/pushSubscriptionService';
|
|
12
12
|
import { clearRoomsRestCache } from '../networking/api-requests/rooms.api';
|
|
13
13
|
import { clearPersistedState } from '../roomStore/persistence';
|
|
14
|
-
import {
|
|
14
|
+
import { secureUserStorage } from '../helpers/secureUserStorage';
|
|
15
|
+
import { getFlushBoundaryTs } from '../helpers/getServerReadTimestamp';
|
|
15
16
|
|
|
16
17
|
// AsyncStorage keys the library writes but that aren't cleared by any
|
|
17
18
|
// slice reducer. Listed here so a single logout call wipes the full
|
|
@@ -59,9 +60,16 @@ const logoutService = {
|
|
|
59
60
|
const client = state.chatSettingStore?.client;
|
|
60
61
|
const rooms = state.rooms?.rooms;
|
|
61
62
|
const visibleRoomJID = state.rooms?.visibleRoomJID || null;
|
|
63
|
+
// The visible room is exempt from `onlyIfNoUnread`'s skip (it's
|
|
64
|
+
// meant to write "read up to now" for whatever's open), so if the
|
|
65
|
+
// user is logging out while scrolled up with unread messages
|
|
66
|
+
// above, the boundary must still be carried through here - same
|
|
67
|
+
// reasoning as every other "leaving a room" path (bug #42).
|
|
68
|
+
const boundaryTs = visibleRoomJID ? getFlushBoundaryTs(rooms?.[visibleRoomJID], state.roomHeapSlice, state.rooms?.readBoundaries?.[visibleRoomJID] ?? null) : undefined;
|
|
62
69
|
if (client?.flushLastViewedToPrivateStoreStanza) {
|
|
63
70
|
await Promise.race([client.flushLastViewedToPrivateStoreStanza(rooms, {
|
|
64
71
|
visibleRoomJID,
|
|
72
|
+
visibleRoomTs: boundaryTs,
|
|
65
73
|
onlyIfNoUnread: true
|
|
66
74
|
}), new Promise(res => setTimeout(res, 2000))]);
|
|
67
75
|
}
|
|
@@ -117,15 +125,23 @@ const logoutService = {
|
|
|
117
125
|
|
|
118
126
|
// 6. Stray keys the slices don't touch.
|
|
119
127
|
try {
|
|
120
|
-
await AsyncStorage.multiRemove(
|
|
121
|
-
// Belt-and-suspenders: the chat slice's `logout` reducer
|
|
122
|
-
// schedules an async remove of ETHORA_USER fire-and-forget;
|
|
123
|
-
// re-issue it here so the disk is provably clean before this
|
|
124
|
-
// Promise resolves.
|
|
125
|
-
localStorageConstants.ETHORA_USER]);
|
|
128
|
+
await AsyncStorage.multiRemove(LIBRARY_STRAY_KEYS);
|
|
126
129
|
} catch (e) {
|
|
127
130
|
console.warn('logoutService: stray-key clear failed', e);
|
|
128
131
|
}
|
|
132
|
+
|
|
133
|
+
// 7. Belt-and-suspenders: the chat slice's `logout` reducer already
|
|
134
|
+
// fires an async ETHORA_USER removal, but re-issue it here (via
|
|
135
|
+
// the same secureUserStorage split the reducer uses) so BOTH the
|
|
136
|
+
// plain-AsyncStorage profile half AND the Keychain/Keystore
|
|
137
|
+
// secrets are provably gone before this Promise resolves — a bare
|
|
138
|
+
// `AsyncStorage.removeItem(ETHORA_USER)` here would only clear the
|
|
139
|
+
// profile half and leave the tokens behind.
|
|
140
|
+
try {
|
|
141
|
+
await secureUserStorage().remove();
|
|
142
|
+
} catch (e) {
|
|
143
|
+
console.warn('logoutService: secure user storage clear failed', e);
|
|
144
|
+
}
|
|
129
145
|
}
|
|
130
146
|
};
|
|
131
147
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useDispatch","DeviceEventEmitter","AsyncStorage","store","logout","setLogoutState","useCallback","clearHeap","pushSubscriptionService","clearRoomsRestCache","clearPersistedState","
|
|
1
|
+
{"version":3,"names":["useDispatch","DeviceEventEmitter","AsyncStorage","store","logout","setLogoutState","useCallback","clearHeap","pushSubscriptionService","clearRoomsRestCache","clearPersistedState","secureUserStorage","getFlushBoundaryTs","LIBRARY_STRAY_KEYS","logoutService","performLogout","state","getState","client","chatSettingStore","rooms","visibleRoomJID","boundaryTs","roomHeapSlice","readBoundaries","undefined","flushLastViewedToPrivateStoreStanza","Promise","race","visibleRoomTs","onlyIfNoUnread","res","setTimeout","e","console","warn","emit","reset","dispatch","multiRemove","remove","useLogout","err"],"sourceRoot":"../../../src","sources":["hooks/useLogout.tsx"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,aAAa;AACzC,SAASC,kBAAkB,QAAQ,cAAc;AACjD,OAAOC,YAAY,MAAM,2CAA2C;AACpE,SAASC,KAAK,QAAQ,cAAc;AACpC,SAASC,MAAM,QAAQ,gCAAgC;AACvD,SAASC,cAAc,QAAQ,yBAAyB;AACxD,SAASC,WAAW,QAAQ,OAAO;AACnC,SAASC,SAAS,QAAQ,4BAA4B;AACtD,SAASC,uBAAuB,QAAQ,qCAAqC;AAC7E,SAASC,mBAAmB,QAAQ,sCAAsC;AAC1E,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,iBAAiB,QAAQ,8BAA8B;AAChE,SAASC,kBAAkB,QAAQ,mCAAmC;;AAEtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,GAAG,CACzB,iCAAiC,CAAE;AAAA,CACpC;AAED,MAAMC,aAAa,GAAG;EACpB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,aAAa,EAAE,MAAAA,CAAA,KAA2B;IACxC;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI;MACF,MAAMC,KAAK,GAAGb,KAAK,CAACc,QAAQ,CAAC,CAAC;MAC9B,MAAMC,MAAM,GAAIF,KAAK,CAACG,gBAAgB,EAAUD,MAAM;MACtD,MAAME,KAAK,GAAGJ,KAAK,CAACI,KAAK,EAAEA,KAAK;MAChC,MAAMC,cAAc,GAAGL,KAAK,CAACI,KAAK,EAAEC,cAAc,IAAI,IAAI;MAC1D;MACA;MACA;MACA;MACA;MACA,MAAMC,UAAU,GAAGD,cAAc,GAC7BT,kBAAkB,CAChBQ,KAAK,GAAGC,cAAc,CAAC,EACvBL,KAAK,CAACO,aAAa,EACnBP,KAAK,CAACI,K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vB,mBAAmB,CAAC,CAAC;IAC7B,CAAC,CAAC,MAAM;MACN;IAAA;;IAGF;IACA,IAAI;MACF,MAAMR,YAAY,CAACqC,WAAW,CAAC1B,kBAAkB,CAAC;IACpD,CAAC,CAAC,OAAOoB,CAAC,EAAE;MACVC,OAAO,CAACC,IAAI,CAAC,uCAAuC,EAAEF,CAAC,CAAC;IAC1D;;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI;MACF,MAAMtB,iBAAiB,CAAC,CAAC,CAAC6B,MAAM,CAAC,CAAC;IACpC,CAAC,CAAC,OAAOP,CAAC,EAAE;MACVC,OAAO,CAACC,IAAI,CAAC,iDAAiD,EAAEF,CAAC,CAAC;IACpE;EACF;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMQ,SAAS,GAAGA,CAAA,KAA6B;EACpD;EACA;EACA;EACAzC,WAAW,CAAC,CAAC;EAEb,OAAOM,WAAW,CAAC,YAAY;IAC7B,IAAI;MACF,MAAMQ,aAAa,CAACC,aAAa,CAAC,CAAC;IACrC,CAAC,CAAC,OAAO2B,GAAG,EAAE;MACZR,OAAO,CAACC,IAAI,CAAC,iCAAiC,EAAEO,GAAG,CAAC;IACtD;EACF,CAAC,EAAE,EAAE,CAAC;AACR,CAAC;AAED,SAAS5B,aAAa","ignoreList":[]}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
4
|
import { useSelector, useDispatch } from 'react-redux';
|
|
5
5
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
6
|
-
|
|
6
|
+
import { setCurrentRoom, clearPendingNotificationJid } from '../roomStore/roomsSlice';
|
|
7
|
+
import { PENDING_NOTIFICATION_JID_KEY, readPendingJid } from '../helpers/pushPayload';
|
|
7
8
|
export function usePendingNotification() {
|
|
8
9
|
const dispatch = useDispatch();
|
|
9
10
|
const rooms = useSelector(state => state.rooms.rooms);
|
|
@@ -16,20 +17,16 @@ export function usePendingNotification() {
|
|
|
16
17
|
}
|
|
17
18
|
let jidToOpen = pendingNotificationJid;
|
|
18
19
|
if (!jidToOpen) {
|
|
19
|
-
|
|
20
|
-
const storedJid = await AsyncStorage.getItem(PENDING_NOTIFICATION_JID_KEY);
|
|
21
|
-
if (storedJid) {
|
|
22
|
-
jidToOpen = storedJid;
|
|
23
|
-
await AsyncStorage.removeItem(PENDING_NOTIFICATION_JID_KEY);
|
|
24
|
-
}
|
|
25
|
-
} catch (error) {
|
|
26
|
-
console.error('Error reading from AsyncStorage:', error);
|
|
27
|
-
}
|
|
20
|
+
jidToOpen = await readPendingJid();
|
|
28
21
|
}
|
|
29
22
|
if (jidToOpen) {
|
|
30
23
|
const room = rooms[jidToOpen];
|
|
31
24
|
if (room) {
|
|
32
|
-
|
|
25
|
+
dispatch(clearPendingNotificationJid());
|
|
26
|
+
AsyncStorage.removeItem(PENDING_NOTIFICATION_JID_KEY).catch(() => undefined);
|
|
27
|
+
dispatch(setCurrentRoom({
|
|
28
|
+
roomJID: jidToOpen
|
|
29
|
+
}));
|
|
33
30
|
}
|
|
34
31
|
}
|
|
35
32
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useSelector","useDispatch","AsyncStorage","PENDING_NOTIFICATION_JID_KEY","usePendingNotification","dispatch","rooms","state","pendingNotificationJid","isLoading","checkPendingNotification","jidToOpen","
|
|
1
|
+
{"version":3,"names":["useEffect","useSelector","useDispatch","AsyncStorage","setCurrentRoom","clearPendingNotificationJid","PENDING_NOTIFICATION_JID_KEY","readPendingJid","usePendingNotification","dispatch","rooms","state","pendingNotificationJid","isLoading","checkPendingNotification","jidToOpen","room","removeItem","catch","undefined","roomJID"],"sourceRoot":"../../../src","sources":["hooks/usePendingNotification.ts"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,WAA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