@100mslive/react-native-room-kit 1.0.7 → 1.0.8
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/lib/commonjs/HMSRoomSetup.js +4 -1
- package/lib/commonjs/HMSRoomSetup.js.map +1 -1
- package/lib/commonjs/Icons/Chat/assets/chat-on.png +0 -0
- package/lib/commonjs/Icons/Chat/assets/chat-on@2x.png +0 -0
- package/lib/commonjs/Icons/Chat/assets/chat-on@3x.png +0 -0
- package/lib/commonjs/Icons/Chat/index.js +4 -3
- package/lib/commonjs/Icons/Chat/index.js.map +1 -1
- package/lib/commonjs/Icons/NoEntry/assets/no-entry.png +0 -0
- package/lib/commonjs/Icons/NoEntry/assets/no-entry@2x.png +0 -0
- package/lib/commonjs/Icons/NoEntry/assets/no-entry@3x.png +0 -0
- package/lib/commonjs/Icons/NoEntry/index.js +33 -0
- package/lib/commonjs/Icons/NoEntry/index.js.map +1 -0
- package/lib/commonjs/Icons/PauseCircle/assets/pause-circle.png +0 -0
- package/lib/commonjs/Icons/PauseCircle/assets/pause-circle@2x.png +0 -0
- package/lib/commonjs/Icons/PauseCircle/assets/pause-circle@3x.png +0 -0
- package/lib/commonjs/Icons/PauseCircle/index.js +29 -0
- package/lib/commonjs/Icons/PauseCircle/index.js.map +1 -0
- package/lib/commonjs/Icons/Pin/assets/unpin.png +0 -0
- package/lib/commonjs/Icons/Pin/assets/unpin@2x.png +0 -0
- package/lib/commonjs/Icons/Pin/assets/unpin@3x.png +0 -0
- package/lib/commonjs/Icons/Pin/index.js +2 -1
- package/lib/commonjs/Icons/Pin/index.js.map +1 -1
- package/lib/commonjs/Icons/Recording/assets/recording-pause.png +0 -0
- package/lib/commonjs/Icons/Recording/assets/recording-pause@2x.png +0 -0
- package/lib/commonjs/Icons/Recording/assets/recording-pause@3x.png +0 -0
- package/lib/commonjs/Icons/Recording/index.js.map +1 -1
- package/lib/commonjs/Icons/index.js +22 -0
- package/lib/commonjs/Icons/index.js.map +1 -1
- package/lib/commonjs/components/BottomSheet.js.map +1 -1
- package/lib/commonjs/components/Chat/ChatFilterBottomSheet.js +36 -0
- package/lib/commonjs/components/Chat/ChatFilterBottomSheet.js.map +1 -0
- package/lib/commonjs/components/Chat/ChatFilterBottomSheetOpener.js +90 -23
- package/lib/commonjs/components/Chat/ChatFilterBottomSheetOpener.js.map +1 -1
- package/lib/commonjs/components/Chat/ChatFilterItem.js +10 -7
- package/lib/commonjs/components/Chat/ChatFilterItem.js.map +1 -1
- package/lib/commonjs/components/Chat/ChatFilterView.js +54 -45
- package/lib/commonjs/components/Chat/ChatFilterView.js.map +1 -1
- package/lib/commonjs/components/Chat/ChatList.js +13 -6
- package/lib/commonjs/components/Chat/ChatList.js.map +1 -1
- package/lib/commonjs/components/Chat/ChatMessage.js +79 -7
- package/lib/commonjs/components/Chat/ChatMessage.js.map +1 -1
- package/lib/commonjs/components/Chat/ChatMoreActionsModal.js +61 -0
- package/lib/commonjs/components/Chat/ChatMoreActionsModal.js.map +1 -0
- package/lib/commonjs/components/Chat/ChatMoreActionsSheetView.js +63 -0
- package/lib/commonjs/components/Chat/ChatMoreActionsSheetView.js.map +1 -0
- package/lib/commonjs/components/Chat/ChatMoreActionsView.js +83 -0
- package/lib/commonjs/components/Chat/ChatMoreActionsView.js.map +1 -0
- package/lib/commonjs/components/Chat/ChatPaused.js +86 -0
- package/lib/commonjs/components/Chat/ChatPaused.js.map +1 -0
- package/lib/commonjs/components/Chat/MessageOptionsBottomSheet.js +34 -0
- package/lib/commonjs/components/Chat/MessageOptionsBottomSheet.js.map +1 -0
- package/lib/commonjs/components/Chat/MessageOptionsBottomSheetView.js +66 -0
- package/lib/commonjs/components/Chat/MessageOptionsBottomSheetView.js.map +1 -0
- package/lib/commonjs/components/Chat/MessageOptionsView.js +188 -0
- package/lib/commonjs/components/Chat/MessageOptionsView.js.map +1 -0
- package/lib/commonjs/components/Chat/PeerBlockedFromChat.js +47 -0
- package/lib/commonjs/components/Chat/PeerBlockedFromChat.js.map +1 -0
- package/lib/commonjs/components/Chat/PinnedMessages.js +297 -0
- package/lib/commonjs/components/Chat/PinnedMessages.js.map +1 -0
- package/lib/commonjs/components/Chat/index.js +4 -4
- package/lib/commonjs/components/Chat/index.js.map +1 -1
- package/lib/commonjs/components/ChatAndParticipants/ChatAndParticipantsBottomSheet.js.map +1 -1
- package/lib/commonjs/components/ChatAndParticipants/ChatAndParticipantsHeader.js +21 -2
- package/lib/commonjs/components/ChatAndParticipants/ChatAndParticipantsHeader.js.map +1 -1
- package/lib/commonjs/components/ChatAndParticipants/ChatAndParticipantsView.js +3 -1
- package/lib/commonjs/components/ChatAndParticipants/ChatAndParticipantsView.js.map +1 -1
- package/lib/commonjs/components/ChatAndParticipants/ChatView.js +21 -2
- package/lib/commonjs/components/ChatAndParticipants/ChatView.js.map +1 -1
- package/lib/commonjs/components/EndRoomModalContent.js +6 -9
- package/lib/commonjs/components/EndRoomModalContent.js.map +1 -1
- package/lib/commonjs/components/Footer.js.map +1 -1
- package/lib/commonjs/components/GridView.js.map +1 -1
- package/lib/commonjs/components/HLSView.js +8 -6
- package/lib/commonjs/components/HLSView.js.map +1 -1
- package/lib/commonjs/components/HMSBaseButton.js +10 -2
- package/lib/commonjs/components/HMSBaseButton.js.map +1 -1
- package/lib/commonjs/components/HMSDangerButton.js +4 -2
- package/lib/commonjs/components/HMSDangerButton.js.map +1 -1
- package/lib/commonjs/components/HMSHLSMessage.js +86 -1
- package/lib/commonjs/components/HMSHLSMessage.js.map +1 -1
- package/lib/commonjs/components/HMSHLSMessageList.js +2 -2
- package/lib/commonjs/components/HMSHLSMessageList.js.map +1 -1
- package/lib/commonjs/components/HMSHandRaiseNotification.js +6 -3
- package/lib/commonjs/components/HMSHandRaiseNotification.js.map +1 -1
- package/lib/commonjs/components/HMSKeyboardAvoidingView.js +5 -1
- package/lib/commonjs/components/HMSKeyboardAvoidingView.js.map +1 -1
- package/lib/commonjs/components/HMSLiveIndicator.js +2 -6
- package/lib/commonjs/components/HMSLiveIndicator.js.map +1 -1
- package/lib/commonjs/components/HMSLiveViewerCount.js +8 -7
- package/lib/commonjs/components/HMSLiveViewerCount.js.map +1 -1
- package/lib/commonjs/components/HMSLocalScreenshareNotification.js +2 -1
- package/lib/commonjs/components/HMSLocalScreenshareNotification.js.map +1 -1
- package/lib/commonjs/components/HMSNotification.js +31 -4
- package/lib/commonjs/components/HMSNotification.js.map +1 -1
- package/lib/commonjs/components/HMSNotifications.js +9 -2
- package/lib/commonjs/components/HMSNotifications.js.map +1 -1
- package/lib/commonjs/components/HMSOverlayChatView.js +44 -2
- package/lib/commonjs/components/HMSOverlayChatView.js.map +1 -1
- package/lib/commonjs/components/HMSPreviewEditName.js.map +1 -1
- package/lib/commonjs/components/HMSPreviewHLSLiveIndicator.js +2 -6
- package/lib/commonjs/components/HMSPreviewHLSLiveIndicator.js.map +1 -1
- package/lib/commonjs/components/HMSPrimaryButton.js +4 -2
- package/lib/commonjs/components/HMSPrimaryButton.js.map +1 -1
- package/lib/commonjs/components/HMSRecordingIndicator.js +11 -16
- package/lib/commonjs/components/HMSRecordingIndicator.js.map +1 -1
- package/lib/commonjs/components/HMSRoomOptions.js.map +1 -1
- package/lib/commonjs/components/HMSTerminalErrorNotification.js +6 -2
- package/lib/commonjs/components/HMSTerminalErrorNotification.js.map +1 -1
- package/lib/commonjs/components/Header.js.map +1 -1
- package/lib/commonjs/components/LeaveRoomBottomSheet.js +3 -6
- package/lib/commonjs/components/LeaveRoomBottomSheet.js.map +1 -1
- package/lib/commonjs/components/Meeting.js +3 -0
- package/lib/commonjs/components/Meeting.js.map +1 -1
- package/lib/commonjs/components/MeetingScreenContent.js.map +1 -1
- package/lib/commonjs/components/Modals.js +9 -12
- package/lib/commonjs/components/Modals.js.map +1 -1
- package/lib/commonjs/components/Participants/ParticipantsItemOptions.js +5 -1
- package/lib/commonjs/components/Participants/ParticipantsItemOptions.js.map +1 -1
- package/lib/commonjs/components/PeerSettingsModalContent.js.map +1 -1
- package/lib/commonjs/components/PeerVideoTile/PeerVideoTileView.js.map +1 -1
- package/lib/commonjs/components/Preview.js +14 -1
- package/lib/commonjs/components/Preview.js.map +1 -1
- package/lib/commonjs/components/PreviewForRoleChangeModal.js +5 -4
- package/lib/commonjs/components/PreviewForRoleChangeModal.js.map +1 -1
- package/lib/commonjs/components/RoomSettingsModalContent.js +15 -6
- package/lib/commonjs/components/RoomSettingsModalContent.js.map +1 -1
- package/lib/commonjs/components/RoomSettingsModalDebugModeContent.js +2 -4
- package/lib/commonjs/components/RoomSettingsModalDebugModeContent.js.map +1 -1
- package/lib/commonjs/components/WebrtcView.js.map +1 -1
- package/lib/commonjs/hooks-sdk-selectors.js +16 -1
- package/lib/commonjs/hooks-sdk-selectors.js.map +1 -1
- package/lib/commonjs/hooks-sdk.js +27 -1
- package/lib/commonjs/hooks-sdk.js.map +1 -1
- package/lib/commonjs/hooks-util-selectors.js +3 -3
- package/lib/commonjs/hooks-util-selectors.js.map +1 -1
- package/lib/commonjs/hooks-util.js +408 -61
- package/lib/commonjs/hooks-util.js.map +1 -1
- package/lib/commonjs/redux/actionTypes.js +16 -3
- package/lib/commonjs/redux/actionTypes.js.map +1 -1
- package/lib/commonjs/redux/actions/index.js +44 -4
- package/lib/commonjs/redux/actions/index.js.map +1 -1
- package/lib/commonjs/redux/reducers/appState.js +41 -1
- package/lib/commonjs/redux/reducers/appState.js.map +1 -1
- package/lib/commonjs/redux/reducers/chatWindow.js +1 -2
- package/lib/commonjs/redux/reducers/chatWindow.js.map +1 -1
- package/lib/commonjs/redux/reducers/message.js +17 -4
- package/lib/commonjs/redux/reducers/message.js.map +1 -1
- package/lib/commonjs/types.js +1 -0
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils/types.js +3 -0
- package/lib/commonjs/utils/types.js.map +1 -1
- package/lib/commonjs/utils.js +2 -2
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/module/HMSRoomSetup.js +5 -2
- package/lib/module/HMSRoomSetup.js.map +1 -1
- package/lib/module/Icons/Chat/assets/chat-on.png +0 -0
- package/lib/module/Icons/Chat/assets/chat-on@2x.png +0 -0
- package/lib/module/Icons/Chat/assets/chat-on@3x.png +0 -0
- package/lib/module/Icons/Chat/index.js +4 -3
- package/lib/module/Icons/Chat/index.js.map +1 -1
- package/lib/module/Icons/NoEntry/assets/no-entry.png +0 -0
- package/lib/module/Icons/NoEntry/assets/no-entry@2x.png +0 -0
- package/lib/module/Icons/NoEntry/assets/no-entry@3x.png +0 -0
- package/lib/module/Icons/NoEntry/index.js +25 -0
- package/lib/module/Icons/NoEntry/index.js.map +1 -0
- package/lib/module/Icons/PauseCircle/assets/pause-circle.png +0 -0
- package/lib/module/Icons/PauseCircle/assets/pause-circle@2x.png +0 -0
- package/lib/module/Icons/PauseCircle/assets/pause-circle@3x.png +0 -0
- package/lib/module/Icons/PauseCircle/index.js +21 -0
- package/lib/module/Icons/PauseCircle/index.js.map +1 -0
- package/lib/module/Icons/Pin/assets/unpin.png +0 -0
- package/lib/module/Icons/Pin/assets/unpin@2x.png +0 -0
- package/lib/module/Icons/Pin/assets/unpin@3x.png +0 -0
- package/lib/module/Icons/Pin/index.js +2 -1
- package/lib/module/Icons/Pin/index.js.map +1 -1
- package/lib/module/Icons/Recording/assets/recording-pause.png +0 -0
- package/lib/module/Icons/Recording/assets/recording-pause@2x.png +0 -0
- package/lib/module/Icons/Recording/assets/recording-pause@3x.png +0 -0
- package/lib/module/Icons/Recording/index.js.map +1 -1
- package/lib/module/Icons/index.js +2 -0
- package/lib/module/Icons/index.js.map +1 -1
- package/lib/module/components/BottomSheet.js.map +1 -1
- package/lib/module/components/Chat/ChatFilterBottomSheet.js +28 -0
- package/lib/module/components/Chat/ChatFilterBottomSheet.js.map +1 -0
- package/lib/module/components/Chat/ChatFilterBottomSheetOpener.js +93 -26
- package/lib/module/components/Chat/ChatFilterBottomSheetOpener.js.map +1 -1
- package/lib/module/components/Chat/ChatFilterItem.js +11 -8
- package/lib/module/components/Chat/ChatFilterItem.js.map +1 -1
- package/lib/module/components/Chat/ChatFilterView.js +55 -46
- package/lib/module/components/Chat/ChatFilterView.js.map +1 -1
- package/lib/module/components/Chat/ChatList.js +14 -7
- package/lib/module/components/Chat/ChatList.js.map +1 -1
- package/lib/module/components/Chat/ChatMessage.js +81 -9
- package/lib/module/components/Chat/ChatMessage.js.map +1 -1
- package/lib/module/components/Chat/ChatMoreActionsModal.js +53 -0
- package/lib/module/components/Chat/ChatMoreActionsModal.js.map +1 -0
- package/lib/module/components/Chat/ChatMoreActionsSheetView.js +55 -0
- package/lib/module/components/Chat/ChatMoreActionsSheetView.js.map +1 -0
- package/lib/module/components/Chat/ChatMoreActionsView.js +75 -0
- package/lib/module/components/Chat/ChatMoreActionsView.js.map +1 -0
- package/lib/module/components/Chat/ChatPaused.js +77 -0
- package/lib/module/components/Chat/ChatPaused.js.map +1 -0
- package/lib/module/components/Chat/MessageOptionsBottomSheet.js +26 -0
- package/lib/module/components/Chat/MessageOptionsBottomSheet.js.map +1 -0
- package/lib/module/components/Chat/MessageOptionsBottomSheetView.js +58 -0
- package/lib/module/components/Chat/MessageOptionsBottomSheetView.js.map +1 -0
- package/lib/module/components/Chat/MessageOptionsView.js +180 -0
- package/lib/module/components/Chat/MessageOptionsView.js.map +1 -0
- package/lib/module/components/Chat/PeerBlockedFromChat.js +38 -0
- package/lib/module/components/Chat/PeerBlockedFromChat.js.map +1 -0
- package/lib/module/components/Chat/PinnedMessages.js +288 -0
- package/lib/module/components/Chat/PinnedMessages.js.map +1 -0
- package/lib/module/components/Chat/index.js +1 -1
- package/lib/module/components/Chat/index.js.map +1 -1
- package/lib/module/components/ChatAndParticipants/ChatAndParticipantsBottomSheet.js.map +1 -1
- package/lib/module/components/ChatAndParticipants/ChatAndParticipantsHeader.js +24 -5
- package/lib/module/components/ChatAndParticipants/ChatAndParticipantsHeader.js.map +1 -1
- package/lib/module/components/ChatAndParticipants/ChatAndParticipantsView.js +3 -1
- package/lib/module/components/ChatAndParticipants/ChatAndParticipantsView.js.map +1 -1
- package/lib/module/components/ChatAndParticipants/ChatView.js +22 -3
- package/lib/module/components/ChatAndParticipants/ChatView.js.map +1 -1
- package/lib/module/components/EndRoomModalContent.js +6 -9
- package/lib/module/components/EndRoomModalContent.js.map +1 -1
- package/lib/module/components/Footer.js.map +1 -1
- package/lib/module/components/GridView.js.map +1 -1
- package/lib/module/components/HLSView.js +9 -7
- package/lib/module/components/HLSView.js.map +1 -1
- package/lib/module/components/HMSBaseButton.js +10 -2
- package/lib/module/components/HMSBaseButton.js.map +1 -1
- package/lib/module/components/HMSDangerButton.js +4 -2
- package/lib/module/components/HMSDangerButton.js.map +1 -1
- package/lib/module/components/HMSHLSMessage.js +88 -3
- package/lib/module/components/HMSHLSMessage.js.map +1 -1
- package/lib/module/components/HMSHLSMessageList.js +2 -2
- package/lib/module/components/HMSHLSMessageList.js.map +1 -1
- package/lib/module/components/HMSHandRaiseNotification.js +6 -3
- package/lib/module/components/HMSHandRaiseNotification.js.map +1 -1
- package/lib/module/components/HMSKeyboardAvoidingView.js +6 -2
- package/lib/module/components/HMSKeyboardAvoidingView.js.map +1 -1
- package/lib/module/components/HMSLiveIndicator.js +2 -6
- package/lib/module/components/HMSLiveIndicator.js.map +1 -1
- package/lib/module/components/HMSLiveViewerCount.js +8 -7
- package/lib/module/components/HMSLiveViewerCount.js.map +1 -1
- package/lib/module/components/HMSLocalScreenshareNotification.js +2 -1
- package/lib/module/components/HMSLocalScreenshareNotification.js.map +1 -1
- package/lib/module/components/HMSNotification.js +32 -5
- package/lib/module/components/HMSNotification.js.map +1 -1
- package/lib/module/components/HMSNotifications.js +9 -2
- package/lib/module/components/HMSNotifications.js.map +1 -1
- package/lib/module/components/HMSOverlayChatView.js +45 -3
- package/lib/module/components/HMSOverlayChatView.js.map +1 -1
- package/lib/module/components/HMSPreviewEditName.js.map +1 -1
- package/lib/module/components/HMSPreviewHLSLiveIndicator.js +2 -6
- package/lib/module/components/HMSPreviewHLSLiveIndicator.js.map +1 -1
- package/lib/module/components/HMSPrimaryButton.js +4 -2
- package/lib/module/components/HMSPrimaryButton.js.map +1 -1
- package/lib/module/components/HMSRecordingIndicator.js +11 -16
- package/lib/module/components/HMSRecordingIndicator.js.map +1 -1
- package/lib/module/components/HMSRoomOptions.js.map +1 -1
- package/lib/module/components/HMSTerminalErrorNotification.js +6 -2
- package/lib/module/components/HMSTerminalErrorNotification.js.map +1 -1
- package/lib/module/components/Header.js.map +1 -1
- package/lib/module/components/LeaveRoomBottomSheet.js +3 -6
- package/lib/module/components/LeaveRoomBottomSheet.js.map +1 -1
- package/lib/module/components/Meeting.js +4 -1
- package/lib/module/components/Meeting.js.map +1 -1
- package/lib/module/components/MeetingScreenContent.js.map +1 -1
- package/lib/module/components/Modals.js +10 -13
- package/lib/module/components/Modals.js.map +1 -1
- package/lib/module/components/Participants/ParticipantsItemOptions.js +5 -1
- package/lib/module/components/Participants/ParticipantsItemOptions.js.map +1 -1
- package/lib/module/components/PeerSettingsModalContent.js.map +1 -1
- package/lib/module/components/PeerVideoTile/PeerVideoTileView.js.map +1 -1
- package/lib/module/components/Preview.js +13 -2
- package/lib/module/components/Preview.js.map +1 -1
- package/lib/module/components/PreviewForRoleChangeModal.js +5 -4
- package/lib/module/components/PreviewForRoleChangeModal.js.map +1 -1
- package/lib/module/components/RoomSettingsModalContent.js +16 -7
- package/lib/module/components/RoomSettingsModalContent.js.map +1 -1
- package/lib/module/components/RoomSettingsModalDebugModeContent.js +3 -5
- package/lib/module/components/RoomSettingsModalDebugModeContent.js.map +1 -1
- package/lib/module/components/WebrtcView.js.map +1 -1
- package/lib/module/hooks-sdk-selectors.js +12 -0
- package/lib/module/hooks-sdk-selectors.js.map +1 -1
- package/lib/module/hooks-sdk.js +23 -1
- package/lib/module/hooks-sdk.js.map +1 -1
- package/lib/module/hooks-util-selectors.js +3 -3
- package/lib/module/hooks-util-selectors.js.map +1 -1
- package/lib/module/hooks-util.js +398 -62
- package/lib/module/hooks-util.js.map +1 -1
- package/lib/module/redux/actionTypes.js +16 -3
- package/lib/module/redux/actionTypes.js.map +1 -1
- package/lib/module/redux/actions/index.js +36 -2
- package/lib/module/redux/actions/index.js.map +1 -1
- package/lib/module/redux/reducers/appState.js +41 -1
- package/lib/module/redux/reducers/appState.js.map +1 -1
- package/lib/module/redux/reducers/chatWindow.js +1 -2
- package/lib/module/redux/reducers/chatWindow.js.map +1 -1
- package/lib/module/redux/reducers/message.js +17 -4
- package/lib/module/redux/reducers/message.js.map +1 -1
- package/lib/module/types.js +1 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/types.js +3 -0
- package/lib/module/utils/types.js.map +1 -1
- package/lib/module/utils.js +2 -2
- package/lib/module/utils.js.map +1 -1
- package/lib/typescript/HMSRoomSetup.d.ts.map +1 -1
- package/lib/typescript/Icons/Chat/index.d.ts +1 -0
- package/lib/typescript/Icons/Chat/index.d.ts.map +1 -1
- package/lib/typescript/Icons/NoEntry/index.d.ts +7 -0
- package/lib/typescript/Icons/NoEntry/index.d.ts.map +1 -0
- package/lib/typescript/Icons/PauseCircle/index.d.ts +7 -0
- package/lib/typescript/Icons/PauseCircle/index.d.ts.map +1 -0
- package/lib/typescript/Icons/Pin/index.d.ts +1 -0
- package/lib/typescript/Icons/Pin/index.d.ts.map +1 -1
- package/lib/typescript/Icons/index.d.ts +2 -0
- package/lib/typescript/Icons/index.d.ts.map +1 -1
- package/lib/typescript/components/BottomSheet.d.ts.map +1 -1
- package/lib/typescript/components/Chat/ChatFilterBottomSheet.d.ts +3 -0
- package/lib/typescript/components/Chat/ChatFilterBottomSheet.d.ts.map +1 -0
- package/lib/typescript/components/Chat/ChatFilterBottomSheetOpener.d.ts +1 -0
- package/lib/typescript/components/Chat/ChatFilterBottomSheetOpener.d.ts.map +1 -1
- package/lib/typescript/components/Chat/ChatFilterItem.d.ts +1 -0
- package/lib/typescript/components/Chat/ChatFilterItem.d.ts.map +1 -1
- package/lib/typescript/components/Chat/ChatFilterView.d.ts +1 -0
- package/lib/typescript/components/Chat/ChatFilterView.d.ts.map +1 -1
- package/lib/typescript/components/Chat/ChatList.d.ts.map +1 -1
- package/lib/typescript/components/Chat/ChatMessage.d.ts.map +1 -1
- package/lib/typescript/components/Chat/ChatMoreActionsModal.d.ts +7 -0
- package/lib/typescript/components/Chat/ChatMoreActionsModal.d.ts.map +1 -0
- package/lib/typescript/components/Chat/ChatMoreActionsSheetView.d.ts +6 -0
- package/lib/typescript/components/Chat/ChatMoreActionsSheetView.d.ts.map +1 -0
- package/lib/typescript/components/Chat/ChatMoreActionsView.d.ts +7 -0
- package/lib/typescript/components/Chat/ChatMoreActionsView.d.ts.map +1 -0
- package/lib/typescript/components/Chat/ChatPaused.d.ts +10 -0
- package/lib/typescript/components/Chat/ChatPaused.d.ts.map +1 -0
- package/lib/typescript/components/Chat/MessageOptionsBottomSheet.d.ts +3 -0
- package/lib/typescript/components/Chat/MessageOptionsBottomSheet.d.ts.map +1 -0
- package/lib/typescript/components/Chat/MessageOptionsBottomSheetView.d.ts +6 -0
- package/lib/typescript/components/Chat/MessageOptionsBottomSheetView.d.ts.map +1 -0
- package/lib/typescript/components/Chat/MessageOptionsView.d.ts +7 -0
- package/lib/typescript/components/Chat/MessageOptionsView.d.ts.map +1 -0
- package/lib/typescript/components/Chat/PeerBlockedFromChat.d.ts +9 -0
- package/lib/typescript/components/Chat/PeerBlockedFromChat.d.ts.map +1 -0
- package/lib/typescript/components/Chat/PinnedMessages.d.ts +8 -0
- package/lib/typescript/components/Chat/PinnedMessages.d.ts.map +1 -0
- package/lib/typescript/components/Chat/index.d.ts +1 -1
- package/lib/typescript/components/Chat/index.d.ts.map +1 -1
- package/lib/typescript/components/ChatAndParticipants/ChatAndParticipantsBottomSheet.d.ts.map +1 -1
- package/lib/typescript/components/ChatAndParticipants/ChatAndParticipantsHeader.d.ts.map +1 -1
- package/lib/typescript/components/ChatAndParticipants/ChatAndParticipantsView.d.ts.map +1 -1
- package/lib/typescript/components/ChatAndParticipants/ChatView.d.ts.map +1 -1
- package/lib/typescript/components/EndRoomModalContent.d.ts.map +1 -1
- package/lib/typescript/components/Footer.d.ts.map +1 -1
- package/lib/typescript/components/GridView.d.ts.map +1 -1
- package/lib/typescript/components/HMSBaseButton.d.ts +1 -0
- package/lib/typescript/components/HMSBaseButton.d.ts.map +1 -1
- package/lib/typescript/components/HMSDangerButton.d.ts +1 -0
- package/lib/typescript/components/HMSDangerButton.d.ts.map +1 -1
- package/lib/typescript/components/HMSHLSMessage.d.ts +1 -1
- package/lib/typescript/components/HMSHLSMessage.d.ts.map +1 -1
- package/lib/typescript/components/HMSHandRaiseNotification.d.ts.map +1 -1
- package/lib/typescript/components/HMSKeyboardAvoidingView.d.ts.map +1 -1
- package/lib/typescript/components/HMSLiveIndicator.d.ts.map +1 -1
- package/lib/typescript/components/HMSLiveViewerCount.d.ts.map +1 -1
- package/lib/typescript/components/HMSLocalScreenshareNotification.d.ts.map +1 -1
- package/lib/typescript/components/HMSNotification.d.ts +2 -1
- package/lib/typescript/components/HMSNotification.d.ts.map +1 -1
- package/lib/typescript/components/HMSNotifications.d.ts.map +1 -1
- package/lib/typescript/components/HMSOverlayChatView.d.ts.map +1 -1
- package/lib/typescript/components/HMSPreviewEditName.d.ts.map +1 -1
- package/lib/typescript/components/HMSPreviewHLSLiveIndicator.d.ts.map +1 -1
- package/lib/typescript/components/HMSPrimaryButton.d.ts +1 -0
- package/lib/typescript/components/HMSPrimaryButton.d.ts.map +1 -1
- package/lib/typescript/components/HMSRecordingIndicator.d.ts.map +1 -1
- package/lib/typescript/components/HMSRoomOptions.d.ts.map +1 -1
- package/lib/typescript/components/HMSTerminalErrorNotification.d.ts.map +1 -1
- package/lib/typescript/components/Header.d.ts.map +1 -1
- package/lib/typescript/components/LeaveRoomBottomSheet.d.ts.map +1 -1
- package/lib/typescript/components/Meeting.d.ts.map +1 -1
- package/lib/typescript/components/MeetingScreenContent.d.ts.map +1 -1
- package/lib/typescript/components/Modals.d.ts.map +1 -1
- package/lib/typescript/components/Participants/ParticipantsItemOptions.d.ts.map +1 -1
- package/lib/typescript/components/PeerSettingsModalContent.d.ts.map +1 -1
- package/lib/typescript/components/PeerVideoTile/PeerVideoTileView.d.ts.map +1 -1
- package/lib/typescript/components/Preview.d.ts.map +1 -1
- package/lib/typescript/components/PreviewForRoleChangeModal.d.ts.map +1 -1
- package/lib/typescript/components/RoomSettingsModalContent.d.ts.map +1 -1
- package/lib/typescript/components/RoomSettingsModalDebugModeContent.d.ts.map +1 -1
- package/lib/typescript/components/WebrtcView.d.ts.map +1 -1
- package/lib/typescript/hooks-sdk-selectors.d.ts +3 -0
- package/lib/typescript/hooks-sdk-selectors.d.ts.map +1 -1
- package/lib/typescript/hooks-sdk.d.ts +4 -0
- package/lib/typescript/hooks-sdk.d.ts.map +1 -1
- package/lib/typescript/hooks-util-selectors.d.ts.map +1 -1
- package/lib/typescript/hooks-util.d.ts +35 -3
- package/lib/typescript/hooks-util.d.ts.map +1 -1
- package/lib/typescript/redux/actionTypes.d.ts +9 -2
- package/lib/typescript/redux/actionTypes.d.ts.map +1 -1
- package/lib/typescript/redux/actions/index.d.ts +37 -3
- package/lib/typescript/redux/actions/index.d.ts.map +1 -1
- package/lib/typescript/redux/index.d.ts +7 -2
- package/lib/typescript/redux/index.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/appState.d.ts +7 -2
- package/lib/typescript/redux/reducers/appState.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/chatWindow.d.ts +1 -1
- package/lib/typescript/redux/reducers/chatWindow.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/index.d.ts +7 -2
- package/lib/typescript/redux/reducers/index.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/message.d.ts +3 -2
- package/lib/typescript/redux/reducers/message.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +23 -3
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/utils/types.d.ts +3 -0
- package/lib/typescript/utils/types.d.ts.map +1 -1
- package/package.json +179 -179
- package/src/HMSRoomSetup.tsx +7 -2
- package/src/Icons/Chat/assets/chat-on.png +0 -0
- package/src/Icons/Chat/assets/chat-on@2x.png +0 -0
- package/src/Icons/Chat/assets/chat-on@3x.png +0 -0
- package/src/Icons/Chat/index.tsx +19 -6
- package/src/Icons/NoEntry/assets/no-entry.png +0 -0
- package/src/Icons/NoEntry/assets/no-entry@2x.png +0 -0
- package/src/Icons/NoEntry/assets/no-entry@3x.png +0 -0
- package/src/Icons/NoEntry/index.tsx +33 -0
- package/src/Icons/PauseCircle/assets/pause-circle.png +0 -0
- package/src/Icons/PauseCircle/assets/pause-circle@2x.png +0 -0
- package/src/Icons/PauseCircle/assets/pause-circle@3x.png +0 -0
- package/src/Icons/PauseCircle/index.tsx +27 -0
- package/src/Icons/Pin/assets/unpin.png +0 -0
- package/src/Icons/Pin/assets/unpin@2x.png +0 -0
- package/src/Icons/Pin/assets/unpin@3x.png +0 -0
- package/src/Icons/Pin/index.tsx +13 -3
- package/src/Icons/Recording/assets/recording-pause.png +0 -0
- package/src/Icons/Recording/assets/recording-pause@2x.png +0 -0
- package/src/Icons/Recording/assets/recording-pause@3x.png +0 -0
- package/src/Icons/Recording/index.tsx +2 -2
- package/src/Icons/index.ts +2 -0
- package/src/components/BottomSheet.tsx +13 -3
- package/src/components/Chat/ChatFilterBottomSheet.tsx +35 -0
- package/src/components/Chat/ChatFilterBottomSheetOpener.tsx +170 -42
- package/src/components/Chat/ChatFilterItem.tsx +8 -4
- package/src/components/Chat/ChatFilterView.tsx +102 -75
- package/src/components/Chat/ChatList.tsx +18 -6
- package/src/components/Chat/ChatMessage.tsx +111 -7
- package/src/components/Chat/ChatMoreActionsModal.tsx +75 -0
- package/src/components/Chat/ChatMoreActionsSheetView.tsx +77 -0
- package/src/components/Chat/ChatMoreActionsView.tsx +84 -0
- package/src/components/Chat/ChatPaused.tsx +103 -0
- package/src/components/Chat/MessageOptionsBottomSheet.tsx +33 -0
- package/src/components/Chat/MessageOptionsBottomSheetView.tsx +82 -0
- package/src/components/Chat/MessageOptionsView.tsx +248 -0
- package/src/components/Chat/PeerBlockedFromChat.tsx +49 -0
- package/src/components/Chat/PinnedMessages.tsx +422 -0
- package/src/components/Chat/index.ts +1 -1
- package/src/components/ChatAndParticipants/ChatAndParticipantsBottomSheet.tsx +4 -1
- package/src/components/ChatAndParticipants/ChatAndParticipantsHeader.tsx +48 -12
- package/src/components/ChatAndParticipants/ChatAndParticipantsView.tsx +9 -1
- package/src/components/ChatAndParticipants/ChatView.tsx +37 -5
- package/src/components/EndRoomModalContent.tsx +11 -14
- package/src/components/Footer.tsx +3 -1
- package/src/components/GridView.tsx +17 -8
- package/src/components/HLSView.tsx +45 -45
- package/src/components/HMSBaseButton.tsx +17 -2
- package/src/components/HMSDangerButton.tsx +3 -0
- package/src/components/HMSHLSMessage.tsx +130 -13
- package/src/components/HMSHLSMessageList.tsx +2 -2
- package/src/components/HMSHandRaiseNotification.tsx +17 -10
- package/src/components/HMSKeyboardAvoidingView.tsx +6 -1
- package/src/components/HMSLiveIndicator.tsx +9 -13
- package/src/components/HMSLiveViewerCount.tsx +21 -20
- package/src/components/HMSLocalScreenshareNotification.tsx +1 -0
- package/src/components/HMSNotification.tsx +56 -13
- package/src/components/HMSNotifications.tsx +12 -2
- package/src/components/HMSOverlayChatView.tsx +74 -17
- package/src/components/HMSPreviewEditName.tsx +3 -1
- package/src/components/HMSPreviewHLSLiveIndicator.tsx +2 -6
- package/src/components/HMSPrimaryButton.tsx +3 -0
- package/src/components/HMSRecordingIndicator.tsx +8 -22
- package/src/components/HMSRoomOptions.tsx +4 -1
- package/src/components/HMSTerminalErrorNotification.tsx +15 -10
- package/src/components/Header.tsx +4 -1
- package/src/components/LeaveRoomBottomSheet.tsx +13 -11
- package/src/components/Meeting.tsx +4 -0
- package/src/components/MeetingScreenContent.tsx +24 -21
- package/src/components/Modals.tsx +23 -25
- package/src/components/Participants/ParticipantsItemOptions.tsx +12 -7
- package/src/components/PeerSettingsModalContent.tsx +3 -1
- package/src/components/PeerVideoTile/PeerVideoTileView.tsx +3 -1
- package/src/components/Preview.tsx +15 -2
- package/src/components/PreviewForRoleChangeModal.tsx +4 -3
- package/src/components/RoomSettingsModalContent.tsx +62 -18
- package/src/components/RoomSettingsModalDebugModeContent.tsx +2 -5
- package/src/components/WebrtcView.tsx +6 -2
- package/src/hooks-sdk-selectors.tsx +19 -0
- package/src/hooks-sdk.ts +37 -0
- package/src/hooks-util-selectors.tsx +2 -3
- package/src/hooks-util.ts +578 -87
- package/src/redux/actionTypes.ts +22 -2
- package/src/redux/actions/index.ts +41 -4
- package/src/redux/reducers/appState.ts +54 -5
- package/src/redux/reducers/chatWindow.ts +2 -2
- package/src/redux/reducers/message.ts +20 -6
- package/src/types.ts +35 -6
- package/src/utils/types.ts +3 -0
- package/src/utils.ts +2 -2
- package/lib/commonjs/components/Chat/PinnedMessage.js +0 -81
- package/lib/commonjs/components/Chat/PinnedMessage.js.map +0 -1
- package/lib/module/components/Chat/PinnedMessage.js +0 -72
- package/lib/module/components/Chat/PinnedMessage.js.map +0 -1
- package/lib/typescript/components/Chat/PinnedMessage.d.ts +0 -3
- package/lib/typescript/components/Chat/PinnedMessage.d.ts.map +0 -1
- package/src/components/Chat/PinnedMessage.tsx +0 -89
package/lib/module/hooks-util.js
CHANGED
|
@@ -5,9 +5,10 @@ import { SoftInputModes } from '@100mslive/react-native-hms';
|
|
|
5
5
|
import Toast from 'react-native-simple-toast';
|
|
6
6
|
import { useRef, useCallback, useEffect, useState, useMemo, useContext } from 'react';
|
|
7
7
|
import { MaxTilesInOnePage, ModalTypes, OnLeaveReason, PeerListRefreshInterval, PipModes } from './utils/types';
|
|
8
|
-
import {
|
|
8
|
+
import { ChatBroadcastFilter } from './utils/types';
|
|
9
|
+
import { createPeerTrackNode, parseMetadata } from './utils/functions';
|
|
9
10
|
import { batch, shallowEqual, useDispatch, useSelector, useStore } from 'react-redux';
|
|
10
|
-
import { addMessage, addNotification, addParticipant, addParticipants,
|
|
11
|
+
import { addMessage, addNotification, addParticipant, addParticipants, addPinnedMessages, addScreenshareTile, addUpdateParticipant, changeMeetingState, changePipModeStatus, changeStartingHLSStream, clearStore, filterOutMsgsFromBlockedPeers, removeNotification, removeParticipant, removeParticipants, removeScreenshareTile, replaceParticipantsList, saveUserData, setActiveChatBottomSheetTab, setActiveSpeakers, setAutoEnterPipMode, setChatPeerBlacklist, setChatState, setEditUsernameDisabled, setFullScreenPeerTrackNode, setHMSLocalPeerState, setHMSRoleState, setHMSRoomState, setHandleBackButton, setIsLocalAudioMutedState, setIsLocalVideoMutedState, setLayoutConfig, setLocalPeerTrackNode, setMiniViewPeerTrackNode, setModalType, setOnLeaveHandler, setPrebuiltData, setReconnecting, setRoleChangeRequest, setStartingOrStoppingRecording, updateFullScreenPeerTrackNode, updateLocalPeerTrackNode, updateMiniViewPeerTrackNode, updateScreenshareTile } from './redux/actions';
|
|
11
12
|
import { createPeerTrackNodeUniqueId, degradeOrRestorePeerTrackNodes, peerTrackNodeExistForPeer, peerTrackNodeExistForPeerAndTrack, removePeerTrackNodes, removePeerTrackNodesWithTrack, replacePeerTrackNodes, replacePeerTrackNodesWithTrack } from './peerTrackNodeUtils';
|
|
12
13
|
import { MeetingState } from './types';
|
|
13
14
|
import { BackHandler, InteractionManager, Keyboard, Platform } from 'react-native';
|
|
@@ -18,6 +19,7 @@ import { getRoomLayout } from './modules/HMSManager';
|
|
|
18
19
|
import { DEFAULT_THEME, DEFAULT_TYPOGRAPHY } from './utils/theme';
|
|
19
20
|
import { NotificationTypes } from './types';
|
|
20
21
|
import { KeyboardState, useSharedValue } from 'react-native-reanimated';
|
|
22
|
+
import { useHMSActions } from './hooks-sdk';
|
|
21
23
|
export const useHMSListeners = setPeerTrackNodes => {
|
|
22
24
|
const hmsInstance = useHMSInstance();
|
|
23
25
|
const updateLocalPeer = useUpdateHMSLocalPeer(hmsInstance);
|
|
@@ -57,7 +59,7 @@ const useHMSPeersUpdate = (hmsInstance, updateLocalPeer, setPeerTrackNodes) => {
|
|
|
57
59
|
// const inMeeting = useSelector(
|
|
58
60
|
// (state: RootState) => state.app.meetingState === MeetingState.IN_MEETING
|
|
59
61
|
// );
|
|
60
|
-
|
|
62
|
+
const hmsActions = useHMSActions();
|
|
61
63
|
useEffect(() => {
|
|
62
64
|
const peerUpdateHandler = ({
|
|
63
65
|
peer,
|
|
@@ -105,6 +107,7 @@ const useHMSPeersUpdate = (hmsInstance, updateLocalPeer, setPeerTrackNodes) => {
|
|
|
105
107
|
const fullScreenPeerTrackNode = reduxState.app.fullScreenPeerTrackNode;
|
|
106
108
|
const miniviewPeerTrackNode = reduxState.app.miniviewPeerTrackNode;
|
|
107
109
|
const localPeerTrackNode = reduxState.app.localPeerTrackNode;
|
|
110
|
+
const initialRole = reduxState.app.initialRole;
|
|
108
111
|
|
|
109
112
|
// Currently Applied Layout config
|
|
110
113
|
const currentLayoutConfig = selectLayoutConfigForRole(reduxState.hmsStates.layoutConfig, peer.role || null);
|
|
@@ -159,12 +162,36 @@ const useHMSPeersUpdate = (hmsInstance, updateLocalPeer, setPeerTrackNodes) => {
|
|
|
159
162
|
// - TODO: update local localPeer state
|
|
160
163
|
// - Pass this updated data to Meeting component -> DisplayView component
|
|
161
164
|
updateLocalPeer();
|
|
165
|
+
if (type === HMSPeerUpdate.ROLE_CHANGED) {
|
|
166
|
+
const parsedLocalPeerMetadata = parseMetadata(peer.metadata);
|
|
167
|
+
if (parsedLocalPeerMetadata.prevRole !== initialRole) {
|
|
168
|
+
const newMetadata = {
|
|
169
|
+
...parsedLocalPeerMetadata,
|
|
170
|
+
prevRole: initialRole === null || initialRole === void 0 ? void 0 : initialRole.name
|
|
171
|
+
};
|
|
172
|
+
hmsActions.changeMetadata(newMetadata).then(r => {
|
|
173
|
+
console.log('Metadata changed successfully', r);
|
|
174
|
+
}).catch(e => {
|
|
175
|
+
console.log('Metadata change failed', e);
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
162
179
|
return;
|
|
163
180
|
}
|
|
164
181
|
if (type === HMSPeerUpdate.ROLE_CHANGED) {
|
|
165
182
|
var _peer$role2, _peer$role3, _peer$role4, _peer$role5, _peer$role6, _peer$role7, _peer$role8, _peer$role9, _peer$role10;
|
|
166
183
|
dispatch(addUpdateParticipant(peer));
|
|
167
184
|
|
|
185
|
+
// saving current role in peer metadata,
|
|
186
|
+
// so that when peer is removed from stage, we can assign previous role to it.
|
|
187
|
+
// if (localPeerRoleName) {
|
|
188
|
+
// const newMetadata = {
|
|
189
|
+
// ...localPeerMetadata,
|
|
190
|
+
// prevRole: localPeerRoleName,
|
|
191
|
+
// };
|
|
192
|
+
// await hmsActions.changeMetadata(newMetadata);
|
|
193
|
+
// }
|
|
194
|
+
|
|
168
195
|
// Handling regular tiles list
|
|
169
196
|
if (((_peer$role2 = peer.role) === null || _peer$role2 === void 0 || (_peer$role2 = _peer$role2.publishSettings) === null || _peer$role2 === void 0 ? void 0 : _peer$role2.allowed) === undefined || (_peer$role3 = peer.role) !== null && _peer$role3 !== void 0 && (_peer$role3 = _peer$role3.publishSettings) !== null && _peer$role3 !== void 0 && _peer$role3.allowed && ((_peer$role4 = peer.role) === null || _peer$role4 === void 0 || (_peer$role4 = _peer$role4.publishSettings) === null || _peer$role4 === void 0 ? void 0 : _peer$role4.allowed.length) < 1) {
|
|
170
197
|
setPeerTrackNodes(prevPeerTrackNodes => {
|
|
@@ -624,6 +651,7 @@ export const useHMSRoleChangeRequest = (callback, deps) => {
|
|
|
624
651
|
}, [...(deps || []), hmsInstance]);
|
|
625
652
|
};
|
|
626
653
|
export const useHMSSessionStoreListeners = gridViewRef => {
|
|
654
|
+
const store = useStore();
|
|
627
655
|
const dispatch = useDispatch();
|
|
628
656
|
const hmsSessionStore = useSelector(state => state.user.hmsSessionStore);
|
|
629
657
|
const sessionStoreListenersRef = useRef([]);
|
|
@@ -635,21 +663,79 @@ export const useHMSSessionStoreListeners = gridViewRef => {
|
|
|
635
663
|
const addSessionStoreListeners = () => {
|
|
636
664
|
// Handle 'spotlight' key values
|
|
637
665
|
const handleSpotlightIdChange = id => {
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
666
|
+
if (id === null || id === undefined || typeof id === 'string') {
|
|
667
|
+
var _gridViewRef$current;
|
|
668
|
+
// set value to the state to rerender the component to reflect changes
|
|
669
|
+
dispatch(saveUserData({
|
|
670
|
+
spotlightTrackId: id
|
|
671
|
+
}));
|
|
672
|
+
// Scroll to start of the list
|
|
673
|
+
(_gridViewRef$current = gridViewRef.current) === null || _gridViewRef$current === void 0 || (_gridViewRef$current = _gridViewRef$current.getRegularTilesFlatlistRef().current) === null || _gridViewRef$current === void 0 || _gridViewRef$current.scrollToOffset({
|
|
674
|
+
animated: true,
|
|
675
|
+
offset: 0
|
|
676
|
+
});
|
|
677
|
+
}
|
|
648
678
|
};
|
|
649
679
|
|
|
650
|
-
// Handle '
|
|
651
|
-
const
|
|
652
|
-
|
|
680
|
+
// Handle 'pinnedMessages' key values
|
|
681
|
+
const handlePinnedMessagesChange = data => {
|
|
682
|
+
if (Array.isArray(data)) {
|
|
683
|
+
dispatch(addPinnedMessages(data));
|
|
684
|
+
}
|
|
685
|
+
};
|
|
686
|
+
|
|
687
|
+
// Handle 'chatState' key values
|
|
688
|
+
const handleChatStateChange = data => {
|
|
689
|
+
try {
|
|
690
|
+
var _reduxState$hmsStates3;
|
|
691
|
+
if (typeof data !== 'object' || Array.isArray(data) || data === null) {
|
|
692
|
+
throw new Error('`data` is a falsy value');
|
|
693
|
+
}
|
|
694
|
+
if (!('enabled' in data)) {
|
|
695
|
+
throw new Error("`data` doesn't have `enabled` property");
|
|
696
|
+
}
|
|
697
|
+
const parsedData = data;
|
|
698
|
+
const reduxState = store.getState();
|
|
699
|
+
const currentChatState = reduxState.app.chatState;
|
|
700
|
+
if (parsedData.enabled === (currentChatState === null || currentChatState === void 0 ? void 0 : currentChatState.enabled)) {
|
|
701
|
+
return;
|
|
702
|
+
}
|
|
703
|
+
const currentLayoutConfig = selectLayoutConfigForRole(reduxState.hmsStates.layoutConfig, ((_reduxState$hmsStates3 = reduxState.hmsStates.localPeer) === null || _reduxState$hmsStates3 === void 0 ? void 0 : _reduxState$hmsStates3.role) ?? null);
|
|
704
|
+
const chatLayoutConfig = selectChatLayoutConfig(currentLayoutConfig);
|
|
705
|
+
const isAllowedToSendMessage = ((chatLayoutConfig === null || chatLayoutConfig === void 0 ? void 0 : chatLayoutConfig.private_chat_enabled) || (chatLayoutConfig === null || chatLayoutConfig === void 0 ? void 0 : chatLayoutConfig.public_chat_enabled) || (chatLayoutConfig === null || chatLayoutConfig === void 0 ? void 0 : chatLayoutConfig.roles_whitelist) && (chatLayoutConfig === null || chatLayoutConfig === void 0 ? void 0 : chatLayoutConfig.roles_whitelist.length) > 0) ?? false;
|
|
706
|
+
batch(() => {
|
|
707
|
+
if (isAllowedToSendMessage && (
|
|
708
|
+
// Only show notification when allowed to send message, AND
|
|
709
|
+
!parsedData.enabled ||
|
|
710
|
+
// Chat is Paused, OR
|
|
711
|
+
currentChatState && parsedData.enabled !== currentChatState.enabled) // current Chat state is different from previous state
|
|
712
|
+
) {
|
|
713
|
+
dispatch(addNotification({
|
|
714
|
+
id: `chat-state-enabled-${Math.random().toString(16).slice(2)}`,
|
|
715
|
+
icon: parsedData.enabled ? 'chat-on' : 'chat-off',
|
|
716
|
+
type: NotificationTypes.INFO,
|
|
717
|
+
title: `Chat ${parsedData.enabled ? 'Resumed' : 'Paused'}`,
|
|
718
|
+
message: `Chat ${parsedData.enabled ? 'resumed' : 'paused'} ${parsedData.updatedBy ? `by ${parsedData.updatedBy.userName}` : ''}`
|
|
719
|
+
}));
|
|
720
|
+
}
|
|
721
|
+
dispatch(setChatState(parsedData));
|
|
722
|
+
});
|
|
723
|
+
} catch (error) {
|
|
724
|
+
dispatch(setChatState(null));
|
|
725
|
+
}
|
|
726
|
+
};
|
|
727
|
+
|
|
728
|
+
// Handle 'chatPeerBlacklist' key values
|
|
729
|
+
const handleChatPeerBlacklistChange = data => {
|
|
730
|
+
// Whenever list changes :
|
|
731
|
+
// - check if local peer is blocked or unblocked
|
|
732
|
+
// - filter out messages of blocked peers
|
|
733
|
+
if (Array.isArray(data)) {
|
|
734
|
+
batch(() => {
|
|
735
|
+
dispatch(setChatPeerBlacklist(data));
|
|
736
|
+
dispatch(filterOutMsgsFromBlockedPeers(data));
|
|
737
|
+
});
|
|
738
|
+
}
|
|
653
739
|
};
|
|
654
740
|
|
|
655
741
|
// Getting value for 'spotlight' key by using `get` method on HMSSessionStore instance
|
|
@@ -658,20 +744,32 @@ export const useHMSSessionStoreListeners = gridViewRef => {
|
|
|
658
744
|
handleSpotlightIdChange(data);
|
|
659
745
|
}).catch(error => console.log('Session Store get `spotlight` key value error: ', error));
|
|
660
746
|
|
|
661
|
-
// Getting value for '
|
|
662
|
-
hmsSessionStore.get('
|
|
663
|
-
console.log('Session Store get `
|
|
664
|
-
|
|
665
|
-
}).catch(error => console.log('Session Store get `
|
|
747
|
+
// Getting value for 'pinnedMessages' key by using `get` method on HMSSessionStore instance
|
|
748
|
+
hmsSessionStore.get('pinnedMessages').then(data => {
|
|
749
|
+
console.log('Session Store get `pinnedMessages` key value success: ', data);
|
|
750
|
+
handlePinnedMessagesChange(data);
|
|
751
|
+
}).catch(error => console.log('Session Store get `pinnedMessages` key value error: ', error));
|
|
752
|
+
|
|
753
|
+
// Getting value for 'chatState' key by using `get` method on HMSSessionStore instance
|
|
754
|
+
hmsSessionStore.get('chatState').then(data => {
|
|
755
|
+
console.log('Session Store get `chatState` key value success: ', data);
|
|
756
|
+
handleChatStateChange(data);
|
|
757
|
+
}).catch(error => console.log('Session Store get `chatState` key value error: ', error));
|
|
758
|
+
|
|
759
|
+
// Getting value for 'chatPeerBlacklist' key by using `get` method on HMSSessionStore instance
|
|
760
|
+
hmsSessionStore.get('chatPeerBlacklist').then(data => {
|
|
761
|
+
console.log('Session Store get `chatPeerBlacklist` key value success: ', data);
|
|
762
|
+
handleChatPeerBlacklistChange(data);
|
|
763
|
+
}).catch(error => console.log('Session Store get `chatPeerBlacklist` key value error: ', error));
|
|
666
764
|
|
|
667
765
|
// let lastSpotlightValue: HMSSessionStoreValue = null;
|
|
668
766
|
// let lastPinnedMessageValue: HMSSessionStoreValue = null;
|
|
669
767
|
|
|
670
|
-
// Add subscription for `spotlight` & `
|
|
671
|
-
const subscription = hmsSessionStore.addKeyChangeListener(['spotlight', '
|
|
768
|
+
// Add subscription for `spotlight`, `pinnedMessages`, `chatState` & `chatPeerBlacklist` keys updates on Session Store
|
|
769
|
+
const subscription = hmsSessionStore.addKeyChangeListener(['spotlight', 'pinnedMessages', 'chatState', 'chatPeerBlacklist'], (error, data) => {
|
|
672
770
|
// If error occurs, handle error and return early
|
|
673
771
|
if (error !== null) {
|
|
674
|
-
console.log('`spotlight` & `
|
|
772
|
+
console.log('`spotlight`, `pinnedMessages`, `chatState` & `chatPeerBlacklist` key listener Error -> ', error);
|
|
675
773
|
return;
|
|
676
774
|
}
|
|
677
775
|
|
|
@@ -681,44 +779,21 @@ export const useHMSSessionStoreListeners = gridViewRef => {
|
|
|
681
779
|
case 'spotlight':
|
|
682
780
|
{
|
|
683
781
|
handleSpotlightIdChange(data.value);
|
|
684
|
-
|
|
685
|
-
// Showing Toast message if value has actually changed
|
|
686
|
-
// if (
|
|
687
|
-
// data.value !== lastSpotlightValue &&
|
|
688
|
-
// (data.value || lastSpotlightValue)
|
|
689
|
-
// ) {
|
|
690
|
-
// Toast.showWithGravity(
|
|
691
|
-
// `SessionStore: \`spotlight\` key's value changed to ${data.value}`,
|
|
692
|
-
// Toast.LONG,
|
|
693
|
-
// Toast.TOP
|
|
694
|
-
// );
|
|
695
|
-
// }
|
|
696
|
-
|
|
697
|
-
// lastSpotlightValue = data.value;
|
|
698
782
|
break;
|
|
699
783
|
}
|
|
700
|
-
case '
|
|
784
|
+
case 'pinnedMessages':
|
|
701
785
|
{
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
// Toast.showWithGravity(
|
|
714
|
-
// `SessionStore: \`pinnedMessage\` key's value changed to ${data.value}`,
|
|
715
|
-
// Toast.LONG,
|
|
716
|
-
// Toast.TOP
|
|
717
|
-
// );
|
|
718
|
-
// }, 1500);
|
|
719
|
-
// }
|
|
720
|
-
|
|
721
|
-
// lastPinnedMessageValue = data.value;
|
|
786
|
+
handlePinnedMessagesChange(data.value);
|
|
787
|
+
break;
|
|
788
|
+
}
|
|
789
|
+
case 'chatState':
|
|
790
|
+
{
|
|
791
|
+
handleChatStateChange(data.value);
|
|
792
|
+
break;
|
|
793
|
+
}
|
|
794
|
+
case 'chatPeerBlacklist':
|
|
795
|
+
{
|
|
796
|
+
handleChatPeerBlacklistChange(data.value);
|
|
722
797
|
break;
|
|
723
798
|
}
|
|
724
799
|
}
|
|
@@ -736,7 +811,7 @@ export const useHMSSessionStoreListeners = gridViewRef => {
|
|
|
736
811
|
// if (toastTimeoutId !== null) clearTimeout(toastTimeoutId);
|
|
737
812
|
};
|
|
738
813
|
}
|
|
739
|
-
}, [hmsSessionStore]);
|
|
814
|
+
}, [store, hmsSessionStore]);
|
|
740
815
|
};
|
|
741
816
|
export const useHMSSessionStore = () => {
|
|
742
817
|
const hmsInstance = useHMSInstance();
|
|
@@ -1491,7 +1566,7 @@ export const useSendMessage = () => {
|
|
|
1491
1566
|
const chatWindowState = reduxStore.getState().chatWindow;
|
|
1492
1567
|
const message = chatWindowState.typedMessage;
|
|
1493
1568
|
const sendingTo = chatWindowState.sendTo;
|
|
1494
|
-
if (message.length <= 0) return;
|
|
1569
|
+
if (message.length <= 0 || !sendingTo) return;
|
|
1495
1570
|
const hmsMessageRecipient = new HMSMessageRecipient({
|
|
1496
1571
|
recipientType: 'publishSettings' in sendingTo ? HMSMessageRecipientType.ROLES : 'peerID' in sendingTo ? HMSMessageRecipientType.PEER : HMSMessageRecipientType.BROADCAST,
|
|
1497
1572
|
recipientPeer: 'peerID' in sendingTo ? sendingTo : undefined,
|
|
@@ -1543,6 +1618,42 @@ export const useSendMessage = () => {
|
|
|
1543
1618
|
sendMessage
|
|
1544
1619
|
};
|
|
1545
1620
|
};
|
|
1621
|
+
export const useHMSCanDisableChat = () => {
|
|
1622
|
+
return useHMSChatLayoutConfig(chatLayoutConfig => {
|
|
1623
|
+
var _chatLayoutConfig$rea;
|
|
1624
|
+
return (chatLayoutConfig === null || chatLayoutConfig === void 0 || (_chatLayoutConfig$rea = chatLayoutConfig.real_time_controls) === null || _chatLayoutConfig$rea === void 0 ? void 0 : _chatLayoutConfig$rea.can_disable_chat) ?? false;
|
|
1625
|
+
});
|
|
1626
|
+
};
|
|
1627
|
+
export const useHMSChatRecipientSelector = () => {
|
|
1628
|
+
const roles = useSelector(state => state.hmsStates.roles);
|
|
1629
|
+
const defaultChatRecipient = useMemo(() => ({
|
|
1630
|
+
privateChat: false,
|
|
1631
|
+
publicChat: false,
|
|
1632
|
+
roles: []
|
|
1633
|
+
}), []);
|
|
1634
|
+
const chatLayoutConfig = useHMSChatLayoutConfig(_chatLayoutConfig => _chatLayoutConfig);
|
|
1635
|
+
const rolesWhitelist = chatLayoutConfig === null || chatLayoutConfig === void 0 ? void 0 : chatLayoutConfig.roles_whitelist;
|
|
1636
|
+
const whitelistedRoles = useMemo(() => {
|
|
1637
|
+
if (!rolesWhitelist) {
|
|
1638
|
+
return defaultChatRecipient.roles;
|
|
1639
|
+
}
|
|
1640
|
+
return rolesWhitelist.map(roleStr => roles.find(role => role.name === roleStr)).filter(role => !!role);
|
|
1641
|
+
}, [roles, rolesWhitelist, defaultChatRecipient]);
|
|
1642
|
+
const privateChat = (chatLayoutConfig === null || chatLayoutConfig === void 0 ? void 0 : chatLayoutConfig.private_chat_enabled) ?? defaultChatRecipient.privateChat;
|
|
1643
|
+
const publicChat = (chatLayoutConfig === null || chatLayoutConfig === void 0 ? void 0 : chatLayoutConfig.public_chat_enabled) ?? defaultChatRecipient.publicChat;
|
|
1644
|
+
if (chatLayoutConfig) {
|
|
1645
|
+
return {
|
|
1646
|
+
privateChat,
|
|
1647
|
+
publicChat,
|
|
1648
|
+
roles: whitelistedRoles
|
|
1649
|
+
};
|
|
1650
|
+
}
|
|
1651
|
+
return defaultChatRecipient;
|
|
1652
|
+
};
|
|
1653
|
+
export const useIsAllowedToSendMessage = () => {
|
|
1654
|
+
const chatRecipients = useHMSChatRecipientSelector();
|
|
1655
|
+
return chatRecipients.privateChat || chatRecipients.publicChat || chatRecipients.roles.length > 0;
|
|
1656
|
+
};
|
|
1546
1657
|
export const useHMSChatLayoutConfig = (selector, equalityFn) => {
|
|
1547
1658
|
return useHMSLayoutConfig(layoutConfig => {
|
|
1548
1659
|
const chatConfig = selectChatLayoutConfig(layoutConfig);
|
|
@@ -1633,7 +1744,7 @@ export const useStartRecording = () => {
|
|
|
1633
1744
|
dispatch(addNotification({
|
|
1634
1745
|
id: Math.random().toString(16).slice(2),
|
|
1635
1746
|
type: NotificationTypes.ERROR,
|
|
1636
|
-
|
|
1747
|
+
title: error.message
|
|
1637
1748
|
}));
|
|
1638
1749
|
});
|
|
1639
1750
|
});
|
|
@@ -1642,6 +1753,152 @@ export const useStartRecording = () => {
|
|
|
1642
1753
|
startRecording
|
|
1643
1754
|
};
|
|
1644
1755
|
};
|
|
1756
|
+
export const useHMSChatState = () => {
|
|
1757
|
+
const hmsSessionStore = useSelector(state => state.user.hmsSessionStore);
|
|
1758
|
+
const localPeerName = useSelector(state => {
|
|
1759
|
+
var _state$hmsStates$loca4;
|
|
1760
|
+
return (_state$hmsStates$loca4 = state.hmsStates.localPeer) === null || _state$hmsStates$loca4 === void 0 ? void 0 : _state$hmsStates$loca4.name;
|
|
1761
|
+
});
|
|
1762
|
+
const localPeerID = useSelector(state => {
|
|
1763
|
+
var _state$hmsStates$loca5;
|
|
1764
|
+
return (_state$hmsStates$loca5 = state.hmsStates.localPeer) === null || _state$hmsStates$loca5 === void 0 ? void 0 : _state$hmsStates$loca5.peerID;
|
|
1765
|
+
});
|
|
1766
|
+
const localPeerUserID = useSelector(state => {
|
|
1767
|
+
var _state$hmsStates$loca6;
|
|
1768
|
+
return (_state$hmsStates$loca6 = state.hmsStates.localPeer) === null || _state$hmsStates$loca6 === void 0 ? void 0 : _state$hmsStates$loca6.customerUserID;
|
|
1769
|
+
});
|
|
1770
|
+
const _chatState = useSelector(state => state.app.chatState);
|
|
1771
|
+
const chatState = useMemo(() => _chatState || {
|
|
1772
|
+
enabled: true
|
|
1773
|
+
}, [_chatState]);
|
|
1774
|
+
const setChatState = useCallback(async enabled => {
|
|
1775
|
+
// If instance of HMSSessionStore is available
|
|
1776
|
+
if (hmsSessionStore) {
|
|
1777
|
+
try {
|
|
1778
|
+
const value = {
|
|
1779
|
+
enabled,
|
|
1780
|
+
updatedBy: {
|
|
1781
|
+
peerID: localPeerID ?? null,
|
|
1782
|
+
userID: localPeerUserID ?? null,
|
|
1783
|
+
userName: localPeerName ?? ''
|
|
1784
|
+
},
|
|
1785
|
+
updatedAt: Date.now()
|
|
1786
|
+
};
|
|
1787
|
+
// set `value` on `session` with key 'chatState'
|
|
1788
|
+
const response = await hmsSessionStore.set(value, 'chatState');
|
|
1789
|
+
console.log('setSessionMetaData Response -> ', response);
|
|
1790
|
+
} catch (error) {
|
|
1791
|
+
console.log('setSessionMetaData Error -> ', error);
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
}, [localPeerName, hmsSessionStore, localPeerUserID, localPeerID]);
|
|
1795
|
+
return {
|
|
1796
|
+
chatState,
|
|
1797
|
+
setChatState
|
|
1798
|
+
};
|
|
1799
|
+
};
|
|
1800
|
+
export const useIsMessagePinned = message => {
|
|
1801
|
+
return useSelector(state => message ? state.messages.pinnedMessages.findIndex(pinnedMessage => pinnedMessage.id === message.messageId) >= 0 : false);
|
|
1802
|
+
};
|
|
1803
|
+
export const useHMSMessagePinningActions = () => {
|
|
1804
|
+
const store = useStore();
|
|
1805
|
+
const hmsSessionStore = useSelector(state => state.user.hmsSessionStore);
|
|
1806
|
+
const pinMessage = useCallback(async message => {
|
|
1807
|
+
let messages = message;
|
|
1808
|
+
if (!Array.isArray(messages)) {
|
|
1809
|
+
messages = [messages];
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
// If instance of HMSSessionStore is available
|
|
1813
|
+
if (hmsSessionStore) {
|
|
1814
|
+
try {
|
|
1815
|
+
var _reduxState$hmsStates4;
|
|
1816
|
+
const reduxState = store.getState();
|
|
1817
|
+
const localPeerName = (_reduxState$hmsStates4 = reduxState.hmsStates.localPeer) === null || _reduxState$hmsStates4 === void 0 ? void 0 : _reduxState$hmsStates4.name;
|
|
1818
|
+
const pinnedMessages = reduxState.messages.pinnedMessages;
|
|
1819
|
+
let payload = messages.map(message => {
|
|
1820
|
+
var _message$sender2, _message$sender3;
|
|
1821
|
+
return {
|
|
1822
|
+
authorId: ((_message$sender2 = message.sender) === null || _message$sender2 === void 0 ? void 0 : _message$sender2.customerUserID) ?? '',
|
|
1823
|
+
id: message.messageId,
|
|
1824
|
+
pinnedBy: localPeerName ?? '',
|
|
1825
|
+
text: `${(_message$sender3 = message.sender) === null || _message$sender3 === void 0 ? void 0 : _message$sender3.name}: ${message.message}`
|
|
1826
|
+
};
|
|
1827
|
+
});
|
|
1828
|
+
let updatedPinnedMessages = [...pinnedMessages, ...payload];
|
|
1829
|
+
if (updatedPinnedMessages.length > 3) {
|
|
1830
|
+
updatedPinnedMessages = updatedPinnedMessages.slice(updatedPinnedMessages.length - 3);
|
|
1831
|
+
}
|
|
1832
|
+
const response = await hmsSessionStore.set(updatedPinnedMessages, 'pinnedMessages');
|
|
1833
|
+
console.log('setSessionMetaData Response -> ', response);
|
|
1834
|
+
} catch (error) {
|
|
1835
|
+
console.log('setSessionMetaData Error -> ', error);
|
|
1836
|
+
return Promise.reject(error);
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
}, [hmsSessionStore]);
|
|
1840
|
+
const unpinMessage = useCallback(async message => {
|
|
1841
|
+
let messages = message;
|
|
1842
|
+
if (!Array.isArray(messages)) {
|
|
1843
|
+
messages = [messages];
|
|
1844
|
+
}
|
|
1845
|
+
|
|
1846
|
+
// If instance of HMSSessionStore is available
|
|
1847
|
+
if (hmsSessionStore) {
|
|
1848
|
+
try {
|
|
1849
|
+
const pinnedMessages = store.getState().messages.pinnedMessages;
|
|
1850
|
+
const messageIdsToUnpin = messages.map(msg => 'messageId' in msg ? msg.messageId : msg.id);
|
|
1851
|
+
const updatedPinnedMessages = pinnedMessages.filter(pinnedMessage => !messageIdsToUnpin.includes(pinnedMessage.id));
|
|
1852
|
+
const response = await hmsSessionStore.set(updatedPinnedMessages, 'pinnedMessages');
|
|
1853
|
+
console.log('setSessionMetaData Response -> ', response);
|
|
1854
|
+
} catch (error) {
|
|
1855
|
+
console.log('setSessionMetaData Error -> ', error);
|
|
1856
|
+
return Promise.reject(error);
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1859
|
+
}, [hmsSessionStore]);
|
|
1860
|
+
return {
|
|
1861
|
+
pinMessage,
|
|
1862
|
+
unpinMessage
|
|
1863
|
+
};
|
|
1864
|
+
};
|
|
1865
|
+
export const useSetDefaultChatRecipient = () => {
|
|
1866
|
+
const dispatch = useDispatch();
|
|
1867
|
+
const localPeerRoleName = useSelector(state => {
|
|
1868
|
+
var _state$hmsStates$loca7;
|
|
1869
|
+
return (_state$hmsStates$loca7 = state.hmsStates.localPeer) === null || _state$hmsStates$loca7 === void 0 || (_state$hmsStates$loca7 = _state$hmsStates$loca7.role) === null || _state$hmsStates$loca7 === void 0 ? void 0 : _state$hmsStates$loca7.name;
|
|
1870
|
+
});
|
|
1871
|
+
const {
|
|
1872
|
+
privateChat,
|
|
1873
|
+
publicChat,
|
|
1874
|
+
roles: whitelistedRoles
|
|
1875
|
+
} = useHMSChatRecipientSelector();
|
|
1876
|
+
useEffect(() => {
|
|
1877
|
+
if (publicChat) {
|
|
1878
|
+
dispatch({
|
|
1879
|
+
type: 'SET_SENDTO',
|
|
1880
|
+
sendTo: ChatBroadcastFilter
|
|
1881
|
+
});
|
|
1882
|
+
}
|
|
1883
|
+
// If Role is enabled, Select a role
|
|
1884
|
+
else if (Array.isArray(whitelistedRoles) && whitelistedRoles.length > 0) {
|
|
1885
|
+
const roleObj = whitelistedRoles.length === 1 ? whitelistedRoles[0] : whitelistedRoles.filter(whitelistRole => whitelistRole.name !== localPeerRoleName)[0];
|
|
1886
|
+
if (roleObj) {
|
|
1887
|
+
dispatch({
|
|
1888
|
+
type: 'SET_SENDTO',
|
|
1889
|
+
sendTo: roleObj
|
|
1890
|
+
});
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1893
|
+
// If private is enabled, Select None
|
|
1894
|
+
else if (privateChat) {
|
|
1895
|
+
dispatch({
|
|
1896
|
+
type: 'SET_SENDTO',
|
|
1897
|
+
sendTo: null
|
|
1898
|
+
});
|
|
1899
|
+
}
|
|
1900
|
+
}, [privateChat, publicChat, whitelistedRoles, localPeerRoleName, dispatch]);
|
|
1901
|
+
};
|
|
1645
1902
|
export const useAndroidSoftInputAdjustResize = () => {
|
|
1646
1903
|
const currentSoftInputRef = useRef(null);
|
|
1647
1904
|
useEffect(() => {
|
|
@@ -1708,4 +1965,83 @@ export const useKeyboardState = () => {
|
|
|
1708
1965
|
keyboardState
|
|
1709
1966
|
};
|
|
1710
1967
|
};
|
|
1968
|
+
export const useAllowPinningMessage = () => {
|
|
1969
|
+
return useHMSChatLayoutConfig(config => (config === null || config === void 0 ? void 0 : config.allow_pinning_messages) ?? false);
|
|
1970
|
+
};
|
|
1971
|
+
export const useIsLocalPeerBlockedFromChat = () => {
|
|
1972
|
+
return useSelector(state => {
|
|
1973
|
+
var _state$hmsStates$loca8;
|
|
1974
|
+
const chatPeerBlacklist = state.app.chatPeerBlacklist;
|
|
1975
|
+
const localPeerUserId = (_state$hmsStates$loca8 = state.hmsStates.localPeer) === null || _state$hmsStates$loca8 === void 0 ? void 0 : _state$hmsStates$loca8.customerUserID;
|
|
1976
|
+
return localPeerUserId ? chatPeerBlacklist.includes(localPeerUserId) : false;
|
|
1977
|
+
});
|
|
1978
|
+
};
|
|
1979
|
+
export const useIsPeerBlocked = peer => {
|
|
1980
|
+
return useSelector(state => {
|
|
1981
|
+
const chatPeerBlacklist = state.app.chatPeerBlacklist;
|
|
1982
|
+
const localPeerUserId = peer === null || peer === void 0 ? void 0 : peer.customerUserID;
|
|
1983
|
+
return localPeerUserId ? chatPeerBlacklist.includes(localPeerUserId) : false;
|
|
1984
|
+
});
|
|
1985
|
+
};
|
|
1986
|
+
export const useBlockPeerActions = () => {
|
|
1987
|
+
const store = useStore();
|
|
1988
|
+
const hmsSessionStore = useSelector(state => state.user.hmsSessionStore);
|
|
1989
|
+
const {
|
|
1990
|
+
unpinMessage
|
|
1991
|
+
} = useHMSMessagePinningActions();
|
|
1992
|
+
const blockPeer = useCallback(async peer => {
|
|
1993
|
+
// If instance of HMSSessionStore is available
|
|
1994
|
+
if (hmsSessionStore) {
|
|
1995
|
+
try {
|
|
1996
|
+
const reduxState = store.getState();
|
|
1997
|
+
const chatPeerBlacklist = reduxState.app.chatPeerBlacklist;
|
|
1998
|
+
const pinnedMessages = reduxState.messages.pinnedMessages;
|
|
1999
|
+
if (peer.customerUserID && !chatPeerBlacklist.includes(peer.customerUserID)) {
|
|
2000
|
+
let updatedChatPeerBlacklist = [...chatPeerBlacklist, peer.customerUserID];
|
|
2001
|
+
const response = await hmsSessionStore.set(updatedChatPeerBlacklist, 'chatPeerBlacklist');
|
|
2002
|
+
console.log('setSessionMetaData Response -> ', response);
|
|
2003
|
+
|
|
2004
|
+
// Unpin messages from sent by the peer
|
|
2005
|
+
const msgsToUnpin = pinnedMessages.filter(pinnedMessage => pinnedMessage.authorId === peer.customerUserID);
|
|
2006
|
+
if (msgsToUnpin.length > 0) {
|
|
2007
|
+
await unpinMessage(msgsToUnpin);
|
|
2008
|
+
}
|
|
2009
|
+
return response;
|
|
2010
|
+
}
|
|
2011
|
+
return Promise.reject('Peer is already blocked!');
|
|
2012
|
+
} catch (error) {
|
|
2013
|
+
console.log('setSessionMetaData Error -> ', error);
|
|
2014
|
+
return Promise.reject(error);
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
}, [hmsSessionStore, unpinMessage]);
|
|
2018
|
+
const unblockPeer = useCallback(async peer => {
|
|
2019
|
+
// If instance of HMSSessionStore is available
|
|
2020
|
+
if (hmsSessionStore) {
|
|
2021
|
+
try {
|
|
2022
|
+
const chatPeerBlacklist = store.getState().app.chatPeerBlacklist;
|
|
2023
|
+
if (peer.customerUserID && chatPeerBlacklist.includes(peer.customerUserID)) {
|
|
2024
|
+
const updatedChatPeerBlacklist = chatPeerBlacklist.filter(peerUserId => peerUserId !== peer.customerUserID);
|
|
2025
|
+
const response = await hmsSessionStore.set(updatedChatPeerBlacklist, 'chatPeerBlacklist');
|
|
2026
|
+
console.log('setSessionMetaData Response -> ', response);
|
|
2027
|
+
return response;
|
|
2028
|
+
}
|
|
2029
|
+
return Promise.reject('Peer is already unblocked!');
|
|
2030
|
+
} catch (error) {
|
|
2031
|
+
console.log('setSessionMetaData Error -> ', error);
|
|
2032
|
+
return Promise.reject(error);
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
}, [hmsSessionStore]);
|
|
2036
|
+
return {
|
|
2037
|
+
blockPeer,
|
|
2038
|
+
unblockPeer
|
|
2039
|
+
};
|
|
2040
|
+
};
|
|
2041
|
+
export const useAllowBlockingPeerFromChat = () => {
|
|
2042
|
+
return useHMSChatLayoutConfig(config => {
|
|
2043
|
+
var _config$real_time_con;
|
|
2044
|
+
return (config === null || config === void 0 || (_config$real_time_con = config.real_time_controls) === null || _config$real_time_con === void 0 ? void 0 : _config$real_time_con.can_block_user) ?? false;
|
|
2045
|
+
});
|
|
2046
|
+
};
|
|
1711
2047
|
//# sourceMappingURL=hooks-util.js.map
|