@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.
- package/lib/commonjs/HMSInstanceSetup.js +11 -5
- package/lib/commonjs/HMSInstanceSetup.js.map +1 -1
- package/lib/commonjs/Icons/AddImage/assets/add-image.png +0 -0
- package/lib/commonjs/Icons/AddImage/assets/add-image@2x.png +0 -0
- package/lib/commonjs/Icons/AddImage/assets/add-image@3x.png +0 -0
- package/lib/commonjs/Icons/AddImage/index.js +33 -0
- package/lib/commonjs/Icons/AddImage/index.js.map +1 -0
- package/lib/commonjs/Icons/BlurPeople/assets/blur-people.png +0 -0
- package/lib/commonjs/Icons/BlurPeople/assets/blur-people@2x.png +0 -0
- package/lib/commonjs/Icons/BlurPeople/assets/blur-people@3x.png +0 -0
- package/lib/commonjs/Icons/BlurPeople/index.js +33 -0
- package/lib/commonjs/Icons/BlurPeople/index.js.map +1 -0
- package/lib/commonjs/Icons/CrossCircle/assets/cross-circle-large.png +0 -0
- package/lib/commonjs/Icons/CrossCircle/assets/cross-circle-large@2x.png +0 -0
- package/lib/commonjs/Icons/CrossCircle/assets/cross-circle-large@3x.png +0 -0
- package/lib/commonjs/Icons/CrossCircle/index.js +7 -2
- package/lib/commonjs/Icons/CrossCircle/index.js.map +1 -1
- package/lib/commonjs/Icons/VirtualBackground/assets/virtual-background.png +0 -0
- package/lib/commonjs/Icons/VirtualBackground/assets/virtual-background@2x.png +0 -0
- package/lib/commonjs/Icons/VirtualBackground/assets/virtual-background@3x.png +0 -0
- package/lib/commonjs/Icons/VirtualBackground/index.js +33 -0
- package/lib/commonjs/Icons/VirtualBackground/index.js.map +1 -0
- package/lib/commonjs/Icons/index.js +33 -0
- package/lib/commonjs/Icons/index.js.map +1 -1
- package/lib/commonjs/components/Chat/ChatMessage.js +13 -1
- package/lib/commonjs/components/Chat/ChatMessage.js.map +1 -1
- package/lib/commonjs/components/HLSDescriptionPane.js +3 -29
- package/lib/commonjs/components/HLSDescriptionPane.js.map +1 -1
- package/lib/commonjs/components/HMSHLSMessage.js +14 -1
- package/lib/commonjs/components/HMSHLSMessage.js.map +1 -1
- package/lib/commonjs/components/HMSManageCameraRotation.js +11 -4
- package/lib/commonjs/components/HMSManageCameraRotation.js.map +1 -1
- package/lib/commonjs/components/HMSManageLocalVideo.js +11 -4
- package/lib/commonjs/components/HMSManageLocalVideo.js.map +1 -1
- package/lib/commonjs/components/HMSManageVirtualBackground.js +55 -0
- package/lib/commonjs/components/HMSManageVirtualBackground.js.map +1 -0
- package/lib/commonjs/components/HMSOverlayMessageView.js +14 -1
- package/lib/commonjs/components/HMSOverlayMessageView.js.map +1 -1
- package/lib/commonjs/components/HMSRoomOptions.js +2 -1
- package/lib/commonjs/components/HMSRoomOptions.js.map +1 -1
- package/lib/commonjs/components/Preview.js +8 -3
- package/lib/commonjs/components/Preview.js.map +1 -1
- package/lib/commonjs/components/RoomSettingsModalContent.js +29 -0
- package/lib/commonjs/components/RoomSettingsModalContent.js.map +1 -1
- package/lib/commonjs/components/VirtualBackgroundBottomSheet.js +52 -0
- package/lib/commonjs/components/VirtualBackgroundBottomSheet.js.map +1 -0
- package/lib/commonjs/components/VirtualBackgroundModalContent.js +364 -0
- package/lib/commonjs/components/VirtualBackgroundModalContent.js.map +1 -0
- package/lib/commonjs/modules/imagePickerWrapper.js +19 -0
- package/lib/commonjs/modules/imagePickerWrapper.js.map +1 -0
- package/lib/commonjs/modules/videoPluginWrapper.js +13 -0
- package/lib/commonjs/modules/videoPluginWrapper.js.map +1 -0
- package/lib/commonjs/redux/actionTypes.js +3 -0
- package/lib/commonjs/redux/actionTypes.js.map +1 -1
- package/lib/commonjs/redux/actions/index.js +14 -2
- package/lib/commonjs/redux/actions/index.js.map +1 -1
- package/lib/commonjs/redux/reducers/appState.js +9 -1
- package/lib/commonjs/redux/reducers/appState.js.map +1 -1
- package/lib/commonjs/redux/reducers/hmsStates.js +6 -0
- package/lib/commonjs/redux/reducers/hmsStates.js.map +1 -1
- package/lib/commonjs/utils/functions.js +33 -1
- package/lib/commonjs/utils/functions.js.map +1 -1
- package/lib/commonjs/utils/types.js +1 -0
- package/lib/commonjs/utils/types.js.map +1 -1
- package/lib/module/HMSInstanceSetup.js +12 -6
- package/lib/module/HMSInstanceSetup.js.map +1 -1
- package/lib/module/Icons/AddImage/assets/add-image.png +0 -0
- package/lib/module/Icons/AddImage/assets/add-image@2x.png +0 -0
- package/lib/module/Icons/AddImage/assets/add-image@3x.png +0 -0
- package/lib/module/Icons/AddImage/index.js +25 -0
- package/lib/module/Icons/AddImage/index.js.map +1 -0
- package/lib/module/Icons/BlurPeople/assets/blur-people.png +0 -0
- package/lib/module/Icons/BlurPeople/assets/blur-people@2x.png +0 -0
- package/lib/module/Icons/BlurPeople/assets/blur-people@3x.png +0 -0
- package/lib/module/Icons/BlurPeople/index.js +25 -0
- package/lib/module/Icons/BlurPeople/index.js.map +1 -0
- package/lib/module/Icons/CrossCircle/assets/cross-circle-large.png +0 -0
- package/lib/module/Icons/CrossCircle/assets/cross-circle-large@2x.png +0 -0
- package/lib/module/Icons/CrossCircle/assets/cross-circle-large@3x.png +0 -0
- package/lib/module/Icons/CrossCircle/index.js +7 -2
- package/lib/module/Icons/CrossCircle/index.js.map +1 -1
- package/lib/module/Icons/VirtualBackground/assets/virtual-background.png +0 -0
- package/lib/module/Icons/VirtualBackground/assets/virtual-background@2x.png +0 -0
- package/lib/module/Icons/VirtualBackground/assets/virtual-background@3x.png +0 -0
- package/lib/module/Icons/VirtualBackground/index.js +25 -0
- package/lib/module/Icons/VirtualBackground/index.js.map +1 -0
- package/lib/module/Icons/index.js +3 -0
- package/lib/module/Icons/index.js.map +1 -1
- package/lib/module/components/Chat/ChatMessage.js +15 -3
- package/lib/module/components/Chat/ChatMessage.js.map +1 -1
- package/lib/module/components/HLSDescriptionPane.js +2 -28
- package/lib/module/components/HLSDescriptionPane.js.map +1 -1
- package/lib/module/components/HMSHLSMessage.js +15 -2
- package/lib/module/components/HMSHLSMessage.js.map +1 -1
- package/lib/module/components/HMSManageCameraRotation.js +11 -4
- package/lib/module/components/HMSManageCameraRotation.js.map +1 -1
- package/lib/module/components/HMSManageLocalVideo.js +11 -4
- package/lib/module/components/HMSManageLocalVideo.js.map +1 -1
- package/lib/module/components/HMSManageVirtualBackground.js +46 -0
- package/lib/module/components/HMSManageVirtualBackground.js.map +1 -0
- package/lib/module/components/HMSOverlayMessageView.js +15 -2
- package/lib/module/components/HMSOverlayMessageView.js.map +1 -1
- package/lib/module/components/HMSRoomOptions.js +2 -1
- package/lib/module/components/HMSRoomOptions.js.map +1 -1
- package/lib/module/components/Preview.js +8 -3
- package/lib/module/components/Preview.js.map +1 -1
- package/lib/module/components/RoomSettingsModalContent.js +31 -2
- package/lib/module/components/RoomSettingsModalContent.js.map +1 -1
- package/lib/module/components/VirtualBackgroundBottomSheet.js +43 -0
- package/lib/module/components/VirtualBackgroundBottomSheet.js.map +1 -0
- package/lib/module/components/VirtualBackgroundModalContent.js +355 -0
- package/lib/module/components/VirtualBackgroundModalContent.js.map +1 -0
- package/lib/module/modules/imagePickerWrapper.js +14 -0
- package/lib/module/modules/imagePickerWrapper.js.map +1 -0
- package/lib/module/modules/videoPluginWrapper.js +8 -0
- package/lib/module/modules/videoPluginWrapper.js.map +1 -0
- package/lib/module/redux/actionTypes.js +3 -0
- package/lib/module/redux/actionTypes.js.map +1 -1
- package/lib/module/redux/actions/index.js +10 -0
- package/lib/module/redux/actions/index.js.map +1 -1
- package/lib/module/redux/reducers/appState.js +9 -1
- package/lib/module/redux/reducers/appState.js.map +1 -1
- package/lib/module/redux/reducers/hmsStates.js +6 -0
- package/lib/module/redux/reducers/hmsStates.js.map +1 -1
- package/lib/module/utils/functions.js +29 -1
- package/lib/module/utils/functions.js.map +1 -1
- package/lib/module/utils/types.js +1 -0
- package/lib/module/utils/types.js.map +1 -1
- package/lib/typescript/HMSInstanceSetup.d.ts.map +1 -1
- package/lib/typescript/Icons/AddImage/index.d.ts +7 -0
- package/lib/typescript/Icons/AddImage/index.d.ts.map +1 -0
- package/lib/typescript/Icons/BlurPeople/index.d.ts +7 -0
- package/lib/typescript/Icons/BlurPeople/index.d.ts.map +1 -0
- package/lib/typescript/Icons/CrossCircle/index.d.ts +1 -0
- package/lib/typescript/Icons/CrossCircle/index.d.ts.map +1 -1
- package/lib/typescript/Icons/VirtualBackground/index.d.ts +7 -0
- package/lib/typescript/Icons/VirtualBackground/index.d.ts.map +1 -0
- package/lib/typescript/Icons/index.d.ts +3 -0
- package/lib/typescript/Icons/index.d.ts.map +1 -1
- package/lib/typescript/components/Chat/ChatMessage.d.ts.map +1 -1
- package/lib/typescript/components/HLSDescriptionPane.d.ts.map +1 -1
- package/lib/typescript/components/HMSHLSMessage.d.ts.map +1 -1
- package/lib/typescript/components/HMSManageCameraRotation.d.ts +8 -1
- package/lib/typescript/components/HMSManageCameraRotation.d.ts.map +1 -1
- package/lib/typescript/components/HMSManageLocalVideo.d.ts +8 -1
- package/lib/typescript/components/HMSManageLocalVideo.d.ts.map +1 -1
- package/lib/typescript/components/HMSManageVirtualBackground.d.ts +8 -0
- package/lib/typescript/components/HMSManageVirtualBackground.d.ts.map +1 -0
- package/lib/typescript/components/HMSOverlayMessageView.d.ts.map +1 -1
- package/lib/typescript/components/HMSRoomOptions.d.ts.map +1 -1
- package/lib/typescript/components/Preview.d.ts.map +1 -1
- package/lib/typescript/components/RoomSettingsModalContent.d.ts.map +1 -1
- package/lib/typescript/components/VirtualBackgroundBottomSheet.d.ts +3 -0
- package/lib/typescript/components/VirtualBackgroundBottomSheet.d.ts.map +1 -0
- package/lib/typescript/components/VirtualBackgroundModalContent.d.ts +6 -0
- package/lib/typescript/components/VirtualBackgroundModalContent.d.ts.map +1 -0
- package/lib/typescript/modules/imagePickerWrapper.d.ts +6 -0
- package/lib/typescript/modules/imagePickerWrapper.d.ts.map +1 -0
- package/lib/typescript/modules/videoPluginWrapper.d.ts +19 -0
- package/lib/typescript/modules/videoPluginWrapper.d.ts.map +1 -0
- package/lib/typescript/redux/actionTypes.d.ts +2 -0
- package/lib/typescript/redux/actionTypes.d.ts.map +1 -1
- package/lib/typescript/redux/actions/index.d.ts +11 -0
- package/lib/typescript/redux/actions/index.d.ts.map +1 -1
- package/lib/typescript/redux/index.d.ts +2 -0
- package/lib/typescript/redux/index.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/appState.d.ts +1 -0
- package/lib/typescript/redux/reducers/appState.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/hmsStates.d.ts +7 -1
- package/lib/typescript/redux/reducers/hmsStates.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/index.d.ts +2 -0
- package/lib/typescript/redux/reducers/index.d.ts.map +1 -1
- package/lib/typescript/utils/functions.d.ts +2 -0
- package/lib/typescript/utils/functions.d.ts.map +1 -1
- package/lib/typescript/utils/types.d.ts +1 -0
- package/lib/typescript/utils/types.d.ts.map +1 -1
- package/package.json +8 -2
- package/src/HMSInstanceSetup.tsx +17 -4
- package/src/Icons/AddImage/assets/add-image.png +0 -0
- package/src/Icons/AddImage/assets/add-image@2x.png +0 -0
- package/src/Icons/AddImage/assets/add-image@3x.png +0 -0
- package/src/Icons/AddImage/index.tsx +33 -0
- package/src/Icons/BlurPeople/assets/blur-people.png +0 -0
- package/src/Icons/BlurPeople/assets/blur-people@2x.png +0 -0
- package/src/Icons/BlurPeople/assets/blur-people@3x.png +0 -0
- package/src/Icons/BlurPeople/index.tsx +33 -0
- package/src/Icons/CrossCircle/assets/cross-circle-large.png +0 -0
- package/src/Icons/CrossCircle/assets/cross-circle-large@2x.png +0 -0
- package/src/Icons/CrossCircle/assets/cross-circle-large@3x.png +0 -0
- package/src/Icons/CrossCircle/index.tsx +19 -3
- package/src/Icons/VirtualBackground/assets/virtual-background.png +0 -0
- package/src/Icons/VirtualBackground/assets/virtual-background@2x.png +0 -0
- package/src/Icons/VirtualBackground/assets/virtual-background@3x.png +0 -0
- package/src/Icons/VirtualBackground/index.tsx +33 -0
- package/src/Icons/index.ts +3 -0
- package/src/components/Chat/ChatMessage.tsx +19 -2
- package/src/components/HLSDescriptionPane.tsx +2 -33
- package/src/components/HMSHLSMessage.tsx +16 -1
- package/src/components/HMSManageCameraRotation.tsx +18 -4
- package/src/components/HMSManageLocalVideo.tsx +20 -4
- package/src/components/HMSManageVirtualBackground.tsx +76 -0
- package/src/components/HMSOverlayMessageView.tsx +16 -1
- package/src/components/HMSRoomOptions.tsx +3 -0
- package/src/components/Preview.tsx +12 -5
- package/src/components/RoomSettingsModalContent.tsx +33 -0
- package/src/components/VirtualBackgroundBottomSheet.tsx +62 -0
- package/src/components/VirtualBackgroundModalContent.tsx +500 -0
- package/src/modules/imagePickerWrapper.ts +20 -0
- package/src/modules/videoPluginWrapper.ts +32 -0
- package/src/redux/actionTypes.ts +4 -0
- package/src/redux/actions/index.ts +11 -0
- package/src/redux/reducers/appState.ts +8 -0
- package/src/redux/reducers/hmsStates.ts +14 -0
- package/src/utils/{functions.ts → functions.tsx} +34 -0
- 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
|
-
|
|
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
|
-
|
|
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={
|
|
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
|
-
|
|
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
|
-
|
|
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={
|
|
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
|
-
<
|
|
178
|
-
|
|
179
|
-
|
|
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
|
-
|
|
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
|
+
});
|