@100mslive/react-native-room-kit 1.1.8 → 1.1.9-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 (215) hide show
  1. package/lib/commonjs/HMSInstanceSetup.js +11 -5
  2. package/lib/commonjs/HMSInstanceSetup.js.map +1 -1
  3. package/lib/commonjs/Icons/AddImage/assets/add-image.png +0 -0
  4. package/lib/commonjs/Icons/AddImage/assets/add-image@2x.png +0 -0
  5. package/lib/commonjs/Icons/AddImage/assets/add-image@3x.png +0 -0
  6. package/lib/commonjs/Icons/AddImage/index.js +33 -0
  7. package/lib/commonjs/Icons/AddImage/index.js.map +1 -0
  8. package/lib/commonjs/Icons/BlurPeople/assets/blur-people.png +0 -0
  9. package/lib/commonjs/Icons/BlurPeople/assets/blur-people@2x.png +0 -0
  10. package/lib/commonjs/Icons/BlurPeople/assets/blur-people@3x.png +0 -0
  11. package/lib/commonjs/Icons/BlurPeople/index.js +33 -0
  12. package/lib/commonjs/Icons/BlurPeople/index.js.map +1 -0
  13. package/lib/commonjs/Icons/CrossCircle/assets/cross-circle-large.png +0 -0
  14. package/lib/commonjs/Icons/CrossCircle/assets/cross-circle-large@2x.png +0 -0
  15. package/lib/commonjs/Icons/CrossCircle/assets/cross-circle-large@3x.png +0 -0
  16. package/lib/commonjs/Icons/CrossCircle/index.js +7 -2
  17. package/lib/commonjs/Icons/CrossCircle/index.js.map +1 -1
  18. package/lib/commonjs/Icons/VirtualBackground/assets/virtual-background.png +0 -0
  19. package/lib/commonjs/Icons/VirtualBackground/assets/virtual-background@2x.png +0 -0
  20. package/lib/commonjs/Icons/VirtualBackground/assets/virtual-background@3x.png +0 -0
  21. package/lib/commonjs/Icons/VirtualBackground/index.js +33 -0
  22. package/lib/commonjs/Icons/VirtualBackground/index.js.map +1 -0
  23. package/lib/commonjs/Icons/index.js +33 -0
  24. package/lib/commonjs/Icons/index.js.map +1 -1
  25. package/lib/commonjs/components/Chat/ChatMessage.js +13 -1
  26. package/lib/commonjs/components/Chat/ChatMessage.js.map +1 -1
  27. package/lib/commonjs/components/HLSDescriptionPane.js +3 -29
  28. package/lib/commonjs/components/HLSDescriptionPane.js.map +1 -1
  29. package/lib/commonjs/components/HMSHLSMessage.js +14 -1
  30. package/lib/commonjs/components/HMSHLSMessage.js.map +1 -1
  31. package/lib/commonjs/components/HMSManageCameraRotation.js +11 -4
  32. package/lib/commonjs/components/HMSManageCameraRotation.js.map +1 -1
  33. package/lib/commonjs/components/HMSManageLocalVideo.js +11 -4
  34. package/lib/commonjs/components/HMSManageLocalVideo.js.map +1 -1
  35. package/lib/commonjs/components/HMSManageVirtualBackground.js +55 -0
  36. package/lib/commonjs/components/HMSManageVirtualBackground.js.map +1 -0
  37. package/lib/commonjs/components/HMSOverlayMessageView.js +14 -1
  38. package/lib/commonjs/components/HMSOverlayMessageView.js.map +1 -1
  39. package/lib/commonjs/components/HMSRoomOptions.js +2 -1
  40. package/lib/commonjs/components/HMSRoomOptions.js.map +1 -1
  41. package/lib/commonjs/components/Preview.js +8 -3
  42. package/lib/commonjs/components/Preview.js.map +1 -1
  43. package/lib/commonjs/components/RoomSettingsModalContent.js +29 -0
  44. package/lib/commonjs/components/RoomSettingsModalContent.js.map +1 -1
  45. package/lib/commonjs/components/VirtualBackgroundBottomSheet.js +52 -0
  46. package/lib/commonjs/components/VirtualBackgroundBottomSheet.js.map +1 -0
  47. package/lib/commonjs/components/VirtualBackgroundModalContent.js +364 -0
  48. package/lib/commonjs/components/VirtualBackgroundModalContent.js.map +1 -0
  49. package/lib/commonjs/modules/imagePickerWrapper.js +19 -0
  50. package/lib/commonjs/modules/imagePickerWrapper.js.map +1 -0
  51. package/lib/commonjs/modules/videoPluginWrapper.js +13 -0
  52. package/lib/commonjs/modules/videoPluginWrapper.js.map +1 -0
  53. package/lib/commonjs/redux/actionTypes.js +3 -0
  54. package/lib/commonjs/redux/actionTypes.js.map +1 -1
  55. package/lib/commonjs/redux/actions/index.js +14 -2
  56. package/lib/commonjs/redux/actions/index.js.map +1 -1
  57. package/lib/commonjs/redux/reducers/appState.js +9 -1
  58. package/lib/commonjs/redux/reducers/appState.js.map +1 -1
  59. package/lib/commonjs/redux/reducers/hmsStates.js +6 -0
  60. package/lib/commonjs/redux/reducers/hmsStates.js.map +1 -1
  61. package/lib/commonjs/utils/functions.js +33 -1
  62. package/lib/commonjs/utils/functions.js.map +1 -1
  63. package/lib/commonjs/utils/types.js +1 -0
  64. package/lib/commonjs/utils/types.js.map +1 -1
  65. package/lib/module/HMSInstanceSetup.js +12 -6
  66. package/lib/module/HMSInstanceSetup.js.map +1 -1
  67. package/lib/module/Icons/AddImage/assets/add-image.png +0 -0
  68. package/lib/module/Icons/AddImage/assets/add-image@2x.png +0 -0
  69. package/lib/module/Icons/AddImage/assets/add-image@3x.png +0 -0
  70. package/lib/module/Icons/AddImage/index.js +25 -0
  71. package/lib/module/Icons/AddImage/index.js.map +1 -0
  72. package/lib/module/Icons/BlurPeople/assets/blur-people.png +0 -0
  73. package/lib/module/Icons/BlurPeople/assets/blur-people@2x.png +0 -0
  74. package/lib/module/Icons/BlurPeople/assets/blur-people@3x.png +0 -0
  75. package/lib/module/Icons/BlurPeople/index.js +25 -0
  76. package/lib/module/Icons/BlurPeople/index.js.map +1 -0
  77. package/lib/module/Icons/CrossCircle/assets/cross-circle-large.png +0 -0
  78. package/lib/module/Icons/CrossCircle/assets/cross-circle-large@2x.png +0 -0
  79. package/lib/module/Icons/CrossCircle/assets/cross-circle-large@3x.png +0 -0
  80. package/lib/module/Icons/CrossCircle/index.js +7 -2
  81. package/lib/module/Icons/CrossCircle/index.js.map +1 -1
  82. package/lib/module/Icons/VirtualBackground/assets/virtual-background.png +0 -0
  83. package/lib/module/Icons/VirtualBackground/assets/virtual-background@2x.png +0 -0
  84. package/lib/module/Icons/VirtualBackground/assets/virtual-background@3x.png +0 -0
  85. package/lib/module/Icons/VirtualBackground/index.js +25 -0
  86. package/lib/module/Icons/VirtualBackground/index.js.map +1 -0
  87. package/lib/module/Icons/index.js +3 -0
  88. package/lib/module/Icons/index.js.map +1 -1
  89. package/lib/module/components/Chat/ChatMessage.js +15 -3
  90. package/lib/module/components/Chat/ChatMessage.js.map +1 -1
  91. package/lib/module/components/HLSDescriptionPane.js +2 -28
  92. package/lib/module/components/HLSDescriptionPane.js.map +1 -1
  93. package/lib/module/components/HMSHLSMessage.js +15 -2
  94. package/lib/module/components/HMSHLSMessage.js.map +1 -1
  95. package/lib/module/components/HMSManageCameraRotation.js +11 -4
  96. package/lib/module/components/HMSManageCameraRotation.js.map +1 -1
  97. package/lib/module/components/HMSManageLocalVideo.js +11 -4
  98. package/lib/module/components/HMSManageLocalVideo.js.map +1 -1
  99. package/lib/module/components/HMSManageVirtualBackground.js +46 -0
  100. package/lib/module/components/HMSManageVirtualBackground.js.map +1 -0
  101. package/lib/module/components/HMSOverlayMessageView.js +15 -2
  102. package/lib/module/components/HMSOverlayMessageView.js.map +1 -1
  103. package/lib/module/components/HMSRoomOptions.js +2 -1
  104. package/lib/module/components/HMSRoomOptions.js.map +1 -1
  105. package/lib/module/components/Preview.js +8 -3
  106. package/lib/module/components/Preview.js.map +1 -1
  107. package/lib/module/components/RoomSettingsModalContent.js +31 -2
  108. package/lib/module/components/RoomSettingsModalContent.js.map +1 -1
  109. package/lib/module/components/VirtualBackgroundBottomSheet.js +43 -0
  110. package/lib/module/components/VirtualBackgroundBottomSheet.js.map +1 -0
  111. package/lib/module/components/VirtualBackgroundModalContent.js +355 -0
  112. package/lib/module/components/VirtualBackgroundModalContent.js.map +1 -0
  113. package/lib/module/modules/imagePickerWrapper.js +14 -0
  114. package/lib/module/modules/imagePickerWrapper.js.map +1 -0
  115. package/lib/module/modules/videoPluginWrapper.js +8 -0
  116. package/lib/module/modules/videoPluginWrapper.js.map +1 -0
  117. package/lib/module/redux/actionTypes.js +3 -0
  118. package/lib/module/redux/actionTypes.js.map +1 -1
  119. package/lib/module/redux/actions/index.js +10 -0
  120. package/lib/module/redux/actions/index.js.map +1 -1
  121. package/lib/module/redux/reducers/appState.js +9 -1
  122. package/lib/module/redux/reducers/appState.js.map +1 -1
  123. package/lib/module/redux/reducers/hmsStates.js +6 -0
  124. package/lib/module/redux/reducers/hmsStates.js.map +1 -1
  125. package/lib/module/utils/functions.js +29 -1
  126. package/lib/module/utils/functions.js.map +1 -1
  127. package/lib/module/utils/types.js +1 -0
  128. package/lib/module/utils/types.js.map +1 -1
  129. package/lib/typescript/HMSInstanceSetup.d.ts.map +1 -1
  130. package/lib/typescript/Icons/AddImage/index.d.ts +7 -0
  131. package/lib/typescript/Icons/AddImage/index.d.ts.map +1 -0
  132. package/lib/typescript/Icons/BlurPeople/index.d.ts +7 -0
  133. package/lib/typescript/Icons/BlurPeople/index.d.ts.map +1 -0
  134. package/lib/typescript/Icons/CrossCircle/index.d.ts +1 -0
  135. package/lib/typescript/Icons/CrossCircle/index.d.ts.map +1 -1
  136. package/lib/typescript/Icons/VirtualBackground/index.d.ts +7 -0
  137. package/lib/typescript/Icons/VirtualBackground/index.d.ts.map +1 -0
  138. package/lib/typescript/Icons/index.d.ts +3 -0
  139. package/lib/typescript/Icons/index.d.ts.map +1 -1
  140. package/lib/typescript/components/Chat/ChatMessage.d.ts.map +1 -1
  141. package/lib/typescript/components/HLSDescriptionPane.d.ts.map +1 -1
  142. package/lib/typescript/components/HMSHLSMessage.d.ts.map +1 -1
  143. package/lib/typescript/components/HMSManageCameraRotation.d.ts +8 -1
  144. package/lib/typescript/components/HMSManageCameraRotation.d.ts.map +1 -1
  145. package/lib/typescript/components/HMSManageLocalVideo.d.ts +8 -1
  146. package/lib/typescript/components/HMSManageLocalVideo.d.ts.map +1 -1
  147. package/lib/typescript/components/HMSManageVirtualBackground.d.ts +8 -0
  148. package/lib/typescript/components/HMSManageVirtualBackground.d.ts.map +1 -0
  149. package/lib/typescript/components/HMSOverlayMessageView.d.ts.map +1 -1
  150. package/lib/typescript/components/HMSRoomOptions.d.ts.map +1 -1
  151. package/lib/typescript/components/Preview.d.ts.map +1 -1
  152. package/lib/typescript/components/RoomSettingsModalContent.d.ts.map +1 -1
  153. package/lib/typescript/components/VirtualBackgroundBottomSheet.d.ts +3 -0
  154. package/lib/typescript/components/VirtualBackgroundBottomSheet.d.ts.map +1 -0
  155. package/lib/typescript/components/VirtualBackgroundModalContent.d.ts +6 -0
  156. package/lib/typescript/components/VirtualBackgroundModalContent.d.ts.map +1 -0
  157. package/lib/typescript/modules/imagePickerWrapper.d.ts +6 -0
  158. package/lib/typescript/modules/imagePickerWrapper.d.ts.map +1 -0
  159. package/lib/typescript/modules/videoPluginWrapper.d.ts +19 -0
  160. package/lib/typescript/modules/videoPluginWrapper.d.ts.map +1 -0
  161. package/lib/typescript/redux/actionTypes.d.ts +2 -0
  162. package/lib/typescript/redux/actionTypes.d.ts.map +1 -1
  163. package/lib/typescript/redux/actions/index.d.ts +11 -0
  164. package/lib/typescript/redux/actions/index.d.ts.map +1 -1
  165. package/lib/typescript/redux/index.d.ts +2 -0
  166. package/lib/typescript/redux/index.d.ts.map +1 -1
  167. package/lib/typescript/redux/reducers/appState.d.ts +1 -0
  168. package/lib/typescript/redux/reducers/appState.d.ts.map +1 -1
  169. package/lib/typescript/redux/reducers/hmsStates.d.ts +7 -1
  170. package/lib/typescript/redux/reducers/hmsStates.d.ts.map +1 -1
  171. package/lib/typescript/redux/reducers/index.d.ts +2 -0
  172. package/lib/typescript/redux/reducers/index.d.ts.map +1 -1
  173. package/lib/typescript/utils/functions.d.ts +2 -0
  174. package/lib/typescript/utils/functions.d.ts.map +1 -1
  175. package/lib/typescript/utils/types.d.ts +1 -0
  176. package/lib/typescript/utils/types.d.ts.map +1 -1
  177. package/package.json +8 -2
  178. package/src/HMSInstanceSetup.tsx +17 -4
  179. package/src/Icons/AddImage/assets/add-image.png +0 -0
  180. package/src/Icons/AddImage/assets/add-image@2x.png +0 -0
  181. package/src/Icons/AddImage/assets/add-image@3x.png +0 -0
  182. package/src/Icons/AddImage/index.tsx +33 -0
  183. package/src/Icons/BlurPeople/assets/blur-people.png +0 -0
  184. package/src/Icons/BlurPeople/assets/blur-people@2x.png +0 -0
  185. package/src/Icons/BlurPeople/assets/blur-people@3x.png +0 -0
  186. package/src/Icons/BlurPeople/index.tsx +33 -0
  187. package/src/Icons/CrossCircle/assets/cross-circle-large.png +0 -0
  188. package/src/Icons/CrossCircle/assets/cross-circle-large@2x.png +0 -0
  189. package/src/Icons/CrossCircle/assets/cross-circle-large@3x.png +0 -0
  190. package/src/Icons/CrossCircle/index.tsx +19 -3
  191. package/src/Icons/VirtualBackground/assets/virtual-background.png +0 -0
  192. package/src/Icons/VirtualBackground/assets/virtual-background@2x.png +0 -0
  193. package/src/Icons/VirtualBackground/assets/virtual-background@3x.png +0 -0
  194. package/src/Icons/VirtualBackground/index.tsx +33 -0
  195. package/src/Icons/index.ts +3 -0
  196. package/src/components/Chat/ChatMessage.tsx +19 -2
  197. package/src/components/HLSDescriptionPane.tsx +2 -33
  198. package/src/components/HMSHLSMessage.tsx +16 -1
  199. package/src/components/HMSManageCameraRotation.tsx +18 -4
  200. package/src/components/HMSManageLocalVideo.tsx +20 -4
  201. package/src/components/HMSManageVirtualBackground.tsx +76 -0
  202. package/src/components/HMSOverlayMessageView.tsx +16 -1
  203. package/src/components/HMSRoomOptions.tsx +3 -0
  204. package/src/components/Preview.tsx +12 -5
  205. package/src/components/RoomSettingsModalContent.tsx +33 -0
  206. package/src/components/VirtualBackgroundBottomSheet.tsx +62 -0
  207. package/src/components/VirtualBackgroundModalContent.tsx +500 -0
  208. package/src/modules/imagePickerWrapper.ts +20 -0
  209. package/src/modules/videoPluginWrapper.ts +32 -0
  210. package/src/redux/actionTypes.ts +4 -0
  211. package/src/redux/actions/index.ts +11 -0
  212. package/src/redux/reducers/appState.ts +8 -0
  213. package/src/redux/reducers/hmsStates.ts +14 -0
  214. package/src/utils/{functions.ts → functions.tsx} +34 -0
  215. package/src/utils/types.ts +1 -0
