@100mslive/react-native-room-kit 1.0.1 → 1.0.2-beta.1
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/HMSPrebuilt.js +16 -14
- package/lib/commonjs/HMSPrebuilt.js.map +1 -1
- package/lib/commonjs/HMSRoomSetup.js +85 -44
- package/lib/commonjs/HMSRoomSetup.js.map +1 -1
- package/lib/commonjs/Icons/Hand/assets/hand-off.png +0 -0
- package/lib/commonjs/Icons/Hand/assets/hand-off@2x.png +0 -0
- package/lib/commonjs/Icons/Hand/assets/hand-off@3x.png +0 -0
- package/lib/commonjs/Icons/Hand/index.js +2 -1
- package/lib/commonjs/Icons/Hand/index.js.map +1 -1
- package/lib/commonjs/Icons/Recording/assets/recording-off.png +0 -0
- package/lib/commonjs/Icons/Recording/assets/recording-off@2x.png +0 -0
- package/lib/commonjs/Icons/Recording/assets/recording-off@3x.png +0 -0
- package/lib/commonjs/Icons/Recording/index.js +2 -1
- package/lib/commonjs/Icons/Recording/index.js.map +1 -1
- package/lib/commonjs/components/DisplayView.js +3 -1
- package/lib/commonjs/components/DisplayView.js.map +1 -1
- package/lib/commonjs/components/EndRoomModal.js +29 -0
- package/lib/commonjs/components/EndRoomModal.js.map +1 -0
- package/lib/commonjs/components/EndRoomModalContent.js +9 -2
- package/lib/commonjs/components/EndRoomModalContent.js.map +1 -1
- package/lib/commonjs/components/Footer.js +9 -1
- package/lib/commonjs/components/Footer.js.map +1 -1
- package/lib/commonjs/components/HMSKeyboardAvoidingView.js +3 -18
- package/lib/commonjs/components/HMSKeyboardAvoidingView.js.map +1 -1
- package/lib/commonjs/components/HMSLocalScreenshareNotification.js +2 -2
- package/lib/commonjs/components/HMSLocalScreenshareNotification.js.map +1 -1
- package/lib/commonjs/components/HMSManageLeave.js +3 -178
- package/lib/commonjs/components/HMSManageLeave.js.map +1 -1
- package/lib/commonjs/components/HMSNotification.js +4 -3
- package/lib/commonjs/components/HMSNotification.js.map +1 -1
- package/lib/commonjs/components/HMSNotifications.js +32 -6
- package/lib/commonjs/components/HMSNotifications.js.map +1 -1
- package/lib/commonjs/components/HMSOverlayChatView.js +7 -1
- package/lib/commonjs/components/HMSOverlayChatView.js.map +1 -1
- package/lib/commonjs/components/HMSReconnectingNotification.js +33 -0
- package/lib/commonjs/components/HMSReconnectingNotification.js.map +1 -0
- package/lib/commonjs/components/HMSRecordingIndicator.js +1 -1
- package/lib/commonjs/components/HMSRecordingIndicator.js.map +1 -1
- package/lib/commonjs/components/HMSTerminalErrorNotification.js +66 -0
- package/lib/commonjs/components/HMSTerminalErrorNotification.js.map +1 -0
- package/lib/commonjs/components/LeaveRoomBottomSheet.js +175 -0
- package/lib/commonjs/components/LeaveRoomBottomSheet.js.map +1 -0
- package/lib/commonjs/components/Meeting.js +4 -0
- package/lib/commonjs/components/Meeting.js.map +1 -1
- package/lib/commonjs/components/MeetingScreenContent.js +3 -2
- package/lib/commonjs/components/MeetingScreenContent.js.map +1 -1
- package/lib/commonjs/components/PIPView.js +80 -15
- package/lib/commonjs/components/PIPView.js.map +1 -1
- package/lib/commonjs/components/Participants/ParticipantsItemOptions.js +23 -1
- package/lib/commonjs/components/Participants/ParticipantsItemOptions.js.map +1 -1
- package/lib/commonjs/components/PeerVideoTile/AvatarView.js +4 -4
- package/lib/commonjs/components/PeerVideoTile/PeerAudioIndicator.js +3 -1
- package/lib/commonjs/components/PeerVideoTile/PeerAudioIndicator.js.map +1 -1
- package/lib/commonjs/components/PeerVideoTile/PeerVideoTileView.js +1 -1
- package/lib/commonjs/components/PeerVideoTile/PeerVideoTileView.js.map +1 -1
- package/lib/commonjs/components/PreviewForRoleChangeModal.js +2 -2
- package/lib/commonjs/components/PreviewForRoleChangeModal.js.map +1 -1
- package/lib/commonjs/components/RoomSettingsModalContent.js +4 -7
- package/lib/commonjs/components/RoomSettingsModalContent.js.map +1 -1
- package/lib/commonjs/components/StopRecordingModalContent.js +4 -1
- package/lib/commonjs/components/StopRecordingModalContent.js.map +1 -1
- package/lib/commonjs/hooks-util.js +193 -28
- package/lib/commonjs/hooks-util.js.map +1 -1
- package/lib/commonjs/index.js +11 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/redux/actionTypes.js +6 -1
- package/lib/commonjs/redux/actionTypes.js.map +1 -1
- package/lib/commonjs/redux/actions/index.js +22 -1
- package/lib/commonjs/redux/actions/index.js.map +1 -1
- package/lib/commonjs/redux/reducers/appState.js +17 -1
- package/lib/commonjs/redux/reducers/appState.js.map +1 -1
- package/lib/commonjs/redux/reducers/hmsStates.js +15 -4
- package/lib/commonjs/redux/reducers/hmsStates.js.map +1 -1
- package/lib/commonjs/redux/reducers/userState.js +5 -1
- package/lib/commonjs/redux/reducers/userState.js.map +1 -1
- package/lib/commonjs/types.js +10 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils/types.js +11 -1
- package/lib/commonjs/utils/types.js.map +1 -1
- package/lib/commonjs/utils.js +1 -7
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/module/HMSPrebuilt.js +16 -14
- package/lib/module/HMSPrebuilt.js.map +1 -1
- package/lib/module/HMSRoomSetup.js +81 -40
- package/lib/module/HMSRoomSetup.js.map +1 -1
- package/lib/module/Icons/Hand/assets/hand-off.png +0 -0
- package/lib/module/Icons/Hand/assets/hand-off@2x.png +0 -0
- package/lib/module/Icons/Hand/assets/hand-off@3x.png +0 -0
- package/lib/module/Icons/Hand/index.js +2 -1
- package/lib/module/Icons/Hand/index.js.map +1 -1
- package/lib/module/Icons/Recording/assets/recording-off.png +0 -0
- package/lib/module/Icons/Recording/assets/recording-off@2x.png +0 -0
- package/lib/module/Icons/Recording/assets/recording-off@3x.png +0 -0
- package/lib/module/Icons/Recording/index.js +2 -1
- package/lib/module/Icons/Recording/index.js.map +1 -1
- package/lib/module/components/DisplayView.js +3 -1
- package/lib/module/components/DisplayView.js.map +1 -1
- package/lib/module/components/EndRoomModal.js +20 -0
- package/lib/module/components/EndRoomModal.js.map +1 -0
- package/lib/module/components/EndRoomModalContent.js +9 -2
- package/lib/module/components/EndRoomModalContent.js.map +1 -1
- package/lib/module/components/Footer.js +9 -1
- package/lib/module/components/Footer.js.map +1 -1
- package/lib/module/components/HMSKeyboardAvoidingView.js +4 -19
- package/lib/module/components/HMSKeyboardAvoidingView.js.map +1 -1
- package/lib/module/components/HMSLocalScreenshareNotification.js +1 -1
- package/lib/module/components/HMSManageLeave.js +5 -181
- package/lib/module/components/HMSManageLeave.js.map +1 -1
- package/lib/module/components/HMSNotification.js +4 -3
- package/lib/module/components/HMSNotification.js.map +1 -1
- package/lib/module/components/HMSNotifications.js +28 -2
- package/lib/module/components/HMSNotifications.js.map +1 -1
- package/lib/module/components/HMSOverlayChatView.js +7 -1
- package/lib/module/components/HMSOverlayChatView.js.map +1 -1
- package/lib/module/components/HMSReconnectingNotification.js +24 -0
- package/lib/module/components/HMSReconnectingNotification.js.map +1 -0
- package/lib/module/components/HMSRecordingIndicator.js +1 -1
- package/lib/module/components/HMSRecordingIndicator.js.map +1 -1
- package/lib/module/components/HMSTerminalErrorNotification.js +57 -0
- package/lib/module/components/HMSTerminalErrorNotification.js.map +1 -0
- package/lib/module/components/LeaveRoomBottomSheet.js +167 -0
- package/lib/module/components/LeaveRoomBottomSheet.js.map +1 -0
- package/lib/module/components/Meeting.js +5 -1
- package/lib/module/components/Meeting.js.map +1 -1
- package/lib/module/components/MeetingScreenContent.js +3 -2
- package/lib/module/components/MeetingScreenContent.js.map +1 -1
- package/lib/module/components/PIPView.js +81 -16
- package/lib/module/components/PIPView.js.map +1 -1
- package/lib/module/components/Participants/ParticipantsItemOptions.js +24 -2
- package/lib/module/components/Participants/ParticipantsItemOptions.js.map +1 -1
- package/lib/module/components/PeerVideoTile/AvatarView.js +4 -4
- package/lib/module/components/PeerVideoTile/PeerAudioIndicator.js +3 -1
- package/lib/module/components/PeerVideoTile/PeerAudioIndicator.js.map +1 -1
- package/lib/module/components/PeerVideoTile/PeerVideoTileView.js +1 -1
- package/lib/module/components/PeerVideoTile/PeerVideoTileView.js.map +1 -1
- package/lib/module/components/PreviewForRoleChangeModal.js +1 -1
- package/lib/module/components/RoomSettingsModalContent.js +6 -9
- package/lib/module/components/RoomSettingsModalContent.js.map +1 -1
- package/lib/module/components/StopRecordingModalContent.js +4 -1
- package/lib/module/components/StopRecordingModalContent.js.map +1 -1
- package/lib/module/hooks-util.js +184 -25
- package/lib/module/hooks-util.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/redux/actionTypes.js +6 -1
- package/lib/module/redux/actionTypes.js.map +1 -1
- package/lib/module/redux/actions/index.js +18 -0
- package/lib/module/redux/actions/index.js.map +1 -1
- package/lib/module/redux/reducers/appState.js +17 -1
- package/lib/module/redux/reducers/appState.js.map +1 -1
- package/lib/module/redux/reducers/hmsStates.js +15 -4
- package/lib/module/redux/reducers/hmsStates.js.map +1 -1
- package/lib/module/redux/reducers/userState.js +5 -1
- package/lib/module/redux/reducers/userState.js.map +1 -1
- package/lib/module/types.js +9 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/types.js +11 -0
- package/lib/module/utils/types.js.map +1 -1
- package/lib/module/utils.js +0 -6
- package/lib/module/utils.js.map +1 -1
- package/lib/typescript/HMSPrebuilt.d.ts +2 -16
- package/lib/typescript/HMSPrebuilt.d.ts.map +1 -1
- package/lib/typescript/HMSRoomSetup.d.ts.map +1 -1
- package/lib/typescript/Icons/Hand/index.d.ts +1 -0
- package/lib/typescript/Icons/Hand/index.d.ts.map +1 -1
- package/lib/typescript/Icons/Recording/index.d.ts +1 -0
- package/lib/typescript/Icons/Recording/index.d.ts.map +1 -1
- package/lib/typescript/components/DisplayView.d.ts.map +1 -1
- package/lib/typescript/components/EndRoomModal.d.ts +6 -0
- package/lib/typescript/components/EndRoomModal.d.ts.map +1 -0
- package/lib/typescript/components/EndRoomModalContent.d.ts.map +1 -1
- package/lib/typescript/components/Footer.d.ts +1 -0
- package/lib/typescript/components/Footer.d.ts.map +1 -1
- package/lib/typescript/components/HMSKeyboardAvoidingView.d.ts +1 -0
- package/lib/typescript/components/HMSKeyboardAvoidingView.d.ts.map +1 -1
- package/lib/typescript/components/HMSManageLeave.d.ts.map +1 -1
- package/lib/typescript/components/HMSNotification.d.ts +1 -0
- package/lib/typescript/components/HMSNotification.d.ts.map +1 -1
- package/lib/typescript/components/HMSNotifications.d.ts +1 -0
- package/lib/typescript/components/HMSNotifications.d.ts.map +1 -1
- package/lib/typescript/components/HMSOverlayChatView.d.ts.map +1 -1
- package/lib/typescript/components/HMSReconnectingNotification.d.ts +5 -0
- package/lib/typescript/components/HMSReconnectingNotification.d.ts.map +1 -0
- package/lib/typescript/components/HMSTerminalErrorNotification.d.ts +10 -0
- package/lib/typescript/components/HMSTerminalErrorNotification.d.ts.map +1 -0
- package/lib/typescript/components/LeaveRoomBottomSheet.d.ts +6 -0
- package/lib/typescript/components/LeaveRoomBottomSheet.d.ts.map +1 -0
- package/lib/typescript/components/Meeting.d.ts.map +1 -1
- package/lib/typescript/components/PIPView.d.ts.map +1 -1
- package/lib/typescript/components/Participants/ParticipantsItemOptions.d.ts.map +1 -1
- package/lib/typescript/components/PeerVideoTile/PeerAudioIndicator.d.ts.map +1 -1
- package/lib/typescript/components/PeerVideoTile/PeerVideoTileView.d.ts.map +1 -1
- package/lib/typescript/components/RoomSettingsModalContent.d.ts.map +1 -1
- package/lib/typescript/components/StopRecordingModalContent.d.ts.map +1 -1
- package/lib/typescript/hooks-util.d.ts +20 -7
- package/lib/typescript/hooks-util.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +2 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/redux/actionTypes.d.ts +3 -0
- package/lib/typescript/redux/actionTypes.d.ts.map +1 -1
- package/lib/typescript/redux/actions/index.d.ts +23 -14
- package/lib/typescript/redux/actions/index.d.ts.map +1 -1
- package/lib/typescript/redux/index.d.ts +5 -7
- package/lib/typescript/redux/index.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/appState.d.ts +4 -5
- package/lib/typescript/redux/reducers/appState.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/hmsStates.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/index.d.ts +5 -7
- package/lib/typescript/redux/reducers/index.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/userState.d.ts +2 -2
- package/lib/typescript/redux/reducers/userState.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +79 -0
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/utils/types.d.ts +24 -0
- package/lib/typescript/utils/types.d.ts.map +1 -1
- package/lib/typescript/utils.d.ts +0 -5
- package/lib/typescript/utils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/HMSPrebuilt.tsx +32 -23
- package/src/HMSRoomSetup.tsx +105 -53
- package/src/Icons/Hand/assets/hand-off.png +0 -0
- package/src/Icons/Hand/assets/hand-off@2x.png +0 -0
- package/src/Icons/Hand/assets/hand-off@3x.png +0 -0
- package/src/Icons/Hand/index.tsx +13 -3
- package/src/Icons/Recording/assets/recording-off.png +0 -0
- package/src/Icons/Recording/assets/recording-off@2x.png +0 -0
- package/src/Icons/Recording/assets/recording-off@3x.png +0 -0
- package/src/Icons/Recording/index.tsx +9 -2
- package/src/components/DisplayView.tsx +6 -0
- package/src/components/EndRoomModal.tsx +24 -0
- package/src/components/EndRoomModalContent.tsx +9 -2
- package/src/components/Footer.tsx +18 -2
- package/src/components/HMSKeyboardAvoidingView.tsx +5 -23
- package/src/components/HMSLocalScreenshareNotification.tsx +1 -1
- package/src/components/HMSManageLeave.tsx +4 -228
- package/src/components/HMSNotification.tsx +4 -2
- package/src/components/HMSNotifications.tsx +41 -7
- package/src/components/HMSOverlayChatView.tsx +6 -1
- package/src/components/HMSReconnectingNotification.tsx +27 -0
- package/src/components/HMSRecordingIndicator.tsx +1 -1
- package/src/components/HMSTerminalErrorNotification.tsx +70 -0
- package/src/components/LeaveRoomBottomSheet.tsx +199 -0
- package/src/components/Meeting.tsx +7 -0
- package/src/components/MeetingScreenContent.tsx +2 -2
- package/src/components/PIPView.tsx +113 -25
- package/src/components/Participants/ParticipantsItemOptions.tsx +26 -4
- package/src/components/PeerVideoTile/AvatarView.tsx +4 -4
- package/src/components/PeerVideoTile/PeerAudioIndicator.tsx +6 -1
- package/src/components/PeerVideoTile/PeerVideoTileView.tsx +4 -2
- package/src/components/PreviewForRoleChangeModal.tsx +1 -1
- package/src/components/RoomSettingsModalContent.tsx +5 -9
- package/src/components/StopRecordingModalContent.tsx +3 -1
- package/src/hooks-util.ts +243 -25
- package/src/index.ts +2 -0
- package/src/redux/actionTypes.ts +7 -0
- package/src/redux/actions/index.ts +19 -7
- package/src/redux/reducers/appState.ts +18 -1
- package/src/redux/reducers/hmsStates.ts +19 -7
- package/src/redux/reducers/userState.ts +7 -3
- package/src/types.ts +71 -0
- package/src/utils/types.ts +27 -0
- package/src/utils.ts +0 -6
package/src/hooks-util.ts
CHANGED
|
@@ -18,10 +18,13 @@ import {
|
|
|
18
18
|
HMSTrackUpdate,
|
|
19
19
|
HMSUpdateListenerActions,
|
|
20
20
|
HMSMessageRecipient,
|
|
21
|
+
useHMSHLSPlayerResolution,
|
|
22
|
+
useHmsViewsResolutionsState,
|
|
21
23
|
// useHMSPeerUpdates,
|
|
22
24
|
} from '@100mslive/react-native-hms';
|
|
23
25
|
import type { Chat as ChatConfig } from '@100mslive/types-prebuilt/elements/chat';
|
|
24
26
|
import type {
|
|
27
|
+
HMSPIPConfig,
|
|
25
28
|
HMSRole,
|
|
26
29
|
HMSSessionStore,
|
|
27
30
|
HMSSessionStoreValue,
|
|
@@ -49,10 +52,11 @@ import type { DependencyList } from 'react';
|
|
|
49
52
|
import {
|
|
50
53
|
MaxTilesInOnePage,
|
|
51
54
|
ModalTypes,
|
|
55
|
+
OnLeaveReason,
|
|
52
56
|
PeerListRefreshInterval,
|
|
53
57
|
PipModes,
|
|
54
58
|
} from './utils/types';
|
|
55
|
-
import type { ChatBroadcastFilter, PeerTrackNode } from './utils/types';
|
|
59
|
+
import type { ChatBroadcastFilter, OnLeaveHandler, PeerTrackNode } from './utils/types';
|
|
56
60
|
import { createPeerTrackNode } from './utils/functions';
|
|
57
61
|
import {
|
|
58
62
|
batch,
|
|
@@ -61,7 +65,7 @@ import {
|
|
|
61
65
|
useSelector,
|
|
62
66
|
useStore,
|
|
63
67
|
} from 'react-redux';
|
|
64
|
-
import type { RootState } from './redux';
|
|
68
|
+
import type { AppDispatch, RootState } from './redux';
|
|
65
69
|
import {
|
|
66
70
|
addMessage,
|
|
67
71
|
addNotification,
|
|
@@ -82,16 +86,20 @@ import {
|
|
|
82
86
|
saveUserData,
|
|
83
87
|
setActiveChatBottomSheetTab,
|
|
84
88
|
setActiveSpeakers,
|
|
89
|
+
setAutoEnterPipMode,
|
|
85
90
|
setFullScreenPeerTrackNode,
|
|
86
91
|
setHMSLocalPeerState,
|
|
87
92
|
setHMSRoleState,
|
|
88
93
|
setHMSRoomState,
|
|
94
|
+
setHandleBackButton,
|
|
89
95
|
setIsLocalAudioMutedState,
|
|
90
96
|
setIsLocalVideoMutedState,
|
|
91
97
|
setLayoutConfig,
|
|
92
98
|
setLocalPeerTrackNode,
|
|
93
99
|
setMiniViewPeerTrackNode,
|
|
94
100
|
setModalType,
|
|
101
|
+
setOnLeaveHandler,
|
|
102
|
+
setPrebuiltData,
|
|
95
103
|
setReconnecting,
|
|
96
104
|
setRoleChangeRequest,
|
|
97
105
|
setStartingOrStoppingRecording,
|
|
@@ -111,7 +119,13 @@ import {
|
|
|
111
119
|
replacePeerTrackNodesWithTrack,
|
|
112
120
|
} from './peerTrackNodeUtils';
|
|
113
121
|
import { MeetingState } from './types';
|
|
114
|
-
import {
|
|
122
|
+
import type { HMSPrebuiltProps } from './types';
|
|
123
|
+
import {
|
|
124
|
+
BackHandler,
|
|
125
|
+
InteractionManager,
|
|
126
|
+
Keyboard,
|
|
127
|
+
Platform,
|
|
128
|
+
} from 'react-native';
|
|
115
129
|
import type { ImageStyle, StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
116
130
|
import { NavigationContext } from '@react-navigation/native';
|
|
117
131
|
import {
|
|
@@ -129,7 +143,7 @@ import {
|
|
|
129
143
|
import type { GridViewRefAttrs } from './components/GridView';
|
|
130
144
|
import { getRoomLayout } from './modules/HMSManager';
|
|
131
145
|
import { DEFAULT_THEME, DEFAULT_TYPOGRAPHY } from './utils/theme';
|
|
132
|
-
import { NotificationTypes } from './
|
|
146
|
+
import { NotificationTypes } from './types';
|
|
133
147
|
|
|
134
148
|
export const useHMSListeners = (
|
|
135
149
|
setPeerTrackNodes: React.Dispatch<React.SetStateAction<PeerTrackNode[]>>
|
|
@@ -1240,12 +1254,21 @@ export const useHMSReconnection = () => {
|
|
|
1240
1254
|
|
|
1241
1255
|
hmsInstance.addEventListener(HMSUpdateListenerActions.RECONNECTING, () => {
|
|
1242
1256
|
if (mounted) {
|
|
1243
|
-
|
|
1257
|
+
batch(() => {
|
|
1258
|
+
dispatch(setReconnecting(true));
|
|
1259
|
+
dispatch(addNotification({
|
|
1260
|
+
id: NotificationTypes.RECONNECTING,
|
|
1261
|
+
type: NotificationTypes.RECONNECTING
|
|
1262
|
+
}))
|
|
1263
|
+
});
|
|
1244
1264
|
}
|
|
1245
1265
|
});
|
|
1246
1266
|
hmsInstance.addEventListener(HMSUpdateListenerActions.RECONNECTED, () => {
|
|
1247
1267
|
if (mounted) {
|
|
1248
|
-
|
|
1268
|
+
batch(() => {
|
|
1269
|
+
dispatch(setReconnecting(false));
|
|
1270
|
+
dispatch(removeNotification(NotificationTypes.RECONNECTING));
|
|
1271
|
+
})
|
|
1249
1272
|
}
|
|
1250
1273
|
});
|
|
1251
1274
|
|
|
@@ -1259,11 +1282,11 @@ export const useHMSReconnection = () => {
|
|
|
1259
1282
|
|
|
1260
1283
|
export const useHMSPIPRoomLeave = () => {
|
|
1261
1284
|
const hmsInstance = useHMSInstance();
|
|
1262
|
-
const { destroy } = useLeaveMethods(
|
|
1285
|
+
const { destroy } = useLeaveMethods();
|
|
1263
1286
|
|
|
1264
1287
|
useEffect(() => {
|
|
1265
1288
|
const pipRoomLeaveHandler = () => {
|
|
1266
|
-
destroy();
|
|
1289
|
+
destroy(OnLeaveReason.PIP);
|
|
1267
1290
|
};
|
|
1268
1291
|
|
|
1269
1292
|
hmsInstance.addEventListener(
|
|
@@ -1279,11 +1302,17 @@ export const useHMSPIPRoomLeave = () => {
|
|
|
1279
1302
|
|
|
1280
1303
|
export const useHMSRemovedFromRoomUpdate = () => {
|
|
1281
1304
|
const hmsInstance = useHMSInstance();
|
|
1282
|
-
const { destroy } = useLeaveMethods(
|
|
1305
|
+
const { destroy } = useLeaveMethods();
|
|
1283
1306
|
|
|
1284
1307
|
useEffect(() => {
|
|
1285
|
-
const removedFromRoomHandler = (
|
|
1286
|
-
|
|
1308
|
+
const removedFromRoomHandler = (data: {
|
|
1309
|
+
requestedBy?: HMSPeer | null;
|
|
1310
|
+
reason?: string;
|
|
1311
|
+
roomEnded?: boolean;
|
|
1312
|
+
}) => {
|
|
1313
|
+
destroy(
|
|
1314
|
+
data.roomEnded ? OnLeaveReason.ROOM_END : OnLeaveReason.PEER_KICKED
|
|
1315
|
+
);
|
|
1287
1316
|
};
|
|
1288
1317
|
|
|
1289
1318
|
hmsInstance.addEventListener(
|
|
@@ -1360,6 +1389,93 @@ export const useHMSNetworkQualityUpdate = () => {
|
|
|
1360
1389
|
}, [hmsInstance]);
|
|
1361
1390
|
};
|
|
1362
1391
|
|
|
1392
|
+
export type PIPConfig = Omit<HMSPIPConfig, 'autoEnterPipMode'>;
|
|
1393
|
+
|
|
1394
|
+
export const useEnableAutoPip = () => {
|
|
1395
|
+
const hmsInstance = useHMSInstance();
|
|
1396
|
+
|
|
1397
|
+
const enableAutoPip = useCallback(
|
|
1398
|
+
(data?: PIPConfig) => {
|
|
1399
|
+
hmsInstance.setPipParams({ ...data, autoEnterPipMode: true });
|
|
1400
|
+
},
|
|
1401
|
+
[hmsInstance]
|
|
1402
|
+
);
|
|
1403
|
+
|
|
1404
|
+
return enableAutoPip;
|
|
1405
|
+
};
|
|
1406
|
+
|
|
1407
|
+
export const useDisableAutoPip = () => {
|
|
1408
|
+
const hmsInstance = useHMSInstance();
|
|
1409
|
+
|
|
1410
|
+
const disableAutoPip = useCallback(
|
|
1411
|
+
(data?: PIPConfig) => {
|
|
1412
|
+
hmsInstance.setPipParams({ ...data, autoEnterPipMode: false });
|
|
1413
|
+
},
|
|
1414
|
+
[hmsInstance]
|
|
1415
|
+
);
|
|
1416
|
+
|
|
1417
|
+
return disableAutoPip;
|
|
1418
|
+
};
|
|
1419
|
+
|
|
1420
|
+
export const useAutoPip = (oneToOneCall: boolean) => {
|
|
1421
|
+
const enableAutoPip = useEnableAutoPip();
|
|
1422
|
+
const disableAutoPip = useDisableAutoPip();
|
|
1423
|
+
|
|
1424
|
+
const autoEnterPipMode = useSelector(
|
|
1425
|
+
(state: RootState) => state.app.autoEnterPipMode
|
|
1426
|
+
);
|
|
1427
|
+
const [numerator, denominator] = usePipAspectRatio(oneToOneCall);
|
|
1428
|
+
|
|
1429
|
+
useEffect(() => {
|
|
1430
|
+
if (autoEnterPipMode) {
|
|
1431
|
+
enableAutoPip({ aspectRatio: [numerator, denominator] });
|
|
1432
|
+
|
|
1433
|
+
return disableAutoPip;
|
|
1434
|
+
}
|
|
1435
|
+
}, [
|
|
1436
|
+
numerator,
|
|
1437
|
+
denominator,
|
|
1438
|
+
autoEnterPipMode,
|
|
1439
|
+
enableAutoPip,
|
|
1440
|
+
disableAutoPip,
|
|
1441
|
+
]);
|
|
1442
|
+
};
|
|
1443
|
+
|
|
1444
|
+
export const usePipAspectRatio = (oneToOneCall: boolean): [number, number] => {
|
|
1445
|
+
const isHLSViewer = useIsHLSViewer();
|
|
1446
|
+
const hlsPlayerResolution = useHMSHLSPlayerResolution();
|
|
1447
|
+
|
|
1448
|
+
const firstSSNodeId = useSelector((state: RootState) => {
|
|
1449
|
+
const ssPeerTrackNode = state.app.screensharePeerTrackNodes[0];
|
|
1450
|
+
return ssPeerTrackNode?.track?.trackId;
|
|
1451
|
+
});
|
|
1452
|
+
|
|
1453
|
+
const ssResolution = useHmsViewsResolutionsState(firstSSNodeId);
|
|
1454
|
+
|
|
1455
|
+
const aspectRatio = useMemo((): [number, number] => {
|
|
1456
|
+
// When user is hlsviewer and we have stream resolution
|
|
1457
|
+
if (isHLSViewer && hlsPlayerResolution) {
|
|
1458
|
+
return [hlsPlayerResolution.width, hlsPlayerResolution.height];
|
|
1459
|
+
}
|
|
1460
|
+
// When user is hlsviewer and we don't have stream resolution
|
|
1461
|
+
if (isHLSViewer) {
|
|
1462
|
+
return [9, 16];
|
|
1463
|
+
}
|
|
1464
|
+
// When we have screenshare resolution, use it
|
|
1465
|
+
if (ssResolution) {
|
|
1466
|
+
return [ssResolution.width, ssResolution.height];
|
|
1467
|
+
}
|
|
1468
|
+
// When there is no screenshare and one-to-one call is happening
|
|
1469
|
+
if (!firstSSNodeId && oneToOneCall) {
|
|
1470
|
+
return [9, 16];
|
|
1471
|
+
}
|
|
1472
|
+
// default aspect ratio
|
|
1473
|
+
return [16, 9];
|
|
1474
|
+
}, [isHLSViewer, firstSSNodeId, oneToOneCall, ssResolution, hlsPlayerResolution]);
|
|
1475
|
+
|
|
1476
|
+
return aspectRatio;
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1363
1479
|
export const useHMSActiveSpeakerUpdates = (
|
|
1364
1480
|
setPeerTrackNodes: React.Dispatch<React.SetStateAction<PeerTrackNode[]>>,
|
|
1365
1481
|
active?: boolean
|
|
@@ -1821,7 +1937,6 @@ export const useFilteredParticipants = (filterText: string) => {
|
|
|
1821
1937
|
: list;
|
|
1822
1938
|
|
|
1823
1939
|
if (Array.isArray(filteredList) && filteredList.length > 0) {
|
|
1824
|
-
|
|
1825
1940
|
filteredHandRaisedPeers.push(filteredList);
|
|
1826
1941
|
const offStageRoleTotalCount =
|
|
1827
1942
|
offStageParticipantsTotalCounts[role.name!];
|
|
@@ -1831,8 +1946,9 @@ export const useFilteredParticipants = (filterText: string) => {
|
|
|
1831
1946
|
t.push({
|
|
1832
1947
|
id: role.name!,
|
|
1833
1948
|
label: `${role.name!} (${
|
|
1834
|
-
typeof offStageRoleTotalCount === 'number'
|
|
1835
|
-
|
|
1949
|
+
typeof offStageRoleTotalCount === 'number' &&
|
|
1950
|
+
offStageRoleTotalCount > filteredList.length
|
|
1951
|
+
? offStageRoleTotalCount // only use `offStageRoleTotalCount` when it is number and more than list length
|
|
1836
1952
|
: filteredList.length
|
|
1837
1953
|
})`,
|
|
1838
1954
|
showViewAll:
|
|
@@ -1886,13 +2002,13 @@ export const useShouldGoLive = () => {
|
|
|
1886
2002
|
return shouldGoLive;
|
|
1887
2003
|
};
|
|
1888
2004
|
|
|
1889
|
-
export const useLeaveMethods = (
|
|
2005
|
+
export const useLeaveMethods = () => {
|
|
1890
2006
|
const navigation = useContext(NavigationContext);
|
|
1891
2007
|
const hmsInstance = useHMSInstance();
|
|
1892
2008
|
const dispatch = useDispatch();
|
|
1893
2009
|
const reduxStore = useStore<RootState>();
|
|
1894
2010
|
|
|
1895
|
-
const destroy = useCallback(() => {
|
|
2011
|
+
const destroy = useCallback((reason: Parameters<OnLeaveHandler>[0]) => {
|
|
1896
2012
|
try {
|
|
1897
2013
|
const s = hmsInstance.destroy();
|
|
1898
2014
|
console.log('Destroy Success: ', s);
|
|
@@ -1919,9 +2035,13 @@ export const useLeaveMethods = (isUnmounted: boolean) => {
|
|
|
1919
2035
|
const onLeave = reduxStore.getState().user.onLeave;
|
|
1920
2036
|
|
|
1921
2037
|
if (typeof onLeave === 'function') {
|
|
1922
|
-
onLeave();
|
|
2038
|
+
onLeave(reason);
|
|
1923
2039
|
dispatch(clearStore());
|
|
1924
|
-
} else if (
|
|
2040
|
+
} else if (
|
|
2041
|
+
navigation &&
|
|
2042
|
+
typeof navigation.canGoBack === 'function' &&
|
|
2043
|
+
navigation.canGoBack()
|
|
2044
|
+
) {
|
|
1925
2045
|
navigation.goBack();
|
|
1926
2046
|
dispatch(clearStore());
|
|
1927
2047
|
} else {
|
|
@@ -1941,7 +2061,7 @@ export const useLeaveMethods = (isUnmounted: boolean) => {
|
|
|
1941
2061
|
}, [hmsInstance]);
|
|
1942
2062
|
|
|
1943
2063
|
const leave = useCallback(
|
|
1944
|
-
async (shouldEndStream: boolean = false) => {
|
|
2064
|
+
async (reason: OnLeaveReason, shouldEndStream: boolean = false) => {
|
|
1945
2065
|
if (shouldEndStream) {
|
|
1946
2066
|
hmsInstance.stopHLSStreaming().catch((error) => {
|
|
1947
2067
|
console.log('Stop HLS Streaming Error: ', error);
|
|
@@ -1950,7 +2070,7 @@ export const useLeaveMethods = (isUnmounted: boolean) => {
|
|
|
1950
2070
|
try {
|
|
1951
2071
|
const d = await hmsInstance.leave();
|
|
1952
2072
|
console.log('Leave Success: ', d);
|
|
1953
|
-
await destroy();
|
|
2073
|
+
await destroy(reason);
|
|
1954
2074
|
} catch (e) {
|
|
1955
2075
|
console.log(`Leave Room Error: ${e}`);
|
|
1956
2076
|
Toast.showWithGravity(`Leave Room Error: ${e}`, Toast.LONG, Toast.TOP);
|
|
@@ -1959,31 +2079,31 @@ export const useLeaveMethods = (isUnmounted: boolean) => {
|
|
|
1959
2079
|
[destroy, hmsInstance]
|
|
1960
2080
|
);
|
|
1961
2081
|
|
|
1962
|
-
const
|
|
2082
|
+
const prebuiltCleanUp = useCallback(async () => {
|
|
1963
2083
|
try {
|
|
1964
2084
|
await hmsInstance.leave();
|
|
1965
2085
|
await hmsInstance.destroy();
|
|
1966
2086
|
dispatch(clearStore());
|
|
1967
2087
|
} catch (error) {
|
|
1968
2088
|
Toast.showWithGravity(
|
|
1969
|
-
`Unable to
|
|
2089
|
+
`Unable to leave or destroy: ${error}`,
|
|
1970
2090
|
Toast.LONG,
|
|
1971
2091
|
Toast.TOP
|
|
1972
2092
|
);
|
|
1973
2093
|
}
|
|
1974
2094
|
}, [hmsInstance]);
|
|
1975
2095
|
|
|
1976
|
-
const endRoom = useCallback(async () => {
|
|
2096
|
+
const endRoom = useCallback(async (reason: OnLeaveReason) => {
|
|
1977
2097
|
try {
|
|
1978
2098
|
const d = await hmsInstance.endRoom('Host ended the room');
|
|
1979
2099
|
console.log('EndRoom Success: ', d);
|
|
1980
|
-
await destroy();
|
|
2100
|
+
await destroy(reason);
|
|
1981
2101
|
} catch (e) {
|
|
1982
2102
|
console.log('EndRoom Error: ', e);
|
|
1983
2103
|
}
|
|
1984
2104
|
}, [destroy, hmsInstance]);
|
|
1985
2105
|
|
|
1986
|
-
return { destroy, leave, endRoom,
|
|
2106
|
+
return { destroy, leave, endRoom, prebuiltCleanUp };
|
|
1987
2107
|
};
|
|
1988
2108
|
|
|
1989
2109
|
// Returns layout config as it is returned from server
|
|
@@ -2189,3 +2309,101 @@ export const useHMSConferencingScreenConfig = <Selected = unknown>(
|
|
|
2189
2309
|
return selector(conferencingScreenConfig);
|
|
2190
2310
|
}, equalityFn);
|
|
2191
2311
|
};
|
|
2312
|
+
|
|
2313
|
+
export const useBackButtonPress = () => {
|
|
2314
|
+
const { handleModalVisibleType } = useModalType();
|
|
2315
|
+
|
|
2316
|
+
const handleBackPress = useSelector(
|
|
2317
|
+
(state: RootState) => state.app.handleBackButton
|
|
2318
|
+
);
|
|
2319
|
+
|
|
2320
|
+
useEffect(() => {
|
|
2321
|
+
if (handleBackPress) {
|
|
2322
|
+
const backPressHandler = () => {
|
|
2323
|
+
handleModalVisibleType(ModalTypes.LEAVE_ROOM);
|
|
2324
|
+
|
|
2325
|
+
/**
|
|
2326
|
+
* When true is returned the event will not be bubbled up
|
|
2327
|
+
* & no other back action will execute
|
|
2328
|
+
*/
|
|
2329
|
+
return true;
|
|
2330
|
+
|
|
2331
|
+
/**
|
|
2332
|
+
* Returning false will let the event to bubble up & let other event listeners
|
|
2333
|
+
* or the system's default back action to be executed.
|
|
2334
|
+
*/
|
|
2335
|
+
// return false;
|
|
2336
|
+
};
|
|
2337
|
+
|
|
2338
|
+
const subscription = BackHandler.addEventListener(
|
|
2339
|
+
'hardwareBackPress',
|
|
2340
|
+
backPressHandler
|
|
2341
|
+
);
|
|
2342
|
+
|
|
2343
|
+
return () => {
|
|
2344
|
+
if (typeof subscription.remove === 'function') {
|
|
2345
|
+
subscription.remove();
|
|
2346
|
+
} else {
|
|
2347
|
+
BackHandler.removeEventListener(
|
|
2348
|
+
'hardwareBackPress',
|
|
2349
|
+
backPressHandler
|
|
2350
|
+
);
|
|
2351
|
+
}
|
|
2352
|
+
};
|
|
2353
|
+
}
|
|
2354
|
+
}, [handleBackPress, handleModalVisibleType]);
|
|
2355
|
+
};
|
|
2356
|
+
|
|
2357
|
+
export const useSavePropsToStore = (
|
|
2358
|
+
props: HMSPrebuiltProps,
|
|
2359
|
+
dispatch: AppDispatch
|
|
2360
|
+
) => {
|
|
2361
|
+
const { roomCode, options, onLeave, handleBackButton, autoEnterPipMode } =
|
|
2362
|
+
props;
|
|
2363
|
+
|
|
2364
|
+
useEffect(() => {
|
|
2365
|
+
dispatch(setPrebuiltData({ roomCode, options }));
|
|
2366
|
+
}, [roomCode, options]);
|
|
2367
|
+
|
|
2368
|
+
useEffect(() => {
|
|
2369
|
+
dispatch(setOnLeaveHandler(onLeave));
|
|
2370
|
+
}, [onLeave]);
|
|
2371
|
+
|
|
2372
|
+
useEffect(() => {
|
|
2373
|
+
if (Platform.OS === 'android') {
|
|
2374
|
+
dispatch(setHandleBackButton(handleBackButton));
|
|
2375
|
+
}
|
|
2376
|
+
}, [handleBackButton]);
|
|
2377
|
+
|
|
2378
|
+
useEffect(() => {
|
|
2379
|
+
if (Platform.OS === 'android') {
|
|
2380
|
+
dispatch(setAutoEnterPipMode(autoEnterPipMode));
|
|
2381
|
+
}
|
|
2382
|
+
}, [autoEnterPipMode]);
|
|
2383
|
+
};
|
|
2384
|
+
|
|
2385
|
+
export const useStartRecording = () => {
|
|
2386
|
+
const dispatch = useDispatch();
|
|
2387
|
+
const hmsInstance = useHMSInstance();
|
|
2388
|
+
|
|
2389
|
+
const startRecording = useCallback(() => {
|
|
2390
|
+
dispatch(setStartingOrStoppingRecording(true));
|
|
2391
|
+
|
|
2392
|
+
hmsInstance.startRTMPOrRecording({ record: true }).catch((error) => {
|
|
2393
|
+
batch(() => {
|
|
2394
|
+
dispatch(setStartingOrStoppingRecording(false));
|
|
2395
|
+
dispatch(
|
|
2396
|
+
addNotification({
|
|
2397
|
+
id: Math.random().toString(16).slice(2),
|
|
2398
|
+
type: NotificationTypes.ERROR,
|
|
2399
|
+
message: error.message
|
|
2400
|
+
})
|
|
2401
|
+
);
|
|
2402
|
+
});
|
|
2403
|
+
});
|
|
2404
|
+
}, [hmsInstance]);
|
|
2405
|
+
|
|
2406
|
+
return {
|
|
2407
|
+
startRecording,
|
|
2408
|
+
};
|
|
2409
|
+
};
|
package/src/index.ts
CHANGED
package/src/redux/actionTypes.ts
CHANGED
|
@@ -84,6 +84,10 @@ const SET_ACTIVE_CHAT_BOTTOM_SHEET_TAB = 'SET_ACTIVE_CHAT_BOTTOM_SHEET_TAB';
|
|
|
84
84
|
|
|
85
85
|
const SET_CHAT_FILTER_SHEET_VISIBLE = 'SET_CHAT_FILTER_SHEET_VISIBLE';
|
|
86
86
|
|
|
87
|
+
const SET_HANDLE_BACK_BUTTON = 'SET_HANDLE_BACK_BUTTON';
|
|
88
|
+
|
|
89
|
+
const SET_AUTO_ENTER_PIP_MODE = 'SET_AUTO_ENTER_PIP_MODE';
|
|
90
|
+
|
|
87
91
|
export default {
|
|
88
92
|
ADD_PINNED_MESSAGE,
|
|
89
93
|
ADD_MESSAGE,
|
|
@@ -123,11 +127,14 @@ export default {
|
|
|
123
127
|
REMOVE_NOTIFICATION,
|
|
124
128
|
SET_ACTIVE_CHAT_BOTTOM_SHEET_TAB,
|
|
125
129
|
SET_CHAT_FILTER_SHEET_VISIBLE,
|
|
130
|
+
SET_HANDLE_BACK_BUTTON,
|
|
131
|
+
SET_AUTO_ENTER_PIP_MODE,
|
|
126
132
|
};
|
|
127
133
|
|
|
128
134
|
export enum HmsStateActionTypes {
|
|
129
135
|
CLEAR_STATES = 'CLEAR_STATES',
|
|
130
136
|
SET_PREBUILT_DATA = 'SET_PREBUILT_DATA',
|
|
137
|
+
SET_ON_LEAVE_HANDLER = 'SET_ON_LEAVE_HANDLER',
|
|
131
138
|
SET_ROOM_STATE = 'SET_ROOM_STATE',
|
|
132
139
|
SET_LOCAL_PEER_STATE = 'SET_LOCAL_PEER_STATE',
|
|
133
140
|
SET_ROLES_STATE = 'SET_ROLES_STATE',
|
|
@@ -18,11 +18,13 @@ import type {
|
|
|
18
18
|
ChatBottomSheetTabs,
|
|
19
19
|
HMSIOSScreenShareConfig,
|
|
20
20
|
ModalTypes,
|
|
21
|
+
OnLeaveHandler,
|
|
21
22
|
PeerTrackNode,
|
|
22
23
|
PipModes,
|
|
23
24
|
} from '../../utils/types';
|
|
24
25
|
import actionTypes, { HmsStateActionTypes } from '../actionTypes';
|
|
25
26
|
import { MeetingState } from '../../types';
|
|
27
|
+
import type { Notification } from '../../types';
|
|
26
28
|
|
|
27
29
|
export const setPrebuiltData = (data: {
|
|
28
30
|
roomCode: string;
|
|
@@ -37,12 +39,16 @@ export const setPrebuiltData = (data: {
|
|
|
37
39
|
};
|
|
38
40
|
ios?: HMSIOSScreenShareConfig;
|
|
39
41
|
};
|
|
40
|
-
onLeave?: () => void;
|
|
41
42
|
}) => ({
|
|
42
43
|
type: HmsStateActionTypes.SET_PREBUILT_DATA,
|
|
43
44
|
payload: data,
|
|
44
45
|
});
|
|
45
46
|
|
|
47
|
+
export const setOnLeaveHandler = (onLeave?: OnLeaveHandler) => ({
|
|
48
|
+
type: HmsStateActionTypes.SET_ON_LEAVE_HANDLER,
|
|
49
|
+
payload: { onLeave },
|
|
50
|
+
});
|
|
51
|
+
|
|
46
52
|
export const clearStore = () => ({
|
|
47
53
|
type: HmsStateActionTypes.CLEAR_STATES,
|
|
48
54
|
});
|
|
@@ -306,16 +312,12 @@ export const updateScreenshareTile = (
|
|
|
306
312
|
payload: data,
|
|
307
313
|
});
|
|
308
314
|
|
|
309
|
-
export const addNotification = (notification: {
|
|
310
|
-
id: string;
|
|
311
|
-
type: string;
|
|
312
|
-
peer: HMSPeer;
|
|
313
|
-
}) => ({
|
|
315
|
+
export const addNotification = (notification: Notification) => ({
|
|
314
316
|
type: actionTypes.ADD_NOTIFICATION,
|
|
315
317
|
payload: { notification },
|
|
316
318
|
});
|
|
317
319
|
|
|
318
|
-
export const removeNotification = (notificationId:
|
|
320
|
+
export const removeNotification = (notificationId: Notification['id']) => ({
|
|
319
321
|
type: actionTypes.REMOVE_NOTIFICATION,
|
|
320
322
|
payload: { id: notificationId },
|
|
321
323
|
});
|
|
@@ -379,3 +381,13 @@ export const setReconnecting = (reconnecting: boolean) => ({
|
|
|
379
381
|
type: HmsStateActionTypes.SET_RECONNECTING,
|
|
380
382
|
reconnecting,
|
|
381
383
|
});
|
|
384
|
+
|
|
385
|
+
export const setHandleBackButton = (handleBackButton?: boolean) => ({
|
|
386
|
+
type: actionTypes.SET_HANDLE_BACK_BUTTON,
|
|
387
|
+
payload: { handleBackButton },
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
export const setAutoEnterPipMode = (autoEnterPipMode?: boolean) => ({
|
|
391
|
+
type: actionTypes.SET_AUTO_ENTER_PIP_MODE,
|
|
392
|
+
payload: { autoEnterPipMode },
|
|
393
|
+
});
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
HMSRemoteVideoStats,
|
|
12
12
|
} from '@100mslive/react-native-hms';
|
|
13
13
|
import { MeetingState } from '../../types';
|
|
14
|
+
import type { Notification } from '../../types';
|
|
14
15
|
|
|
15
16
|
type ActionType = {
|
|
16
17
|
payload: { [key: string]: any };
|
|
@@ -48,9 +49,11 @@ type IntialStateType = {
|
|
|
48
49
|
startingOrStoppingRecording: boolean;
|
|
49
50
|
fullScreenPeerTrackNode: null | PeerTrackNode;
|
|
50
51
|
screensharePeerTrackNodes: PeerTrackNode[];
|
|
51
|
-
notifications:
|
|
52
|
+
notifications: Notification[];
|
|
52
53
|
activeChatBottomSheetTab: (typeof ChatBottomSheetTabs)[number];
|
|
53
54
|
chatFilterSheetVisible: boolean;
|
|
55
|
+
handleBackButton: boolean;
|
|
56
|
+
autoEnterPipMode: boolean;
|
|
54
57
|
};
|
|
55
58
|
|
|
56
59
|
const INITIAL_STATE: IntialStateType = {
|
|
@@ -80,6 +83,8 @@ const INITIAL_STATE: IntialStateType = {
|
|
|
80
83
|
notifications: [],
|
|
81
84
|
activeChatBottomSheetTab: ChatBottomSheetTabs[0],
|
|
82
85
|
chatFilterSheetVisible: false,
|
|
86
|
+
handleBackButton: false,
|
|
87
|
+
autoEnterPipMode: false,
|
|
83
88
|
};
|
|
84
89
|
|
|
85
90
|
const appReducer = (
|
|
@@ -283,6 +288,18 @@ const appReducer = (
|
|
|
283
288
|
chatFilterSheetVisible: action.payload.chatFilterSheetVisible,
|
|
284
289
|
};
|
|
285
290
|
}
|
|
291
|
+
case ActionTypes.SET_HANDLE_BACK_BUTTON: {
|
|
292
|
+
return {
|
|
293
|
+
...state,
|
|
294
|
+
handleBackButton: action.payload.handleBackButton ?? INITIAL_STATE.handleBackButton,
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
case ActionTypes.SET_AUTO_ENTER_PIP_MODE: {
|
|
298
|
+
return {
|
|
299
|
+
...state,
|
|
300
|
+
autoEnterPipMode: action.payload.autoEnterPipMode ?? INITIAL_STATE.autoEnterPipMode,
|
|
301
|
+
};
|
|
302
|
+
}
|
|
286
303
|
case HmsStateActionTypes.CLEAR_STATES:
|
|
287
304
|
return INITIAL_STATE;
|
|
288
305
|
default:
|
|
@@ -402,17 +402,29 @@ const hmsStatesReducer = (
|
|
|
402
402
|
};
|
|
403
403
|
}
|
|
404
404
|
case HmsStateActionTypes.UPDATE_PARTICIPANT: {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
405
|
+
let previousRoleName: HMSRole['name'] | null = null;
|
|
406
|
+
|
|
407
|
+
for (const groupName in state.groupedParticipants) {
|
|
408
|
+
if (Object.prototype.hasOwnProperty.call(state.groupedParticipants, groupName)) {
|
|
409
|
+
const participantsList = state.groupedParticipants[groupName];
|
|
410
|
+
|
|
411
|
+
if (Array.isArray(participantsList)) {
|
|
412
|
+
const result = participantsList.find(
|
|
413
|
+
(participant) => participant.peerID === action.participant.peerID
|
|
414
|
+
);
|
|
415
|
+
|
|
416
|
+
if (result) {
|
|
417
|
+
previousRoleName = groupName;
|
|
418
|
+
break;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
410
423
|
|
|
411
|
-
if (!
|
|
424
|
+
if (!previousRoleName) {
|
|
412
425
|
return state;
|
|
413
426
|
}
|
|
414
427
|
|
|
415
|
-
const previousRoleName = previousParticipant.role?.name!;
|
|
416
428
|
const currentRoleName = action.participant.role?.name!;
|
|
417
429
|
|
|
418
430
|
// check if role change
|
|
@@ -5,7 +5,7 @@ import type {
|
|
|
5
5
|
} from '@100mslive/react-native-hms';
|
|
6
6
|
import { getMeetingCode, getMeetingUrl } from '../../utils/functions';
|
|
7
7
|
import ActionTypes, { HmsStateActionTypes } from '../actionTypes';
|
|
8
|
-
import type { HMSIOSScreenShareConfig } from '../../utils/types';
|
|
8
|
+
import type { HMSIOSScreenShareConfig, OnLeaveHandler } from '../../utils/types';
|
|
9
9
|
|
|
10
10
|
type ActionType = {
|
|
11
11
|
payload: any;
|
|
@@ -25,7 +25,7 @@ type IntialStateType = {
|
|
|
25
25
|
isHLSFlow: boolean;
|
|
26
26
|
roles: HMSRole[];
|
|
27
27
|
iosBuildConfig: HMSIOSScreenShareConfig | null;
|
|
28
|
-
onLeave:
|
|
28
|
+
onLeave: OnLeaveHandler | undefined;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
const INITIAL_STATE: IntialStateType = {
|
|
@@ -78,9 +78,13 @@ const userReducer = (
|
|
|
78
78
|
state.endPoints = action.payload.options.endPoints;
|
|
79
79
|
state.debugMode = action.payload.options.debugMode ?? false;
|
|
80
80
|
state.iosBuildConfig = action.payload.options.ios ?? null;
|
|
81
|
-
state.onLeave = action.payload.onLeave;
|
|
82
81
|
|
|
83
82
|
return state;
|
|
83
|
+
case HmsStateActionTypes.SET_ON_LEAVE_HANDLER:
|
|
84
|
+
return {
|
|
85
|
+
...state,
|
|
86
|
+
onLeave: action.payload.onLeave,
|
|
87
|
+
};
|
|
84
88
|
case HmsStateActionTypes.CLEAR_STATES:
|
|
85
89
|
return INITIAL_STATE;
|
|
86
90
|
default:
|