@100mslive/react-native-room-kit 1.0.1 → 1.0.2-beta.0
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 +191 -27
- 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/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 +182 -24
- 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/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/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 +240 -23
- 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/userState.ts +7 -3
- package/src/types.ts +71 -0
- package/src/utils/types.ts +27 -0
- package/src/utils.ts +0 -6
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { useSelector } from 'react-redux';
|
|
2
|
+
import { View } from 'react-native';
|
|
4
3
|
|
|
5
4
|
import { LeaveIcon } from '../Icons';
|
|
6
|
-
import { useHMSRoomStyleSheet,
|
|
7
|
-
import type { RootState } from '../redux';
|
|
5
|
+
import { useHMSRoomStyleSheet, useModalType } from '../hooks-util';
|
|
8
6
|
import { ModalTypes } from '../utils/types';
|
|
9
7
|
import { PressableIcon } from './PressableIcon';
|
|
10
|
-
import { BottomSheet } from './BottomSheet';
|
|
11
|
-
import { StopIcon } from '../Icons';
|
|
12
|
-
import { EndRoomModalContent } from './EndRoomModalContent';
|
|
13
8
|
import { COLORS } from '../utils/theme';
|
|
14
9
|
|
|
15
10
|
export const HMSManageLeave: React.FC<LeaveButtonProps> = (props) => {
|
|
@@ -32,62 +27,15 @@ type LeaveButtonProps =
|
|
|
32
27
|
};
|
|
33
28
|
|
|
34
29
|
const LeaveButton: React.FC<LeaveButtonProps> = (props) => {
|
|
35
|
-
const
|
|
36
|
-
const [leavePopVisible, setLeavePopVisible] = React.useState(false);
|
|
37
|
-
const [leaveModalType, setLeaveModalType] = React.useState(
|
|
38
|
-
ModalTypes.DEFAULT
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
const { leave } = useLeaveMethods(false);
|
|
30
|
+
const { handleModalVisibleType } = useModalType();
|
|
42
31
|
|
|
43
32
|
/**
|
|
44
33
|
* Opens the Leave Popup Menu
|
|
45
34
|
*/
|
|
46
35
|
const handleLeaveButtonPress = () => {
|
|
47
|
-
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Closes the Leave Popup Menu
|
|
52
|
-
* Leave Modal will open after the popup is hidden
|
|
53
|
-
*/
|
|
54
|
-
const handleLeavePress = async () => {
|
|
55
|
-
setLeavePopVisible(false);
|
|
56
|
-
await leave();
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Closes the Leave Popup Menu
|
|
61
|
-
* End Session Modal will open after the popup is hidden
|
|
62
|
-
*/
|
|
63
|
-
const handleEndSessionPress = async () => {
|
|
64
|
-
leavePopCloseAction.current = ModalTypes.END_ROOM;
|
|
65
|
-
setLeavePopVisible(false);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const handleEndStreamPress = async () => {
|
|
69
|
-
leavePopCloseAction.current = ModalTypes.END_ROOM;
|
|
70
|
-
setLeavePopVisible(false);
|
|
36
|
+
handleModalVisibleType(ModalTypes.LEAVE_ROOM);
|
|
71
37
|
};
|
|
72
38
|
|
|
73
|
-
/**
|
|
74
|
-
* Closes the Leave Popup Menu
|
|
75
|
-
* No action is taken when the popup is hidden
|
|
76
|
-
*/
|
|
77
|
-
const dismissPopup = () => {
|
|
78
|
-
leavePopCloseAction.current = ModalTypes.DEFAULT;
|
|
79
|
-
setLeavePopVisible(false);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Handles action to take when the leave popup is hidden
|
|
84
|
-
*/
|
|
85
|
-
const handlePopupHide = () => {
|
|
86
|
-
setLeaveModalType(leavePopCloseAction.current);
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const dismissModal = () => setLeaveModalType(ModalTypes.DEFAULT);
|
|
90
|
-
|
|
91
39
|
const hmsRoomStyles = useHMSRoomStyleSheet((theme) => ({
|
|
92
40
|
button: {
|
|
93
41
|
backgroundColor: theme.palette.alert_error_default,
|
|
@@ -118,178 +66,6 @@ const LeaveButton: React.FC<LeaveButtonProps> = (props) => {
|
|
|
118
66
|
onPress: handleLeaveButtonPress,
|
|
119
67
|
style: hmsRoomStyles.button,
|
|
120
68
|
})}
|
|
121
|
-
|
|
122
|
-
<LeaveBottomSheet
|
|
123
|
-
isVisible={leavePopVisible}
|
|
124
|
-
onEndSessionPress={handleEndSessionPress}
|
|
125
|
-
onLeavePress={handleLeavePress}
|
|
126
|
-
onPopupDismiss={dismissPopup}
|
|
127
|
-
onPopupHide={handlePopupHide}
|
|
128
|
-
onEndStreamPress={handleEndStreamPress}
|
|
129
|
-
/>
|
|
130
|
-
|
|
131
|
-
<BottomSheet
|
|
132
|
-
dismissModal={dismissModal}
|
|
133
|
-
isVisible={leaveModalType === ModalTypes.END_ROOM}
|
|
134
|
-
animationOutTiming={700}
|
|
135
|
-
>
|
|
136
|
-
<EndRoomModalContent dismissModal={dismissModal} />
|
|
137
|
-
</BottomSheet>
|
|
138
69
|
</View>
|
|
139
70
|
);
|
|
140
71
|
};
|
|
141
|
-
|
|
142
|
-
// const HEADER_CONTENT_HEIGHT = 24 + 8 + 8 + 2; // ICON_SIZE + TOP_PADDING + BOTTOM_PADDING + TOP&BOTTOM_BORDER_WIDTH
|
|
143
|
-
// const HEADER_HEIGHT = 8 + HEADER_CONTENT_HEIGHT + 8; // TOP_HEADER_PADDING + HEADER_CONTENT_HEIGHT + BOTTOM_HEADER_PADDING
|
|
144
|
-
|
|
145
|
-
interface LeaveBottomSheetProps {
|
|
146
|
-
isVisible: boolean;
|
|
147
|
-
onPopupDismiss(): void;
|
|
148
|
-
onLeavePress(): void;
|
|
149
|
-
onEndSessionPress(): void;
|
|
150
|
-
onEndStreamPress(): void;
|
|
151
|
-
onPopupHide(): void;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const LeaveBottomSheet: React.FC<LeaveBottomSheetProps> = ({
|
|
155
|
-
isVisible,
|
|
156
|
-
onPopupDismiss,
|
|
157
|
-
onLeavePress,
|
|
158
|
-
onEndSessionPress,
|
|
159
|
-
onEndStreamPress,
|
|
160
|
-
onPopupHide,
|
|
161
|
-
}) => {
|
|
162
|
-
const canEndRoom = useSelector(
|
|
163
|
-
(state: RootState) => state.hmsStates.localPeer?.role?.permissions?.endRoom
|
|
164
|
-
);
|
|
165
|
-
const canStream = useSelector(
|
|
166
|
-
(state: RootState) =>
|
|
167
|
-
state.hmsStates.localPeer?.role?.permissions?.hlsStreaming
|
|
168
|
-
);
|
|
169
|
-
|
|
170
|
-
const isStreaming = useSelector(
|
|
171
|
-
(state: RootState) =>
|
|
172
|
-
state.hmsStates.room?.hlsStreamingState?.running ?? false
|
|
173
|
-
);
|
|
174
|
-
|
|
175
|
-
const hmsRoomStyles = useHMSRoomStyleSheet((theme, typography) => ({
|
|
176
|
-
text: {
|
|
177
|
-
color: theme.palette.on_surface_high,
|
|
178
|
-
fontFamily: `${typography.font_family}-SemiBold`,
|
|
179
|
-
},
|
|
180
|
-
subtext: {
|
|
181
|
-
color: theme.palette.on_surface_low,
|
|
182
|
-
fontFamily: `${typography.font_family}-Regular`,
|
|
183
|
-
},
|
|
184
|
-
endButton: {
|
|
185
|
-
backgroundColor: theme.palette.alert_error_dim,
|
|
186
|
-
},
|
|
187
|
-
endText: {
|
|
188
|
-
color: theme.palette.alert_error_brighter,
|
|
189
|
-
fontFamily: `${typography.font_family}-SemiBold`,
|
|
190
|
-
},
|
|
191
|
-
endSubtext: {
|
|
192
|
-
color: theme.palette.alert_error_bright,
|
|
193
|
-
fontFamily: `${typography.font_family}-Regular`,
|
|
194
|
-
},
|
|
195
|
-
endIcon: {
|
|
196
|
-
tintColor: theme.palette.alert_error_brighter,
|
|
197
|
-
},
|
|
198
|
-
}));
|
|
199
|
-
|
|
200
|
-
return (
|
|
201
|
-
<BottomSheet
|
|
202
|
-
isVisible={isVisible}
|
|
203
|
-
containerStyle={leavePopupStyles.container}
|
|
204
|
-
dismissModal={onPopupDismiss}
|
|
205
|
-
onModalHide={onPopupHide}
|
|
206
|
-
animationOutTiming={700}
|
|
207
|
-
>
|
|
208
|
-
<View>
|
|
209
|
-
<TouchableOpacity
|
|
210
|
-
style={leavePopupStyles.button}
|
|
211
|
-
onPress={onLeavePress}
|
|
212
|
-
>
|
|
213
|
-
<LeaveIcon style={leavePopupStyles.icon} />
|
|
214
|
-
|
|
215
|
-
<View style={leavePopupStyles.textContainer}>
|
|
216
|
-
<Text style={[leavePopupStyles.text, hmsRoomStyles.text]}>
|
|
217
|
-
Leave
|
|
218
|
-
</Text>
|
|
219
|
-
<Text style={[leavePopupStyles.subtext, hmsRoomStyles.subtext]}>
|
|
220
|
-
Others will continue after you leave. You can join the session
|
|
221
|
-
again.
|
|
222
|
-
</Text>
|
|
223
|
-
</View>
|
|
224
|
-
</TouchableOpacity>
|
|
225
|
-
|
|
226
|
-
{canStream && isStreaming ? (
|
|
227
|
-
<TouchableOpacity
|
|
228
|
-
style={[leavePopupStyles.button, hmsRoomStyles.endButton]}
|
|
229
|
-
onPress={onEndStreamPress}
|
|
230
|
-
>
|
|
231
|
-
<StopIcon style={[leavePopupStyles.icon, hmsRoomStyles.endIcon]} />
|
|
232
|
-
|
|
233
|
-
<View style={leavePopupStyles.textContainer}>
|
|
234
|
-
<Text style={[leavePopupStyles.text, hmsRoomStyles.endText]}>
|
|
235
|
-
End Stream
|
|
236
|
-
</Text>
|
|
237
|
-
<Text
|
|
238
|
-
style={[leavePopupStyles.subtext, hmsRoomStyles.endSubtext]}
|
|
239
|
-
>
|
|
240
|
-
The stream will end for everyone after they’ve watched it.
|
|
241
|
-
</Text>
|
|
242
|
-
</View>
|
|
243
|
-
</TouchableOpacity>
|
|
244
|
-
) : canEndRoom ? (
|
|
245
|
-
<TouchableOpacity
|
|
246
|
-
style={[leavePopupStyles.button, hmsRoomStyles.endButton]}
|
|
247
|
-
onPress={onEndSessionPress}
|
|
248
|
-
>
|
|
249
|
-
<StopIcon style={[leavePopupStyles.icon, hmsRoomStyles.endIcon]} />
|
|
250
|
-
|
|
251
|
-
<View style={leavePopupStyles.textContainer}>
|
|
252
|
-
<Text style={[leavePopupStyles.text, hmsRoomStyles.endText]}>
|
|
253
|
-
End Session
|
|
254
|
-
</Text>
|
|
255
|
-
<Text
|
|
256
|
-
style={[leavePopupStyles.subtext, hmsRoomStyles.endSubtext]}
|
|
257
|
-
>
|
|
258
|
-
The session will end for everyone in the room immediately.
|
|
259
|
-
</Text>
|
|
260
|
-
</View>
|
|
261
|
-
</TouchableOpacity>
|
|
262
|
-
) : null}
|
|
263
|
-
</View>
|
|
264
|
-
</BottomSheet>
|
|
265
|
-
);
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
const leavePopupStyles = StyleSheet.create({
|
|
269
|
-
container: {
|
|
270
|
-
paddingBottom: 0,
|
|
271
|
-
},
|
|
272
|
-
button: {
|
|
273
|
-
flexDirection: 'row',
|
|
274
|
-
padding: 24,
|
|
275
|
-
},
|
|
276
|
-
icon: {
|
|
277
|
-
width: 24,
|
|
278
|
-
height: 24,
|
|
279
|
-
marginRight: 16,
|
|
280
|
-
},
|
|
281
|
-
textContainer: {
|
|
282
|
-
flex: 1,
|
|
283
|
-
},
|
|
284
|
-
text: {
|
|
285
|
-
fontSize: 20,
|
|
286
|
-
lineHeight: 24,
|
|
287
|
-
letterSpacing: 0.15,
|
|
288
|
-
},
|
|
289
|
-
subtext: {
|
|
290
|
-
fontSize: 14,
|
|
291
|
-
lineHeight: 20,
|
|
292
|
-
letterSpacing: 0.25,
|
|
293
|
-
marginTop: 4,
|
|
294
|
-
},
|
|
295
|
-
});
|
|
@@ -18,6 +18,7 @@ export interface HMSNotificationProps {
|
|
|
18
18
|
autoDismiss?: boolean;
|
|
19
19
|
dismissDelay?: number;
|
|
20
20
|
cta?: React.ReactElement;
|
|
21
|
+
dismissable?: boolean;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
export const HMSNotification: React.FC<HMSNotificationProps> = ({
|
|
@@ -30,6 +31,7 @@ export const HMSNotification: React.FC<HMSNotificationProps> = ({
|
|
|
30
31
|
onDismiss,
|
|
31
32
|
dismissDelay = 5000,
|
|
32
33
|
autoDismiss = true,
|
|
34
|
+
dismissable = false,
|
|
33
35
|
}) => {
|
|
34
36
|
const dispatch = useDispatch();
|
|
35
37
|
|
|
@@ -45,7 +47,7 @@ export const HMSNotification: React.FC<HMSNotificationProps> = ({
|
|
|
45
47
|
|
|
46
48
|
const dismissNotification =
|
|
47
49
|
onDismiss ||
|
|
48
|
-
(autoDismiss
|
|
50
|
+
(autoDismiss || dismissable
|
|
49
51
|
? () => {
|
|
50
52
|
dispatch(removeNotification(id));
|
|
51
53
|
}
|
|
@@ -77,7 +79,7 @@ export const HMSNotification: React.FC<HMSNotificationProps> = ({
|
|
|
77
79
|
</View>
|
|
78
80
|
);
|
|
79
81
|
|
|
80
|
-
if (dismissNotification) {
|
|
82
|
+
if (dismissNotification && autoDismiss) {
|
|
81
83
|
return (
|
|
82
84
|
<UnmountAfterDelay
|
|
83
85
|
visible={true}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { shallowEqual, useSelector } from 'react-redux';
|
|
3
3
|
import { StyleSheet, View } from 'react-native';
|
|
4
|
-
import type { HMSPeer } from '@100mslive/react-native-hms';
|
|
5
4
|
|
|
6
5
|
import type { RootState } from '../redux';
|
|
7
6
|
import { HMSLocalScreenshareNotification } from './HMSLocalScreenshareNotification';
|
|
8
7
|
import { HMSHandRaiseNotification } from './HMSHandRaiseNotification';
|
|
9
8
|
import { HMSRoleChangeDeclinedNotification } from './HMSRoleChangeDeclinedNotification';
|
|
10
|
-
import { NotificationTypes } from '../
|
|
9
|
+
import { NotificationTypes } from '../types';
|
|
10
|
+
import { HMSTerminalErrorNotification } from './HMSTerminalErrorNotification';
|
|
11
|
+
import { HMSNotification } from './HMSNotification';
|
|
12
|
+
import { AlertTriangleIcon } from '../Icons';
|
|
13
|
+
import { HMSReconnectingNotification } from './HMSReconnectingNotification';
|
|
11
14
|
|
|
12
15
|
export interface HMSNotificationsProps {}
|
|
13
16
|
|
|
@@ -22,14 +25,11 @@ export const HMSNotifications: React.FC<HMSNotificationsProps> = () => {
|
|
|
22
25
|
);
|
|
23
26
|
|
|
24
27
|
// notifications is a stack, first will appear last
|
|
25
|
-
const notifications:
|
|
26
|
-
| typeof LOCAL_SCREENSHARE_PAYLOAD
|
|
27
|
-
| { id: string; type: string; peer: HMSPeer }
|
|
28
|
-
)[] = useSelector((state: RootState) => {
|
|
28
|
+
const notifications = useSelector((state: RootState) => {
|
|
29
29
|
// Latest notification will be at 0th index.
|
|
30
30
|
const allNotifications = state.app.notifications;
|
|
31
31
|
|
|
32
|
-
let list = [];
|
|
32
|
+
let list: typeof allNotifications = [];
|
|
33
33
|
|
|
34
34
|
if (isLocalScreenShared) {
|
|
35
35
|
list.push(LOCAL_SCREENSHARE_PAYLOAD);
|
|
@@ -101,6 +101,8 @@ export const HMSNotifications: React.FC<HMSNotificationsProps> = () => {
|
|
|
101
101
|
>
|
|
102
102
|
{notification.type === NotificationTypes.LOCAL_SCREENSHARE ? (
|
|
103
103
|
<HMSLocalScreenshareNotification />
|
|
104
|
+
) : notification.type === NotificationTypes.RECONNECTING ? (
|
|
105
|
+
<HMSReconnectingNotification />
|
|
104
106
|
) : notification.type === NotificationTypes.HAND_RAISE &&
|
|
105
107
|
'peer' in notification ? (
|
|
106
108
|
<HMSHandRaiseNotification
|
|
@@ -117,6 +119,22 @@ export const HMSNotifications: React.FC<HMSNotificationsProps> = () => {
|
|
|
117
119
|
autoDismiss={atTop}
|
|
118
120
|
dismissDelay={10000}
|
|
119
121
|
/>
|
|
122
|
+
) : notification.type === NotificationTypes.TERMINAL_ERROR &&
|
|
123
|
+
'exception' in notification ? (
|
|
124
|
+
<HMSTerminalErrorNotification
|
|
125
|
+
id={notification.id}
|
|
126
|
+
exception={notification.exception}
|
|
127
|
+
autoDismiss={false}
|
|
128
|
+
/>
|
|
129
|
+
) : notification.type === NotificationTypes.ERROR &&
|
|
130
|
+
'message' in notification ? (
|
|
131
|
+
<HMSNotification
|
|
132
|
+
icon={<AlertTriangleIcon type="line" />}
|
|
133
|
+
id={notification.id}
|
|
134
|
+
text={notification.message}
|
|
135
|
+
autoDismiss={false}
|
|
136
|
+
dismissable={true}
|
|
137
|
+
/>
|
|
120
138
|
) : null}
|
|
121
139
|
</View>
|
|
122
140
|
);
|
|
@@ -125,6 +143,22 @@ export const HMSNotifications: React.FC<HMSNotificationsProps> = () => {
|
|
|
125
143
|
);
|
|
126
144
|
};
|
|
127
145
|
|
|
146
|
+
export const useHMSNotificationsHeight = () => {
|
|
147
|
+
const numberOfNotifications = useSelector((state: RootState) => {
|
|
148
|
+
const allNotifications = state.app.notifications;
|
|
149
|
+
const isLocalScreenShared = state.hmsStates.isLocalScreenShared;
|
|
150
|
+
|
|
151
|
+
return (
|
|
152
|
+
Math.min(allNotifications.length, isLocalScreenShared ? 2 : 3) +
|
|
153
|
+
(isLocalScreenShared ? 1 : 0)
|
|
154
|
+
);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
if (numberOfNotifications === 0) return 0;
|
|
158
|
+
|
|
159
|
+
return 8 + (numberOfNotifications - 1) * 16 + 56; // marginBottom + calculated paddingTop + content
|
|
160
|
+
};
|
|
161
|
+
|
|
128
162
|
const styles = StyleSheet.create({
|
|
129
163
|
absoluteContainer: {
|
|
130
164
|
position: 'relative',
|
|
@@ -6,6 +6,8 @@ import MaskedView from '@react-native-masked-view/masked-view';
|
|
|
6
6
|
import { HMSKeyboardAvoidingView } from './HMSKeyboardAvoidingView';
|
|
7
7
|
import { HMSSendMessageInput } from './HMSSendMessageInput';
|
|
8
8
|
import { HMSHLSMessageList } from './HMSHLSMessageList';
|
|
9
|
+
import { useFooterHeight } from './Footer';
|
|
10
|
+
import { useHMSNotificationsHeight } from './HMSNotifications';
|
|
9
11
|
|
|
10
12
|
const colors = [
|
|
11
13
|
'rgba(0, 0, 0, 0)',
|
|
@@ -15,8 +17,11 @@ const colors = [
|
|
|
15
17
|
const colorLocations = [0, 0.4, 1];
|
|
16
18
|
|
|
17
19
|
export const HLSChatView = () => {
|
|
20
|
+
const footerHeight = useFooterHeight();
|
|
21
|
+
const hmsNotificationsHeight = useHMSNotificationsHeight();
|
|
22
|
+
|
|
18
23
|
return (
|
|
19
|
-
<HMSKeyboardAvoidingView>
|
|
24
|
+
<HMSKeyboardAvoidingView bottomOffset={footerHeight + hmsNotificationsHeight}>
|
|
20
25
|
<MaskedView
|
|
21
26
|
maskElement={
|
|
22
27
|
<LinearGradient
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ActivityIndicator } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { HMSNotification } from './HMSNotification';
|
|
5
|
+
import { useHMSRoomColorPalette, useHMSRoomStyle } from '../hooks-util';
|
|
6
|
+
import { NotificationTypes } from '../types';
|
|
7
|
+
|
|
8
|
+
export interface HMSReconnectingNotificationProps {}
|
|
9
|
+
|
|
10
|
+
export const HMSReconnectingNotification: React.FC<
|
|
11
|
+
HMSReconnectingNotificationProps
|
|
12
|
+
> = () => {
|
|
13
|
+
const { on_surface_high: onSurfaceHigh } = useHMSRoomColorPalette();
|
|
14
|
+
const notificationStyle = useHMSRoomStyle((theme) => ({
|
|
15
|
+
backgroundColor: theme.palette.surface_default,
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<HMSNotification
|
|
20
|
+
id={NotificationTypes.RECONNECTING}
|
|
21
|
+
autoDismiss={false}
|
|
22
|
+
style={notificationStyle}
|
|
23
|
+
text={'You lost your network connection. Trying to reconnect.'}
|
|
24
|
+
icon={<ActivityIndicator size='small' color={onSurfaceHigh} />}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
@@ -13,7 +13,7 @@ export const HMSRecordingIndicator = () => {
|
|
|
13
13
|
const startingOrStoppingRecording = useSelector(
|
|
14
14
|
(state: RootState) =>
|
|
15
15
|
state.app.startingOrStoppingRecording ||
|
|
16
|
-
state.hmsStates.room?.browserRecordingState.initialising
|
|
16
|
+
(state.hmsStates.room?.browserRecordingState.initialising ?? false)
|
|
17
17
|
);
|
|
18
18
|
|
|
19
19
|
const { on_surface_high: onSurfaceHighColor } = useHMSRoomColorPalette();
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { HMSException } from '@100mslive/react-native-hms';
|
|
3
|
+
import { StyleSheet, Text, TouchableOpacity } from 'react-native';
|
|
4
|
+
|
|
5
|
+
import { HMSNotification } from './HMSNotification';
|
|
6
|
+
import { AlertTriangleIcon } from '../Icons';
|
|
7
|
+
import { useHMSRoomStyleSheet, useLeaveMethods } from '../hooks-util';
|
|
8
|
+
import { OnLeaveReason } from '../utils/types';
|
|
9
|
+
import { COLORS } from '../utils/theme';
|
|
10
|
+
|
|
11
|
+
export interface HMSTerminalErrorNotificationProps {
|
|
12
|
+
id: string;
|
|
13
|
+
exception: HMSException;
|
|
14
|
+
autoDismiss?: boolean;
|
|
15
|
+
dismissDelay?: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const HMSTerminalErrorNotification: React.FC<
|
|
19
|
+
HMSTerminalErrorNotificationProps
|
|
20
|
+
> = ({ id, exception, autoDismiss, dismissDelay }) => {
|
|
21
|
+
const { leave } = useLeaveMethods();
|
|
22
|
+
|
|
23
|
+
const hmsRoomStyles = useHMSRoomStyleSheet((theme, typography) => ({
|
|
24
|
+
button: {
|
|
25
|
+
backgroundColor: theme.palette.alert_error_default,
|
|
26
|
+
},
|
|
27
|
+
buttonText: {
|
|
28
|
+
color: COLORS.WHITE,
|
|
29
|
+
fontFamily: `${typography.font_family}-SemiBold`,
|
|
30
|
+
},
|
|
31
|
+
}));
|
|
32
|
+
|
|
33
|
+
const handleLeaveRoomPress = () => {
|
|
34
|
+
leave(OnLeaveReason.NETWORK_ISSUES);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<HMSNotification
|
|
39
|
+
id={id}
|
|
40
|
+
icon={<AlertTriangleIcon />}
|
|
41
|
+
text={exception.description || 'Something went wrong!'}
|
|
42
|
+
dismissDelay={dismissDelay}
|
|
43
|
+
autoDismiss={autoDismiss}
|
|
44
|
+
cta={(
|
|
45
|
+
<TouchableOpacity
|
|
46
|
+
style={[styles.button, hmsRoomStyles.button]}
|
|
47
|
+
onPress={handleLeaveRoomPress}
|
|
48
|
+
>
|
|
49
|
+
<Text style={[styles.buttonText, hmsRoomStyles.buttonText]}>
|
|
50
|
+
Leave
|
|
51
|
+
</Text>
|
|
52
|
+
</TouchableOpacity>
|
|
53
|
+
)}
|
|
54
|
+
/>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const styles = StyleSheet.create({
|
|
59
|
+
button: {
|
|
60
|
+
paddingVertical: 8,
|
|
61
|
+
paddingHorizontal: 16,
|
|
62
|
+
borderRadius: 8,
|
|
63
|
+
marginRight: 16,
|
|
64
|
+
},
|
|
65
|
+
buttonText: {
|
|
66
|
+
fontSize: 14,
|
|
67
|
+
lineHeight: 20,
|
|
68
|
+
letterSpacing: 0.25,
|
|
69
|
+
},
|
|
70
|
+
});
|