@@ -16,6 +16,7 @@ import {
16
16
  import { HLSAnimatedDescriptionPane } from './HLSAnimatedDescriptionPane';
17
17
  import { setHlsDescriptionPaneVisible } from '../redux/actions';
18
18
  import type { RootState } from '../redux';
19
+ import { splitLinksAndContent } from '../utils/functions';
19
20
 
20
21
  interface HLSDescriptionPaneProps {}
21
22
 
@@ -74,7 +75,7 @@ export const HLSDescriptionPane: React.FC<HLSDescriptionPaneProps> = () => {
74
75
  const handleLinkPress = async (url: string) => {
75
76
  const canOpen = await Linking.canOpenURL(url);
76
77
  if (canOpen) {
77
- Linking.openURL(url);
78
+ await Linking.openURL(url);
78
79
  }
79
80
  };
80
81
 
@@ -134,35 +135,3 @@ const styles = StyleSheet.create({
134
135
  marginHorizontal: 16,
135
136
  },
136
137
  });
137
-
138
- function splitLinksAndContent(
139
- text: string,
140
- { pressHandler, style }: any
141
- ): string | (string | React.ReactElement)[] {
142
- // Regular expression to find links in a string
143
- const pattern = /http[s]?:\/\/\S+/g;
144
-
145
- // Find all links in the text
146
- const links = text.match(pattern) || [];
147
-
148
- if (links.length <= 0) {
149
- return text;
150
- }
151
-
152
- // Split the text into an array of links and content
153
- const parts = text.replace(pattern, '^<link>^').split('^');
154
-
155
- return parts.map((p, i) => {
156
- if (p !== '<link>') {
157
- return p;
158
- }
159
- const link = links.pop();
160
- return link ? (
161
- <Text key={link + i} onPress={() => pressHandler(link)} style={style}>
162
- {link}
163
- </Text>
164
- ) : (
165
- p
166
- );
167
- });
168
- }
@@ -6,6 +6,7 @@ import {
6
6
  StyleSheet,
7
7
  Platform,
8
8
  TouchableOpacity,
9
+ Linking,
9
10
  } from 'react-native';
10
11
  import type { HMSMessage } from '@100mslive/react-native-hms';
11
12
 
@@ -19,6 +20,7 @@ import { PinIcon, ThreeDotsIcon } from '../Icons';
19
20
  import { setSelectedMessageForAction } from '../redux/actions';
20
21
  import { ModalTypes } from '../utils/types';
21
22
  import type { RootState } from '../redux';
23
+ import { splitLinksAndContent } from '../utils/functions';
22
24
 
23
25
  interface HMSHLSMessageProps {
24
26
  message: HMSMessage;
@@ -63,6 +65,9 @@ const _HMSHLSMessage: React.FC<HMSHLSMessageProps> = ({ message }) => {
63
65
  pinnedLabel: {
64
66
  color: '#ffffff',
65
67
  },
68
+ link: {
69
+ color: theme.palette.primary_bright,
70
+ },
66
71
  }),
67
72
  []
68
73
  );
