@100mslive/react-native-room-kit 0.0.1 → 0.0.3

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 (255) hide show
  1. package/lib/commonjs/HMSRoomSetup.js +1 -1
  2. package/lib/commonjs/HMSRoomSetup.js.map +1 -1
  3. package/lib/commonjs/Icons/AnswerPhone/assets/answer-phone.png +0 -0
  4. package/lib/commonjs/Icons/AnswerPhone/assets/answer-phone@2x.png +0 -0
  5. package/lib/commonjs/Icons/AnswerPhone/assets/answer-phone@3x.png +0 -0
  6. package/lib/commonjs/Icons/AnswerPhone/index.js +30 -0
  7. package/lib/commonjs/Icons/AnswerPhone/index.js.map +1 -0
  8. package/lib/commonjs/Icons/Bluetooth/assets/bluetooth-on.png +0 -0
  9. package/lib/commonjs/Icons/Bluetooth/assets/bluetooth-on@2x.png +0 -0
  10. package/lib/commonjs/Icons/Bluetooth/assets/bluetooth-on@3x.png +0 -0
  11. package/lib/commonjs/Icons/Bluetooth/index.js +30 -0
  12. package/lib/commonjs/Icons/Bluetooth/index.js.map +1 -0
  13. package/lib/commonjs/Icons/GenericLogo/assets/generic-logo.png +0 -0
  14. package/lib/commonjs/Icons/GenericLogo/assets/generic-logo@2x.png +0 -0
  15. package/lib/commonjs/Icons/GenericLogo/assets/generic-logo@3x.png +0 -0
  16. package/lib/commonjs/Icons/GenericLogo/index.js +30 -0
  17. package/lib/commonjs/Icons/GenericLogo/index.js.map +1 -0
  18. package/lib/commonjs/Icons/Headphones/assets/headphones.png +0 -0
  19. package/lib/commonjs/Icons/Headphones/assets/headphones@2x.png +0 -0
  20. package/lib/commonjs/Icons/Headphones/assets/headphones@3x.png +0 -0
  21. package/lib/commonjs/Icons/Headphones/index.js +30 -0
  22. package/lib/commonjs/Icons/Headphones/index.js.map +1 -0
  23. package/lib/commonjs/Icons/Person/assets/person.png +0 -0
  24. package/lib/commonjs/Icons/Person/assets/person@2x.png +0 -0
  25. package/lib/commonjs/Icons/Person/assets/person@3x.png +0 -0
  26. package/lib/commonjs/Icons/Person/index.js +30 -0
  27. package/lib/commonjs/Icons/Person/index.js.map +1 -0
  28. package/lib/commonjs/Icons/Speaker/assets/speaker-large.png +0 -0
  29. package/lib/commonjs/Icons/Speaker/assets/speaker-large@2x.png +0 -0
  30. package/lib/commonjs/Icons/Speaker/assets/speaker-large@3x.png +0 -0
  31. package/lib/commonjs/Icons/Speaker/index.js +7 -2
  32. package/lib/commonjs/Icons/Speaker/index.js.map +1 -1
  33. package/lib/commonjs/Icons/Wave/assets/wave.png +0 -0
  34. package/lib/commonjs/Icons/Wave/assets/wave@2x.png +0 -0
  35. package/lib/commonjs/Icons/Wave/assets/wave@3x.png +0 -0
  36. package/lib/commonjs/Icons/Wave/index.js +30 -0
  37. package/lib/commonjs/Icons/Wave/index.js.map +1 -0
  38. package/lib/commonjs/Icons/index.js +66 -0
  39. package/lib/commonjs/Icons/index.js.map +1 -1
  40. package/lib/commonjs/components/BackButton.js +1 -1
  41. package/lib/commonjs/components/BackButton.js.map +1 -1
  42. package/lib/commonjs/components/DisplayTrack.js +1 -1
  43. package/lib/commonjs/components/DisplayTrack.js.map +1 -1
  44. package/lib/commonjs/components/HMSPreviewEditName.js +1 -1
  45. package/lib/commonjs/components/HMSPreviewEditName.js.map +1 -1
  46. package/lib/commonjs/components/HMSPreviewJoinButton.js +11 -4
  47. package/lib/commonjs/components/HMSPreviewJoinButton.js.map +1 -1
  48. package/lib/commonjs/components/HMSPreviewPeersList.js +9 -32
  49. package/lib/commonjs/components/HMSPreviewPeersList.js.map +1 -1
  50. package/lib/commonjs/components/HMSPreviewSubtitle.js +1 -1
  51. package/lib/commonjs/components/HMSPreviewSubtitle.js.map +1 -1
  52. package/lib/commonjs/components/HMSPreviewTile.js +11 -61
  53. package/lib/commonjs/components/HMSPreviewTile.js.map +1 -1
  54. package/lib/commonjs/components/HMSPreviewTitle.js +0 -1
  55. package/lib/commonjs/components/HMSPreviewTitle.js.map +1 -1
  56. package/lib/commonjs/components/{HMSPreviewDeviceSettings.js → HMSSpeakerSettings.js} +69 -161
  57. package/lib/commonjs/components/HMSSpeakerSettings.js.map +1 -0
  58. package/lib/commonjs/components/Header.js +2 -1
  59. package/lib/commonjs/components/Header.js.map +1 -1
  60. package/lib/commonjs/components/Participants/ParticipantsList.js +1 -1
  61. package/lib/commonjs/components/Participants/ParticipantsList.js.map +1 -1
  62. package/lib/commonjs/components/PeerSettingsModalContent.js +4 -3
  63. package/lib/commonjs/components/PeerSettingsModalContent.js.map +1 -1
  64. package/lib/commonjs/components/Preview.js +72 -21
  65. package/lib/commonjs/components/Preview.js.map +1 -1
  66. package/lib/commonjs/components/RoomSettingsModalContent.js +5 -5
  67. package/lib/commonjs/components/RoomSettingsModalContent.js.map +1 -1
  68. package/lib/commonjs/hooks-util.js +111 -93
  69. package/lib/commonjs/hooks-util.js.map +1 -1
  70. package/lib/commonjs/redux/actionTypes.js +2 -0
  71. package/lib/commonjs/redux/actionTypes.js.map +1 -1
  72. package/lib/commonjs/redux/actions/index.js +11 -1
  73. package/lib/commonjs/redux/actions/index.js.map +1 -1
  74. package/lib/commonjs/redux/reducers/hmsStates.js +12 -1
  75. package/lib/commonjs/redux/reducers/hmsStates.js.map +1 -1
  76. package/lib/commonjs/redux/reducers/userState.js +1 -1
  77. package/lib/commonjs/redux/reducers/userState.js.map +1 -1
  78. package/lib/commonjs/utils/theme.js +5 -1
  79. package/lib/commonjs/utils/theme.js.map +1 -1
  80. package/lib/module/HMSRoomSetup.js +1 -1
  81. package/lib/module/HMSRoomSetup.js.map +1 -1
  82. package/lib/module/Icons/AnswerPhone/assets/answer-phone.png +0 -0
  83. package/lib/module/Icons/AnswerPhone/assets/answer-phone@2x.png +0 -0
  84. package/lib/module/Icons/AnswerPhone/assets/answer-phone@3x.png +0 -0
  85. package/lib/module/Icons/AnswerPhone/index.js +22 -0
  86. package/lib/module/Icons/AnswerPhone/index.js.map +1 -0
  87. package/lib/module/Icons/Bluetooth/assets/bluetooth-on.png +0 -0
  88. package/lib/module/Icons/Bluetooth/assets/bluetooth-on@2x.png +0 -0
  89. package/lib/module/Icons/Bluetooth/assets/bluetooth-on@3x.png +0 -0
  90. package/lib/module/Icons/Bluetooth/index.js +22 -0
  91. package/lib/module/Icons/Bluetooth/index.js.map +1 -0
  92. package/lib/module/Icons/GenericLogo/assets/generic-logo.png +0 -0
  93. package/lib/module/Icons/GenericLogo/assets/generic-logo@2x.png +0 -0
  94. package/lib/module/Icons/GenericLogo/assets/generic-logo@3x.png +0 -0
  95. package/lib/module/Icons/GenericLogo/index.js +22 -0
  96. package/lib/module/Icons/GenericLogo/index.js.map +1 -0
  97. package/lib/module/Icons/Headphones/assets/headphones.png +0 -0
  98. package/lib/module/Icons/Headphones/assets/headphones@2x.png +0 -0
  99. package/lib/module/Icons/Headphones/assets/headphones@3x.png +0 -0
  100. package/lib/module/Icons/Headphones/index.js +22 -0
  101. package/lib/module/Icons/Headphones/index.js.map +1 -0
  102. package/lib/module/Icons/Person/assets/person.png +0 -0
  103. package/lib/module/Icons/Person/assets/person@2x.png +0 -0
  104. package/lib/module/Icons/Person/assets/person@3x.png +0 -0
  105. package/lib/module/Icons/Person/index.js +22 -0
  106. package/lib/module/Icons/Person/index.js.map +1 -0
  107. package/lib/module/Icons/Speaker/assets/speaker-large.png +0 -0
  108. package/lib/module/Icons/Speaker/assets/speaker-large@2x.png +0 -0
  109. package/lib/module/Icons/Speaker/assets/speaker-large@3x.png +0 -0
  110. package/lib/module/Icons/Speaker/index.js +7 -2
  111. package/lib/module/Icons/Speaker/index.js.map +1 -1
  112. package/lib/module/Icons/Wave/assets/wave.png +0 -0
  113. package/lib/module/Icons/Wave/assets/wave@2x.png +0 -0
  114. package/lib/module/Icons/Wave/assets/wave@3x.png +0 -0
  115. package/lib/module/Icons/Wave/index.js +22 -0
  116. package/lib/module/Icons/Wave/index.js.map +1 -0
  117. package/lib/module/Icons/index.js +6 -0
  118. package/lib/module/Icons/index.js.map +1 -1
  119. package/lib/module/components/BackButton.js +1 -1
  120. package/lib/module/components/BackButton.js.map +1 -1
  121. package/lib/module/components/DisplayTrack.js +1 -1
  122. package/lib/module/components/DisplayTrack.js.map +1 -1
  123. package/lib/module/components/HMSPreviewEditName.js +1 -1
  124. package/lib/module/components/HMSPreviewEditName.js.map +1 -1
  125. package/lib/module/components/HMSPreviewJoinButton.js +11 -4
  126. package/lib/module/components/HMSPreviewJoinButton.js.map +1 -1
  127. package/lib/module/components/HMSPreviewPeersList.js +9 -32
  128. package/lib/module/components/HMSPreviewPeersList.js.map +1 -1
  129. package/lib/module/components/HMSPreviewSubtitle.js +1 -1
  130. package/lib/module/components/HMSPreviewSubtitle.js.map +1 -1
  131. package/lib/module/components/HMSPreviewTile.js +12 -62
  132. package/lib/module/components/HMSPreviewTile.js.map +1 -1
  133. package/lib/module/components/HMSPreviewTitle.js +0 -1
  134. package/lib/module/components/HMSPreviewTitle.js.map +1 -1
  135. package/lib/module/components/HMSSpeakerSettings.js +204 -0
  136. package/lib/module/components/HMSSpeakerSettings.js.map +1 -0
  137. package/lib/module/components/Header.js +2 -1
  138. package/lib/module/components/Header.js.map +1 -1
  139. package/lib/module/components/Participants/ParticipantsList.js +1 -1
  140. package/lib/module/components/Participants/ParticipantsList.js.map +1 -1
  141. package/lib/module/components/PeerSettingsModalContent.js +4 -3
  142. package/lib/module/components/PeerSettingsModalContent.js.map +1 -1
  143. package/lib/module/components/Preview.js +73 -23
  144. package/lib/module/components/Preview.js.map +1 -1
  145. package/lib/module/components/RoomSettingsModalContent.js +5 -5
  146. package/lib/module/components/RoomSettingsModalContent.js.map +1 -1
  147. package/lib/module/hooks-util.js +114 -103
  148. package/lib/module/hooks-util.js.map +1 -1
  149. package/lib/module/redux/actionTypes.js +2 -0
  150. package/lib/module/redux/actionTypes.js.map +1 -1
  151. package/lib/module/redux/actions/index.js +8 -0
  152. package/lib/module/redux/actions/index.js.map +1 -1
  153. package/lib/module/redux/reducers/hmsStates.js +12 -1
  154. package/lib/module/redux/reducers/hmsStates.js.map +1 -1
  155. package/lib/module/redux/reducers/userState.js +1 -1
  156. package/lib/module/redux/reducers/userState.js.map +1 -1
  157. package/lib/module/utils/theme.js +5 -1
  158. package/lib/module/utils/theme.js.map +1 -1
  159. package/lib/typescript/Icons/AnswerPhone/index.d.ts +7 -0
  160. package/lib/typescript/Icons/AnswerPhone/index.d.ts.map +1 -0
  161. package/lib/typescript/Icons/Bluetooth/index.d.ts +7 -0
  162. package/lib/typescript/Icons/Bluetooth/index.d.ts.map +1 -0
  163. package/lib/typescript/Icons/GenericLogo/index.d.ts +7 -0
  164. package/lib/typescript/Icons/GenericLogo/index.d.ts.map +1 -0
  165. package/lib/typescript/Icons/Headphones/index.d.ts +7 -0
  166. package/lib/typescript/Icons/Headphones/index.d.ts.map +1 -0
  167. package/lib/typescript/Icons/Person/index.d.ts +7 -0
  168. package/lib/typescript/Icons/Person/index.d.ts.map +1 -0
  169. package/lib/typescript/Icons/Speaker/index.d.ts +1 -0
  170. package/lib/typescript/Icons/Speaker/index.d.ts.map +1 -1
  171. package/lib/typescript/Icons/Wave/index.d.ts +7 -0
  172. package/lib/typescript/Icons/Wave/index.d.ts.map +1 -0
  173. package/lib/typescript/Icons/index.d.ts +6 -0
  174. package/lib/typescript/Icons/index.d.ts.map +1 -1
  175. package/lib/typescript/components/HMSPreviewJoinButton.d.ts.map +1 -1
  176. package/lib/typescript/components/HMSPreviewPeersList.d.ts.map +1 -1
  177. package/lib/typescript/components/HMSPreviewTile.d.ts.map +1 -1
  178. package/lib/typescript/components/HMSSpeakerSettings.d.ts +3 -0
  179. package/lib/typescript/components/HMSSpeakerSettings.d.ts.map +1 -0
  180. package/lib/typescript/components/Header.d.ts.map +1 -1
  181. package/lib/typescript/components/Participants/ParticipantsList.d.ts.map +1 -1
  182. package/lib/typescript/components/PeerSettingsModalContent.d.ts.map +1 -1
  183. package/lib/typescript/components/Preview.d.ts.map +1 -1
  184. package/lib/typescript/components/RoomSettingsModalContent.d.ts.map +1 -1
  185. package/lib/typescript/hooks-util.d.ts +1 -1
  186. package/lib/typescript/hooks-util.d.ts.map +1 -1
  187. package/lib/typescript/redux/actionTypes.d.ts +3 -1
  188. package/lib/typescript/redux/actionTypes.d.ts.map +1 -1
  189. package/lib/typescript/redux/actions/index.d.ts +8 -0
  190. package/lib/typescript/redux/actions/index.d.ts.map +1 -1
  191. package/lib/typescript/redux/index.d.ts +1 -0
  192. package/lib/typescript/redux/index.d.ts.map +1 -1
  193. package/lib/typescript/redux/reducers/hmsStates.d.ts +11 -2
  194. package/lib/typescript/redux/reducers/hmsStates.d.ts.map +1 -1
  195. package/lib/typescript/redux/reducers/index.d.ts +1 -0
  196. package/lib/typescript/redux/reducers/index.d.ts.map +1 -1
  197. package/lib/typescript/utils/theme.d.ts +4 -0
  198. package/lib/typescript/utils/theme.d.ts.map +1 -1
  199. package/package.json +4 -3
  200. package/src/HMSRoomSetup.tsx +1 -1
  201. package/src/Icons/AnswerPhone/assets/answer-phone.png +0 -0
  202. package/src/Icons/AnswerPhone/assets/answer-phone@2x.png +0 -0
  203. package/src/Icons/AnswerPhone/assets/answer-phone@3x.png +0 -0
  204. package/src/Icons/AnswerPhone/index.tsx +27 -0
  205. package/src/Icons/Bluetooth/assets/bluetooth-on.png +0 -0
  206. package/src/Icons/Bluetooth/assets/bluetooth-on@2x.png +0 -0
  207. package/src/Icons/Bluetooth/assets/bluetooth-on@3x.png +0 -0
  208. package/src/Icons/Bluetooth/index.tsx +27 -0
  209. package/src/Icons/GenericLogo/assets/generic-logo.png +0 -0
  210. package/src/Icons/GenericLogo/assets/generic-logo@2x.png +0 -0
  211. package/src/Icons/GenericLogo/assets/generic-logo@3x.png +0 -0
  212. package/src/Icons/GenericLogo/index.tsx +27 -0
  213. package/src/Icons/Headphones/assets/headphones.png +0 -0
  214. package/src/Icons/Headphones/assets/headphones@2x.png +0 -0
  215. package/src/Icons/Headphones/assets/headphones@3x.png +0 -0
  216. package/src/Icons/Headphones/index.tsx +27 -0
  217. package/src/Icons/Person/assets/person.png +0 -0
  218. package/src/Icons/Person/assets/person@2x.png +0 -0
  219. package/src/Icons/Person/assets/person@3x.png +0 -0
  220. package/src/Icons/Person/index.tsx +27 -0
  221. package/src/Icons/Speaker/assets/speaker-large.png +0 -0
  222. package/src/Icons/Speaker/assets/speaker-large@2x.png +0 -0
  223. package/src/Icons/Speaker/assets/speaker-large@3x.png +0 -0
  224. package/src/Icons/Speaker/index.tsx +10 -2
  225. package/src/Icons/Wave/assets/wave.png +0 -0
  226. package/src/Icons/Wave/assets/wave@2x.png +0 -0
  227. package/src/Icons/Wave/assets/wave@3x.png +0 -0
  228. package/src/Icons/Wave/index.tsx +24 -0
  229. package/src/Icons/index.ts +6 -0
  230. package/src/components/BackButton.tsx +1 -1
  231. package/src/components/DisplayTrack.tsx +1 -1
  232. package/src/components/HMSPreviewEditName.tsx +1 -1
  233. package/src/components/HMSPreviewJoinButton.tsx +21 -4
  234. package/src/components/HMSPreviewPeersList.tsx +19 -40
  235. package/src/components/HMSPreviewSubtitle.tsx +1 -1
  236. package/src/components/HMSPreviewTile.tsx +11 -67
  237. package/src/components/HMSPreviewTitle.tsx +0 -1
  238. package/src/components/HMSSpeakerSettings.tsx +259 -0
  239. package/src/components/Header.tsx +4 -1
  240. package/src/components/Participants/ParticipantsList.tsx +0 -1
  241. package/src/components/PeerSettingsModalContent.tsx +7 -5
  242. package/src/components/Preview.tsx +92 -37
  243. package/src/components/RoomSettingsModalContent.tsx +7 -6
  244. package/src/hooks-util.ts +133 -103
  245. package/src/redux/actionTypes.ts +2 -0
  246. package/src/redux/actions/index.ts +10 -0
  247. package/src/redux/reducers/hmsStates.ts +28 -1
  248. package/src/redux/reducers/userState.ts +1 -1
  249. package/src/utils/theme.ts +5 -1
  250. package/lib/commonjs/components/HMSPreviewDeviceSettings.js.map +0 -1
  251. package/lib/module/components/HMSPreviewDeviceSettings.js +0 -296
  252. package/lib/module/components/HMSPreviewDeviceSettings.js.map +0 -1
  253. package/lib/typescript/components/HMSPreviewDeviceSettings.d.ts +0 -3
  254. package/lib/typescript/components/HMSPreviewDeviceSettings.d.ts.map +0 -1
  255. package/src/components/HMSPreviewDeviceSettings.tsx +0 -387
