@ethora/chat-component-rn 26.10.9 → 26.10.11
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 +17 -0
- package/README.md +126 -1
- package/lib/commonjs/booking/index.js +44 -0
- package/lib/commonjs/booking/index.js.map +1 -0
- package/lib/commonjs/booking/pendingScheduledCall.js +275 -0
- package/lib/commonjs/booking/pendingScheduledCall.js.map +1 -0
- package/lib/commonjs/booking/scheduleForm.js +91 -0
- package/lib/commonjs/booking/scheduleForm.js.map +1 -0
- package/lib/commonjs/booking/scheduledCall.js +141 -0
- package/lib/commonjs/booking/scheduledCall.js.map +1 -0
- package/lib/commonjs/booking/scheduledCallActions.js +128 -0
- package/lib/commonjs/booking/scheduledCallActions.js.map +1 -0
- package/lib/commonjs/booking/scheduledCallLink.js +143 -0
- package/lib/commonjs/booking/scheduledCallLink.js.map +1 -0
- package/lib/commonjs/booking/scheduledCallStore.js +64 -0
- package/lib/commonjs/booking/scheduledCallStore.js.map +1 -0
- package/lib/commonjs/booking/startRoomCall.js +84 -0
- package/lib/commonjs/booking/startRoomCall.js.map +1 -0
- package/lib/commonjs/calls/callBusy.js +18 -0
- package/lib/commonjs/calls/callBusy.js.map +1 -0
- package/lib/commonjs/calls/callDisplay.js +73 -0
- package/lib/commonjs/calls/callDisplay.js.map +1 -0
- package/lib/commonjs/calls/callMode.js +175 -0
- package/lib/commonjs/calls/callMode.js.map +1 -0
- package/lib/commonjs/calls/declineReport.js +20 -0
- package/lib/commonjs/calls/declineReport.js.map +1 -0
- package/lib/commonjs/calls/p2p/P2PCallController.js +724 -0
- package/lib/commonjs/calls/p2p/P2PCallController.js.map +1 -0
- package/lib/commonjs/calls/p2p/icePolicy.js +107 -0
- package/lib/commonjs/calls/p2p/icePolicy.js.map +1 -0
- package/lib/commonjs/calls/p2p/negotiator.js +202 -0
- package/lib/commonjs/calls/p2p/negotiator.js.map +1 -0
- package/lib/commonjs/calls/p2p/p2pRuntime.js +147 -0
- package/lib/commonjs/calls/p2p/p2pRuntime.js.map +1 -0
- package/lib/commonjs/calls/p2p/signalInbox.js +98 -0
- package/lib/commonjs/calls/p2p/signalInbox.js.map +1 -0
- package/lib/commonjs/calls/p2p/signalStanza.js +141 -0
- package/lib/commonjs/calls/p2p/signalStanza.js.map +1 -0
- package/lib/commonjs/calls/p2p/webrtcRuntime.js +53 -0
- package/lib/commonjs/calls/p2p/webrtcRuntime.js.map +1 -0
- package/lib/commonjs/calls/senderTrust.js +43 -0
- package/lib/commonjs/calls/senderTrust.js.map +1 -0
- package/lib/commonjs/calls/startCall.js +51 -0
- package/lib/commonjs/calls/startCall.js.map +1 -0
- package/lib/commonjs/components/Booking/BookingIcons.js +55 -0
- package/lib/commonjs/components/Booking/BookingIcons.js.map +1 -0
- package/lib/commonjs/components/Booking/ScheduleCallButton.js +64 -0
- package/lib/commonjs/components/Booking/ScheduleCallButton.js.map +1 -0
- package/lib/commonjs/components/Booking/ScheduleCallSheet.js +351 -0
- package/lib/commonjs/components/Booking/ScheduleCallSheet.js.map +1 -0
- package/lib/commonjs/components/Booking/ScheduledCallCard.js +203 -0
- package/lib/commonjs/components/Booking/ScheduledCallCard.js.map +1 -0
- package/lib/commonjs/components/Booking/ScheduledCallHost.js +23 -0
- package/lib/commonjs/components/Booking/ScheduledCallHost.js.map +1 -0
- package/lib/commonjs/components/Booking/ScheduledCallMessage.js +55 -0
- package/lib/commonjs/components/Booking/ScheduledCallMessage.js.map +1 -0
- package/lib/commonjs/components/Booking/ScheduledCallPreJoin.js +235 -0
- package/lib/commonjs/components/Booking/ScheduledCallPreJoin.js.map +1 -0
- package/lib/commonjs/components/Booking/bookingShared.js +305 -0
- package/lib/commonjs/components/Booking/bookingShared.js.map +1 -0
- package/lib/commonjs/components/MainComponents/AlbumGrid.js +6 -2
- package/lib/commonjs/components/MainComponents/AlbumGrid.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatHeader.js +18 -12
- package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/commonjs/components/MainComponents/LanguageSelectorButton.js +5 -2
- package/lib/commonjs/components/MainComponents/LanguageSelectorButton.js.map +1 -1
- package/lib/commonjs/components/MainComponents/LanguageSelectorModal.js +6 -3
- package/lib/commonjs/components/MainComponents/LanguageSelectorModal.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MediaMessage.js +13 -0
- package/lib/commonjs/components/MainComponents/MediaMessage.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MessageContainer.js +13 -0
- package/lib/commonjs/components/MainComponents/MessageContainer.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ReduxWrapper.js +10 -0
- package/lib/commonjs/components/MainComponents/ReduxWrapper.js.map +1 -1
- package/lib/commonjs/components/MainComponents/RoomList.js +7 -16
- package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/Message.js +27 -1
- package/lib/commonjs/components/MessageBubble/Message.js.map +1 -1
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatMediaGrid.js +159 -0
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatMediaGrid.js.map +1 -0
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +203 -134
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/ChatProfileModal/LeaveChatModal.js +180 -0
- package/lib/commonjs/components/Modals/ChatProfileModal/LeaveChatModal.js.map +1 -0
- package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js +19 -15
- package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js.map +1 -1
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +100 -162
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
- package/lib/commonjs/components/Modals/FilePreviewModal/MediaViewer.js +824 -0
- package/lib/commonjs/components/Modals/FilePreviewModal/MediaViewer.js.map +1 -0
- package/lib/commonjs/components/Modals/FilePreviewModal/useSaveFile.js +179 -0
- package/lib/commonjs/components/Modals/FilePreviewModal/useSaveFile.js.map +1 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/MessageSearchModal.js +22 -5
- package/lib/commonjs/components/Modals/MessageSearchModal/MessageSearchModal.js.map +1 -1
- package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js +15 -8
- package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/UserSettingsModal/LanguageCard.js +1 -1
- package/lib/commonjs/components/Modals/UserSettingsModal/LanguageCard.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/ActiveCallBar.js +3 -2
- package/lib/commonjs/components/VideoCalls/ActiveCallBar.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/CallButtons.js +19 -11
- package/lib/commonjs/components/VideoCalls/CallButtons.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/CallControlBar.js +119 -0
- package/lib/commonjs/components/VideoCalls/CallControlBar.js.map +1 -0
- package/lib/commonjs/components/VideoCalls/CallVideo.js +49 -0
- package/lib/commonjs/components/VideoCalls/CallVideo.js.map +1 -0
- package/lib/commonjs/components/VideoCalls/GroupCallView.js +281 -0
- package/lib/commonjs/components/VideoCalls/GroupCallView.js.map +1 -0
- package/lib/commonjs/components/VideoCalls/P2PCallRunner.js +151 -0
- package/lib/commonjs/components/VideoCalls/P2PCallRunner.js.map +1 -0
- package/lib/commonjs/components/VideoCalls/VideoCallOverlay.js +38 -14
- package/lib/commonjs/components/VideoCalls/VideoCallOverlay.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/VideoCallSession.js +57 -128
- package/lib/commonjs/components/VideoCalls/VideoCallSession.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/callActions.js +3 -0
- package/lib/commonjs/components/VideoCalls/callActions.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/callElapsed.js +38 -0
- package/lib/commonjs/components/VideoCalls/callElapsed.js.map +1 -0
- package/lib/commonjs/components/VideoCalls/callLive.js +15 -0
- package/lib/commonjs/components/VideoCalls/callLive.js.map +1 -0
- package/lib/commonjs/components/VideoCalls/callSessionController.js +81 -24
- package/lib/commonjs/components/VideoCalls/callSessionController.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/callSessionTypes.js +41 -0
- package/lib/commonjs/components/VideoCalls/callSessionTypes.js.map +1 -0
- package/lib/commonjs/components/VideoCalls/groupLayout.js +43 -0
- package/lib/commonjs/components/VideoCalls/groupLayout.js.map +1 -0
- package/lib/commonjs/components/VideoCalls/p2pCallSession.js +272 -0
- package/lib/commonjs/components/VideoCalls/p2pCallSession.js.map +1 -0
- package/lib/commonjs/components/VideoCalls/useCallKeep.js +7 -2
- package/lib/commonjs/components/VideoCalls/useCallKeep.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/useOngoingCallNotification.js +2 -1
- package/lib/commonjs/components/VideoCalls/useOngoingCallNotification.js.map +1 -1
- package/lib/commonjs/components/styled/MessageImage.js +4 -1
- package/lib/commonjs/components/styled/MessageImage.js.map +1 -1
- package/lib/commonjs/components/styled/VideoMessage.js +5 -1
- package/lib/commonjs/components/styled/VideoMessage.js.map +1 -1
- package/lib/commonjs/context/MediaSourceContext.js +18 -0
- package/lib/commonjs/context/MediaSourceContext.js.map +1 -0
- package/lib/commonjs/context/xmppProvider.js +2 -1
- package/lib/commonjs/context/xmppProvider.js.map +1 -1
- package/lib/commonjs/helpers/callPush.js +3 -1
- package/lib/commonjs/helpers/callPush.js.map +1 -1
- package/lib/commonjs/helpers/constants/MODAL_COMPONENTS.js +3 -1
- package/lib/commonjs/helpers/constants/MODAL_COMPONENTS.js.map +1 -1
- package/lib/commonjs/helpers/constants/MODAL_TYPES.js +2 -0
- package/lib/commonjs/helpers/constants/MODAL_TYPES.js.map +1 -1
- package/lib/commonjs/helpers/incomingCallFromPush.js +63 -7
- package/lib/commonjs/helpers/incomingCallFromPush.js.map +1 -1
- package/lib/commonjs/helpers/publicChatsEntry.js +8 -6
- package/lib/commonjs/helpers/publicChatsEntry.js.map +1 -1
- package/lib/commonjs/helpers/pushPayload.js +5 -0
- package/lib/commonjs/helpers/pushPayload.js.map +1 -1
- package/lib/commonjs/helpers/reportRoom.js +76 -0
- package/lib/commonjs/helpers/reportRoom.js.map +1 -0
- package/lib/commonjs/helpers/roomMedia.js +118 -0
- package/lib/commonjs/helpers/roomMedia.js.map +1 -0
- package/lib/commonjs/i18n/strings.js +480 -0
- package/lib/commonjs/i18n/strings.js.map +1 -1
- package/lib/commonjs/main.js +93 -0
- package/lib/commonjs/main.js.map +1 -1
- package/lib/commonjs/networking/api-requests/callState.api.js +75 -0
- package/lib/commonjs/networking/api-requests/callState.api.js.map +1 -0
- package/lib/commonjs/networking/api-requests/push.api.js +29 -6
- package/lib/commonjs/networking/api-requests/push.api.js.map +1 -1
- package/lib/commonjs/networking/api-requests/rooms.api.js +17 -15
- package/lib/commonjs/networking/api-requests/rooms.api.js.map +1 -1
- package/lib/commonjs/networking/api-requests/scheduledCalls.api.js +141 -0
- package/lib/commonjs/networking/api-requests/scheduledCalls.api.js.map +1 -0
- package/lib/commonjs/networking/callTokenStanza.js +210 -50
- package/lib/commonjs/networking/callTokenStanza.js.map +1 -1
- package/lib/commonjs/roomStore/callSlice.js +59 -4
- package/lib/commonjs/roomStore/callSlice.js.map +1 -1
- package/lib/commonjs/services/appBadge.js +80 -0
- package/lib/commonjs/services/appBadge.js.map +1 -0
- package/lib/commonjs/services/languageSettings.js +47 -15
- package/lib/commonjs/services/languageSettings.js.map +1 -1
- package/lib/commonjs/services/pushRegistration.js +21 -5
- package/lib/commonjs/services/pushRegistration.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/booking/index.js +5 -0
- package/lib/module/booking/index.js.map +1 -0
- package/lib/module/booking/pendingScheduledCall.js +261 -0
- package/lib/module/booking/pendingScheduledCall.js.map +1 -0
- package/lib/module/booking/scheduleForm.js +79 -0
- package/lib/module/booking/scheduleForm.js.map +1 -0
- package/lib/module/booking/scheduledCall.js +129 -0
- package/lib/module/booking/scheduledCall.js.map +1 -0
- package/lib/module/booking/scheduledCallActions.js +118 -0
- package/lib/module/booking/scheduledCallActions.js.map +1 -0
- package/lib/module/booking/scheduledCallLink.js +136 -0
- package/lib/module/booking/scheduledCallLink.js.map +1 -0
- package/lib/module/booking/scheduledCallStore.js +60 -0
- package/lib/module/booking/scheduledCallStore.js.map +1 -0
- package/lib/module/booking/startRoomCall.js +80 -0
- package/lib/module/booking/startRoomCall.js.map +1 -0
- package/lib/module/calls/callBusy.js +13 -0
- package/lib/module/calls/callBusy.js.map +1 -0
- package/lib/module/calls/callDisplay.js +65 -0
- package/lib/module/calls/callDisplay.js.map +1 -0
- package/lib/module/calls/callMode.js +168 -0
- package/lib/module/calls/callMode.js.map +1 -0
- package/lib/module/calls/declineReport.js +16 -0
- package/lib/module/calls/declineReport.js.map +1 -0
- package/lib/module/calls/p2p/P2PCallController.js +718 -0
- package/lib/module/calls/p2p/P2PCallController.js.map +1 -0
- package/lib/module/calls/p2p/icePolicy.js +102 -0
- package/lib/module/calls/p2p/icePolicy.js.map +1 -0
- package/lib/module/calls/p2p/negotiator.js +197 -0
- package/lib/module/calls/p2p/negotiator.js.map +1 -0
- package/lib/module/calls/p2p/p2pRuntime.js +137 -0
- package/lib/module/calls/p2p/p2pRuntime.js.map +1 -0
- package/lib/module/calls/p2p/signalInbox.js +93 -0
- package/lib/module/calls/p2p/signalInbox.js.map +1 -0
- package/lib/module/calls/p2p/signalStanza.js +135 -0
- package/lib/module/calls/p2p/signalStanza.js.map +1 -0
- package/lib/module/calls/p2p/webrtcRuntime.js +46 -0
- package/lib/module/calls/p2p/webrtcRuntime.js.map +1 -0
- package/lib/module/calls/senderTrust.js +38 -0
- package/lib/module/calls/senderTrust.js.map +1 -0
- package/lib/module/calls/startCall.js +47 -0
- package/lib/module/calls/startCall.js.map +1 -0
- package/lib/module/components/Booking/BookingIcons.js +48 -0
- package/lib/module/components/Booking/BookingIcons.js.map +1 -0
- package/lib/module/components/Booking/ScheduleCallButton.js +59 -0
- package/lib/module/components/Booking/ScheduleCallButton.js.map +1 -0
- package/lib/module/components/Booking/ScheduleCallSheet.js +345 -0
- package/lib/module/components/Booking/ScheduleCallSheet.js.map +1 -0
- package/lib/module/components/Booking/ScheduledCallCard.js +197 -0
- package/lib/module/components/Booking/ScheduledCallCard.js.map +1 -0
- package/lib/module/components/Booking/ScheduledCallHost.js +18 -0
- package/lib/module/components/Booking/ScheduledCallHost.js.map +1 -0
- package/lib/module/components/Booking/ScheduledCallMessage.js +48 -0
- package/lib/module/components/Booking/ScheduledCallMessage.js.map +1 -0
- package/lib/module/components/Booking/ScheduledCallPreJoin.js +229 -0
- package/lib/module/components/Booking/ScheduledCallPreJoin.js.map +1 -0
- package/lib/module/components/Booking/bookingShared.js +291 -0
- package/lib/module/components/Booking/bookingShared.js.map +1 -0
- package/lib/module/components/MainComponents/AlbumGrid.js +6 -2
- package/lib/module/components/MainComponents/AlbumGrid.js.map +1 -1
- package/lib/module/components/MainComponents/ChatHeader.js +20 -14
- package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/module/components/MainComponents/LanguageSelectorButton.js +5 -2
- package/lib/module/components/MainComponents/LanguageSelectorButton.js.map +1 -1
- package/lib/module/components/MainComponents/LanguageSelectorModal.js +7 -4
- package/lib/module/components/MainComponents/LanguageSelectorModal.js.map +1 -1
- package/lib/module/components/MainComponents/MediaMessage.js +13 -0
- package/lib/module/components/MainComponents/MediaMessage.js.map +1 -1
- package/lib/module/components/MainComponents/MessageContainer.js +13 -0
- package/lib/module/components/MainComponents/MessageContainer.js.map +1 -1
- package/lib/module/components/MainComponents/ReduxWrapper.js +10 -0
- package/lib/module/components/MainComponents/ReduxWrapper.js.map +1 -1
- package/lib/module/components/MainComponents/RoomList.js +7 -16
- package/lib/module/components/MainComponents/RoomList.js.map +1 -1
- package/lib/module/components/MessageBubble/Message.js +27 -1
- package/lib/module/components/MessageBubble/Message.js.map +1 -1
- package/lib/module/components/Modals/ChatProfileModal/ChatMediaGrid.js +154 -0
- package/lib/module/components/Modals/ChatProfileModal/ChatMediaGrid.js.map +1 -0
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +204 -136
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/module/components/Modals/ChatProfileModal/LeaveChatModal.js +175 -0
- package/lib/module/components/Modals/ChatProfileModal/LeaveChatModal.js.map +1 -0
- package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js +21 -15
- package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js.map +1 -1
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +100 -163
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
- package/lib/module/components/Modals/FilePreviewModal/MediaViewer.js +819 -0
- package/lib/module/components/Modals/FilePreviewModal/MediaViewer.js.map +1 -0
- package/lib/module/components/Modals/FilePreviewModal/useSaveFile.js +172 -0
- package/lib/module/components/Modals/FilePreviewModal/useSaveFile.js.map +1 -0
- package/lib/module/components/Modals/MessageSearchModal/MessageSearchModal.js +20 -4
- package/lib/module/components/Modals/MessageSearchModal/MessageSearchModal.js.map +1 -1
- package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js +17 -10
- package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
- package/lib/module/components/Modals/UserSettingsModal/LanguageCard.js +1 -1
- package/lib/module/components/Modals/UserSettingsModal/LanguageCard.js.map +1 -1
- package/lib/module/components/VideoCalls/ActiveCallBar.js +3 -2
- package/lib/module/components/VideoCalls/ActiveCallBar.js.map +1 -1
- package/lib/module/components/VideoCalls/CallButtons.js +19 -11
- package/lib/module/components/VideoCalls/CallButtons.js.map +1 -1
- package/lib/module/components/VideoCalls/CallControlBar.js +113 -0
- package/lib/module/components/VideoCalls/CallControlBar.js.map +1 -0
- package/lib/module/components/VideoCalls/CallVideo.js +43 -0
- package/lib/module/components/VideoCalls/CallVideo.js.map +1 -0
- package/lib/module/components/VideoCalls/GroupCallView.js +275 -0
- package/lib/module/components/VideoCalls/GroupCallView.js.map +1 -0
- package/lib/module/components/VideoCalls/P2PCallRunner.js +147 -0
- package/lib/module/components/VideoCalls/P2PCallRunner.js.map +1 -0
- package/lib/module/components/VideoCalls/VideoCallOverlay.js +38 -14
- package/lib/module/components/VideoCalls/VideoCallOverlay.js.map +1 -1
- package/lib/module/components/VideoCalls/VideoCallSession.js +46 -127
- package/lib/module/components/VideoCalls/VideoCallSession.js.map +1 -1
- package/lib/module/components/VideoCalls/callActions.js +3 -0
- package/lib/module/components/VideoCalls/callActions.js.map +1 -1
- package/lib/module/components/VideoCalls/callElapsed.js +33 -0
- package/lib/module/components/VideoCalls/callElapsed.js.map +1 -0
- package/lib/module/components/VideoCalls/callLive.js +10 -0
- package/lib/module/components/VideoCalls/callLive.js.map +1 -0
- package/lib/module/components/VideoCalls/callSessionController.js +80 -24
- package/lib/module/components/VideoCalls/callSessionController.js.map +1 -1
- package/lib/module/components/VideoCalls/callSessionTypes.js +37 -0
- package/lib/module/components/VideoCalls/callSessionTypes.js.map +1 -0
- package/lib/module/components/VideoCalls/groupLayout.js +36 -0
- package/lib/module/components/VideoCalls/groupLayout.js.map +1 -0
- package/lib/module/components/VideoCalls/p2pCallSession.js +256 -0
- package/lib/module/components/VideoCalls/p2pCallSession.js.map +1 -0
- package/lib/module/components/VideoCalls/useCallKeep.js +8 -2
- package/lib/module/components/VideoCalls/useCallKeep.js.map +1 -1
- package/lib/module/components/VideoCalls/useOngoingCallNotification.js +2 -1
- package/lib/module/components/VideoCalls/useOngoingCallNotification.js.map +1 -1
- package/lib/module/components/styled/MessageImage.js +4 -1
- package/lib/module/components/styled/MessageImage.js.map +1 -1
- package/lib/module/components/styled/VideoMessage.js +5 -1
- package/lib/module/components/styled/VideoMessage.js.map +1 -1
- package/lib/module/context/MediaSourceContext.js +13 -0
- package/lib/module/context/MediaSourceContext.js.map +1 -0
- package/lib/module/context/xmppProvider.js +2 -1
- package/lib/module/context/xmppProvider.js.map +1 -1
- package/lib/module/helpers/callPush.js +3 -1
- package/lib/module/helpers/callPush.js.map +1 -1
- package/lib/module/helpers/constants/MODAL_COMPONENTS.js +2 -1
- package/lib/module/helpers/constants/MODAL_COMPONENTS.js.map +1 -1
- package/lib/module/helpers/constants/MODAL_TYPES.js +2 -0
- package/lib/module/helpers/constants/MODAL_TYPES.js.map +1 -1
- package/lib/module/helpers/incomingCallFromPush.js +63 -7
- package/lib/module/helpers/incomingCallFromPush.js.map +1 -1
- package/lib/module/helpers/publicChatsEntry.js +8 -6
- package/lib/module/helpers/publicChatsEntry.js.map +1 -1
- package/lib/module/helpers/pushPayload.js +5 -0
- package/lib/module/helpers/pushPayload.js.map +1 -1
- package/lib/module/helpers/reportRoom.js +70 -0
- package/lib/module/helpers/reportRoom.js.map +1 -0
- package/lib/module/helpers/roomMedia.js +112 -0
- package/lib/module/helpers/roomMedia.js.map +1 -0
- package/lib/module/i18n/strings.js +480 -0
- package/lib/module/i18n/strings.js.map +1 -1
- package/lib/module/main.js +5 -0
- package/lib/module/main.js.map +1 -1
- package/lib/module/networking/api-requests/callState.api.js +66 -0
- package/lib/module/networking/api-requests/callState.api.js.map +1 -0
- package/lib/module/networking/api-requests/push.api.js +29 -6
- package/lib/module/networking/api-requests/push.api.js.map +1 -1
- package/lib/module/networking/api-requests/rooms.api.js +17 -15
- package/lib/module/networking/api-requests/rooms.api.js.map +1 -1
- package/lib/module/networking/api-requests/scheduledCalls.api.js +130 -0
- package/lib/module/networking/api-requests/scheduledCalls.api.js.map +1 -0
- package/lib/module/networking/callTokenStanza.js +210 -50
- package/lib/module/networking/callTokenStanza.js.map +1 -1
- package/lib/module/roomStore/callSlice.js +57 -3
- package/lib/module/roomStore/callSlice.js.map +1 -1
- package/lib/module/services/appBadge.js +74 -0
- package/lib/module/services/appBadge.js.map +1 -0
- package/lib/module/services/languageSettings.js +44 -13
- package/lib/module/services/languageSettings.js.map +1 -1
- package/lib/module/services/pushRegistration.js +21 -5
- package/lib/module/services/pushRegistration.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/booking/index.d.ts +3 -0
- package/lib/typescript/booking/index.d.ts.map +1 -0
- package/lib/typescript/booking/pendingScheduledCall.d.ts +80 -0
- package/lib/typescript/booking/pendingScheduledCall.d.ts.map +1 -0
- package/lib/typescript/booking/scheduleForm.d.ts +28 -0
- package/lib/typescript/booking/scheduleForm.d.ts.map +1 -0
- package/lib/typescript/booking/scheduledCall.d.ts +52 -0
- package/lib/typescript/booking/scheduledCall.d.ts.map +1 -0
- package/lib/typescript/booking/scheduledCallActions.d.ts +22 -0
- package/lib/typescript/booking/scheduledCallActions.d.ts.map +1 -0
- package/lib/typescript/booking/scheduledCallLink.d.ts +37 -0
- package/lib/typescript/booking/scheduledCallLink.d.ts.map +1 -0
- package/lib/typescript/booking/scheduledCallStore.d.ts +47 -0
- package/lib/typescript/booking/scheduledCallStore.d.ts.map +1 -0
- package/lib/typescript/booking/startRoomCall.d.ts +12 -0
- package/lib/typescript/booking/startRoomCall.d.ts.map +1 -0
- package/lib/typescript/calls/callBusy.d.ts +9 -0
- package/lib/typescript/calls/callBusy.d.ts.map +1 -0
- package/lib/typescript/calls/callDisplay.d.ts +23 -0
- package/lib/typescript/calls/callDisplay.d.ts.map +1 -0
- package/lib/typescript/calls/callMode.d.ts +106 -0
- package/lib/typescript/calls/callMode.d.ts.map +1 -0
- package/lib/typescript/calls/declineReport.d.ts +11 -0
- package/lib/typescript/calls/declineReport.d.ts.map +1 -0
- package/lib/typescript/calls/p2p/P2PCallController.d.ts +150 -0
- package/lib/typescript/calls/p2p/P2PCallController.d.ts.map +1 -0
- package/lib/typescript/calls/p2p/icePolicy.d.ts +37 -0
- package/lib/typescript/calls/p2p/icePolicy.d.ts.map +1 -0
- package/lib/typescript/calls/p2p/negotiator.d.ts +57 -0
- package/lib/typescript/calls/p2p/negotiator.d.ts.map +1 -0
- package/lib/typescript/calls/p2p/p2pRuntime.d.ts +41 -0
- package/lib/typescript/calls/p2p/p2pRuntime.d.ts.map +1 -0
- package/lib/typescript/calls/p2p/signalInbox.d.ts +35 -0
- package/lib/typescript/calls/p2p/signalInbox.d.ts.map +1 -0
- package/lib/typescript/calls/p2p/signalStanza.d.ts +52 -0
- package/lib/typescript/calls/p2p/signalStanza.d.ts.map +1 -0
- package/lib/typescript/calls/p2p/webrtcRuntime.d.ts +32 -0
- package/lib/typescript/calls/p2p/webrtcRuntime.d.ts.map +1 -0
- package/lib/typescript/calls/senderTrust.d.ts +8 -0
- package/lib/typescript/calls/senderTrust.d.ts.map +1 -0
- package/lib/typescript/calls/startCall.d.ts +17 -0
- package/lib/typescript/calls/startCall.d.ts.map +1 -0
- package/lib/typescript/components/Booking/BookingIcons.d.ts +9 -0
- package/lib/typescript/components/Booking/BookingIcons.d.ts.map +1 -0
- package/lib/typescript/components/Booking/ScheduleCallButton.d.ts +11 -0
- package/lib/typescript/components/Booking/ScheduleCallButton.d.ts.map +1 -0
- package/lib/typescript/components/Booking/ScheduleCallSheet.d.ts +4 -0
- package/lib/typescript/components/Booking/ScheduleCallSheet.d.ts.map +1 -0
- package/lib/typescript/components/Booking/ScheduledCallCard.d.ts +14 -0
- package/lib/typescript/components/Booking/ScheduledCallCard.d.ts.map +1 -0
- package/lib/typescript/components/Booking/ScheduledCallHost.d.ts +10 -0
- package/lib/typescript/components/Booking/ScheduledCallHost.d.ts.map +1 -0
- package/lib/typescript/components/Booking/ScheduledCallMessage.d.ts +20 -0
- package/lib/typescript/components/Booking/ScheduledCallMessage.d.ts.map +1 -0
- package/lib/typescript/components/Booking/ScheduledCallPreJoin.d.ts +8 -0
- package/lib/typescript/components/Booking/ScheduledCallPreJoin.d.ts.map +1 -0
- package/lib/typescript/components/Booking/bookingShared.d.ts +199 -0
- package/lib/typescript/components/Booking/bookingShared.d.ts.map +1 -0
- package/lib/typescript/components/MainComponents/AlbumGrid.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ChatHeader.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/LanguageSelectorButton.d.ts +3 -1
- package/lib/typescript/components/MainComponents/LanguageSelectorButton.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/LanguageSelectorModal.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/MediaMessage.d.ts +3 -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/ReduxWrapper.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/Message.d.ts.map +1 -1
- package/lib/typescript/components/Modals/ChatProfileModal/ChatMediaGrid.d.ts +16 -0
- package/lib/typescript/components/Modals/ChatProfileModal/ChatMediaGrid.d.ts.map +1 -0
- package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/ChatProfileModal/LeaveChatModal.d.ts +18 -0
- package/lib/typescript/components/Modals/ChatProfileModal/LeaveChatModal.d.ts.map +1 -0
- package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts +16 -0
- package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/FilePreviewModal/MediaViewer.d.ts +27 -0
- package/lib/typescript/components/Modals/FilePreviewModal/MediaViewer.d.ts.map +1 -0
- package/lib/typescript/components/Modals/FilePreviewModal/useSaveFile.d.ts +9 -0
- package/lib/typescript/components/Modals/FilePreviewModal/useSaveFile.d.ts.map +1 -0
- package/lib/typescript/components/Modals/MessageSearchModal/MessageSearchModal.d.ts +8 -0
- package/lib/typescript/components/Modals/MessageSearchModal/MessageSearchModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserSettingsModal/LanguageCard.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/ActiveCallBar.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/CallButtons.d.ts +2 -1
- package/lib/typescript/components/VideoCalls/CallButtons.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/CallControlBar.d.ts +17 -0
- package/lib/typescript/components/VideoCalls/CallControlBar.d.ts.map +1 -0
- package/lib/typescript/components/VideoCalls/CallVideo.d.ts +23 -0
- package/lib/typescript/components/VideoCalls/CallVideo.d.ts.map +1 -0
- package/lib/typescript/components/VideoCalls/GroupCallView.d.ts +22 -0
- package/lib/typescript/components/VideoCalls/GroupCallView.d.ts.map +1 -0
- package/lib/typescript/components/VideoCalls/P2PCallRunner.d.ts +2 -0
- package/lib/typescript/components/VideoCalls/P2PCallRunner.d.ts.map +1 -0
- package/lib/typescript/components/VideoCalls/VideoCallOverlay.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/VideoCallSession.d.ts +10 -12
- package/lib/typescript/components/VideoCalls/VideoCallSession.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/callActions.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/callElapsed.d.ts +8 -0
- package/lib/typescript/components/VideoCalls/callElapsed.d.ts.map +1 -0
- package/lib/typescript/components/VideoCalls/callLive.d.ts +9 -0
- package/lib/typescript/components/VideoCalls/callLive.d.ts.map +1 -0
- package/lib/typescript/components/VideoCalls/callSessionController.d.ts +10 -31
- package/lib/typescript/components/VideoCalls/callSessionController.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/callSessionTypes.d.ts +60 -0
- package/lib/typescript/components/VideoCalls/callSessionTypes.d.ts.map +1 -0
- package/lib/typescript/components/VideoCalls/groupLayout.d.ts +23 -0
- package/lib/typescript/components/VideoCalls/groupLayout.d.ts.map +1 -0
- package/lib/typescript/components/VideoCalls/p2pCallSession.d.ts +31 -0
- package/lib/typescript/components/VideoCalls/p2pCallSession.d.ts.map +1 -0
- package/lib/typescript/components/VideoCalls/useCallKeep.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/useOngoingCallNotification.d.ts.map +1 -1
- package/lib/typescript/components/styled/MessageImage.d.ts.map +1 -1
- package/lib/typescript/components/styled/VideoMessage.d.ts.map +1 -1
- package/lib/typescript/context/MediaSourceContext.d.ts +4 -0
- package/lib/typescript/context/MediaSourceContext.d.ts.map +1 -0
- package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
- package/lib/typescript/helpers/callPush.d.ts +11 -1
- package/lib/typescript/helpers/callPush.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/incomingCallFromPush.d.ts.map +1 -1
- package/lib/typescript/helpers/publicChatsEntry.d.ts +7 -5
- package/lib/typescript/helpers/publicChatsEntry.d.ts.map +1 -1
- package/lib/typescript/helpers/pushPayload.d.ts +1 -1
- package/lib/typescript/helpers/pushPayload.d.ts.map +1 -1
- package/lib/typescript/helpers/reportRoom.d.ts +19 -0
- package/lib/typescript/helpers/reportRoom.d.ts.map +1 -0
- package/lib/typescript/helpers/roomMedia.d.ts +26 -0
- package/lib/typescript/helpers/roomMedia.d.ts.map +1 -0
- package/lib/typescript/i18n/strings.d.ts.map +1 -1
- package/lib/typescript/main.d.ts +6 -1
- package/lib/typescript/main.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/callState.api.d.ts +25 -0
- package/lib/typescript/networking/api-requests/callState.api.d.ts.map +1 -0
- package/lib/typescript/networking/api-requests/push.api.d.ts +9 -2
- package/lib/typescript/networking/api-requests/push.api.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/rooms.api.d.ts +8 -6
- package/lib/typescript/networking/api-requests/rooms.api.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/scheduledCalls.api.d.ts +86 -0
- package/lib/typescript/networking/api-requests/scheduledCalls.api.d.ts.map +1 -0
- package/lib/typescript/networking/callTokenStanza.d.ts.map +1 -1
- package/lib/typescript/roomStore/callSlice.d.ts +23 -1
- package/lib/typescript/roomStore/callSlice.d.ts.map +1 -1
- package/lib/typescript/services/appBadge.d.ts +3 -0
- package/lib/typescript/services/appBadge.d.ts.map +1 -0
- package/lib/typescript/services/languageSettings.d.ts +7 -0
- package/lib/typescript/services/languageSettings.d.ts.map +1 -1
- package/lib/typescript/services/pushRegistration.d.ts.map +1 -1
- package/lib/typescript/types/models/modal.model.d.ts +18 -0
- package/lib/typescript/types/models/modal.model.d.ts.map +1 -1
- package/lib/typescript/types/types.d.ts +85 -4
- 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 +9 -2
- package/src/booking/index.ts +10 -0
- package/src/booking/pendingScheduledCall.ts +272 -0
- package/src/booking/scheduleForm.ts +84 -0
- package/src/booking/scheduledCall.ts +163 -0
- package/src/booking/scheduledCallActions.ts +141 -0
- package/src/booking/scheduledCallLink.ts +145 -0
- package/src/booking/scheduledCallStore.ts +69 -0
- package/src/booking/startRoomCall.ts +103 -0
- package/src/calls/callBusy.ts +10 -0
- package/src/calls/callDisplay.ts +74 -0
- package/src/calls/callMode.ts +286 -0
- package/src/calls/declineReport.ts +16 -0
- package/src/calls/p2p/P2PCallController.ts +813 -0
- package/src/calls/p2p/icePolicy.ts +99 -0
- package/src/calls/p2p/negotiator.ts +186 -0
- package/src/calls/p2p/p2pRuntime.ts +164 -0
- package/src/calls/p2p/signalInbox.ts +117 -0
- package/src/calls/p2p/signalStanza.ts +205 -0
- package/src/calls/p2p/webrtcRuntime.ts +60 -0
- package/src/calls/senderTrust.ts +40 -0
- package/src/calls/startCall.ts +56 -0
- package/src/components/Booking/BookingIcons.tsx +44 -0
- package/src/components/Booking/ScheduleCallButton.tsx +66 -0
- package/src/components/Booking/ScheduleCallSheet.tsx +380 -0
- package/src/components/Booking/ScheduledCallCard.tsx +216 -0
- package/src/components/Booking/ScheduledCallHost.tsx +18 -0
- package/src/components/Booking/ScheduledCallMessage.tsx +62 -0
- package/src/components/Booking/ScheduledCallPreJoin.tsx +230 -0
- package/src/components/Booking/bookingShared.tsx +295 -0
- package/src/components/MainComponents/AlbumGrid.tsx +5 -1
- package/src/components/MainComponents/ChatHeader.tsx +18 -11
- package/src/components/MainComponents/LanguageSelectorButton.tsx +9 -2
- package/src/components/MainComponents/LanguageSelectorModal.tsx +10 -6
- package/src/components/MainComponents/MediaMessage.tsx +13 -2
- package/src/components/MainComponents/MessageContainer.tsx +15 -0
- package/src/components/MainComponents/ReduxWrapper.tsx +10 -0
- package/src/components/MainComponents/RoomList.tsx +8 -19
- package/src/components/MessageBubble/Message.tsx +24 -1
- package/src/components/Modals/ChatProfileModal/ChatMediaGrid.tsx +174 -0
- package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +119 -48
- package/src/components/Modals/ChatProfileModal/LeaveChatModal.tsx +191 -0
- package/src/components/Modals/ChatProfileModal/ReportChatModal.tsx +22 -22
- package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +115 -185
- package/src/components/Modals/FilePreviewModal/MediaViewer.tsx +880 -0
- package/src/components/Modals/FilePreviewModal/useSaveFile.ts +207 -0
- package/src/components/Modals/MessageSearchModal/MessageSearchModal.tsx +56 -30
- package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +28 -9
- package/src/components/Modals/UserSettingsModal/LanguageCard.tsx +9 -7
- package/src/components/VideoCalls/ActiveCallBar.tsx +6 -5
- package/src/components/VideoCalls/CallButtons.tsx +23 -12
- package/src/components/VideoCalls/CallControlBar.tsx +131 -0
- package/src/components/VideoCalls/CallVideo.tsx +59 -0
- package/src/components/VideoCalls/GroupCallView.tsx +324 -0
- package/src/components/VideoCalls/P2PCallRunner.tsx +192 -0
- package/src/components/VideoCalls/VideoCallOverlay.tsx +62 -17
- package/src/components/VideoCalls/VideoCallSession.tsx +55 -133
- package/src/components/VideoCalls/callActions.ts +3 -0
- package/src/components/VideoCalls/callElapsed.ts +27 -0
- package/src/components/VideoCalls/callLive.ts +13 -0
- package/src/components/VideoCalls/callSessionController.ts +130 -55
- package/src/components/VideoCalls/callSessionTypes.ts +80 -0
- package/src/components/VideoCalls/groupLayout.ts +48 -0
- package/src/components/VideoCalls/p2pCallSession.ts +291 -0
- package/src/components/VideoCalls/useCallKeep.ts +9 -2
- package/src/components/VideoCalls/useOngoingCallNotification.ts +2 -2
- package/src/components/styled/MessageImage.tsx +3 -1
- package/src/components/styled/VideoMessage.tsx +5 -1
- package/src/context/MediaSourceContext.tsx +14 -0
- package/src/context/xmppProvider.tsx +3 -0
- package/src/helpers/callPush.ts +13 -1
- package/src/helpers/constants/MODAL_COMPONENTS.tsx +4 -1
- package/src/helpers/constants/MODAL_TYPES.ts +2 -0
- package/src/helpers/incomingCallFromPush.ts +65 -7
- package/src/helpers/publicChatsEntry.ts +8 -7
- package/src/helpers/pushPayload.ts +9 -1
- package/src/helpers/reportRoom.ts +93 -0
- package/src/helpers/roomMedia.ts +126 -0
- package/src/i18n/strings.ts +480 -0
- package/src/main.ts +33 -0
- package/src/networking/api-requests/callState.api.ts +83 -0
- package/src/networking/api-requests/push.api.ts +28 -3
- package/src/networking/api-requests/rooms.api.ts +25 -15
- package/src/networking/api-requests/scheduledCalls.api.ts +232 -0
- package/src/networking/callTokenStanza.ts +247 -50
- package/src/roomStore/callSlice.ts +86 -2
- package/src/services/appBadge.ts +85 -0
- package/src/services/languageSettings.ts +43 -8
- package/src/services/pushRegistration.ts +34 -3
- package/src/types/models/modal.model.ts +16 -0
- package/src/types/types.ts +86 -4
- package/src/version.ts +1 -1
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
|
|
3
|
+
import React, { useMemo, useState } from 'react';
|
|
4
|
+
import {
|
|
5
|
+
ActivityIndicator,
|
|
6
|
+
Alert,
|
|
7
|
+
Modal,
|
|
8
|
+
StyleSheet,
|
|
9
|
+
Text,
|
|
10
|
+
TouchableOpacity,
|
|
11
|
+
View,
|
|
12
|
+
} from 'react-native';
|
|
13
|
+
import { useSelector } from 'react-redux';
|
|
14
|
+
import type { RootState } from '../../../roomStore';
|
|
15
|
+
import { ProfileImagePlaceholder } from '../../MainComponents/ProfileImagePlaceholder';
|
|
16
|
+
import { useLeaveRoom } from '../../../hooks/useLeaveRoom';
|
|
17
|
+
import { useFileToken } from '../../../hooks/useFileToken';
|
|
18
|
+
import { appendFileToken } from '../../../helpers/secureFileUrl';
|
|
19
|
+
import { useTheme } from '../../../hooks/useTheme';
|
|
20
|
+
import { useT } from '../../../i18n/useT';
|
|
21
|
+
import type { ChatTheme } from '../../../theme/theme';
|
|
22
|
+
|
|
23
|
+
interface LeaveChatModalProps {
|
|
24
|
+
/** The room to leave; the modal is shown while this is set. */
|
|
25
|
+
roomJid: string | null;
|
|
26
|
+
onClose: () => void;
|
|
27
|
+
/** Called after the server took us out, before the modal closes. */
|
|
28
|
+
onLeft?: (jid: string) => void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Telegram-style confirmation in front of every Leave: the chat's avatar and
|
|
33
|
+
* name, the question, Cancel and a red Leave. The leave itself runs here, so
|
|
34
|
+
* the card stays up with a spinner until the server answers and a failure is
|
|
35
|
+
* reported over it instead of after it has gone.
|
|
36
|
+
*/
|
|
37
|
+
const LeaveChatModal: React.FC<LeaveChatModalProps> = ({
|
|
38
|
+
roomJid,
|
|
39
|
+
onClose,
|
|
40
|
+
onLeft,
|
|
41
|
+
}) => {
|
|
42
|
+
const t = useT();
|
|
43
|
+
const theme = useTheme();
|
|
44
|
+
const styles = useMemo(() => createStyles(theme), [theme]);
|
|
45
|
+
const fileToken = useFileToken();
|
|
46
|
+
const leaveRoom = useLeaveRoom();
|
|
47
|
+
const room = useSelector((state: RootState) =>
|
|
48
|
+
roomJid ? state.rooms.rooms?.[roomJid] : undefined
|
|
49
|
+
);
|
|
50
|
+
const [leaving, setLeaving] = useState(false);
|
|
51
|
+
|
|
52
|
+
const name = room?.title || room?.name || '';
|
|
53
|
+
|
|
54
|
+
const close = () => {
|
|
55
|
+
if (!leaving) {onClose();}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const confirm = async () => {
|
|
59
|
+
if (!roomJid || leaving) {return;}
|
|
60
|
+
setLeaving(true);
|
|
61
|
+
const ok = await leaveRoom(roomJid);
|
|
62
|
+
setLeaving(false);
|
|
63
|
+
if (!ok) {
|
|
64
|
+
Alert.alert(t('toast.error'), t('toast.leaveFailed'));
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
onLeft?.(roomJid);
|
|
68
|
+
onClose();
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<Modal
|
|
73
|
+
transparent
|
|
74
|
+
visible={roomJid !== null}
|
|
75
|
+
animationType="fade"
|
|
76
|
+
onRequestClose={close}
|
|
77
|
+
>
|
|
78
|
+
<View style={styles.backdrop}>
|
|
79
|
+
<TouchableOpacity
|
|
80
|
+
testID="leave-backdrop"
|
|
81
|
+
style={StyleSheet.absoluteFill}
|
|
82
|
+
activeOpacity={1}
|
|
83
|
+
onPress={close}
|
|
84
|
+
/>
|
|
85
|
+
<View style={styles.card}>
|
|
86
|
+
<View style={styles.header}>
|
|
87
|
+
<ProfileImagePlaceholder
|
|
88
|
+
name={name}
|
|
89
|
+
size={40}
|
|
90
|
+
icon={appendFileToken(room?.icon, fileToken)}
|
|
91
|
+
disableOverlay
|
|
92
|
+
/>
|
|
93
|
+
<Text style={styles.title} numberOfLines={1}>
|
|
94
|
+
{t('modal.leaveChat.title')}
|
|
95
|
+
</Text>
|
|
96
|
+
</View>
|
|
97
|
+
<Text style={styles.description}>
|
|
98
|
+
{name
|
|
99
|
+
? t('modal.leaveChat.descriptionNamed', { name })
|
|
100
|
+
: t('modal.leaveChat.description')}
|
|
101
|
+
</Text>
|
|
102
|
+
<View style={styles.buttons}>
|
|
103
|
+
<TouchableOpacity
|
|
104
|
+
testID="leave-cancel"
|
|
105
|
+
activeOpacity={0.7}
|
|
106
|
+
disabled={leaving}
|
|
107
|
+
style={[styles.button, styles.cancel]}
|
|
108
|
+
onPress={close}
|
|
109
|
+
>
|
|
110
|
+
<Text style={styles.cancelLabel}>{t('action.cancel')}</Text>
|
|
111
|
+
</TouchableOpacity>
|
|
112
|
+
<TouchableOpacity
|
|
113
|
+
testID="leave-confirm"
|
|
114
|
+
activeOpacity={0.7}
|
|
115
|
+
disabled={leaving}
|
|
116
|
+
style={[styles.button, { backgroundColor: theme.danger }]}
|
|
117
|
+
onPress={confirm}
|
|
118
|
+
>
|
|
119
|
+
{leaving ? (
|
|
120
|
+
<ActivityIndicator color={theme.textOnPrimary} />
|
|
121
|
+
) : (
|
|
122
|
+
<Text style={styles.leaveLabel}>{t('action.leave')}</Text>
|
|
123
|
+
)}
|
|
124
|
+
</TouchableOpacity>
|
|
125
|
+
</View>
|
|
126
|
+
</View>
|
|
127
|
+
</View>
|
|
128
|
+
</Modal>
|
|
129
|
+
);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const createStyles = (theme: ChatTheme) => StyleSheet.create({
|
|
133
|
+
backdrop: {
|
|
134
|
+
flex: 1,
|
|
135
|
+
backgroundColor: theme.overlay,
|
|
136
|
+
alignItems: 'center',
|
|
137
|
+
justifyContent: 'center',
|
|
138
|
+
padding: 24,
|
|
139
|
+
},
|
|
140
|
+
card: {
|
|
141
|
+
width: '100%',
|
|
142
|
+
maxWidth: 400,
|
|
143
|
+
borderRadius: 16,
|
|
144
|
+
backgroundColor: theme.surface,
|
|
145
|
+
padding: 20,
|
|
146
|
+
},
|
|
147
|
+
header: {
|
|
148
|
+
flexDirection: 'row',
|
|
149
|
+
alignItems: 'center',
|
|
150
|
+
gap: 12,
|
|
151
|
+
marginBottom: 12,
|
|
152
|
+
},
|
|
153
|
+
title: {
|
|
154
|
+
flex: 1,
|
|
155
|
+
fontSize: 18,
|
|
156
|
+
fontWeight: '600',
|
|
157
|
+
color: theme.text,
|
|
158
|
+
},
|
|
159
|
+
description: {
|
|
160
|
+
fontSize: 15,
|
|
161
|
+
lineHeight: 21,
|
|
162
|
+
color: theme.text,
|
|
163
|
+
},
|
|
164
|
+
buttons: {
|
|
165
|
+
flexDirection: 'row',
|
|
166
|
+
gap: 12,
|
|
167
|
+
marginTop: 20,
|
|
168
|
+
},
|
|
169
|
+
button: {
|
|
170
|
+
flex: 1,
|
|
171
|
+
height: 44,
|
|
172
|
+
borderRadius: 12,
|
|
173
|
+
alignItems: 'center',
|
|
174
|
+
justifyContent: 'center',
|
|
175
|
+
},
|
|
176
|
+
cancel: {
|
|
177
|
+
backgroundColor: theme.surfaceSecondary,
|
|
178
|
+
},
|
|
179
|
+
cancelLabel: {
|
|
180
|
+
fontSize: 16,
|
|
181
|
+
fontWeight: '500',
|
|
182
|
+
color: theme.text,
|
|
183
|
+
},
|
|
184
|
+
leaveLabel: {
|
|
185
|
+
fontSize: 16,
|
|
186
|
+
fontWeight: '600',
|
|
187
|
+
color: theme.textOnPrimary,
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
export default LeaveChatModal;
|
|
@@ -19,21 +19,19 @@ import { getIconColor } from '../../../helpers/getIconColor';
|
|
|
19
19
|
import { useChatSettingState } from '../../../hooks/useChatSettingState';
|
|
20
20
|
import { useTheme } from '../../../hooks/useTheme';
|
|
21
21
|
import type { ChatTheme } from '../../../theme/theme';
|
|
22
|
+
import {
|
|
23
|
+
buildReportRoomPayload,
|
|
24
|
+
OTHER_REPORT_CATEGORY,
|
|
25
|
+
REPORT_CATEGORIES,
|
|
26
|
+
} from '../../../helpers/reportRoom';
|
|
22
27
|
|
|
23
28
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
29
|
+
* The ids are UI ids: helpers/reportRoom maps each one onto the category
|
|
30
|
+
* value `POST /v1/chats/reports/{chatName}` accepts and builds the
|
|
31
|
+
* non-empty text it requires. Labels come from the `report.category.*`
|
|
32
|
+
* strings.
|
|
27
33
|
*/
|
|
28
|
-
const CATEGORIES = [
|
|
29
|
-
'spam',
|
|
30
|
-
'violence',
|
|
31
|
-
'childAbuse',
|
|
32
|
-
'pornography',
|
|
33
|
-
'personalDetails',
|
|
34
|
-
'illegalDrugs',
|
|
35
|
-
'other',
|
|
36
|
-
] as const;
|
|
34
|
+
const CATEGORIES = [...REPORT_CATEGORIES, OTHER_REPORT_CATEGORY];
|
|
37
35
|
|
|
38
36
|
interface ReportChatModalProps {
|
|
39
37
|
visible: boolean;
|
|
@@ -66,17 +64,19 @@ const ReportChatModal: React.FC<ReportChatModalProps> = ({
|
|
|
66
64
|
|
|
67
65
|
const submit = async () => {
|
|
68
66
|
if (!category || sending) {return;}
|
|
67
|
+
const payload = buildReportRoomPayload(
|
|
68
|
+
roomJid || activeRoom?.jid || '',
|
|
69
|
+
category,
|
|
70
|
+
details
|
|
71
|
+
);
|
|
72
|
+
if (!payload) {return;}
|
|
69
73
|
setSending(true);
|
|
70
74
|
try {
|
|
71
|
-
await postReportRoom(
|
|
72
|
-
chatName: (roomJid || activeRoom?.jid || '').split('@')[0],
|
|
73
|
-
category,
|
|
74
|
-
text: details.trim() || undefined,
|
|
75
|
-
});
|
|
75
|
+
await postReportRoom(payload);
|
|
76
76
|
showToast({
|
|
77
77
|
id: Date.now().toString(),
|
|
78
78
|
title: t('toast.successTitle'),
|
|
79
|
-
message: t('
|
|
79
|
+
message: t('toast.reportSent'),
|
|
80
80
|
type: 'success',
|
|
81
81
|
});
|
|
82
82
|
close();
|
|
@@ -85,7 +85,7 @@ const ReportChatModal: React.FC<ReportChatModalProps> = ({
|
|
|
85
85
|
showToast({
|
|
86
86
|
id: Date.now().toString(),
|
|
87
87
|
title: t('toast.error'),
|
|
88
|
-
message: t('
|
|
88
|
+
message: t('toast.reportFailed'),
|
|
89
89
|
type: 'error',
|
|
90
90
|
});
|
|
91
91
|
} finally {
|
|
@@ -110,7 +110,7 @@ const ReportChatModal: React.FC<ReportChatModalProps> = ({
|
|
|
110
110
|
<View style={styles.card}>
|
|
111
111
|
<Text style={styles.title}>{t('modal.report.chatTitle')}</Text>
|
|
112
112
|
<View style={styles.categories}>
|
|
113
|
-
{CATEGORIES.map((id) => {
|
|
113
|
+
{CATEGORIES.map(({ id, labelKey }) => {
|
|
114
114
|
const selected = category === id;
|
|
115
115
|
return (
|
|
116
116
|
<TouchableOpacity
|
|
@@ -126,13 +126,13 @@ const ReportChatModal: React.FC<ReportChatModalProps> = ({
|
|
|
126
126
|
<Text
|
|
127
127
|
style={[styles.categoryLabel, selected && { color: primary }]}
|
|
128
128
|
>
|
|
129
|
-
{t(
|
|
129
|
+
{t(labelKey)}
|
|
130
130
|
</Text>
|
|
131
131
|
</TouchableOpacity>
|
|
132
132
|
);
|
|
133
133
|
})}
|
|
134
134
|
</View>
|
|
135
|
-
{category ===
|
|
135
|
+
{category === OTHER_REPORT_CATEGORY.id && (
|
|
136
136
|
<TextInput
|
|
137
137
|
testID="report-details"
|
|
138
138
|
style={styles.input}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import { withFileToken } from '../../../helpers/secureFileUrl';
|
|
3
3
|
import styled from 'styled-components/native';
|
|
4
4
|
import {
|
|
@@ -10,26 +10,28 @@ import ModalHeaderComponent from '../ModalHeaderComponent';
|
|
|
10
10
|
import { useChatSettingState } from '../../../hooks/useChatSettingState';
|
|
11
11
|
import { useTheme } from '../../../hooks/useTheme';
|
|
12
12
|
import { chatTextStyle } from '../../../helpers/typography';
|
|
13
|
-
import { useDispatch, useSelector } from 'react-redux';
|
|
13
|
+
import { useDispatch, useSelector, useStore } from 'react-redux';
|
|
14
14
|
import Button from '../../styled/Button';
|
|
15
15
|
import { RootState } from '../../../roomStore';
|
|
16
16
|
import { FullScreenImage } from '../../styled/StyledInputComponents/MediaComponents';
|
|
17
17
|
import { setActiveFile } from '../../../roomStore/chatSettingsSlice';
|
|
18
|
+
import type { ModalFile } from '../../../types/types';
|
|
19
|
+
import MediaViewer from './MediaViewer';
|
|
20
|
+
import { isLocalFile, useSaveFile } from './useSaveFile';
|
|
21
|
+
import { withChatSiblings } from '../../../helpers/roomMedia';
|
|
22
|
+
import { loadRoomHistory } from '../../../helpers/loadRoomHistory';
|
|
23
|
+
import { getGlobalXmppClient } from '../../../utils/clientRegistry';
|
|
24
|
+
import { useFileToken } from '../../../hooks/useFileToken';
|
|
18
25
|
import {
|
|
19
26
|
ActivityIndicator,
|
|
20
|
-
Alert,
|
|
21
27
|
Text,
|
|
22
28
|
View,
|
|
23
29
|
Platform,
|
|
24
30
|
TouchableOpacity,
|
|
25
31
|
StyleSheet,
|
|
26
|
-
Share,
|
|
27
32
|
} from 'react-native';
|
|
28
33
|
import { useVideoPlayer, VideoView } from 'expo-video';
|
|
29
34
|
import { PlayIcon } from '../../../assets/icons';
|
|
30
|
-
import * as FileSystem from 'expo-file-system/legacy';
|
|
31
|
-
import { getMediaLibrary } from '../../../helpers/mediaLibraryRuntime';
|
|
32
|
-
import { useToast } from '../../../context/ToastContext';
|
|
33
35
|
import { useT } from '../../../i18n/useT';
|
|
34
36
|
import PdfViewer from './PdfView';
|
|
35
37
|
import DocumentViewer from './DocumentViewer';
|
|
@@ -44,7 +46,6 @@ import {
|
|
|
44
46
|
} from '../../../helpers/videoCache';
|
|
45
47
|
import {
|
|
46
48
|
getDisplayFileName,
|
|
47
|
-
getUniqueFileName,
|
|
48
49
|
sanitizeFileNameForPath,
|
|
49
50
|
} from '../../../helpers/getDisplayFileName';
|
|
50
51
|
|
|
@@ -62,13 +63,12 @@ const GVIEW_PREVIEWABLE = new Set<string>([
|
|
|
62
63
|
'application/rtf',
|
|
63
64
|
]);
|
|
64
65
|
|
|
65
|
-
const
|
|
66
|
-
|
|
66
|
+
const isMedia = (mime: string | undefined | null) =>
|
|
67
|
+
!!mime && (mime.startsWith('image/') || mime.startsWith('video/'));
|
|
67
68
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
: FileSystem.downloadAsync(withFileToken(url), cachePath);
|
|
69
|
+
/** Older history pages the viewer asked for; one at a time per room. */
|
|
70
|
+
const historyInFlight = new Set<string>();
|
|
71
|
+
const HISTORY_PAGE_SIZE = 30;
|
|
72
72
|
|
|
73
73
|
const isGviewPreviewable = (mime: string | undefined | null) => {
|
|
74
74
|
if (!mime) {return false;}
|
|
@@ -246,11 +246,94 @@ interface FilePreviewModalProps {
|
|
|
246
246
|
handleCloseModal: any;
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
+
/** The viewer on the store's `activeFile`, as opened from a message bubble. */
|
|
249
250
|
const FilePreviewModal: React.FC<FilePreviewModalProps> = ({
|
|
250
251
|
handleCloseModal,
|
|
251
252
|
}) => {
|
|
252
253
|
const dispatch = useDispatch();
|
|
253
|
-
const
|
|
254
|
+
const store = useStore<RootState>();
|
|
255
|
+
const { activeFile } = useSelector(
|
|
256
|
+
(state: RootState) => state.chatSettingStore
|
|
257
|
+
);
|
|
258
|
+
const { user, config } = useChatSettingState();
|
|
259
|
+
const fileToken = useFileToken();
|
|
260
|
+
const roomJid = activeFile?.source?.roomJid;
|
|
261
|
+
const room = useSelector((state: RootState) =>
|
|
262
|
+
roomJid ? state.rooms.rooms?.[roomJid] : undefined
|
|
263
|
+
);
|
|
264
|
+
const messages = room?.messages;
|
|
265
|
+
|
|
266
|
+
// A picture or video opened from a bubble pages through the whole chat;
|
|
267
|
+
// anything not in the loaded history keeps what it was opened with.
|
|
268
|
+
const file = useMemo(() => {
|
|
269
|
+
if (!activeFile?.fileURL || !isMedia(activeFile.mimetype)) {return activeFile;}
|
|
270
|
+
return (
|
|
271
|
+
withChatSiblings(activeFile, messages, {
|
|
272
|
+
me: user,
|
|
273
|
+
fileToken,
|
|
274
|
+
interactive: !config?.disableInteractions,
|
|
275
|
+
repliesOn: !config?.disableReplies,
|
|
276
|
+
}) ?? activeFile
|
|
277
|
+
);
|
|
278
|
+
}, [activeFile, messages, user, fileToken, config?.disableInteractions, config?.disableReplies]);
|
|
279
|
+
|
|
280
|
+
// On the oldest loaded file, ask for an older page: what it brings in
|
|
281
|
+
// shows up to the left of it.
|
|
282
|
+
const atOldest = !!file?.siblings && file.index === 0 && !!roomJid;
|
|
283
|
+
const historyComplete = !!room?.historyComplete;
|
|
284
|
+
useEffect(() => {
|
|
285
|
+
if (!atOldest || historyComplete || !roomJid) {return;}
|
|
286
|
+
loadRoomHistory({
|
|
287
|
+
client: getGlobalXmppClient(),
|
|
288
|
+
room: store.getState().rooms.rooms?.[roomJid],
|
|
289
|
+
inFlight: historyInFlight,
|
|
290
|
+
chatJID: roomJid,
|
|
291
|
+
max: HISTORY_PAGE_SIZE,
|
|
292
|
+
});
|
|
293
|
+
}, [atOldest, historyComplete, roomJid, store]);
|
|
294
|
+
|
|
295
|
+
if (!file?.fileURL) {return null;}
|
|
296
|
+
|
|
297
|
+
const closeModal = () => {
|
|
298
|
+
dispatch(
|
|
299
|
+
setActiveFile({
|
|
300
|
+
fileName: '',
|
|
301
|
+
fileURL: '',
|
|
302
|
+
mimetype: '',
|
|
303
|
+
})
|
|
304
|
+
);
|
|
305
|
+
handleCloseModal?.();
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
return (
|
|
309
|
+
<FilePreview
|
|
310
|
+
file={file}
|
|
311
|
+
onClose={closeModal}
|
|
312
|
+
onChangeFile={(next) => dispatch(setActiveFile(next))}
|
|
313
|
+
/>
|
|
314
|
+
);
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
interface FilePreviewProps {
|
|
318
|
+
file: ModalFile;
|
|
319
|
+
onClose: () => void;
|
|
320
|
+
/** Another file of the album (siblings and index included). */
|
|
321
|
+
onChangeFile: (file: ModalFile) => void;
|
|
322
|
+
/** After the media viewer's Reply opened a thread. */
|
|
323
|
+
onReplyOpened?: () => void;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* One file, full screen: pictures and videos in the Telegram-style
|
|
328
|
+
* MediaViewer, everything else (documents, PDFs, voice notes) on the
|
|
329
|
+
* plain preview page with the save button in its header.
|
|
330
|
+
*/
|
|
331
|
+
export const FilePreview: React.FC<FilePreviewProps> = ({
|
|
332
|
+
file: activeFile,
|
|
333
|
+
onClose,
|
|
334
|
+
onChangeFile,
|
|
335
|
+
onReplyOpened,
|
|
336
|
+
}) => {
|
|
254
337
|
const t = useT();
|
|
255
338
|
const { config } = useChatSettingState();
|
|
256
339
|
const theme = useTheme();
|
|
@@ -258,16 +341,6 @@ const FilePreviewModal: React.FC<FilePreviewModalProps> = ({
|
|
|
258
341
|
// dark sits them on the secondary surface.
|
|
259
342
|
const cardBackground = theme.dark ? theme.surfaceSecondary : '#FFF8ED';
|
|
260
343
|
|
|
261
|
-
// Cache the SAF directory the user granted so saving several documents
|
|
262
|
-
// in a row doesn't re-prompt for a folder every time (Android only).
|
|
263
|
-
const safDirUriRef = useRef<string | null>(null);
|
|
264
|
-
|
|
265
|
-
const { activeFile } = useSelector(
|
|
266
|
-
(state: RootState) => state.chatSettingStore
|
|
267
|
-
);
|
|
268
|
-
|
|
269
|
-
if (!activeFile) {return null;}
|
|
270
|
-
|
|
271
344
|
// Bug #40: prefer the sender's original name over the server's stored
|
|
272
345
|
// hash name everywhere this modal shows or saves/shares the file.
|
|
273
346
|
// Sanitized so it's safe to use as an actual path segment (strips path
|
|
@@ -281,154 +354,8 @@ const FilePreviewModal: React.FC<FilePreviewModalProps> = ({
|
|
|
281
354
|
})
|
|
282
355
|
);
|
|
283
356
|
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
if (!MediaLibrary?.requestPermissionsAsync) {return false;}
|
|
287
|
-
try {
|
|
288
|
-
const { status } = await MediaLibrary.requestPermissionsAsync();
|
|
289
|
-
return status === 'granted';
|
|
290
|
-
} catch (error) {
|
|
291
|
-
console.error('Error requesting permission:', error);
|
|
292
|
-
return false;
|
|
293
|
-
}
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
const saveToGallery = async () => {
|
|
297
|
-
const hasPermission = await requestStoragePermission();
|
|
298
|
-
if (!hasPermission) {
|
|
299
|
-
Alert.alert(
|
|
300
|
-
'Permission Denied',
|
|
301
|
-
'Storage permission is required to save files to the gallery.'
|
|
302
|
-
);
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
try {
|
|
307
|
-
const filePath = FileSystem.cacheDirectory + displayFileName;
|
|
308
|
-
const download = await fetchToCache(activeFile.fileURL, filePath);
|
|
309
|
-
|
|
310
|
-
if (download.status === 200) {
|
|
311
|
-
await getMediaLibrary()?.saveToLibraryAsync(download.uri);
|
|
312
|
-
showToast({
|
|
313
|
-
id: Date.now().toString(),
|
|
314
|
-
title: t('toast.successTitle'),
|
|
315
|
-
message: t('toast.saveSuccessful'),
|
|
316
|
-
type: 'success',
|
|
317
|
-
});
|
|
318
|
-
} else {
|
|
319
|
-
Alert.alert('Error', 'Failed to save the file.');
|
|
320
|
-
}
|
|
321
|
-
} catch (err) {
|
|
322
|
-
Alert.alert('Error', `Failed to save the file: ${displayFileName}`);
|
|
323
|
-
}
|
|
324
|
-
};
|
|
325
|
-
|
|
326
|
-
// Best-effort existing-name lookup for the Android SAF branch below: SAF
|
|
327
|
-
// hands back content URIs, not plain names, so this decodes each one and
|
|
328
|
-
// takes its last path segment. If the provider's URI shape doesn't match
|
|
329
|
-
// what we expect, we fail open (empty set) rather than block the save -
|
|
330
|
-
// worst case we skip de-duplication, we never crash the save flow.
|
|
331
|
-
const listSafDirectoryNames = async (
|
|
332
|
-
saf: any,
|
|
333
|
-
dirUri: string
|
|
334
|
-
): Promise<Set<string>> => {
|
|
335
|
-
try {
|
|
336
|
-
const uris: string[] = await saf.readDirectoryAsync(dirUri);
|
|
337
|
-
const names = uris.map((uri) => {
|
|
338
|
-
try {
|
|
339
|
-
const decoded = decodeURIComponent(uri);
|
|
340
|
-
const last = decoded.split('/').pop() || '';
|
|
341
|
-
return last.includes(':') ? last.split(':').pop() || '' : last;
|
|
342
|
-
} catch {
|
|
343
|
-
return '';
|
|
344
|
-
}
|
|
345
|
-
});
|
|
346
|
-
return new Set(names.filter(Boolean));
|
|
347
|
-
} catch {
|
|
348
|
-
return new Set<string>();
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
|
|
352
|
-
const saveFileToDownloads = async () => {
|
|
353
|
-
try {
|
|
354
|
-
const filePath = FileSystem.cacheDirectory + displayFileName;
|
|
355
|
-
const download = await fetchToCache(activeFile.fileURL, filePath);
|
|
356
|
-
|
|
357
|
-
if (download.status !== 200) {
|
|
358
|
-
Alert.alert('Error', 'Failed to save the file.');
|
|
359
|
-
return;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
if (Platform.OS === 'android') {
|
|
363
|
-
const saf = (FileSystem as any).StorageAccessFramework;
|
|
364
|
-
let dirUri = safDirUriRef.current;
|
|
365
|
-
if (!dirUri) {
|
|
366
|
-
const perm = await saf.requestDirectoryPermissionsAsync();
|
|
367
|
-
if (!perm.granted) {
|
|
368
|
-
Alert.alert(
|
|
369
|
-
'Permission Denied',
|
|
370
|
-
'Storage permission is required to save the file.'
|
|
371
|
-
);
|
|
372
|
-
return;
|
|
373
|
-
}
|
|
374
|
-
dirUri = perm.directoryUri;
|
|
375
|
-
safDirUriRef.current = dirUri;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
// Avoid silently overwriting a different attachment that happens
|
|
379
|
-
// to share the same display name (common now that we prefer the
|
|
380
|
-
// human-picked name over the unique server hash - bug #40) by
|
|
381
|
-
// suffixing " (1)", " (2)", ... on a collision.
|
|
382
|
-
const existingNames = await listSafDirectoryNames(saf, dirUri as string);
|
|
383
|
-
const uniqueName = await getUniqueFileName(
|
|
384
|
-
displayFileName,
|
|
385
|
-
async (candidate) => existingNames.has(candidate)
|
|
386
|
-
);
|
|
387
|
-
const baseName = uniqueName.replace(/\.[^/.]+$/, '');
|
|
388
|
-
const mime = activeFile.mimetype || 'application/octet-stream';
|
|
389
|
-
const base64 = await FileSystem.readAsStringAsync(download.uri, {
|
|
390
|
-
encoding: FileSystem.EncodingType.Base64,
|
|
391
|
-
});
|
|
392
|
-
const destUri = await saf.createFileAsync(dirUri, baseName, mime);
|
|
393
|
-
await FileSystem.writeAsStringAsync(destUri, base64, {
|
|
394
|
-
encoding: FileSystem.EncodingType.Base64,
|
|
395
|
-
});
|
|
396
|
-
|
|
397
|
-
showToast({
|
|
398
|
-
id: Date.now().toString(),
|
|
399
|
-
title: t('toast.successTitle'),
|
|
400
|
-
message: t('toast.saveSuccessful'),
|
|
401
|
-
type: 'success',
|
|
402
|
-
});
|
|
403
|
-
return;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
// iOS (and any non-Android): there is no app-writable "Downloads"
|
|
407
|
-
// folder, and MediaLibrary only accepts images/videos — which is why
|
|
408
|
-
// documents previously hit the success toast without ever being
|
|
409
|
-
// saved. Present the system share sheet so the user can "Save to
|
|
410
|
-
// Files", AirDrop, etc. The sheet itself is the confirmation (the
|
|
411
|
-
// user may cancel), so we don't show a "Save successful" toast here.
|
|
412
|
-
await Share.share({
|
|
413
|
-
url: download.uri,
|
|
414
|
-
title: displayFileName,
|
|
415
|
-
});
|
|
416
|
-
} catch (err) {
|
|
417
|
-
console.error('Error saving file:', err);
|
|
418
|
-
Alert.alert('Error', 'Failed to save the file.');
|
|
419
|
-
}
|
|
420
|
-
};
|
|
421
|
-
|
|
422
|
-
const saveClick = async () => {
|
|
423
|
-
if (
|
|
424
|
-
activeFile.mimetype.startsWith('image/') ||
|
|
425
|
-
activeFile.mimetype.startsWith('video/')
|
|
426
|
-
) {
|
|
427
|
-
await saveToGallery();
|
|
428
|
-
} else {
|
|
429
|
-
await saveFileToDownloads();
|
|
430
|
-
}
|
|
431
|
-
};
|
|
357
|
+
const saveFile = useSaveFile();
|
|
358
|
+
const saveClick = () => saveFile(activeFile);
|
|
432
359
|
|
|
433
360
|
// An album opens with its siblings; the viewer pages through them.
|
|
434
361
|
const albumSize = activeFile.siblings?.length ?? 0;
|
|
@@ -436,21 +363,24 @@ const FilePreviewModal: React.FC<FilePreviewModalProps> = ({
|
|
|
436
363
|
const goToSibling = (next: number) => {
|
|
437
364
|
const target = activeFile.siblings?.[next];
|
|
438
365
|
if (!target) {return;}
|
|
439
|
-
|
|
440
|
-
setActiveFile({ ...target, siblings: activeFile.siblings, index: next })
|
|
441
|
-
);
|
|
366
|
+
onChangeFile({ ...target, siblings: activeFile.siblings, index: next });
|
|
442
367
|
};
|
|
368
|
+
const closeModal = onClose;
|
|
443
369
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
370
|
+
if (
|
|
371
|
+
activeFile.mimetype.startsWith('image/') ||
|
|
372
|
+
activeFile.mimetype.startsWith('video/')
|
|
373
|
+
) {
|
|
374
|
+
return (
|
|
375
|
+
<MediaViewer
|
|
376
|
+
file={activeFile}
|
|
377
|
+
onClose={onClose}
|
|
378
|
+
onPage={goToSibling}
|
|
379
|
+
onSave={saveClick}
|
|
380
|
+
onReplyOpened={onReplyOpened}
|
|
381
|
+
/>
|
|
451
382
|
);
|
|
452
|
-
|
|
453
|
-
};
|
|
383
|
+
}
|
|
454
384
|
|
|
455
385
|
// NOTE: plain computed value, NOT useMemo. It sits AFTER the
|
|
456
386
|
// `if (!activeFile) return` guard above, so as a hook it would run
|