@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
|
@@ -8,6 +8,21 @@ import {
|
|
|
8
8
|
setOutgoingCallToken,
|
|
9
9
|
} from '../roomStore/callSlice';
|
|
10
10
|
import { getGlobalXmppClient } from '../utils/clientRegistry';
|
|
11
|
+
import {
|
|
12
|
+
decideIncomingWhileBusy,
|
|
13
|
+
isCallRoomTypeAllowed,
|
|
14
|
+
parseCallTokenAttrs,
|
|
15
|
+
} from '../calls/callMode';
|
|
16
|
+
import { busySnapshot } from '../calls/callBusy';
|
|
17
|
+
import { isSystemAccountSender } from '../calls/senderTrust';
|
|
18
|
+
import { looksLikeRawRoomName, safeCallName } from '../calls/callDisplay';
|
|
19
|
+
import { P2P_SIGNAL_TYPE } from '../calls/p2p/signalStanza';
|
|
20
|
+
import { handleP2PSignalStanza } from '../calls/p2p/p2pRuntime';
|
|
21
|
+
import { isP2PAvailable } from '../calls/p2p/webrtcRuntime';
|
|
22
|
+
import {
|
|
23
|
+
reportCallDeclined,
|
|
24
|
+
reportCallEnded,
|
|
25
|
+
} from './api-requests/callState.api';
|
|
11
26
|
import { callStateHasLogData } from '../helpers/callLogMessage';
|
|
12
27
|
import { pushLog } from '../utils/devLogger';
|
|
13
28
|
|
|
@@ -57,6 +72,33 @@ const consumeKindHint = (
|
|
|
57
72
|
|
|
58
73
|
const MAX_CALL_TOKEN_AGE_MS = 5000;
|
|
59
74
|
|
|
75
|
+
// XMPP domain of this session (the client's own JID domain, else the host).
|
|
76
|
+
const sessionXmppDomain = (): string => {
|
|
77
|
+
const client = getGlobalXmppClient() as any;
|
|
78
|
+
return String(client?.client?.jid?.getDomain?.() || client?.host || '');
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const isTrueishAttr = (value: unknown): boolean => {
|
|
82
|
+
const text = String(value ?? '').trim().toLowerCase();
|
|
83
|
+
return text === 'true' || text === '1';
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// Display name of a user we only know by xmpp username (p2p tokens carry no
|
|
87
|
+
// JWT, so no caller name), from the enriched usersSet.
|
|
88
|
+
const lookupUserName = (xmppUsername: string | null): string => {
|
|
89
|
+
if (!xmppUsername) {return '';}
|
|
90
|
+
const usersSet = (store.getState().rooms.usersSet || {}) as Record<
|
|
91
|
+
string,
|
|
92
|
+
{ firstName?: string; lastName?: string; name?: string }
|
|
93
|
+
>;
|
|
94
|
+
const user = usersSet[xmppUsername] || usersSet[xmppUsername.split('@')[0]];
|
|
95
|
+
if (!user) {return '';}
|
|
96
|
+
return (
|
|
97
|
+
`${user.firstName || ''} ${user.lastName || ''}`.trim() ||
|
|
98
|
+
String(user.name || '').trim()
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
|
|
60
102
|
// Dev-only trace of call signalling: which `<data type="call-*">` frames
|
|
61
103
|
// arrive and why a call-token was dropped. A dropped token is silent
|
|
62
104
|
// otherwise: the caller sits on "Calling..." and the callee never rings.
|
|
@@ -309,8 +351,11 @@ const handleCallStateData = (
|
|
|
309
351
|
!!stanzaCallId &&
|
|
310
352
|
!!currentCall.callId &&
|
|
311
353
|
currentCall.callId === stanzaCallId;
|
|
312
|
-
|
|
313
|
-
|
|
354
|
+
// A signal that names a DIFFERENT call than the one on screen (e.g. the
|
|
355
|
+
// server log of the previous call in the same room arriving late) must not
|
|
356
|
+
// tear down the current one just because the room matches.
|
|
357
|
+
const callIdConflicts =
|
|
358
|
+
!!stanzaCallId && !!currentCall.callId && currentCall.callId !== stanzaCallId;
|
|
314
359
|
|
|
315
360
|
const isTerminalState =
|
|
316
361
|
state === 'ended' ||
|
|
@@ -324,7 +369,10 @@ const handleCallStateData = (
|
|
|
324
369
|
// itself a "session concluded" signal.
|
|
325
370
|
const isServerCallLog = !state && callStateHasLogData(data.attrs || {});
|
|
326
371
|
|
|
327
|
-
if (
|
|
372
|
+
if (
|
|
373
|
+
(callIdMatches || (roomMatches && !callIdConflicts)) &&
|
|
374
|
+
(isTerminalState || isServerCallLog)
|
|
375
|
+
) {
|
|
328
376
|
store.dispatch(endCall());
|
|
329
377
|
}
|
|
330
378
|
};
|
|
@@ -383,7 +431,15 @@ export const onCallTokenMessage = (stanza: Element): boolean => {
|
|
|
383
431
|
.split('/')[0]
|
|
384
432
|
.split('@')[0]
|
|
385
433
|
.trim();
|
|
386
|
-
|
|
434
|
+
const declinedInGroup =
|
|
435
|
+
String(data.attrs?.state || '').toLowerCase() === 'declined' &&
|
|
436
|
+
isTrueishAttr(data.attrs?.group);
|
|
437
|
+
if (!declinedInGroup) {
|
|
438
|
+
// The state / callId / room live on the <data> element, not on the
|
|
439
|
+
// <message> wrapper. This used to be handed `inner`, which made every
|
|
440
|
+
// client call-state signal and server call-log a no-op here.
|
|
441
|
+
handleCallStateData(data, fromRoom);
|
|
442
|
+
}
|
|
387
443
|
|
|
388
444
|
// Server call-logs (carry callerXmppUsername / durationMs) should
|
|
389
445
|
// flow on to onRealtimeMessage / onMessageHistory where they become
|
|
@@ -396,13 +452,6 @@ export const onCallTokenMessage = (stanza: Element): boolean => {
|
|
|
396
452
|
return true;
|
|
397
453
|
}
|
|
398
454
|
|
|
399
|
-
if (dataType === 'call-state-declined') {
|
|
400
|
-
handleCallStateData({
|
|
401
|
-
attrs: { ...data.attrs, state: 'declined' },
|
|
402
|
-
} as unknown as Element);
|
|
403
|
-
return true;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
455
|
if (dataType === 'call-invite') {
|
|
407
456
|
const inviteKind = String(data.attrs?.kind || '').toLowerCase();
|
|
408
457
|
const normalized: 'audio' | 'video' =
|
|
@@ -430,6 +479,39 @@ export const onCallTokenMessage = (stanza: Element): boolean => {
|
|
|
430
479
|
return true;
|
|
431
480
|
}
|
|
432
481
|
|
|
482
|
+
if (dataType === P2P_SIGNAL_TYPE) {
|
|
483
|
+
// Peer to peer WebRTC signalling (offer / answer / candidate / end).
|
|
484
|
+
// Routed to the p2p runtime, never to the chat pipeline.
|
|
485
|
+
if (store.getState().chatSettingStore.config?.videoCalls?.enabled === true) {
|
|
486
|
+
handleP2PSignalStanza(inner);
|
|
487
|
+
}
|
|
488
|
+
return true;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
if (dataType === 'call-state-declined') {
|
|
492
|
+
// Server relay of a callee's decline. In a group call one member
|
|
493
|
+
// declining must not end the call for everybody, so it is ignored there.
|
|
494
|
+
// For 1:1 it is a terminal state, same as the client-sent `declined`.
|
|
495
|
+
if (isTrueishAttr(data.attrs?.group)) {
|
|
496
|
+
callTrace('group member declined', {
|
|
497
|
+
by: data.attrs?.by,
|
|
498
|
+
callId: data.attrs?.callId,
|
|
499
|
+
});
|
|
500
|
+
return true;
|
|
501
|
+
}
|
|
502
|
+
const fromRoom = String(stanza.attrs?.from || '')
|
|
503
|
+
.split('/')[0]
|
|
504
|
+
.split('@')[0]
|
|
505
|
+
.trim();
|
|
506
|
+
handleCallStateData(
|
|
507
|
+
({
|
|
508
|
+
attrs: { ...(data.attrs || {}), state: 'declined' },
|
|
509
|
+
} as unknown) as Element,
|
|
510
|
+
fromRoom
|
|
511
|
+
);
|
|
512
|
+
return true;
|
|
513
|
+
}
|
|
514
|
+
|
|
433
515
|
if (dataType === 'call-token') {
|
|
434
516
|
const videoCallsConfig =
|
|
435
517
|
store.getState().chatSettingStore.config?.videoCalls;
|
|
@@ -442,47 +524,88 @@ export const onCallTokenMessage = (stanza: Element): boolean => {
|
|
|
442
524
|
return true;
|
|
443
525
|
}
|
|
444
526
|
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
const
|
|
448
|
-
|
|
449
|
-
|
|
527
|
+
// Old servers send neither `mode` nor `group`: parseCallTokenAttrs maps
|
|
528
|
+
// that to a plain LiveKit 1:1 call, exactly the legacy behaviour.
|
|
529
|
+
const attrs = parseCallTokenAttrs(data.attrs);
|
|
530
|
+
// livekitUrl and ice decide where the media goes, and callerName /
|
|
531
|
+
// caller decide who the ring screen says is calling, so they are
|
|
532
|
+
// honoured only from the app's system account (see calls/senderTrust).
|
|
533
|
+
// Anything else keeps the stanza but loses those attributes: the callee
|
|
534
|
+
// then uses config.videoCalls.livekitUrl, GET /v1/calls/ice-servers and
|
|
535
|
+
// the name it can work out locally.
|
|
536
|
+
if (
|
|
537
|
+
(attrs.livekitUrl ||
|
|
538
|
+
attrs.iceServers ||
|
|
539
|
+
attrs.callerName ||
|
|
540
|
+
attrs.caller) &&
|
|
541
|
+
!isSystemAccountSender(inner.attrs?.from, sessionXmppDomain())
|
|
542
|
+
) {
|
|
543
|
+
callTrace(
|
|
544
|
+
'ignoring livekitUrl/ice/callerName/caller on a call-token not sent by the system account',
|
|
545
|
+
{ from: inner.attrs?.from }
|
|
546
|
+
);
|
|
547
|
+
attrs.livekitUrl = null;
|
|
548
|
+
attrs.iceServers = null;
|
|
549
|
+
attrs.callerName = '';
|
|
550
|
+
attrs.caller = null;
|
|
551
|
+
}
|
|
552
|
+
const { token, mode, group, room: stanzaRoom } = attrs;
|
|
553
|
+
const isP2P = mode === 'p2p';
|
|
554
|
+
const stanzaCallId = attrs.callId;
|
|
450
555
|
// Server doesn't propagate `kind` on the broadcast stanza, so first
|
|
451
556
|
// look for a client-side `call-invite` hint we stashed when the
|
|
452
557
|
// dialer signaled us directly. Falls back to whatever the server
|
|
453
558
|
// happens to attach, finally to video (legacy default).
|
|
454
559
|
const hintedKind = consumeKindHint([stanzaRoom, stanzaCallId]);
|
|
455
560
|
const kind: 'audio' | 'video' =
|
|
456
|
-
hintedKind || (
|
|
457
|
-
|
|
561
|
+
hintedKind || (attrs.kind === 'audio' ? 'audio' : 'video');
|
|
562
|
+
// A p2p token is intentionally empty (the media never touches LiveKit);
|
|
563
|
+
// it needs the callId instead, to correlate the signalling.
|
|
564
|
+
if (!stanzaRoom || (isP2P ? !stanzaCallId : !token)) {
|
|
458
565
|
callTrace('drop call-token: no token or room');
|
|
459
566
|
return true;
|
|
460
567
|
}
|
|
461
568
|
|
|
462
569
|
const resolvedRoom = resolveRoomByStanzaRoom(stanzaRoom);
|
|
463
|
-
const allowedRoomTypes = videoCallsConfig.allowedRoomTypes || ['private'];
|
|
464
570
|
const usersCnt = Number(resolvedRoom?.usersCnt || 0);
|
|
465
571
|
const isOneToOneLikeRoom = usersCnt > 0 && usersCnt <= 2;
|
|
466
|
-
const
|
|
467
|
-
if (
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
!
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
572
|
+
const allowedRoomTypes = videoCallsConfig.allowedRoomTypes;
|
|
573
|
+
if (group) {
|
|
574
|
+
// Group room call (always LiveKit). The host may opt out through
|
|
575
|
+
// allowedRoomTypes; a room we know to be private contradicts `group`.
|
|
576
|
+
if (!isCallRoomTypeAllowed('group', allowedRoomTypes)) {
|
|
577
|
+
callTrace('drop call-token: group calls not allowed');
|
|
578
|
+
return true;
|
|
579
|
+
}
|
|
580
|
+
if (resolvedRoom?.type === 'private') {
|
|
581
|
+
callTrace('drop call-token: group flag on a private room');
|
|
582
|
+
return true;
|
|
583
|
+
}
|
|
584
|
+
} else {
|
|
585
|
+
const isPrivateAllowed = isCallRoomTypeAllowed(
|
|
586
|
+
'private',
|
|
587
|
+
allowedRoomTypes
|
|
588
|
+
);
|
|
589
|
+
if (
|
|
590
|
+
resolvedRoom?.type &&
|
|
591
|
+
resolvedRoom.type !== 'private' &&
|
|
592
|
+
!isOneToOneLikeRoom
|
|
593
|
+
) {
|
|
594
|
+
callTrace('drop call-token: room type', { type: resolvedRoom.type, usersCnt });
|
|
595
|
+
return true;
|
|
596
|
+
}
|
|
597
|
+
if (resolvedRoom?.type === 'private' && !isPrivateAllowed) {
|
|
598
|
+
callTrace('drop call-token: private not allowed');
|
|
599
|
+
return true;
|
|
600
|
+
}
|
|
601
|
+
if (
|
|
602
|
+
!resolvedRoom?.type &&
|
|
603
|
+
!stanzaRoom.includes('@') &&
|
|
604
|
+
!isOneToOneLikeRoom
|
|
605
|
+
) {
|
|
606
|
+
callTrace('drop call-token: room unknown', { stanzaRoom });
|
|
607
|
+
return true;
|
|
608
|
+
}
|
|
486
609
|
}
|
|
487
610
|
|
|
488
611
|
const roomJid =
|
|
@@ -491,8 +614,11 @@ export const onCallTokenMessage = (stanza: Element): boolean => {
|
|
|
491
614
|
// ring screen, the server populates it with the caller's full name
|
|
492
615
|
// ("Roman Test") which is far more useful than the resolved room
|
|
493
616
|
// title (which for stale / deleted-peer chats reads "deleted").
|
|
494
|
-
|
|
495
|
-
const
|
|
617
|
+
// A p2p token has no JWT, and in a group the ring should name the room.
|
|
618
|
+
const jwtPayload = isP2P ? null : decodeJwtPayload(token);
|
|
619
|
+
const jwtName = group
|
|
620
|
+
? ''
|
|
621
|
+
: safeCallName(extractCallerDisplayName(jwtPayload)) || '';
|
|
496
622
|
// `title` is the display name; on new-arch private rooms `name` is the
|
|
497
623
|
// bare room id ("${appId}_<a>-${appId}_<b>"), never something to show.
|
|
498
624
|
const resolvedTitle = String(
|
|
@@ -503,23 +629,81 @@ export const onCallTokenMessage = (stanza: Element): boolean => {
|
|
|
503
629
|
resolvedTitle === stanzaRoom ||
|
|
504
630
|
['deleted', 'deleted user', 'unknown', 'null'].includes(
|
|
505
631
|
resolvedTitle.toLowerCase()
|
|
506
|
-
)
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
632
|
+
) ||
|
|
633
|
+
looksLikeRawRoomName(resolvedTitle);
|
|
634
|
+
const selfXmpp =
|
|
635
|
+
store.getState().chatSettingStore.user?.xmppUsername || '';
|
|
636
|
+
// Group rooms have no single peer; a "<a>-<b>" name there is a coincidence.
|
|
637
|
+
const peerXmppUsername = group
|
|
638
|
+
? null
|
|
639
|
+
: derivePeerXmppUsername(stanzaRoom, selfXmpp) || attrs.caller;
|
|
640
|
+
const peerName = titleLooksBad ? lookupUserName(peerXmppUsername) : '';
|
|
641
|
+
// What the call is called on screen. A person's name is preferred; a
|
|
642
|
+
// raw chat name (two joined JIDs) is never used, an empty result makes
|
|
643
|
+
// the UI show a neutral label. In a group the call is the ROOM, and the
|
|
644
|
+
// caller is carried separately (callerName) for the "X is calling in Y"
|
|
645
|
+
// line.
|
|
646
|
+
const incomingRoomName = group
|
|
647
|
+
? (titleLooksBad ? '' : resolvedTitle) || safeCallName(stanzaRoom) || ''
|
|
648
|
+
: attrs.callerName ||
|
|
649
|
+
jwtName ||
|
|
650
|
+
(titleLooksBad ? '' : resolvedTitle) ||
|
|
651
|
+
safeCallName(peerName) ||
|
|
652
|
+
safeCallName(stanzaRoom) ||
|
|
653
|
+
'';
|
|
511
654
|
if (!roomJid) {
|
|
512
655
|
callTrace('drop call-token: no room jid', { stanzaRoom });
|
|
513
656
|
return true;
|
|
514
657
|
}
|
|
515
658
|
|
|
516
659
|
const callId = extractCallId(data, jwtPayload);
|
|
517
|
-
|
|
518
|
-
store.getState().chatSettingStore.user?.xmppUsername || '';
|
|
519
|
-
const peerXmppUsername = derivePeerXmppUsername(stanzaRoom, selfXmpp);
|
|
660
|
+
if (isP2P && !callId) {return true;}
|
|
520
661
|
|
|
521
662
|
const callState = store.getState().call;
|
|
663
|
+
|
|
664
|
+
if (isP2P || callState.mode === 'p2p') {
|
|
665
|
+
// Peer to peer (or an active p2p call): one call at a time, decided
|
|
666
|
+
// by callId. The legacy LiveKit-over-LiveKit path below is untouched.
|
|
667
|
+
if (isP2P && !isP2PAvailable()) {
|
|
668
|
+
// This device cannot take the call (the WebRTC package is not
|
|
669
|
+
// installed); tell the caller instead of leaving them ringing.
|
|
670
|
+
callTrace('decline p2p call-token: WebRTC unavailable', { callId });
|
|
671
|
+
reportCallDeclined(callId);
|
|
672
|
+
return true;
|
|
673
|
+
}
|
|
674
|
+
const decision = decideIncomingWhileBusy(busySnapshot(callState), {
|
|
675
|
+
mode,
|
|
676
|
+
callId,
|
|
677
|
+
roomBareName: stanzaRoom,
|
|
678
|
+
});
|
|
679
|
+
if (decision === 'duplicate' || decision === 'glare-keep') {
|
|
680
|
+
callTrace(`drop call-token: ${decision}`, { callId });
|
|
681
|
+
return true;
|
|
682
|
+
}
|
|
683
|
+
if (decision === 'busy') {
|
|
684
|
+
callTrace('decline call-token: busy', { callId });
|
|
685
|
+
if (isP2P) {
|
|
686
|
+
reportCallDeclined(callId);
|
|
687
|
+
if (peerXmppUsername) {
|
|
688
|
+
sendCallStateSignal('declined', {
|
|
689
|
+
peerXmppUsername,
|
|
690
|
+
callId,
|
|
691
|
+
roomBareName: stanzaRoom,
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
return true;
|
|
696
|
+
}
|
|
697
|
+
if (decision === 'glare-yield') {
|
|
698
|
+
// We both dialled at once and the other call has the smaller id:
|
|
699
|
+
// drop ours (the other side keeps theirs and ignores our token).
|
|
700
|
+
sendCallStateSignal('cancelled');
|
|
701
|
+
reportCallEnded(callState.callId);
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
|
|
522
705
|
const isOutgoingRoomMatch =
|
|
706
|
+
!isP2P &&
|
|
523
707
|
callState.direction === 'outgoing' &&
|
|
524
708
|
(callState.roomJid === roomJid ||
|
|
525
709
|
callState.roomName === incomingRoomName ||
|
|
@@ -529,10 +713,17 @@ export const onCallTokenMessage = (stanza: Element): boolean => {
|
|
|
529
713
|
outgoing: isOutgoingRoomMatch,
|
|
530
714
|
roomJid,
|
|
531
715
|
callId,
|
|
716
|
+
mode,
|
|
717
|
+
group,
|
|
532
718
|
});
|
|
533
719
|
if (isOutgoingRoomMatch) {
|
|
534
720
|
store.dispatch(
|
|
535
|
-
setOutgoingCallToken({
|
|
721
|
+
setOutgoingCallToken({
|
|
722
|
+
roomJid,
|
|
723
|
+
token,
|
|
724
|
+
callId: callId || null,
|
|
725
|
+
livekitUrl: attrs.livekitUrl,
|
|
726
|
+
})
|
|
536
727
|
);
|
|
537
728
|
return true;
|
|
538
729
|
}
|
|
@@ -556,6 +747,12 @@ export const onCallTokenMessage = (stanza: Element): boolean => {
|
|
|
556
747
|
kind,
|
|
557
748
|
callId: callId || null,
|
|
558
749
|
peerXmppUsername: peerXmppUsername || null,
|
|
750
|
+
mode,
|
|
751
|
+
isGroup: group,
|
|
752
|
+
iceServers: attrs.iceServers,
|
|
753
|
+
livekitUrl: attrs.livekitUrl,
|
|
754
|
+
callerName: attrs.callerName || null,
|
|
755
|
+
callerXmppUsername: attrs.caller,
|
|
559
756
|
})
|
|
560
757
|
);
|
|
561
758
|
return true;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { PayloadAction, createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
import type { CallMode, IceServerConfig } from '../calls/callMode';
|
|
3
|
+
import { safeCallName } from '../calls/callDisplay';
|
|
2
4
|
|
|
3
5
|
export type CallPhase =
|
|
4
6
|
| 'idle'
|
|
@@ -33,6 +35,23 @@ export interface CallState {
|
|
|
33
35
|
// When the call actually connected (phase -> 'in-call'). Null until then.
|
|
34
36
|
// Used to compute a duration for the local "call ended" log fallback.
|
|
35
37
|
connectedAt: number | null;
|
|
38
|
+
// Transport of this call. `livekit` is the legacy path (and the only one for
|
|
39
|
+
// group rooms); `p2p` is our own WebRTC peer connection for 1:1. Decided by
|
|
40
|
+
// the server (create response for the caller, call-token `mode` for the
|
|
41
|
+
// callee), defaults to livekit so older servers behave exactly as before.
|
|
42
|
+
mode: CallMode;
|
|
43
|
+
// Group room call (always LiveKit): more than two participants, so the
|
|
44
|
+
// session must not assume the call is over when one remote participant leaves.
|
|
45
|
+
isGroup: boolean;
|
|
46
|
+
// Public LiveKit wss URL the server reported in the create response or on
|
|
47
|
+
// the call-token. Wins over config.videoCalls.livekitUrl when present.
|
|
48
|
+
livekitUrl: string | null;
|
|
49
|
+
// ICE servers (STUN/TURN with ephemeral credentials) for a p2p call.
|
|
50
|
+
iceServers: IceServerConfig[] | null;
|
|
51
|
+
// Who is calling, from the call-token (system account only). roomName is the
|
|
52
|
+
// name shown for the call; for a group it is the room, and this is the person.
|
|
53
|
+
callerName: string | null;
|
|
54
|
+
callerXmppUsername: string | null;
|
|
36
55
|
}
|
|
37
56
|
|
|
38
57
|
const initialState: CallState = {
|
|
@@ -48,6 +67,12 @@ const initialState: CallState = {
|
|
|
48
67
|
error: null,
|
|
49
68
|
startedAt: null,
|
|
50
69
|
connectedAt: null,
|
|
70
|
+
mode: 'livekit',
|
|
71
|
+
isGroup: false,
|
|
72
|
+
livekitUrl: null,
|
|
73
|
+
iceServers: null,
|
|
74
|
+
callerName: null,
|
|
75
|
+
callerXmppUsername: null,
|
|
51
76
|
};
|
|
52
77
|
|
|
53
78
|
const resetState = (): CallState => ({ ...initialState });
|
|
@@ -64,13 +89,16 @@ const callSlice = createSlice({
|
|
|
64
89
|
roomBareName?: string | null;
|
|
65
90
|
kind?: CallKind;
|
|
66
91
|
peerXmppUsername?: string | null;
|
|
92
|
+
isGroup?: boolean;
|
|
67
93
|
}>
|
|
68
94
|
) {
|
|
69
95
|
state.phase = 'requesting';
|
|
70
96
|
state.direction = 'outgoing';
|
|
71
97
|
state.kind = action.payload.kind || 'video';
|
|
72
98
|
state.roomJid = action.payload.roomJid;
|
|
73
|
-
|
|
99
|
+
// A raw chat name is never a name: safeCallName drops it, the UI then
|
|
100
|
+
// shows a neutral label.
|
|
101
|
+
state.roomName = safeCallName(action.payload.roomName);
|
|
74
102
|
state.roomBareName =
|
|
75
103
|
action.payload.roomBareName ||
|
|
76
104
|
(action.payload.roomJid || '').split('@')[0] ||
|
|
@@ -81,6 +109,45 @@ const callSlice = createSlice({
|
|
|
81
109
|
state.error = null;
|
|
82
110
|
state.startedAt = Date.now();
|
|
83
111
|
state.connectedAt = null;
|
|
112
|
+
state.mode = 'livekit';
|
|
113
|
+
state.isGroup = action.payload.isGroup === true;
|
|
114
|
+
state.livekitUrl = null;
|
|
115
|
+
state.iceServers = null;
|
|
116
|
+
state.callerName = null;
|
|
117
|
+
state.callerXmppUsername = null;
|
|
118
|
+
},
|
|
119
|
+
// The create response told the caller how the call is carried. Applied
|
|
120
|
+
// only to the very call that asked (startedAt must match), so a late
|
|
121
|
+
// response for a call the user already cancelled cannot leak into the next.
|
|
122
|
+
setOutgoingCallRoute(
|
|
123
|
+
state,
|
|
124
|
+
action: PayloadAction<{
|
|
125
|
+
startedAt: number | null;
|
|
126
|
+
callId: string | null;
|
|
127
|
+
mode: CallMode;
|
|
128
|
+
group?: boolean | null;
|
|
129
|
+
livekitUrl?: string | null;
|
|
130
|
+
iceServers?: IceServerConfig[] | null;
|
|
131
|
+
}>
|
|
132
|
+
) {
|
|
133
|
+
if (state.direction !== 'outgoing') {return;}
|
|
134
|
+
if (action.payload.startedAt !== state.startedAt) {return;}
|
|
135
|
+
// The LiveKit call-token can overtake the HTTP response, so a livekit
|
|
136
|
+
// route may still be applied once the phase has moved on to
|
|
137
|
+
// 'connecting'. A p2p route only makes sense while still dialling.
|
|
138
|
+
if (state.phase !== 'requesting') {
|
|
139
|
+
if (state.phase !== 'connecting' || action.payload.mode !== 'livekit') {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
state.mode = action.payload.mode;
|
|
144
|
+
if (action.payload.callId) {state.callId = action.payload.callId;}
|
|
145
|
+
if (typeof action.payload.group === 'boolean') {
|
|
146
|
+
state.isGroup = action.payload.group;
|
|
147
|
+
}
|
|
148
|
+
state.livekitUrl = action.payload.livekitUrl || null;
|
|
149
|
+
state.iceServers =
|
|
150
|
+
action.payload.mode === 'p2p' ? action.payload.iceServers || [] : null;
|
|
84
151
|
},
|
|
85
152
|
setIncomingCallToken(
|
|
86
153
|
state,
|
|
@@ -92,13 +159,20 @@ const callSlice = createSlice({
|
|
|
92
159
|
kind?: CallKind;
|
|
93
160
|
callId?: string | null;
|
|
94
161
|
peerXmppUsername?: string | null;
|
|
162
|
+
mode?: CallMode;
|
|
163
|
+
isGroup?: boolean;
|
|
164
|
+
iceServers?: IceServerConfig[] | null;
|
|
165
|
+
// LiveKit URL from the call-token stanza; wins over the host config.
|
|
166
|
+
livekitUrl?: string | null;
|
|
167
|
+
callerName?: string | null;
|
|
168
|
+
callerXmppUsername?: string | null;
|
|
95
169
|
}>
|
|
96
170
|
) {
|
|
97
171
|
state.phase = 'ringing-incoming';
|
|
98
172
|
state.direction = 'incoming';
|
|
99
173
|
state.kind = action.payload.kind || 'video';
|
|
100
174
|
state.roomJid = action.payload.roomJid;
|
|
101
|
-
state.roomName = action.payload.roomName
|
|
175
|
+
state.roomName = safeCallName(action.payload.roomName);
|
|
102
176
|
state.roomBareName =
|
|
103
177
|
action.payload.roomBareName ||
|
|
104
178
|
(action.payload.roomJid || '').split('@')[0] ||
|
|
@@ -109,6 +183,12 @@ const callSlice = createSlice({
|
|
|
109
183
|
state.error = null;
|
|
110
184
|
state.startedAt = Date.now();
|
|
111
185
|
state.connectedAt = null;
|
|
186
|
+
state.mode = action.payload.mode || 'livekit';
|
|
187
|
+
state.isGroup = action.payload.isGroup === true;
|
|
188
|
+
state.livekitUrl = action.payload.livekitUrl || null;
|
|
189
|
+
state.iceServers = action.payload.iceServers || null;
|
|
190
|
+
state.callerName = safeCallName(action.payload.callerName);
|
|
191
|
+
state.callerXmppUsername = action.payload.callerXmppUsername || null;
|
|
112
192
|
},
|
|
113
193
|
setOutgoingCallToken(
|
|
114
194
|
state,
|
|
@@ -116,6 +196,7 @@ const callSlice = createSlice({
|
|
|
116
196
|
roomJid: string;
|
|
117
197
|
token: string;
|
|
118
198
|
callId?: string | null;
|
|
199
|
+
livekitUrl?: string | null;
|
|
119
200
|
}>
|
|
120
201
|
) {
|
|
121
202
|
if (state.direction !== 'outgoing') {return;}
|
|
@@ -127,6 +208,8 @@ const callSlice = createSlice({
|
|
|
127
208
|
state.roomJid = action.payload.roomJid;
|
|
128
209
|
state.token = action.payload.token;
|
|
129
210
|
if (action.payload.callId) {state.callId = action.payload.callId;}
|
|
211
|
+
// The stanza's URL, when present, wins over the create response's.
|
|
212
|
+
if (action.payload.livekitUrl) {state.livekitUrl = action.payload.livekitUrl;}
|
|
130
213
|
state.error = null;
|
|
131
214
|
state.startedAt = state.startedAt || Date.now();
|
|
132
215
|
},
|
|
@@ -178,6 +261,7 @@ export const {
|
|
|
178
261
|
startOutgoingCall,
|
|
179
262
|
setIncomingCallToken,
|
|
180
263
|
setOutgoingCallToken,
|
|
264
|
+
setOutgoingCallRoute,
|
|
181
265
|
acceptIncomingCall,
|
|
182
266
|
declineIncomingCall,
|
|
183
267
|
endCall,
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// The app icon badge, kept honest from the device side.
|
|
2
|
+
//
|
|
3
|
+
// The backend sets the badge only on the push it sends, so nothing lowers it
|
|
4
|
+
// once the user reads the messages: opening the app would keep showing the
|
|
5
|
+
// count of the last push. While the app is in the foreground the badge
|
|
6
|
+
// follows the total unread count instead - 0 when everything is read, the
|
|
7
|
+
// real number otherwise - and the server takes over again with its next push.
|
|
8
|
+
//
|
|
9
|
+
// Needs expo-notifications (an optional peer); without it this is a no-op.
|
|
10
|
+
// Hosts that drive the badge themselves set
|
|
11
|
+
// `config.pushNotifications.syncAppBadge: false`.
|
|
12
|
+
|
|
13
|
+
import { AppState } from 'react-native';
|
|
14
|
+
import { store } from '../roomStore';
|
|
15
|
+
import type { IRoom } from '../types/types';
|
|
16
|
+
import { pushLog } from '../utils/devLogger';
|
|
17
|
+
|
|
18
|
+
let installed = false;
|
|
19
|
+
let lastSet: number | null = null;
|
|
20
|
+
let lastRooms: unknown;
|
|
21
|
+
|
|
22
|
+
const loadNotifications = (): any => {
|
|
23
|
+
try {
|
|
24
|
+
return require('expo-notifications');
|
|
25
|
+
} catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const totalUnread = (): number =>
|
|
31
|
+
Object.values(store.getState().rooms?.rooms || {}).reduce(
|
|
32
|
+
(sum, room: IRoom) => sum + (room?.unreadMessages || 0),
|
|
33
|
+
0
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const isEnabled = (): boolean =>
|
|
37
|
+
store.getState().chatSettingStore?.config?.pushNotifications?.syncAppBadge !==
|
|
38
|
+
false;
|
|
39
|
+
|
|
40
|
+
const sync = (): void => {
|
|
41
|
+
if (AppState.currentState !== 'active' || !isEnabled()) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const count = totalUnread();
|
|
45
|
+
if (count === lastSet) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const notifications = loadNotifications();
|
|
49
|
+
if (typeof notifications?.setBadgeCountAsync !== 'function') {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
lastSet = count;
|
|
53
|
+
Promise.resolve(notifications.setBadgeCountAsync(count)).catch((error: unknown) => {
|
|
54
|
+
lastSet = null;
|
|
55
|
+
pushLog('warn', 'push: setting the app badge failed', error);
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const installAppBadgeSync = (): void => {
|
|
60
|
+
if (installed) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
installed = true;
|
|
64
|
+
AppState.addEventListener('change', (next) => {
|
|
65
|
+
if (next === 'active') {
|
|
66
|
+
// A push may have moved the badge while we were away.
|
|
67
|
+
lastSet = null;
|
|
68
|
+
sync();
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
// Only actions that touch the rooms can move the count.
|
|
72
|
+
store.subscribe(() => {
|
|
73
|
+
const rooms = store.getState().rooms?.rooms;
|
|
74
|
+
if (rooms !== lastRooms) {
|
|
75
|
+
lastRooms = rooms;
|
|
76
|
+
sync();
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
sync();
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const __resetAppBadgeForTests = (): void => {
|
|
83
|
+
lastSet = null;
|
|
84
|
+
lastRooms = undefined;
|
|
85
|
+
};
|