@@ -4,9 +4,11 @@ import type { ImageProps } from 'react-native';
4
4
 
5
5
  interface SpeakerIconProps extends Omit<ImageProps, 'source'> {
6
6
  muted: boolean;
7
+ size?: 'normal' | 'large';
7
8
  }
8
9
 
9
10
  export const SpeakerIcon: React.FC<SpeakerIconProps> = ({
11
+ size = 'normal',
10
12
  muted,
11
13
  style,
12
14
  ...restProps
@@ -16,9 +18,11 @@ export const SpeakerIcon: React.FC<SpeakerIconProps> = ({
16
18
  source={
17
19
  muted
18
20
  ? require('./assets/speaker-muted.png')
19
- : require('./assets/speaker.png')
21
+ : size === 'normal'
22
+ ? require('./assets/speaker.png')
23
+ : require('./assets/speaker-large.png')
20
24
  }
21
- style={[styles.icon, style]}
25
+ style={[styles.icon, style, size === 'large' ? styles.large : null]}
22
26
  {...restProps}
23
27
  />
24
28
  );
@@ -31,4 +35,8 @@ const styles = StyleSheet.create({
31
35
  alignItems: 'center',
32
36
  justifyContent: 'center',
33
37
  },
38
+ large: {
39
+ width: 32,
40
+ height: 32,
41
+ },
34
42
  });
Binary file
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { Image, StyleSheet } from 'react-native';
3
+ import type { ImageProps } from 'react-native';
4
+
5
+ interface WaveIconProps extends Omit<ImageProps, 'source'> {}
6
+
7
+ export const WaveIcon: React.FC<WaveIconProps> = ({ style, ...restProps }) => {
8
+ return (
9
+ <Image
10
+ source={require('./assets/wave.png')}
11
+ style={[styles.icon, style]}
12
+ {...restProps}
13
+ />
14
+ );
15
+ };
16
+
17
+ const styles = StyleSheet.create({
18
+ icon: {
19
+ width: 24,
20
+ height: 24,
21
+ alignItems: 'center',
22
+ justifyContent: 'center',
23
+ },
24
+ });
@@ -17,3 +17,9 @@ export * from './Clock';
17
17
  export * from './End';
18
18
  export * from './100ms';
19
19
  export * from './Hand';
20
+ export * from './Person';
21
+ export * from './AnswerPhone';
22
+ export * from './Bluetooth';
23
+ export * from './Headphones';
24
+ export * from './Wave';
25
+ export * from './GenericLogo';
@@ -36,7 +36,7 @@ export const BackButton: React.FC<BackButtonProps> = () => {
36
36
  const styles = StyleSheet.create({
37
37
  button: {
38
38
  marginTop: 16,
39
- marginLeft: 8,
39
+ marginLeft: 16,
40
40
  backgroundColor: COLORS.SURFACE.DEFAULT,
41
41
  },
42
42
  });
@@ -79,7 +79,7 @@ const DisplayTrack = React.forwardRef<
79
79
  videoTrack?.source !== HMSTrackSource.REGULAR
80
80
  ? `${peer.name}'s ${videoTrack.source}`
81
81
  : isLocal
82
- ? `You (${peer.name})`
82
+ ? `${peer.name} (You)`
83
83
  : peer.name}
84
84
  </Text>
85
85
  </View>
@@ -29,7 +29,7 @@ export const HMSPreviewEditName: React.FC<HMSPreviewEditNameProps> = () => {
29
29
  style={[styles.input, inputFocused ? styles.focusedInput : null]}
30
30
  value={userName}
31
31
  onChangeText={handleNameChange}
32
- placeholder="Name"
32
+ placeholder="Enter Name..."
33
33
  autoCapitalize="words"
34
34
  autoCompleteType="name"
35
35
  placeholderTextColor={COLORS.SURFACE.ON_SURFACE.LOW}
@@ -5,8 +5,10 @@ import {
5
5
  Text,
6
6
  TouchableHighlight,
7
7
  } from 'react-native';
8
+ import { useSelector } from 'react-redux';
8
9
 
9
10
  import { COLORS } from '../utils/theme';
11
+ import type { RootState } from '../redux';
10
12
 
11
13
  export interface HMSPreviewJoinButtonProps {
12
14
  onJoin(): void;
@@ -17,12 +19,21 @@ export const HMSPreviewJoinButton: React.FC<HMSPreviewJoinButtonProps> = ({
17
19
  loading,
18
20
  onJoin,
19
21
  }) => {
22
+ const userNameInvalid = useSelector(
23
+ (state: RootState) => state.user.userName.length <= 0
24
+ );
25
+
26
+ const disabledJoin = userNameInvalid || loading;
27
+
20
28
  return (
21
29
  <TouchableHighlight
22
30
  underlayColor={COLORS.PRIMARY.DARK}
23
- style={styles.button}
31
+ style={[
32
+ styles.button,
33
+ disabledJoin ? { backgroundColor: COLORS.PRIMARY.DISABLED } : null,
34
+ ]}
24
35
  onPress={onJoin}
25
- disabled={loading}
36
+ disabled={disabledJoin}
26
37
  >
27
38
  <>
28
39
  {loading ? (
@@ -33,8 +44,14 @@ export const HMSPreviewJoinButton: React.FC<HMSPreviewJoinButtonProps> = ({
33
44
  />
34
45
  ) : null}
35
46
 
36
- <Text style={[styles.text, { opacity: loading ? 0 : undefined }]}>
37
- {'Join ->'}
47
+ <Text
48
+ style={[
49
+ styles.text,
50
+ { opacity: loading ? 0 : undefined },
51
+ disabledJoin ? { color: COLORS.PRIMARY.ON_PRIMARY.LOW } : null,
52
+ ]}
53
+ >
54
+ Join Now
38
55
  </Text>
39
56
  </>
40
57
  </TouchableHighlight>
@@ -1,53 +1,30 @@
1
1
  import * as React from 'react';
2
2
  import { StyleSheet, Text, View } from 'react-native';
3
- import {
4
- HMSPeer,
5
- // HMSPeerUpdate,
6
- // useHMSPeerUpdates,
7
- } from '@100mslive/react-native-hms';
3
+ import { useSelector } from 'react-redux';
4
+ import type { HMSPeer } from '@100mslive/react-native-hms';
8
5
 
9
6
  import { COLORS } from '../utils/theme';
10
7
  import { ParticipantsIcon } from '../Icons';
8
+ import type { RootState } from '../redux';
11
9
 
12
10
  export interface HMSPreviewPeersListProps {}
13
11
 
14
12
  export const HMSPreviewPeersList: React.FC<HMSPreviewPeersListProps> = () => {
15
- const [peerList, _setPeerList] = React.useState<HMSPeer[]>([]);
16
-
17
- // TODO: Handle case when peer updates are received before this hook mounts
18
- // It leads to some already joined peer missing in list
19
- // useHMSPeerUpdates(
20
- // ({ peer, type }: { peer: HMSPeer; type: HMSPeerUpdate }) => {
21
- // switch (type) {
22
- // case HMSPeerUpdate.PEER_JOINED:
23
- // setPeerList((prevPeerList) => [...prevPeerList, peer]);
24
- // break;
25
- // case HMSPeerUpdate.PEER_LEFT:
26
- // setPeerList((prevPeerList) =>
27
- // prevPeerList.filter(
28
- // (peerFromList) => peerFromList.peerID !== peer.peerID
29
- // )
30
- // );
31
- // break;
32
-
33
- // default:
34
- // break;
35
- // }
36
- // },
37
- // []
38
- // );
13
+ const previewPeersList = useSelector(
14
+ (state: RootState) => state.hmsStates.previewPeersList
15
+ );
39
16
 
40
17
  return (
41
18
  <View style={styles.container}>
42
- {peerList.length > 0 ? <ParticipantsIcon /> : null}
19
+ {previewPeersList.length > 0 ? <ParticipantsIcon /> : null}
43
20
 
44
- {peerList.length === 0 ? (
21
+ {previewPeersList.length === 0 ? (
45
22
  <Text style={[styles.text, styles.textSpacer]}>
46
23
  You are the first to join
47
24
  </Text>
48
- ) : peerList.length === 1 ? (
25
+ ) : previewPeersList.length === 1 ? (
49
26
  <Text style={[styles.text, styles.textSpacer]}>
50
- {peerList[0]!.name} has joined
27
+ {previewPeersList[0]!.name} has joined
51
28
  </Text>
52
29
  ) : (
53
30
  <View style={styles.multiTextContainer}>
@@ -56,17 +33,17 @@ export const HMSPreviewPeersList: React.FC<HMSPreviewPeersListProps> = () => {
56
33
  ellipsizeMode="tail"
57
34
  numberOfLines={1}
58
35
  >
59
- {peerList
36
+ {previewPeersList
60
37
  .slice(0, 2)
61
- .map((peer) => peer.name)
38
+ .map((peer: HMSPeer) => peer.name)
62
39
  .join(', ')}
63
40
  </Text>
64
41
 
65
- {peerList.length - 2 > 0 ? (
42
+ {previewPeersList.length - 2 > 0 ? (
66
43
  <Text style={styles.text}>
67
44
  {' '}
68
- +{peerList.length - 2}{' '}
69
- {peerList.length - 2 > 1 ? 'others' : 'other'}
45
+ +{previewPeersList.length - 2}{' '}
46
+ {previewPeersList.length - 2 > 1 ? 'others' : 'other'}
70
47
  </Text>
71
48
  ) : null}
72
49
  </View>
@@ -81,7 +58,6 @@ const styles = StyleSheet.create({
81
58
  alignItems: 'center',
82
59
  backgroundColor: COLORS.SURFACE.DEFAULT,
83
60
  marginTop: 16,
84
- marginBottom: 24,
85
61
  alignSelf: 'center',
86
62
  paddingVertical: 8,
87
63
  paddingHorizontal: 12,
@@ -99,7 +75,10 @@ const styles = StyleSheet.create({
99
75
  textSpacer: {
100
76
  marginHorizontal: 8,
101
77
  },
102
- flexView: { flex: 1 },
78
+ flexView: {
79
+ flex: 1,
80
+ flexShrink: 1,
81
+ },
103
82
  multiTextContainer: {
104
83
  flexDirection: 'row',
105
84
  marginHorizontal: 8,
@@ -15,7 +15,7 @@ export const HMSPreviewSubtitle: React.FC<HMSPreviewSubtitleProps> = ({
15
15
 
16
16
  const styles = StyleSheet.create({
17
17
  title: {
18
- color: COLORS.SURFACE.ON_SURFACE.LOW,
18
+ color: COLORS.SURFACE.ON_SURFACE.MEDIUM,
19
19
  fontSize: 14,
20
20
  fontFamily: 'Inter',
21
21
  fontWeight: '400',
@@ -3,7 +3,7 @@ import { useSelector } from 'react-redux';
3
3
  import { HMSVideoViewMode } from '@100mslive/react-native-hms';
4
4
  import { StyleSheet, Text, View } from 'react-native';
5
5
 
6
- import { MicIcon, NetworkQualityIcon } from '../Icons';
6
+ import { PersonIcon } from '../Icons';
7
7
  import { useHMSInstance } from '../hooks-util';
8
8
  import type { RootState } from '../redux';
9
9
  import { getInitials } from '../utils/functions';
@@ -21,16 +21,9 @@ export const HMSPreviewTile: React.FC = () => {
21
21
  const isLocalVideoMuted = useSelector(
22
22
  (state: RootState) => state.hmsStates.isLocalVideoMuted
23
23
  );
24
- const isLocalAudioMuted = useSelector(
25
- (state: RootState) => state.hmsStates.isLocalAudioMuted
26
- );
27
24
  const localVideoTrackId = useSelector(
28
25
  (state: RootState) => state.hmsStates.localPeer?.videoTrack?.trackId
29
26
  );
30
- const localPeerNetworkQuality = useSelector(
31
- (state: RootState) =>
32
- state.hmsStates.localPeer?.networkQuality?.downlinkQuality
33
- );
34
27
  const userName = useSelector((state: RootState) => state.user.userName);
35
28
 
36
29
  React.useEffect(() => {
@@ -43,15 +36,12 @@ export const HMSPreviewTile: React.FC = () => {
43
36
  <View style={styles.modalContainer}>
44
37
  {isLocalVideoMuted || !localVideoTrackId ? (
45
38
  <View style={styles.avatarContainer}>
46
- <View
47
- style={[
48
- styles.avatar,
49
- userName.length === 0 ? styles.emptyAvatar : null,
50
- ]}
51
- >
52
- <Text style={styles.avatarText}>
53
- {userName.length === 0 ? '👤' : getInitials(userName)}
54
- </Text>
39
+ <View style={styles.avatar}>
40
+ {userName.length === 0 ? (
41
+ <PersonIcon style={styles.avatarIcon} />
42
+ ) : (
43
+ <Text style={styles.avatarText}>{getInitials(userName)}</Text>
44
+ )}
55
45
  </View>
56
46
  </View>
57
47
  ) : (
@@ -64,18 +54,6 @@ export const HMSPreviewTile: React.FC = () => {
64
54
  style={styles.hmsView}
65
55
  />
66
56
  )}
67
-
68
- {isLocalAudioMuted ? (
69
- <View style={styles.micMuted}>
70
- <MicIcon muted={true} style={styles.micMutedIcon} />
71
- </View>
72
- ) : null}
73
-
74
- <View style={styles.nameInTileContainer}>
75
- {userName ? <Text style={styles.nameInTile}>{userName}</Text> : null}
76
-
77
- <NetworkQualityIcon quality={localPeerNetworkQuality} />
78
- </View>
79
57
  </View>
80
58
  );
81
59
  };
@@ -84,29 +62,12 @@ const styles = StyleSheet.create({
84
62
  modalContainer: {
85
63
  flex: 1,
86
64
  position: 'relative',
87
- backgroundColor: COLORS.BACKGROUND.DEFAULT,
88
- marginHorizontal: 8,
89
- borderRadius: 16,
90
- alignSelf: 'center',
65
+ backgroundColor: COLORS.BACKGROUND.DIM,
91
66
  overflow: 'hidden',
92
- minWidth: '50%',
93
- // minHeight: '50%',
94
- aspectRatio: 377 / 482, // TODO: DO WE NEED THIS?
95
67
  },
96
68
  hmsView: {
97
69
  flex: 1,
98
70
  },
99
- micMuted: {
100
- position: 'absolute',
101
- top: 8,
102
- right: 8,
103
- backgroundColor: COLORS.ALERT.ERROR.DEFAULT,
104
- padding: 8,
105
- borderRadius: 12,
106
- },
107
- micMutedIcon: {
108
- tintColor: COLORS.ALERT.ERROR.BRIGHTER,
109
- },
110
71
  avatarContainer: {
111
72
  flex: 1,
112
73
  alignItems: 'center',
@@ -120,8 +81,9 @@ const styles = StyleSheet.create({
120
81
  justifyContent: 'center',
121
82
  alignItems: 'center',
122
83
  },
123
- emptyAvatar: {
124
- backgroundColor: '#C3D0E5', // TODO: use it from variable
84
+ avatarIcon: {
85
+ width: 40,
86
+ height: 40,
125
87
  },
126
88
  avatarText: {
127
89
  color: COLORS.SURFACE.ON_SURFACE.HIGH,
@@ -131,22 +93,4 @@ const styles = StyleSheet.create({
131
93
  lineHeight: 40,
132
94
  letterSpacing: 0.25,
133
95
  },
134
- nameInTileContainer: {
135
- position: 'absolute',
136
- bottom: 8,
137
- left: 8,
138
- backgroundColor: COLORS.BACKGROUND.DIM_80,
139
- padding: 8,
140
- borderRadius: 12,
141
- flexDirection: 'row',
142
- },
143
- nameInTile: {
144
- color: COLORS.SURFACE.ON_SURFACE.HIGH,
145
- fontSize: 14,
146
- fontFamily: 'Inter',
147
- fontWeight: '400',
148
- lineHeight: 20,
149
- letterSpacing: 0.25,
150
- marginRight: 8,
151
- },
152
96
  });
@@ -20,7 +20,6 @@ const styles = StyleSheet.create({
20
20
  fontFamily: 'Inter',
21
21
  fontWeight: '600',
22
22
  lineHeight: 32,
23
- marginTop: 8,
24
23
  textAlign: 'center',
25
24
  },
26
25
  });
@@ -0,0 +1,259 @@
1
+ import * as React from 'react';
2
+ import Modal from 'react-native-modal';
3
+ import {
4
+ Platform,
5
+ ScrollView,
6
+ StyleSheet,
7
+ Text,
8
+ TouchableOpacity,
9
+ View,
10
+ } from 'react-native';
11
+ import Toast from 'react-native-simple-toast';
12
+ import { useSelector } from 'react-redux';
13
+ import {
14
+ HMSUpdateListenerActions,
15
+ HMSAudioDevice,
16
+ } from '@100mslive/react-native-hms';
17
+
18
+ import {
19
+ AnswerPhoneIcon,
20
+ BluetoothIcon,
21
+ HeadphonesIcon,
22
+ SpeakerIcon,
23
+ WaveIcon,
24
+ } from '../Icons';
25
+ import { PressableIcon } from './PressableIcon';
26
+ import { COLORS } from '../utils/theme';
27
+ import { CloseIcon } from '../Icons';
28
+ import { useHMSInstance } from '../hooks-util';
29
+ import type { RootState } from '../redux';
30
+
31
+ export const HMSSpeakerSettings: React.FC = () => {
32
+ const hmsInstance = useHMSInstance();
33
+ const [settingsModalVisible, setSettingsModalVisible] = React.useState(false);
34
+
35
+ const [currentAudioOutputDevice, setCurrentAudioOutputDevice] =
36
+ React.useState<HMSAudioDevice | null>(null);
37
+ const [availableAudioOutputDevices, setAvailableAudioOutputDevices] =
38
+ React.useState<HMSAudioDevice[]>([]);
39
+
40
+ const debugMode = useSelector((state: RootState) => state.user.debugMode);
41
+
42
+ // Fetch current selected audio device and audio devices list on Android
43
+ React.useEffect(() => {
44
+ if (Platform.OS === 'android') {
45
+ let ignore = false;
46
+
47
+ const getCurrentAudioOutputDevice = async () => {
48
+ const device = await hmsInstance.getAudioOutputRouteType();
49
+ if (!ignore) {
50
+ setCurrentAudioOutputDevice(device);
51
+ }
52
+ };
53
+
54
+ const getAvailableAudioOutputDevices = async () => {
55
+ const devices = await hmsInstance.getAudioDevicesList();
56
+ if (!ignore) {
57
+ setAvailableAudioOutputDevices(devices);
58
+ }
59
+ };
60
+
61
+ getCurrentAudioOutputDevice();
62
+ getAvailableAudioOutputDevices();
63
+
64
+ return () => {
65
+ ignore = true;
66
+ };
67
+ }
68
+ }, [hmsInstance]);
69
+
70
+ // closes modal and no action will be taken after modal has been closed
71
+ const dismissModal = () => {
72
+ setSettingsModalVisible(false);
73
+ };
74
+
75
+ // Handles showing Modal for changing Audio device
76
+ const handleSpeakerChange = () => {
77
+ if (Platform.OS === 'ios') {
78
+ hmsInstance.switchAudioOutputUsingIOSUI();
79
+ } else {
80
+ if (availableAudioOutputDevices.length === 0) {
81
+ hmsInstance
82
+ .getAudioDevicesList()
83
+ .then((devices) => setAvailableAudioOutputDevices(devices)); // TODO(set-state-after-unmount): setting state irrespective of component unmount check
84
+ }
85
+ setSettingsModalVisible(true);
86
+ }
87
+ };
88
+
89
+ // Add audio device change listeners
90
+ React.useEffect(() => {
91
+ if (Platform.OS === 'android') {
92
+ let ignore = false;
93
+ hmsInstance.setAudioDeviceChangeListener((data: any) => {
94
+ if (!ignore && data) {
95
+ setCurrentAudioOutputDevice(data.device);
96
+ }
97
+
98
+ if (debugMode) {
99
+ Toast.showWithGravity(
100
+ `Audio Device Output changed to: ${data?.device}`,
101
+ Toast.LONG,
102
+ Toast.TOP
103
+ );
104
+ }
105
+ });
106
+
107
+ return () => {
108
+ ignore = true;
109
+
110
+ hmsInstance.removeEventListener(
111
+ HMSUpdateListenerActions.ON_AUDIO_DEVICE_CHANGED
112
+ );
113
+ };
114
+ }
115
+ }, [hmsInstance, debugMode]);
116
+
117
+ // Handle changing selected audio device
118
+ const handleSelectAudioDevice = (device: HMSAudioDevice) => {
119
+ hmsInstance.switchAudioOutput(device);
120
+ setSettingsModalVisible(false);
121
+ };
122
+
123
+ return (
124
+ <View>
125
+ <PressableIcon onPress={handleSpeakerChange}>
126
+ {Platform.OS === 'ios' ? (
127
+ <SpeakerIcon muted={false} />
128
+ ) : (
129
+ getIcon(currentAudioOutputDevice || HMSAudioDevice.AUTOMATIC)
130
+ )}
131
+ </PressableIcon>
132
+
133
+ <Modal
134
+ isVisible={settingsModalVisible}
135
+ animationIn={'slideInUp'}
136
+ animationOut={'slideOutDown'}
137
+ backdropColor={COLORS.BACKGROUND.DIM}
138
+ backdropOpacity={0.3}
139
+ onBackButtonPress={dismissModal}
140
+ onBackdropPress={dismissModal}
141
+ useNativeDriver={true}
142
+ useNativeDriverForBackdrop={true}
143
+ hideModalContentWhileAnimating={true}
144
+ // swipeDirection={['up', 'down']}
145
+ // swipe
146
+ style={styles.modal}
147
+ >
148
+ <View style={styles.container}>
149
+ <View style={styles.header}>
150
+ <Text style={styles.headerText}>Speaker Settings</Text>
151
+
152
+ <TouchableOpacity
153
+ onPress={dismissModal}
154
+ hitSlop={styles.closeIconHitSlop}
155
+ >
156
+ <CloseIcon />
157
+ </TouchableOpacity>
158
+ </View>
159
+
160
+ {availableAudioOutputDevices.length === 0 ? (
161
+ <View style={styles.emptyView}>
162
+ <Text style={styles.itemText}>No other devices available!</Text>
163
+ </View>
164
+ ) : (
165
+ <ScrollView showsVerticalScrollIndicator={true}>
166
+ {availableAudioOutputDevices.sort().map((device) => (
167
+ <React.Fragment key={device}>
168
+ {true ? <View style={styles.divider} /> : null}
169
+
170
+ <TouchableOpacity
171
+ style={styles.audioDeviceItem}
172
+ onPress={() => handleSelectAudioDevice(device)}
173
+ >
174
+ {getIcon(device)}
175
+ <Text style={styles.itemText}>{device}</Text>
176
+ </TouchableOpacity>
177
+ </React.Fragment>
178
+ ))}
179
+ </ScrollView>
180
+ )}
181
+ </View>
182
+ </Modal>
183
+ </View>
184
+ );
185
+ };
186
+
187
+ const styles = StyleSheet.create({
188
+ modal: {
189
+ margin: 0,
190
+ justifyContent: 'flex-end',
191
+ },
192
+ container: {
193
+ backgroundColor: COLORS.SURFACE.DIM,
194
+ borderTopLeftRadius: 16,
195
+ borderTopRightRadius: 16,
196
+ paddingTop: 24,
197
+ paddingHorizontal: 16,
198
+ paddingBottom: 32,
199
+ },
200
+ header: {
201
+ flexDirection: 'row',
202
+ alignItems: 'center',
203
+ justifyContent: 'space-between',
204
+ marginBottom: 16,
205
+ },
206
+ headerText: {
207
+ color: COLORS.SURFACE.ON_SURFACE.HIGH,
208
+ fontSize: 16,
209
+ fontFamily: 'Inter',
210
+ fontWeight: '500',
211
+ lineHeight: 24,
212
+ letterSpacing: 0.15,
213
+ },
214
+ closeIconHitSlop: {
215
+ bottom: 16,
216
+ left: 16,
217
+ right: 16,
218
+ top: 16,
219
+ },
220
+ itemText: {
221
+ flex: 1,
222
+ marginHorizontal: 16,
223
+ color: COLORS.SURFACE.ON_SURFACE.HIGH,
224
+ fontSize: 14,
225
+ fontFamily: 'Inter',
226
+ fontWeight: '600',
227
+ lineHeight: 20,
228
+ letterSpacing: 0.1,
229
+ },
230
+ emptyView: {
231
+ height: 160,
232
+ alignItems: 'center',
233
+ justifyContent: 'center',
234
+ },
235
+ audioDeviceItem: {
236
+ flexDirection: 'row',
237
+ alignItems: 'center',
238
+ paddingVertical: 24,
239
+ },
240
+ divider: {
241
+ height: 1,
242
+ backgroundColor: COLORS.BORDER.DEFAULT,
243
+ },
244
+ });
245
+
246
+ const getIcon = (ofDevice: HMSAudioDevice) => {
247
+ switch (ofDevice) {
248
+ case HMSAudioDevice.AUTOMATIC:
249
+ return <WaveIcon />;
250
+ case HMSAudioDevice.BLUETOOTH:
251
+ return <BluetoothIcon />;
252
+ case HMSAudioDevice.EARPIECE:
253
+ return <AnswerPhoneIcon />;
254
+ case HMSAudioDevice.SPEAKER_PHONE:
255
+ return <SpeakerIcon muted={false} />;
256
+ case HMSAudioDevice.WIRED_HEADSET:
257
+ return <HeadphonesIcon />;
258
+ }
259
+ };
@@ -23,6 +23,7 @@ export const _Header: React.FC<HeaderProps> = ({ offset }) => {
23
23
  const roomName = useSelector(
24
24
  (state: RootState) => state.hmsStates.room?.name
25
25
  );
26
+ const debugMode = useSelector((state: RootState) => state.user.debugMode);
26
27
  const animatedStyles = useAnimatedStyle(() => {
27
28
  return {
28
29
  opacity: offset.value,
@@ -44,7 +45,9 @@ export const _Header: React.FC<HeaderProps> = ({ offset }) => {
44
45
  <View style={styles.hlsContainer}>
45
46
  <HmsLogoIcon />
46
47
 
47
- {roomName ? <Text style={styles.roomName}>{roomName}</Text> : null}
48
+ {debugMode && roomName ? (
49
+ <Text style={styles.roomName}>{roomName}</Text>
50
+ ) : null}
48
51
  </View>
49
52
  ) : (
50
53
  <View style={styles.container}>