@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/HMSRoomSetup.tsx
CHANGED
|
@@ -5,22 +5,15 @@ import {
|
|
|
5
5
|
HMSUpdateListenerActions,
|
|
6
6
|
} from '@100mslive/react-native-hms';
|
|
7
7
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
8
|
-
import {
|
|
9
|
-
Alert,
|
|
10
|
-
Keyboard,
|
|
11
|
-
Platform,
|
|
12
|
-
StatusBar,
|
|
13
|
-
StyleSheet,
|
|
14
|
-
View,
|
|
15
|
-
} from 'react-native';
|
|
8
|
+
import { Alert, Keyboard, StatusBar, StyleSheet, View } from 'react-native';
|
|
16
9
|
import Toast from 'react-native-simple-toast';
|
|
17
10
|
import { batch, useDispatch, useSelector, useStore } from 'react-redux';
|
|
18
11
|
|
|
19
12
|
import { Preview } from './components';
|
|
20
13
|
import {
|
|
14
|
+
addNotification,
|
|
21
15
|
changeMeetingState,
|
|
22
16
|
changeStartingHLSStream,
|
|
23
|
-
clearStore,
|
|
24
17
|
setHMSLocalPeerState,
|
|
25
18
|
setHMSRoomState,
|
|
26
19
|
setLocalPeerTrackNode,
|
|
@@ -28,6 +21,7 @@ import {
|
|
|
28
21
|
updateLocalPeerTrackNode,
|
|
29
22
|
} from './redux/actions';
|
|
30
23
|
import { createPeerTrackNode } from './utils/functions';
|
|
24
|
+
import { OnLeaveReason, TerminalExceptionCodes } from './utils/types';
|
|
31
25
|
import type { PeerTrackNode } from './utils/types';
|
|
32
26
|
import { Meeting } from './components/Meeting';
|
|
33
27
|
import {
|
|
@@ -47,7 +41,7 @@ import {
|
|
|
47
41
|
replacePeerTrackNodes,
|
|
48
42
|
peerTrackNodeExistForPeer,
|
|
49
43
|
} from './peerTrackNodeUtils';
|
|
50
|
-
import { MeetingState } from './types';
|
|
44
|
+
import { MeetingState, NotificationTypes } from './types';
|
|
51
45
|
import { getJoinConfig } from './utils';
|
|
52
46
|
import { FullScreenIndicator } from './components/FullScreenIndicator';
|
|
53
47
|
import { HMSMeetingEnded } from './components/HMSMeetingEnded';
|
|
@@ -72,7 +66,7 @@ export const HMSRoomSetup = () => {
|
|
|
72
66
|
const hmsInstance = useHMSInstance();
|
|
73
67
|
const dispatch = useDispatch();
|
|
74
68
|
const reduxStore = useStore<RootState>();
|
|
75
|
-
const {
|
|
69
|
+
const { leave, destroy, prebuiltCleanUp } = useLeaveMethods();
|
|
76
70
|
|
|
77
71
|
const { getConfig, clearConfig } = useHMSConfig();
|
|
78
72
|
const meetingState = useSelector(
|
|
@@ -82,18 +76,52 @@ export const HMSRoomSetup = () => {
|
|
|
82
76
|
const [loading, setLoading] = useState(false);
|
|
83
77
|
|
|
84
78
|
const joinMeeting = useCallback(async () => {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
79
|
+
try {
|
|
80
|
+
setLoading(true);
|
|
81
|
+
Keyboard.dismiss();
|
|
82
|
+
const hmsConfig = await getConfig();
|
|
83
|
+
// TODO: handle case when promise returned from `getConfig()` is resolved when Root component has been unmounted
|
|
84
|
+
hmsInstance.join(hmsConfig);
|
|
85
|
+
} catch (error: any) {
|
|
86
|
+
Alert.alert(
|
|
87
|
+
error.code,
|
|
88
|
+
error.message,
|
|
89
|
+
[
|
|
90
|
+
{
|
|
91
|
+
text: 'Leave',
|
|
92
|
+
style: 'destructive',
|
|
93
|
+
onPress: () => {
|
|
94
|
+
leave(OnLeaveReason.LEAVE);
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
{ cancelable: false }
|
|
99
|
+
);
|
|
100
|
+
}
|
|
90
101
|
}, [getConfig, hmsInstance]);
|
|
91
102
|
|
|
92
103
|
const previewMeeting = useCallback(async () => {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
104
|
+
try {
|
|
105
|
+
setLoading(true);
|
|
106
|
+
const hmsConfig = await getConfig();
|
|
107
|
+
// TODO: handle case when promise returned from `getConfig()` is resolved when Root component has been unmounted
|
|
108
|
+
hmsInstance.preview(hmsConfig);
|
|
109
|
+
} catch (error: any) {
|
|
110
|
+
Alert.alert(
|
|
111
|
+
error.code,
|
|
112
|
+
error.message,
|
|
113
|
+
[
|
|
114
|
+
{
|
|
115
|
+
text: 'Leave',
|
|
116
|
+
style: 'destructive',
|
|
117
|
+
onPress: () => {
|
|
118
|
+
destroy(OnLeaveReason.LEAVE);
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
{ cancelable: false }
|
|
123
|
+
);
|
|
124
|
+
}
|
|
97
125
|
}, [getConfig, hmsInstance]);
|
|
98
126
|
|
|
99
127
|
const startHLSStreaming = useCallback(async () => {
|
|
@@ -105,10 +133,13 @@ export const HMSRoomSetup = () => {
|
|
|
105
133
|
console.log('Start HLS Streaming Error: ', e);
|
|
106
134
|
if (!ignoreHLSStreamPromise.current) {
|
|
107
135
|
console.log('Unable to go live at the moment: ', e);
|
|
108
|
-
//
|
|
136
|
+
// prebuiltCleanUp();
|
|
109
137
|
}
|
|
110
138
|
}
|
|
111
|
-
}, [
|
|
139
|
+
}, [
|
|
140
|
+
// prebuiltCleanUp,
|
|
141
|
+
hmsInstance
|
|
142
|
+
]);
|
|
112
143
|
|
|
113
144
|
// HMS Room, Peers, Track Listeners
|
|
114
145
|
useHMSListeners(setPeerTrackNodes);
|
|
@@ -126,34 +157,60 @@ export const HMSRoomSetup = () => {
|
|
|
126
157
|
*/
|
|
127
158
|
useHMSSessionStore();
|
|
128
159
|
|
|
160
|
+
const meetingJoined = meetingState === MeetingState.IN_MEETING;
|
|
161
|
+
const previewing = meetingState === MeetingState.IN_PREVIEW;
|
|
162
|
+
|
|
129
163
|
// HMS Error Listener
|
|
130
164
|
useEffect(() => {
|
|
131
165
|
const hmsErrorHandler = (error: HMSException) => {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
166
|
+
const terminalError =
|
|
167
|
+
error.isTerminal || TerminalExceptionCodes.includes(error.code);
|
|
168
|
+
|
|
169
|
+
if (meetingJoined) {
|
|
170
|
+
const uid = Math.random().toString(16).slice(2);
|
|
171
|
+
const notificationPayload = terminalError
|
|
172
|
+
? {
|
|
173
|
+
id: uid,
|
|
174
|
+
type: NotificationTypes.TERMINAL_ERROR,
|
|
175
|
+
exception: error,
|
|
176
|
+
}
|
|
177
|
+
: {
|
|
178
|
+
id: uid,
|
|
179
|
+
type: NotificationTypes.ERROR,
|
|
180
|
+
message: error.description,
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
dispatch(addNotification(notificationPayload));
|
|
184
|
+
} else {
|
|
185
|
+
setLoading(false);
|
|
186
|
+
|
|
187
|
+
if (terminalError) {
|
|
188
|
+
Alert.alert(
|
|
189
|
+
error.code.toString(),
|
|
190
|
+
error.description || 'Something went wrong',
|
|
191
|
+
[
|
|
192
|
+
{
|
|
193
|
+
text: 'Leave',
|
|
194
|
+
style: 'destructive',
|
|
195
|
+
onPress: () => {
|
|
196
|
+
if (previewing) {
|
|
197
|
+
leave(OnLeaveReason.NETWORK_ISSUES);
|
|
198
|
+
} else {
|
|
199
|
+
destroy(OnLeaveReason.NETWORK_ISSUES);
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
],
|
|
204
|
+
{ cancelable: false }
|
|
205
|
+
);
|
|
206
|
+
} else {
|
|
207
|
+
Toast.showWithGravity(
|
|
208
|
+
`${error?.code} ${error?.description}` || 'Something went wrong',
|
|
209
|
+
Toast.LONG,
|
|
210
|
+
Toast.TOP
|
|
211
|
+
);
|
|
212
|
+
}
|
|
150
213
|
}
|
|
151
|
-
|
|
152
|
-
Toast.showWithGravity(
|
|
153
|
-
`${error?.code} ${error?.description}` || 'Something went wrong',
|
|
154
|
-
Toast.LONG,
|
|
155
|
-
Toast.TOP
|
|
156
|
-
);
|
|
157
214
|
};
|
|
158
215
|
|
|
159
216
|
hmsInstance.addEventListener(
|
|
@@ -164,7 +221,7 @@ export const HMSRoomSetup = () => {
|
|
|
164
221
|
return () => {
|
|
165
222
|
hmsInstance.removeEventListener(HMSUpdateListenerActions.ON_ERROR);
|
|
166
223
|
};
|
|
167
|
-
}, [hmsInstance]);
|
|
224
|
+
}, [previewing, meetingJoined, hmsInstance]);
|
|
168
225
|
|
|
169
226
|
// HMS Preview Listener
|
|
170
227
|
useEffect(() => {
|
|
@@ -294,8 +351,6 @@ export const HMSRoomSetup = () => {
|
|
|
294
351
|
};
|
|
295
352
|
}, [startHLSStreaming, hmsInstance]);
|
|
296
353
|
|
|
297
|
-
const meetingJoined = meetingState === MeetingState.IN_MEETING;
|
|
298
|
-
|
|
299
354
|
// HMS Active Speaker Listener
|
|
300
355
|
// dev-note: This is added here because we have `setPeerTrackNodes` here
|
|
301
356
|
useHMSActiveSpeakerUpdates(setPeerTrackNodes, meetingJoined);
|
|
@@ -333,13 +388,10 @@ export const HMSRoomSetup = () => {
|
|
|
333
388
|
}
|
|
334
389
|
}, [meetingEnded]);
|
|
335
390
|
|
|
336
|
-
const { leave } = useLeaveMethods(true);
|
|
337
|
-
|
|
338
391
|
useEffect(() => {
|
|
339
392
|
return () => {
|
|
340
393
|
ignoreHLSStreamPromise.current = true;
|
|
341
|
-
|
|
342
|
-
dispatch(clearStore());
|
|
394
|
+
prebuiltCleanUp();
|
|
343
395
|
};
|
|
344
396
|
}, []);
|
|
345
397
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/Icons/Hand/index.tsx
CHANGED
|
@@ -4,16 +4,26 @@ import type { ImageProps } from 'react-native';
|
|
|
4
4
|
|
|
5
5
|
import { useHMSRoomStyle } from '../../hooks-util';
|
|
6
6
|
|
|
7
|
-
interface HandIconProps extends Omit<ImageProps, 'source'> {
|
|
7
|
+
interface HandIconProps extends Omit<ImageProps, 'source'> {
|
|
8
|
+
type?: 'off' | 'on';
|
|
9
|
+
}
|
|
8
10
|
|
|
9
|
-
export const HandIcon: React.FC<HandIconProps> = ({
|
|
11
|
+
export const HandIcon: React.FC<HandIconProps> = ({
|
|
12
|
+
style,
|
|
13
|
+
type = 'on',
|
|
14
|
+
...restProps
|
|
15
|
+
}) => {
|
|
10
16
|
const iconStyles = useHMSRoomStyle((theme) => ({
|
|
11
17
|
tintColor: theme.palette.on_surface_high,
|
|
12
18
|
}));
|
|
13
19
|
|
|
14
20
|
return (
|
|
15
21
|
<Image
|
|
16
|
-
source={
|
|
22
|
+
source={
|
|
23
|
+
type === 'on'
|
|
24
|
+
? require('./assets/hand.png')
|
|
25
|
+
: require('./assets/hand-off.png')
|
|
26
|
+
}
|
|
17
27
|
style={[styles.icon, iconStyles, style]}
|
|
18
28
|
{...restProps}
|
|
19
29
|
/>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -4,10 +4,13 @@ import type { ImageProps } from 'react-native';
|
|
|
4
4
|
|
|
5
5
|
import { useHMSRoomStyle } from '../../hooks-util';
|
|
6
6
|
|
|
7
|
-
interface RecordingIconProps extends Omit<ImageProps, 'source'> {
|
|
7
|
+
interface RecordingIconProps extends Omit<ImageProps, 'source'> {
|
|
8
|
+
type?: 'off' | 'on';
|
|
9
|
+
}
|
|
8
10
|
|
|
9
11
|
export const RecordingIcon: React.FC<RecordingIconProps> = ({
|
|
10
12
|
style,
|
|
13
|
+
type = 'on',
|
|
11
14
|
...restProps
|
|
12
15
|
}) => {
|
|
13
16
|
const iconStyles = useHMSRoomStyle((theme) => ({
|
|
@@ -16,7 +19,11 @@ export const RecordingIcon: React.FC<RecordingIconProps> = ({
|
|
|
16
19
|
|
|
17
20
|
return (
|
|
18
21
|
<Image
|
|
19
|
-
source={
|
|
22
|
+
source={
|
|
23
|
+
type === 'on'
|
|
24
|
+
? require('./assets/recording.png')
|
|
25
|
+
: require('./assets/recording-off.png')
|
|
26
|
+
}
|
|
20
27
|
style={[styles.icon, iconStyles, style]}
|
|
21
28
|
{...restProps}
|
|
22
29
|
/>
|
|
@@ -36,6 +36,8 @@ import { BottomSheet } from './BottomSheet';
|
|
|
36
36
|
import { FullScreenVideoView } from './FullScreenVideoView';
|
|
37
37
|
import { PreviewForRoleChangeModal } from './PreviewForRoleChangeModal';
|
|
38
38
|
import { ChatAndParticipantsBottomSheet } from './ChatAndParticipants';
|
|
39
|
+
import { LeaveRoomBottomSheet } from './LeaveRoomBottomSheet';
|
|
40
|
+
import { EndRoomModal } from './EndRoomModal';
|
|
39
41
|
|
|
40
42
|
type CapturedImagePath = { uri: string } | null;
|
|
41
43
|
|
|
@@ -150,6 +152,10 @@ export const DisplayView: React.FC<DisplayViewProps> = ({
|
|
|
150
152
|
|
|
151
153
|
{isPipModeActive ? null : (
|
|
152
154
|
<>
|
|
155
|
+
<LeaveRoomBottomSheet />
|
|
156
|
+
|
|
157
|
+
<EndRoomModal />
|
|
158
|
+
|
|
153
159
|
<PreviewForRoleChangeModal />
|
|
154
160
|
|
|
155
161
|
<FullScreenVideoView />
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { ModalTypes } from '../utils/types';
|
|
4
|
+
import { BottomSheet } from './BottomSheet';
|
|
5
|
+
import { useModalType } from '../hooks-util';
|
|
6
|
+
import { EndRoomModalContent } from './EndRoomModalContent';
|
|
7
|
+
|
|
8
|
+
interface EndRoomModalProps {}
|
|
9
|
+
|
|
10
|
+
export const EndRoomModal: React.FC<EndRoomModalProps> = () => {
|
|
11
|
+
const { modalVisibleType, handleModalVisibleType } = useModalType();
|
|
12
|
+
|
|
13
|
+
const dismissModal = () => handleModalVisibleType(ModalTypes.DEFAULT);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<BottomSheet
|
|
17
|
+
dismissModal={dismissModal}
|
|
18
|
+
isVisible={modalVisibleType === ModalTypes.END_ROOM}
|
|
19
|
+
animationOutTiming={700}
|
|
20
|
+
>
|
|
21
|
+
<EndRoomModalContent dismissModal={dismissModal} />
|
|
22
|
+
</BottomSheet>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
@@ -6,6 +6,7 @@ import { AlertTriangleIcon, CloseIcon } from '../Icons';
|
|
|
6
6
|
import { HMSDangerButton } from './HMSDangerButton';
|
|
7
7
|
import { useSelector } from 'react-redux';
|
|
8
8
|
import type { RootState } from '../redux';
|
|
9
|
+
import { OnLeaveReason } from '../utils/types';
|
|
9
10
|
|
|
10
11
|
export interface EndRoomModalContentProps {
|
|
11
12
|
dismissModal(): void;
|
|
@@ -14,7 +15,7 @@ export interface EndRoomModalContentProps {
|
|
|
14
15
|
export const EndRoomModalContent: React.FC<EndRoomModalContentProps> = ({
|
|
15
16
|
dismissModal,
|
|
16
17
|
}) => {
|
|
17
|
-
const { endRoom, leave } = useLeaveMethods(
|
|
18
|
+
const { endRoom, leave } = useLeaveMethods();
|
|
18
19
|
|
|
19
20
|
const hmsRoomStyles = useHMSRoomStyleSheet((theme, typography) => ({
|
|
20
21
|
headerText: {
|
|
@@ -72,7 +73,13 @@ export const EndRoomModalContent: React.FC<EndRoomModalContentProps> = ({
|
|
|
72
73
|
</Text>
|
|
73
74
|
<HMSDangerButton
|
|
74
75
|
loading={false}
|
|
75
|
-
onPress={
|
|
76
|
+
onPress={() => {
|
|
77
|
+
if (canStream && isStreaming) {
|
|
78
|
+
leave(OnLeaveReason.LEAVE, true)
|
|
79
|
+
} else {
|
|
80
|
+
endRoom(OnLeaveReason.ROOM_END);
|
|
81
|
+
}
|
|
82
|
+
}}
|
|
76
83
|
title={canStream && isStreaming ? 'End Stream' : 'End Session'}
|
|
77
84
|
/>
|
|
78
85
|
</View>
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React, { memo, useMemo } from 'react';
|
|
2
2
|
import { View, StyleSheet, Platform } from 'react-native';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
SafeAreaView,
|
|
5
|
+
useSafeAreaInsets,
|
|
6
|
+
} from 'react-native-safe-area-context';
|
|
4
7
|
|
|
5
8
|
import {
|
|
6
9
|
useHMSLayoutConfig,
|
|
@@ -50,7 +53,11 @@ export const _Footer: React.FC<FooterProps> = () => {
|
|
|
50
53
|
);
|
|
51
54
|
|
|
52
55
|
const canShowOptions =
|
|
53
|
-
isViewer ||
|
|
56
|
+
isViewer ||
|
|
57
|
+
canPublishScreen ||
|
|
58
|
+
canShowParticipants ||
|
|
59
|
+
canShowBRB ||
|
|
60
|
+
canStartRecording;
|
|
54
61
|
|
|
55
62
|
const footerActionButtons = useMemo(() => {
|
|
56
63
|
const actions = [];
|
|
@@ -129,6 +136,15 @@ export const _Footer: React.FC<FooterProps> = () => {
|
|
|
129
136
|
);
|
|
130
137
|
};
|
|
131
138
|
|
|
139
|
+
export const useFooterHeight = () => {
|
|
140
|
+
const isHLSViewer = useIsHLSViewer();
|
|
141
|
+
const { bottom } = useSafeAreaInsets();
|
|
142
|
+
|
|
143
|
+
return (
|
|
144
|
+
bottom + (isHLSViewer ? 8 : 16) + (Platform.OS === 'android' ? 16 : 0) + 40
|
|
145
|
+
); // bottomSafeArea + paddingTop + marginBottom + content
|
|
146
|
+
};
|
|
147
|
+
|
|
132
148
|
const styles = StyleSheet.create({
|
|
133
149
|
container: {
|
|
134
150
|
paddingTop: 16,
|
|
@@ -1,36 +1,22 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Platform, StatusBar, useWindowDimensions } from 'react-native';
|
|
3
2
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
4
3
|
import Animated, {
|
|
5
4
|
useAnimatedKeyboard,
|
|
6
5
|
useAnimatedStyle,
|
|
7
|
-
|
|
6
|
+
useDerivedValue,
|
|
8
7
|
} from 'react-native-reanimated';
|
|
9
8
|
|
|
10
9
|
export interface HMSKeyboardAvoidingViewProps {
|
|
11
10
|
style?: StyleProp<Animated.AnimateStyle<StyleProp<ViewStyle>>>;
|
|
11
|
+
bottomOffset?: number;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export const HMSKeyboardAvoidingView: React.FC<
|
|
15
15
|
HMSKeyboardAvoidingViewProps
|
|
16
|
-
> = ({ children, style }) => {
|
|
17
|
-
const animatedViewRef = React.useRef<Animated.View>(null);
|
|
18
|
-
const { height: windowHeight } = useWindowDimensions();
|
|
16
|
+
> = ({ children, style, bottomOffset=0 }) => {
|
|
19
17
|
const animatedKeyboard = useAnimatedKeyboard();
|
|
20
18
|
|
|
21
|
-
const initialPageY =
|
|
22
|
-
|
|
23
|
-
const _handleViewOnLayout = React.useCallback(() => {
|
|
24
|
-
animatedViewRef.current?.measureInWindow((_fx, fy, _width, height) => {
|
|
25
|
-
if (height > 0) {
|
|
26
|
-
const finalWindowHeight =
|
|
27
|
-
Platform.OS === 'android' && Platform.Version < 29
|
|
28
|
-
? windowHeight - (StatusBar.currentHeight ?? 0)
|
|
29
|
-
: windowHeight;
|
|
30
|
-
initialPageY.value = finalWindowHeight - (height + fy);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}, []);
|
|
19
|
+
const initialPageY = useDerivedValue(() => bottomOffset, [bottomOffset]);
|
|
34
20
|
|
|
35
21
|
const keyboardAvoidStyle = useAnimatedStyle(() => {
|
|
36
22
|
const keyboardHeight = animatedKeyboard.height.value;
|
|
@@ -47,11 +33,7 @@ export const HMSKeyboardAvoidingView: React.FC<
|
|
|
47
33
|
});
|
|
48
34
|
|
|
49
35
|
return (
|
|
50
|
-
<Animated.View
|
|
51
|
-
ref={animatedViewRef}
|
|
52
|
-
onLayout={_handleViewOnLayout}
|
|
53
|
-
style={[style, keyboardAvoidStyle]}
|
|
54
|
-
>
|
|
36
|
+
<Animated.View style={[style, keyboardAvoidStyle]}>
|
|
55
37
|
{children}
|
|
56
38
|
</Animated.View>
|
|
57
39
|
);
|
|
@@ -5,7 +5,7 @@ import { ScreenShareIcon } from '../Icons';
|
|
|
5
5
|
import { HMSDangerButton } from './HMSDangerButton';
|
|
6
6
|
import { HMSNotification } from './HMSNotification';
|
|
7
7
|
import { useHMSRoomStyle } from '../hooks-util';
|
|
8
|
-
import { NotificationTypes } from '../
|
|
8
|
+
import { NotificationTypes } from '../types';
|
|
9
9
|
|
|
10
10
|
export interface HMSLocalScreenshareNotificationProps {}
|
|
11
11
|
|