@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.
Files changed (262) hide show
  1. package/lib/commonjs/HMSPrebuilt.js +16 -14
  2. package/lib/commonjs/HMSPrebuilt.js.map +1 -1
  3. package/lib/commonjs/HMSRoomSetup.js +85 -44
  4. package/lib/commonjs/HMSRoomSetup.js.map +1 -1
  5. package/lib/commonjs/Icons/Hand/assets/hand-off.png +0 -0
  6. package/lib/commonjs/Icons/Hand/assets/hand-off@2x.png +0 -0
  7. package/lib/commonjs/Icons/Hand/assets/hand-off@3x.png +0 -0
  8. package/lib/commonjs/Icons/Hand/index.js +2 -1
  9. package/lib/commonjs/Icons/Hand/index.js.map +1 -1
  10. package/lib/commonjs/Icons/Recording/assets/recording-off.png +0 -0
  11. package/lib/commonjs/Icons/Recording/assets/recording-off@2x.png +0 -0
  12. package/lib/commonjs/Icons/Recording/assets/recording-off@3x.png +0 -0
  13. package/lib/commonjs/Icons/Recording/index.js +2 -1
  14. package/lib/commonjs/Icons/Recording/index.js.map +1 -1
  15. package/lib/commonjs/components/DisplayView.js +3 -1
  16. package/lib/commonjs/components/DisplayView.js.map +1 -1
  17. package/lib/commonjs/components/EndRoomModal.js +29 -0
  18. package/lib/commonjs/components/EndRoomModal.js.map +1 -0
  19. package/lib/commonjs/components/EndRoomModalContent.js +9 -2
  20. package/lib/commonjs/components/EndRoomModalContent.js.map +1 -1
  21. package/lib/commonjs/components/Footer.js +9 -1
  22. package/lib/commonjs/components/Footer.js.map +1 -1
  23. package/lib/commonjs/components/HMSKeyboardAvoidingView.js +3 -18
  24. package/lib/commonjs/components/HMSKeyboardAvoidingView.js.map +1 -1
  25. package/lib/commonjs/components/HMSLocalScreenshareNotification.js +2 -2
  26. package/lib/commonjs/components/HMSLocalScreenshareNotification.js.map +1 -1
  27. package/lib/commonjs/components/HMSManageLeave.js +3 -178
  28. package/lib/commonjs/components/HMSManageLeave.js.map +1 -1
  29. package/lib/commonjs/components/HMSNotification.js +4 -3
  30. package/lib/commonjs/components/HMSNotification.js.map +1 -1
  31. package/lib/commonjs/components/HMSNotifications.js +32 -6
  32. package/lib/commonjs/components/HMSNotifications.js.map +1 -1
  33. package/lib/commonjs/components/HMSOverlayChatView.js +7 -1
  34. package/lib/commonjs/components/HMSOverlayChatView.js.map +1 -1
  35. package/lib/commonjs/components/HMSReconnectingNotification.js +33 -0
  36. package/lib/commonjs/components/HMSReconnectingNotification.js.map +1 -0
  37. package/lib/commonjs/components/HMSRecordingIndicator.js +1 -1
  38. package/lib/commonjs/components/HMSRecordingIndicator.js.map +1 -1
  39. package/lib/commonjs/components/HMSTerminalErrorNotification.js +66 -0
  40. package/lib/commonjs/components/HMSTerminalErrorNotification.js.map +1 -0
  41. package/lib/commonjs/components/LeaveRoomBottomSheet.js +175 -0
  42. package/lib/commonjs/components/LeaveRoomBottomSheet.js.map +1 -0
  43. package/lib/commonjs/components/Meeting.js +4 -0
  44. package/lib/commonjs/components/Meeting.js.map +1 -1
  45. package/lib/commonjs/components/MeetingScreenContent.js +3 -2
  46. package/lib/commonjs/components/MeetingScreenContent.js.map +1 -1
  47. package/lib/commonjs/components/PIPView.js +80 -15
  48. package/lib/commonjs/components/PIPView.js.map +1 -1
  49. package/lib/commonjs/components/Participants/ParticipantsItemOptions.js +23 -1
  50. package/lib/commonjs/components/Participants/ParticipantsItemOptions.js.map +1 -1
  51. package/lib/commonjs/components/PeerVideoTile/AvatarView.js +4 -4
  52. package/lib/commonjs/components/PeerVideoTile/PeerAudioIndicator.js +3 -1
  53. package/lib/commonjs/components/PeerVideoTile/PeerAudioIndicator.js.map +1 -1
  54. package/lib/commonjs/components/PeerVideoTile/PeerVideoTileView.js +1 -1
  55. package/lib/commonjs/components/PeerVideoTile/PeerVideoTileView.js.map +1 -1
  56. package/lib/commonjs/components/PreviewForRoleChangeModal.js +2 -2
  57. package/lib/commonjs/components/PreviewForRoleChangeModal.js.map +1 -1
  58. package/lib/commonjs/components/RoomSettingsModalContent.js +4 -7
  59. package/lib/commonjs/components/RoomSettingsModalContent.js.map +1 -1
  60. package/lib/commonjs/components/StopRecordingModalContent.js +4 -1
  61. package/lib/commonjs/components/StopRecordingModalContent.js.map +1 -1
  62. package/lib/commonjs/hooks-util.js +193 -28
  63. package/lib/commonjs/hooks-util.js.map +1 -1
  64. package/lib/commonjs/index.js +11 -0
  65. package/lib/commonjs/index.js.map +1 -1
  66. package/lib/commonjs/redux/actionTypes.js +6 -1
  67. package/lib/commonjs/redux/actionTypes.js.map +1 -1
  68. package/lib/commonjs/redux/actions/index.js +22 -1
  69. package/lib/commonjs/redux/actions/index.js.map +1 -1
  70. package/lib/commonjs/redux/reducers/appState.js +17 -1
  71. package/lib/commonjs/redux/reducers/appState.js.map +1 -1
  72. package/lib/commonjs/redux/reducers/hmsStates.js +15 -4
  73. package/lib/commonjs/redux/reducers/hmsStates.js.map +1 -1
  74. package/lib/commonjs/redux/reducers/userState.js +5 -1
  75. package/lib/commonjs/redux/reducers/userState.js.map +1 -1
  76. package/lib/commonjs/types.js +10 -1
  77. package/lib/commonjs/types.js.map +1 -1
  78. package/lib/commonjs/utils/types.js +11 -1
  79. package/lib/commonjs/utils/types.js.map +1 -1
  80. package/lib/commonjs/utils.js +1 -7
  81. package/lib/commonjs/utils.js.map +1 -1
  82. package/lib/module/HMSPrebuilt.js +16 -14
  83. package/lib/module/HMSPrebuilt.js.map +1 -1
  84. package/lib/module/HMSRoomSetup.js +81 -40
  85. package/lib/module/HMSRoomSetup.js.map +1 -1
  86. package/lib/module/Icons/Hand/assets/hand-off.png +0 -0
  87. package/lib/module/Icons/Hand/assets/hand-off@2x.png +0 -0
  88. package/lib/module/Icons/Hand/assets/hand-off@3x.png +0 -0
  89. package/lib/module/Icons/Hand/index.js +2 -1
  90. package/lib/module/Icons/Hand/index.js.map +1 -1
  91. package/lib/module/Icons/Recording/assets/recording-off.png +0 -0
  92. package/lib/module/Icons/Recording/assets/recording-off@2x.png +0 -0
  93. package/lib/module/Icons/Recording/assets/recording-off@3x.png +0 -0
  94. package/lib/module/Icons/Recording/index.js +2 -1
  95. package/lib/module/Icons/Recording/index.js.map +1 -1
  96. package/lib/module/components/DisplayView.js +3 -1
  97. package/lib/module/components/DisplayView.js.map +1 -1
  98. package/lib/module/components/EndRoomModal.js +20 -0
  99. package/lib/module/components/EndRoomModal.js.map +1 -0
  100. package/lib/module/components/EndRoomModalContent.js +9 -2
  101. package/lib/module/components/EndRoomModalContent.js.map +1 -1
  102. package/lib/module/components/Footer.js +9 -1
  103. package/lib/module/components/Footer.js.map +1 -1
  104. package/lib/module/components/HMSKeyboardAvoidingView.js +4 -19
  105. package/lib/module/components/HMSKeyboardAvoidingView.js.map +1 -1
  106. package/lib/module/components/HMSLocalScreenshareNotification.js +1 -1
  107. package/lib/module/components/HMSManageLeave.js +5 -181
  108. package/lib/module/components/HMSManageLeave.js.map +1 -1
  109. package/lib/module/components/HMSNotification.js +4 -3
  110. package/lib/module/components/HMSNotification.js.map +1 -1
  111. package/lib/module/components/HMSNotifications.js +28 -2
  112. package/lib/module/components/HMSNotifications.js.map +1 -1
  113. package/lib/module/components/HMSOverlayChatView.js +7 -1
  114. package/lib/module/components/HMSOverlayChatView.js.map +1 -1
  115. package/lib/module/components/HMSReconnectingNotification.js +24 -0
  116. package/lib/module/components/HMSReconnectingNotification.js.map +1 -0
  117. package/lib/module/components/HMSRecordingIndicator.js +1 -1
  118. package/lib/module/components/HMSRecordingIndicator.js.map +1 -1
  119. package/lib/module/components/HMSTerminalErrorNotification.js +57 -0
  120. package/lib/module/components/HMSTerminalErrorNotification.js.map +1 -0
  121. package/lib/module/components/LeaveRoomBottomSheet.js +167 -0
  122. package/lib/module/components/LeaveRoomBottomSheet.js.map +1 -0
  123. package/lib/module/components/Meeting.js +5 -1
  124. package/lib/module/components/Meeting.js.map +1 -1
  125. package/lib/module/components/MeetingScreenContent.js +3 -2
  126. package/lib/module/components/MeetingScreenContent.js.map +1 -1
  127. package/lib/module/components/PIPView.js +81 -16
  128. package/lib/module/components/PIPView.js.map +1 -1
  129. package/lib/module/components/Participants/ParticipantsItemOptions.js +24 -2
  130. package/lib/module/components/Participants/ParticipantsItemOptions.js.map +1 -1
  131. package/lib/module/components/PeerVideoTile/AvatarView.js +4 -4
  132. package/lib/module/components/PeerVideoTile/PeerAudioIndicator.js +3 -1
  133. package/lib/module/components/PeerVideoTile/PeerAudioIndicator.js.map +1 -1
  134. package/lib/module/components/PeerVideoTile/PeerVideoTileView.js +1 -1
  135. package/lib/module/components/PeerVideoTile/PeerVideoTileView.js.map +1 -1
  136. package/lib/module/components/PreviewForRoleChangeModal.js +1 -1
  137. package/lib/module/components/RoomSettingsModalContent.js +6 -9
  138. package/lib/module/components/RoomSettingsModalContent.js.map +1 -1
  139. package/lib/module/components/StopRecordingModalContent.js +4 -1
  140. package/lib/module/components/StopRecordingModalContent.js.map +1 -1
  141. package/lib/module/hooks-util.js +184 -25
  142. package/lib/module/hooks-util.js.map +1 -1
  143. package/lib/module/index.js +1 -0
  144. package/lib/module/index.js.map +1 -1
  145. package/lib/module/redux/actionTypes.js +6 -1
  146. package/lib/module/redux/actionTypes.js.map +1 -1
  147. package/lib/module/redux/actions/index.js +18 -0
  148. package/lib/module/redux/actions/index.js.map +1 -1
  149. package/lib/module/redux/reducers/appState.js +17 -1
  150. package/lib/module/redux/reducers/appState.js.map +1 -1
  151. package/lib/module/redux/reducers/hmsStates.js +15 -4
  152. package/lib/module/redux/reducers/hmsStates.js.map +1 -1
  153. package/lib/module/redux/reducers/userState.js +5 -1
  154. package/lib/module/redux/reducers/userState.js.map +1 -1
  155. package/lib/module/types.js +9 -0
  156. package/lib/module/types.js.map +1 -1
  157. package/lib/module/utils/types.js +11 -0
  158. package/lib/module/utils/types.js.map +1 -1
  159. package/lib/module/utils.js +0 -6
  160. package/lib/module/utils.js.map +1 -1
  161. package/lib/typescript/HMSPrebuilt.d.ts +2 -16
  162. package/lib/typescript/HMSPrebuilt.d.ts.map +1 -1
  163. package/lib/typescript/HMSRoomSetup.d.ts.map +1 -1
  164. package/lib/typescript/Icons/Hand/index.d.ts +1 -0
  165. package/lib/typescript/Icons/Hand/index.d.ts.map +1 -1
  166. package/lib/typescript/Icons/Recording/index.d.ts +1 -0
  167. package/lib/typescript/Icons/Recording/index.d.ts.map +1 -1
  168. package/lib/typescript/components/DisplayView.d.ts.map +1 -1
  169. package/lib/typescript/components/EndRoomModal.d.ts +6 -0
  170. package/lib/typescript/components/EndRoomModal.d.ts.map +1 -0
  171. package/lib/typescript/components/EndRoomModalContent.d.ts.map +1 -1
  172. package/lib/typescript/components/Footer.d.ts +1 -0
  173. package/lib/typescript/components/Footer.d.ts.map +1 -1
  174. package/lib/typescript/components/HMSKeyboardAvoidingView.d.ts +1 -0
  175. package/lib/typescript/components/HMSKeyboardAvoidingView.d.ts.map +1 -1
  176. package/lib/typescript/components/HMSManageLeave.d.ts.map +1 -1
  177. package/lib/typescript/components/HMSNotification.d.ts +1 -0
  178. package/lib/typescript/components/HMSNotification.d.ts.map +1 -1
  179. package/lib/typescript/components/HMSNotifications.d.ts +1 -0
  180. package/lib/typescript/components/HMSNotifications.d.ts.map +1 -1
  181. package/lib/typescript/components/HMSOverlayChatView.d.ts.map +1 -1
  182. package/lib/typescript/components/HMSReconnectingNotification.d.ts +5 -0
  183. package/lib/typescript/components/HMSReconnectingNotification.d.ts.map +1 -0
  184. package/lib/typescript/components/HMSTerminalErrorNotification.d.ts +10 -0
  185. package/lib/typescript/components/HMSTerminalErrorNotification.d.ts.map +1 -0
  186. package/lib/typescript/components/LeaveRoomBottomSheet.d.ts +6 -0
  187. package/lib/typescript/components/LeaveRoomBottomSheet.d.ts.map +1 -0
  188. package/lib/typescript/components/Meeting.d.ts.map +1 -1
  189. package/lib/typescript/components/PIPView.d.ts.map +1 -1
  190. package/lib/typescript/components/Participants/ParticipantsItemOptions.d.ts.map +1 -1
  191. package/lib/typescript/components/PeerVideoTile/PeerAudioIndicator.d.ts.map +1 -1
  192. package/lib/typescript/components/PeerVideoTile/PeerVideoTileView.d.ts.map +1 -1
  193. package/lib/typescript/components/RoomSettingsModalContent.d.ts.map +1 -1
  194. package/lib/typescript/components/StopRecordingModalContent.d.ts.map +1 -1
  195. package/lib/typescript/hooks-util.d.ts +20 -7
  196. package/lib/typescript/hooks-util.d.ts.map +1 -1
  197. package/lib/typescript/index.d.ts +2 -0
  198. package/lib/typescript/index.d.ts.map +1 -1
  199. package/lib/typescript/redux/actionTypes.d.ts +3 -0
  200. package/lib/typescript/redux/actionTypes.d.ts.map +1 -1
  201. package/lib/typescript/redux/actions/index.d.ts +23 -14
  202. package/lib/typescript/redux/actions/index.d.ts.map +1 -1
  203. package/lib/typescript/redux/index.d.ts +5 -7
  204. package/lib/typescript/redux/index.d.ts.map +1 -1
  205. package/lib/typescript/redux/reducers/appState.d.ts +4 -5
  206. package/lib/typescript/redux/reducers/appState.d.ts.map +1 -1
  207. package/lib/typescript/redux/reducers/hmsStates.d.ts.map +1 -1
  208. package/lib/typescript/redux/reducers/index.d.ts +5 -7
  209. package/lib/typescript/redux/reducers/index.d.ts.map +1 -1
  210. package/lib/typescript/redux/reducers/userState.d.ts +2 -2
  211. package/lib/typescript/redux/reducers/userState.d.ts.map +1 -1
  212. package/lib/typescript/types.d.ts +79 -0
  213. package/lib/typescript/types.d.ts.map +1 -1
  214. package/lib/typescript/utils/types.d.ts +24 -0
  215. package/lib/typescript/utils/types.d.ts.map +1 -1
  216. package/lib/typescript/utils.d.ts +0 -5
  217. package/lib/typescript/utils.d.ts.map +1 -1
  218. package/package.json +2 -2
  219. package/src/HMSPrebuilt.tsx +32 -23
  220. package/src/HMSRoomSetup.tsx +105 -53
  221. package/src/Icons/Hand/assets/hand-off.png +0 -0
  222. package/src/Icons/Hand/assets/hand-off@2x.png +0 -0
  223. package/src/Icons/Hand/assets/hand-off@3x.png +0 -0
  224. package/src/Icons/Hand/index.tsx +13 -3
  225. package/src/Icons/Recording/assets/recording-off.png +0 -0
  226. package/src/Icons/Recording/assets/recording-off@2x.png +0 -0
  227. package/src/Icons/Recording/assets/recording-off@3x.png +0 -0
  228. package/src/Icons/Recording/index.tsx +9 -2
  229. package/src/components/DisplayView.tsx +6 -0
  230. package/src/components/EndRoomModal.tsx +24 -0
  231. package/src/components/EndRoomModalContent.tsx +9 -2
  232. package/src/components/Footer.tsx +18 -2
  233. package/src/components/HMSKeyboardAvoidingView.tsx +5 -23
  234. package/src/components/HMSLocalScreenshareNotification.tsx +1 -1
  235. package/src/components/HMSManageLeave.tsx +4 -228
  236. package/src/components/HMSNotification.tsx +4 -2
  237. package/src/components/HMSNotifications.tsx +41 -7
  238. package/src/components/HMSOverlayChatView.tsx +6 -1
  239. package/src/components/HMSReconnectingNotification.tsx +27 -0
  240. package/src/components/HMSRecordingIndicator.tsx +1 -1
  241. package/src/components/HMSTerminalErrorNotification.tsx +70 -0
  242. package/src/components/LeaveRoomBottomSheet.tsx +199 -0
  243. package/src/components/Meeting.tsx +7 -0
  244. package/src/components/MeetingScreenContent.tsx +2 -2
  245. package/src/components/PIPView.tsx +113 -25
  246. package/src/components/Participants/ParticipantsItemOptions.tsx +26 -4
  247. package/src/components/PeerVideoTile/AvatarView.tsx +4 -4
  248. package/src/components/PeerVideoTile/PeerAudioIndicator.tsx +6 -1
  249. package/src/components/PeerVideoTile/PeerVideoTileView.tsx +4 -2
  250. package/src/components/PreviewForRoleChangeModal.tsx +1 -1
  251. package/src/components/RoomSettingsModalContent.tsx +5 -9
  252. package/src/components/StopRecordingModalContent.tsx +3 -1
  253. package/src/hooks-util.ts +243 -25
  254. package/src/index.ts +2 -0
  255. package/src/redux/actionTypes.ts +7 -0
  256. package/src/redux/actions/index.ts +19 -7
  257. package/src/redux/reducers/appState.ts +18 -1
  258. package/src/redux/reducers/hmsStates.ts +19 -7
  259. package/src/redux/reducers/userState.ts +7 -3
  260. package/src/types.ts +71 -0
  261. package/src/utils/types.ts +27 -0
  262. package/src/utils.ts +0 -6
@@ -1,15 +1,10 @@
1
1
  import * as React from 'react';
2
- import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
3
- import { useSelector } from 'react-redux';
2
+ import { View } from 'react-native';
4
3
 
5
4
  import { LeaveIcon } from '../Icons';
6
- import { useHMSRoomStyleSheet, useLeaveMethods } from '../hooks-util';
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 leavePopCloseAction = React.useRef(ModalTypes.DEFAULT);
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
- setLeavePopVisible(true);
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 '../utils';
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
+ });