@@ -81,6 +86,13 @@ const _HMSHLSMessage: React.FC<HMSHLSMessageProps> = ({ message }) => {
81
86
  message.sender &&
82
87
  message.sender.peerID !== localPeerId); // can remove participants
83
88
 
89
+ const handleLinkPress = async (url: string) => {
90
+ const canOpen = await Linking.canOpenURL(url);
91
+ if (canOpen) {
92
+ await Linking.openURL(url);
93
+ }
94
+ };
95
+
84
96
  return (
85
97
  <View style={styles.container}>
86
98
  {isPinned ? (
@@ -106,7 +118,10 @@ const _HMSHLSMessage: React.FC<HMSHLSMessageProps> = ({ message }) => {
106
118
  {' '}
107
119
  </Text>
108
120
 
109
- {message.message}
121
+ {splitLinksAndContent(message.message, {
122
+ pressHandler: handleLinkPress,
123
+ style: hmsRoomStyles.link,
124
+ })}
110
125
  </Text>
111
126
 
112
127
  {canTakeAction ? (
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { useSelector } from 'react-redux';
3
+ import type { StyleProp, ViewStyle } from 'react-native';
3
4
 
4
5
  import { RotateCameraIcon } from '../Icons';
5
6
  import { useCanPublishVideo, useHMSActions } from '../hooks-sdk';
@@ -8,17 +9,25 @@ import { PressableIcon } from './PressableIcon';
8
9
  import { useHMSRoomStyle } from '../hooks-util';
9
10
  import { TestIds } from '../utils/constants';
10
11
 
11
- export const HMSManageCameraRotation = () => {
12
+ interface HMSManageCameraRotationProps extends RotateCameraButtonProps {}
13
+
14
+ export const HMSManageCameraRotation: React.FC<
15
+ HMSManageCameraRotationProps
16
+ > = ({ style }) => {
12
17
  const canPublishVideo = useCanPublishVideo();
13
18
 
14
19
  if (!canPublishVideo) {
15
20
  return null;
16
21
  }
17
22
 
18
- return <RotateCameraButton />;
23
+ return <RotateCameraButton style={style} />;
19
24
  };
20
25
 
21
- const RotateCameraButton = () => {
26
+ interface RotateCameraButtonProps {
27
+ style?: StyleProp<ViewStyle>;
28
+ }
29
+
30
+ const RotateCameraButton: React.FC<RotateCameraButtonProps> = ({ style }) => {
22
31
  const hmsActions = useHMSActions();
23
32
  // TODO: set initial `isLocalVideoMuted` state value as per initial track setting
24
33
  const isLocalVideoMuted = useSelector(
@@ -43,9 +52,14 @@ const RotateCameraButton = () => {
43
52
 
44
53
  return (
45
54
  <PressableIcon
46
- testID={isLocalVideoMuted ? TestIds.switch_camera_disabled : TestIds.switch_camera}
55
+ testID={
56
+ isLocalVideoMuted
57
+ ? TestIds.switch_camera_disabled
58
+ : TestIds.switch_camera
59
+ }
47
60
  onPress={handleVideoMuteTogglePress}
48
61
  disabled={isLocalVideoMuted}
62
+ style={style}
49
63
  >
50
64
  <RotateCameraIcon style={cameraIconStyles} />
51
65
  </PressableIcon>
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { useSelector } from 'react-redux';
3
+ import type { StyleProp, ViewStyle } from 'react-native';
3
4
 
4
5
  import type { RootState } from '../redux';
5
6
  import { useCanPublishVideo, useHMSActions } from '../hooks-sdk';
@@ -7,17 +8,27 @@ import { PressableIcon } from './PressableIcon';
7
8
  import { CameraIcon } from '../Icons';
8
9
  import { TestIds } from '../utils/constants';
9
10
 
10
- export const HMSManageLocalVideo = () => {
11
+ interface HMSManageLocalVideoProps extends ToggleVideoMuteButtonProps {}
12
+
13
+ export const HMSManageLocalVideo: React.FC<HMSManageLocalVideoProps> = ({
14
+ style,
15
+ }) => {
11
16
  const canPublishVideo = useCanPublishVideo();
12
17
 
13
18
  if (!canPublishVideo) {
14
19
  return null;
15
20
  }
16
21
 
17
- return <ToggleVideoMuteButton />;
22
+ return <ToggleVideoMuteButton style={style} />;
18
23
  };
19
24
 
20
- const ToggleVideoMuteButton = () => {
25
+ interface ToggleVideoMuteButtonProps {
26
+ style?: StyleProp<ViewStyle>;
27
+ }
28
+
29
+ const ToggleVideoMuteButton: React.FC<ToggleVideoMuteButtonProps> = ({
30
+ style,
31
+ }) => {
21
32
  const hmsActions = useHMSActions();
22
33
  // TODO: set initial `isLocalVideoMuted` state value as per initial track setting
23
34
  const isLocalVideoMuted = useSelector(
@@ -32,9 +43,14 @@ const ToggleVideoMuteButton = () => {
32
43
 
33
44
  return (
34
45
  <PressableIcon
35
- testID={!!isLocalVideoMuted ? TestIds.camera_muted_btn : TestIds.camera_unmuted_btn}
46
+ testID={
47
+ !!isLocalVideoMuted
48
+ ? TestIds.camera_muted_btn
49
+ : TestIds.camera_unmuted_btn
50
+ }
36
51
  onPress={handleVideoMuteTogglePress}
37
52
  active={isLocalVideoMuted}
53
+ style={style}
38
54
  >
39
55
  <CameraIcon muted={!!isLocalVideoMuted} />
40
56
  </PressableIcon>
@@ -0,0 +1,76 @@
1
+ import * as React from 'react';
2
+ import { useSelector } from 'react-redux';
3
+ import type { StyleProp, ViewStyle } from 'react-native';
4
+
5
+ import { VirtualBackgroundIcon } from '../Icons';
6
+ import { useCanPublishVideo } from '../hooks-sdk';
7
+ import type { RootState } from '../redux';
8
+ import { PressableIcon } from './PressableIcon';
9
+ import { useHMSRoomStyle, useModalType } from '../hooks-util';
10
+ import { VirtualBackgroundBottomSheet } from './VirtualBackgroundBottomSheet';
11
+ import { ModalTypes } from '../utils/types';
12
+
13
+ interface HMSManageVirtualBackgroundProps {
14
+ style?: StyleProp<ViewStyle>;
15
+ }
16
+
17
+ export const HMSManageVirtualBackground: React.FC<
18
+ HMSManageVirtualBackgroundProps
19
+ > = ({ style }) => {
20
+ const canPublishVideo = useCanPublishVideo();
21
+ const videoPluginExists = useSelector(
22
+ (state: RootState) => !!state.hmsStates.videoPlugin
23
+ );
24
+
25
+ if (!canPublishVideo || !videoPluginExists) {
26
+ return null;
27
+ }
28
+
29
+ return <VirtualBackgroundButton style={style} />;
30
+ };
31
+
32
+ interface VirtualBackgroundButtonProps {
33
+ style?: StyleProp<ViewStyle>;
34
+ }
35
+
36
+ const VirtualBackgroundButton: React.FC<VirtualBackgroundButtonProps> = ({
37
+ style,
38
+ }) => {
39
+ const { handleModalVisibleType } = useModalType();
40
+ const isLocalVideoMuted = useSelector(
41
+ (state: RootState) => state.hmsStates.isLocalVideoMuted
42
+ );
43
+ const videoPluginExists = useSelector(
44
+ (state: RootState) => !!state.hmsStates.videoPlugin
45
+ );
46
+
47
+ const handleVideoMuteTogglePress = async () => {
48
+ if (isLocalVideoMuted || !videoPluginExists) {
49
+ return;
50
+ }
51
+ handleModalVisibleType(ModalTypes.VIRTUAL_BACKGROUND);
52
+ };
53
+
54
+ const cameraIconStyles = useHMSRoomStyle(
55
+ (theme) => ({
56
+ tintColor: isLocalVideoMuted
57
+ ? theme.palette.on_surface_low
58
+ : theme.palette.on_surface_high,
59
+ }),
60
+ [isLocalVideoMuted]
61
+ );
62
+
63
+ return (
64
+ <React.Fragment>
65
+ <PressableIcon
66
+ onPress={handleVideoMuteTogglePress}
67
+ disabled={isLocalVideoMuted}
68
+ style={style}
69
+ >
70
+ <VirtualBackgroundIcon style={cameraIconStyles} />
71
+ </PressableIcon>
72
+
73
+ <VirtualBackgroundBottomSheet />
74
+ </React.Fragment>
75
+ );
76
+ };
@@ -6,6 +6,7 @@ import {
6
6
  StyleSheet,
7
7
  Platform,
8
8
  TouchableOpacity,
9
+ Linking,
9
10
  } from 'react-native';
10
11
  import type { HMSMessage } from '@100mslive/react-native-hms';
11
12
  import { Gesture, GestureDetector } from 'react-native-gesture-handler';
@@ -20,6 +21,7 @@ import { PinIcon, ThreeDotsIcon } from '../Icons';
20
21
  import { setSelectedMessageForAction } from '../redux/actions';
21
22
  import { ModalTypes } from '../utils/types';
22
23
  import type { RootState } from '../redux';
24
+ import { splitLinksAndContent } from '../utils/functions';
23
25
 
24
26
  interface HMSMessageProps {
25
27
  message: HMSMessage;
@@ -66,6 +68,9 @@ const _HMSOverlayMessageView: React.FC<HMSMessageProps> = ({ message }) => {
66
68
  pinnedLabel: {
67
69
  color: '#ffffff',
68
70
  },
71
+ link: {
72
+ color: _theme.palette.primary_bright,
73
+ },
69
74
  }),
70
75
  []
71
76
  );
@@ -84,6 +89,13 @@ const _HMSOverlayMessageView: React.FC<HMSMessageProps> = ({ message }) => {
84
89
  message.sender &&
85
90
  message.sender.peerID !== localPeerId); // can remove participants
86
91
 
92
+ const handleLinkPress = async (url: string) => {
93
+ const canOpen = await Linking.canOpenURL(url);
94
+ if (canOpen) {
95
+ await Linking.openURL(url);
96
+ }
97
+ };
98
+
87
99
  return (
88
100
  <View style={styles.container}>
89
101
  {isPinned ? (
@@ -126,7 +138,10 @@ const _HMSOverlayMessageView: React.FC<HMSMessageProps> = ({ message }) => {
126
138
  </View>
127
139
 
128
140
  <Text style={[styles.message, hmsRoomStyles.message]}>
129
- {message.message}
141
+ {splitLinksAndContent(message.message, {
142
+ pressHandler: handleLinkPress,
143
+ style: hmsRoomStyles.link,
144
+ })}
130
145
  </Text>
131
146
  </View>
132
147
  );
@@ -23,6 +23,7 @@ import { ChangeNameModalContent } from './ChangeNameModalContent';
23
23
  import { StopRecordingModalContent } from './StopRecordingModalContent';
24
24
  import { TestIds } from '../utils/constants';
25
25
  import { PollsAndQuizBottomSheet } from './PollsAndQuizBottomSheet';
26
+ import { VirtualBackgroundBottomSheet } from './VirtualBackgroundBottomSheet';
26
27
 
27
28
  interface HMSRoomOptionsProps {}
28
29
 
@@ -74,6 +75,8 @@ export const HMSRoomOptions: React.FC<HMSRoomOptionsProps> = () => {
74
75
 
75
76
  <PollsAndQuizBottomSheet />
76
77
 
78
+ <VirtualBackgroundBottomSheet />
79
+
77
80
  <BottomSheet
78
81
  isVisible={modalVisible === ModalTypes.CHANGE_NAME}
79
82
  dismissModal={dismissModal}
@@ -37,6 +37,7 @@ import { hexToRgbA } from '../utils/theme';
37
37
  import { HMSManageNoiseCancellation } from './HMSManageNoiseCancellation';
38
38
  import { useSelector } from 'react-redux';
39
39
  import type { RootState } from '../redux';
40
+ import { HMSManageVirtualBackground } from './HMSManageVirtualBackground';
40
41
 
41
42
  const backButtonEdges = ['top'] as const;
42
43
  const headerEdges = ['top', 'left', 'right'] as const;
@@ -174,11 +175,17 @@ export const Preview = ({
174
175
  <View style={styles.micAndCameraControls}>
175
176
  <HMSManageLocalAudio />
176
177
 
177
- <View style={styles.manageLocalButtonWrapper}>
178
- <HMSManageLocalVideo />
179
- </View>
178
+ <HMSManageLocalVideo
179
+ style={styles.manageLocalButtonWrapper}
180
+ />
180
181
 
181
- <HMSManageCameraRotation />
182
+ <HMSManageCameraRotation
183
+ style={styles.manageLocalButtonWrapper}
184
+ />
185
+
186
+ <HMSManageVirtualBackground
187
+ style={styles.manageLocalButtonWrapper}
188
+ />
182
189
  </View>
183
190
 
184
191
  {showNoiseCancellationButton && <HMSManageNoiseCancellation />}
@@ -242,7 +249,7 @@ const styles = StyleSheet.create({
242
249
  alignItems: 'center',
243
250
  },
244
251
  manageLocalButtonWrapper: {
245
- marginHorizontal: 16,
252
+ marginLeft: 16,
246
253
  },
247
254
  joinButtonRow: {
248
255
  marginVertical: 16,
@@ -16,6 +16,7 @@ import {
16
16
  PollVoteIcon,
17
17
  RecordingIcon,
18
18
  ScreenShareIcon,
19
+ VirtualBackgroundIcon,
19
20
  WaveIcon,
20
21
  } from '../Icons';
21
22
  import { BottomSheet, useBottomSheetActions } from './BottomSheet';
@@ -32,6 +33,7 @@ import {
32
33
  import {
33
34
  useCanPublishAudio,
34
35
  useCanPublishScreen,
36
+ useCanPublishVideo,
35
37
  useHMSActions,
36
38
  useIsAnyStreamingOn,
37
39
  } from '../hooks-sdk';
@@ -261,6 +263,28 @@ export const RoomSettingsModalContent: React.FC<
261
263
  };
262
264
  // #endregion
263
265
 
266
+ // #region Virtual Background
267
+ const canPublishVideo = useCanPublishVideo();
268
+ const videoPlugin = useSelector(
269
+ (state: RootState) => state.hmsStates.videoPlugin
270
+ );
271
+ const isLocalVideoMuted = useSelector(
272
+ (state: RootState) => state.hmsStates.isLocalVideoMuted
273
+ );
274
+ const virtualBackgroundApplied = useSelector(
275
+ (state: RootState) => state.app.selectedVirtualBackground !== null
276
+ );
277
+ const handleVirtualBackground = () => {
278
+ // Register callback to be called when bottom sheet is hiddden
279
+ registerOnModalHideAction(() => {
280
+ if (!videoPlugin || isLocalVideoMuted) return;
281
+ setModalVisible(ModalTypes.VIRTUAL_BACKGROUND);
282
+ });
283
+ // Close the current bottom sheet
284
+ closeRoomSettingsModal();
285
+ };
286
+ // #endregion
287
+
264
288
  const changeName = () => {
265
289
  // Register callback to be called when bottom sheet is hiddden
266
290
  registerOnModalHideAction(() => {
@@ -480,6 +504,15 @@ export const RoomSettingsModalContent: React.FC<
480
504
  hide: !showNoiseCancellationButton,
481
505
  disabled: isLocalAudioMuted,
482
506
  },
507
+ {
508
+ id: 'virtual-background',
509
+ icon: <VirtualBackgroundIcon style={{ width: 20, height: 20 }} />,
510
+ label: 'Virtual Background',
511
+ pressHandler: handleVirtualBackground,
512
+ isActive: virtualBackgroundApplied,
513
+ hide: !videoPlugin || !canPublishVideo,
514
+ disabled: isLocalVideoMuted,
515
+ },
483
516
  ].filter((itm) => !itm.hide),
484
517
  true
485
518
  ).map((itm, idx) => {
@@ -0,0 +1,62 @@
1
+ import * as React from 'react';
2
+ import { Platform, StyleSheet } from 'react-native';
3
+ import { useSelector } from 'react-redux';
4
+
5
+ import { BottomSheet } from './BottomSheet';
6
+ import { useHMSRoomStyleSheet, useModalType } from '../hooks-util';
7
+ import { useHeaderHeight } from './Header';
8
+ import { useIsLandscapeOrientation } from '../utils/dimension';
9
+ import { ModalTypes } from '../utils/types';
10
+ import type { RootState } from '../redux';
11
+ import { VirtualBackgroundModalContent } from './VirtualBackgroundModalContent';
12
+
13
+ export const VirtualBackgroundBottomSheet = () => {
14
+ const headerHeight = useHeaderHeight();
15
+ const isLandscapeOrientation = useIsLandscapeOrientation();
16
+ const isLocalVideoMuted = useSelector(
17
+ (state: RootState) => state.hmsStates.isLocalVideoMuted
18
+ );
19
+ const {
20
+ modalVisibleType: modalVisible,
21
+ handleModalVisibleType: setModalVisible,
22
+ } = useModalType();
23
+
24
+ const hmsRoomStyles = useHMSRoomStyleSheet((theme) => ({
25
+ contentContainer: {
26
+ backgroundColor: theme.palette.surface_dim,
27
+ },
28
+ }));
29
+
30
+ const dismissModal = () => {
31
+ setModalVisible(ModalTypes.DEFAULT);
32
+ };
33
+
34
+ const containerStyles = [
35
+ styles.bottomSheet,
36
+ {
37
+ marginTop: isLandscapeOrientation
38
+ ? 0
39
+ : headerHeight + (Platform.OS === 'android' ? 24 : 0),
40
+ },
41
+ hmsRoomStyles.contentContainer,
42
+ ];
43
+
44
+ return (
45
+ <BottomSheet
46
+ dismissModal={dismissModal}
47
+ isVisible={
48
+ !isLocalVideoMuted && modalVisible === ModalTypes.VIRTUAL_BACKGROUND
49
+ }
50
+ containerStyle={containerStyles}
51
+ bottomOffsetSpace={0}
52
+ >
53
+ <VirtualBackgroundModalContent dismissModal={dismissModal} />
54
+ </BottomSheet>
55
+ );
56
+ };
57
+
58
+ const styles = StyleSheet.create({
59
+ bottomSheet: {
60
+ flex: 1,
61
+ },
62
+ });