@stream-io/video-react-native-sdk 0.0.1-alpha.366 → 0.0.1-alpha.368
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/CHANGELOG.md +18 -0
- package/dist/__tests__/components/CallControls.test.js +11 -7
- package/dist/__tests__/components/CallControls.test.js.map +1 -1
- package/dist/src/components/call/CallControls/AcceptCallButton.d.ts +22 -0
- package/dist/src/components/call/CallControls/AcceptCallButton.js +39 -0
- package/dist/src/components/call/CallControls/AcceptCallButton.js.map +1 -0
- package/dist/src/components/call/CallControls/CallControls.d.ts +16 -0
- package/dist/src/components/call/CallControls/CallControls.js +38 -0
- package/dist/src/components/call/CallControls/CallControls.js.map +1 -0
- package/dist/src/components/{utility/internal → call/CallControls}/CallControlsButton.d.ts +5 -1
- package/dist/src/components/{utility/internal → call/CallControls}/CallControlsButton.js +12 -7
- package/dist/src/components/call/CallControls/CallControlsButton.js.map +1 -0
- package/dist/src/components/call/CallControls/ChatButton.d.ts +20 -0
- package/dist/src/components/call/CallControls/ChatButton.js +58 -0
- package/dist/src/components/call/CallControls/ChatButton.js.map +1 -0
- package/dist/src/components/{utility/internal → call/CallControls}/HangupCallButton.d.ts +12 -1
- package/dist/src/components/{utility/internal → call/CallControls}/HangupCallButton.js +10 -16
- package/dist/src/components/call/CallControls/HangupCallButton.js.map +1 -0
- package/dist/src/components/call/CallControls/ReactionButton.d.ts +14 -0
- package/dist/src/components/call/CallControls/ReactionButton.js +76 -0
- package/dist/src/components/call/CallControls/ReactionButton.js.map +1 -0
- package/dist/src/components/call/CallControls/RejectCallButton.d.ts +23 -0
- package/dist/src/components/call/CallControls/RejectCallButton.js +45 -0
- package/dist/src/components/call/CallControls/RejectCallButton.js.map +1 -0
- package/dist/src/components/call/CallControls/ToggleAudioPreviewButton.d.ts +14 -0
- package/dist/src/components/call/CallControls/ToggleAudioPreviewButton.js +39 -0
- package/dist/src/components/call/CallControls/ToggleAudioPreviewButton.js.map +1 -0
- package/dist/src/components/call/CallControls/ToggleAudioPublishingButton.d.ts +14 -0
- package/dist/src/components/{utility/internal/ToggleAudioButton.js → call/CallControls/ToggleAudioPublishingButton.js} +14 -23
- package/dist/src/components/call/CallControls/ToggleAudioPublishingButton.js.map +1 -0
- package/dist/src/components/call/CallControls/ToggleCameraFaceButton.d.ts +14 -0
- package/dist/src/components/{utility/internal → call/CallControls}/ToggleCameraFaceButton.js +12 -16
- package/dist/src/components/call/CallControls/ToggleCameraFaceButton.js.map +1 -0
- package/dist/src/components/call/CallControls/ToggleVideoPreviewButton.d.ts +14 -0
- package/dist/src/components/call/CallControls/ToggleVideoPreviewButton.js +39 -0
- package/dist/src/components/call/CallControls/ToggleVideoPreviewButton.js.map +1 -0
- package/dist/src/components/call/CallControls/ToggleVideoPublishingButton.d.ts +14 -0
- package/dist/src/components/{utility/internal/ToggleVideoButton.js → call/CallControls/ToggleVideoPublishingButton.js} +14 -23
- package/dist/src/components/call/CallControls/ToggleVideoPublishingButton.js.map +1 -0
- package/dist/src/components/call/CallControls/index.d.ts +11 -0
- package/dist/src/components/call/CallControls/index.js +28 -0
- package/dist/src/components/call/CallControls/index.js.map +1 -0
- package/dist/src/components/call/CallTopView/CallTopView.d.ts +22 -0
- package/dist/src/components/call/CallTopView/CallTopView.js +106 -0
- package/dist/src/components/call/CallTopView/CallTopView.js.map +1 -0
- package/dist/src/components/call/CallTopView/ParticipantsInfoBadge.d.ts +7 -0
- package/dist/src/components/call/CallTopView/ParticipantsInfoBadge.js +52 -0
- package/dist/src/components/call/CallTopView/ParticipantsInfoBadge.js.map +1 -0
- package/dist/src/components/call/CallTopView/index.d.ts +2 -0
- package/dist/src/components/call/CallTopView/index.js +19 -0
- package/dist/src/components/call/CallTopView/index.js.map +1 -0
- package/dist/src/components/call/IncomingCall.js +10 -75
- package/dist/src/components/call/IncomingCall.js.map +1 -1
- package/dist/src/components/call/Lobby.js +8 -30
- package/dist/src/components/call/Lobby.js.map +1 -1
- package/dist/src/components/call/OutgoingCall.d.ts +1 -1
- package/dist/src/components/call/OutgoingCall.js +5 -15
- package/dist/src/components/call/OutgoingCall.js.map +1 -1
- package/dist/src/components/call/ReactionsPicker.js +3 -3
- package/dist/src/components/call/ReactionsPicker.js.map +1 -1
- package/dist/src/components/call/index.d.ts +1 -0
- package/dist/src/components/call/index.js +1 -0
- package/dist/src/components/call/index.js.map +1 -1
- package/dist/src/components/participants/index.d.ts +0 -2
- package/dist/src/components/participants/index.js +0 -2
- package/dist/src/components/participants/index.js.map +1 -1
- package/dist/src/icons/Back.d.ts +5 -0
- package/dist/src/icons/Back.js +13 -0
- package/dist/src/icons/Back.js.map +1 -0
- package/dist/src/icons/TopViewBackground.d.ts +13 -0
- package/dist/src/icons/TopViewBackground.js +19 -0
- package/dist/src/icons/TopViewBackground.js.map +1 -0
- package/dist/src/icons/index.d.ts +1 -4
- package/dist/src/icons/index.js +1 -4
- package/dist/src/icons/index.js.map +1 -1
- package/dist/src/theme/padding.js +1 -1
- package/dist/src/translations/en.json +1 -0
- package/dist/src/translations/index.d.ts +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/src/components/call/CallControls/AcceptCallButton.tsx +58 -0
- package/src/components/call/CallControls/CallControls.tsx +48 -0
- package/src/components/{utility/internal → call/CallControls}/CallControlsButton.tsx +18 -10
- package/src/components/call/CallControls/ChatButton.tsx +87 -0
- package/src/components/{utility/internal → call/CallControls}/HangupCallButton.tsx +17 -18
- package/src/components/call/CallControls/ReactionButton.tsx +80 -0
- package/src/components/call/CallControls/RejectCallButton.tsx +65 -0
- package/src/components/call/CallControls/ToggleAudioPreviewButton.tsx +61 -0
- package/src/components/{utility/internal/ToggleAudioButton.tsx → call/CallControls/ToggleAudioPublishingButton.tsx} +24 -24
- package/src/components/{utility/internal → call/CallControls}/ToggleCameraFaceButton.tsx +26 -19
- package/src/components/call/CallControls/ToggleVideoPreviewButton.tsx +61 -0
- package/src/components/{utility/internal/ToggleVideoButton.tsx → call/CallControls/ToggleVideoPublishingButton.tsx} +24 -24
- package/src/components/call/CallControls/index.tsx +11 -0
- package/src/components/call/CallTopView/CallTopView.tsx +130 -0
- package/src/components/call/CallTopView/ParticipantsInfoBadge.tsx +61 -0
- package/src/components/call/CallTopView/index.ts +2 -0
- package/src/components/call/IncomingCall.tsx +8 -76
- package/src/components/call/Lobby.tsx +10 -55
- package/src/components/call/OutgoingCall.tsx +5 -38
- package/src/components/call/ReactionsPicker.tsx +3 -3
- package/src/components/call/index.ts +1 -0
- package/src/components/participants/index.ts +0 -2
- package/src/icons/Back.tsx +15 -0
- package/src/icons/TopViewBackground.tsx +43 -0
- package/src/icons/index.tsx +1 -4
- package/src/theme/padding.ts +1 -1
- package/src/translations/en.json +1 -0
- package/dist/__tests__/components/ParticipantBadge.test.d.ts +0 -1
- package/dist/__tests__/components/ParticipantBadge.test.js +0 -70
- package/dist/__tests__/components/ParticipantBadge.test.js.map +0 -1
- package/dist/src/components/call/CallControls.d.ts +0 -35
- package/dist/src/components/call/CallControls.js +0 -136
- package/dist/src/components/call/CallControls.js.map +0 -1
- package/dist/src/components/participants/ParticipantsInfoBadge.d.ts +0 -8
- package/dist/src/components/participants/ParticipantsInfoBadge.js +0 -74
- package/dist/src/components/participants/ParticipantsInfoBadge.js.map +0 -1
- package/dist/src/components/participants/ParticipantsInfoList.d.ts +0 -17
- package/dist/src/components/participants/ParticipantsInfoList.js +0 -243
- package/dist/src/components/participants/ParticipantsInfoList.js.map +0 -1
- package/dist/src/components/participants/internal/ParticipantActions.d.ts +0 -8
- package/dist/src/components/participants/internal/ParticipantActions.js +0 -236
- package/dist/src/components/participants/internal/ParticipantActions.js.map +0 -1
- package/dist/src/components/utility/internal/CallControlsButton.js.map +0 -1
- package/dist/src/components/utility/internal/HangupCallButton.js.map +0 -1
- package/dist/src/components/utility/internal/ToggleAudioButton.d.ts +0 -1
- package/dist/src/components/utility/internal/ToggleAudioButton.js.map +0 -1
- package/dist/src/components/utility/internal/ToggleCameraFaceButton.d.ts +0 -1
- package/dist/src/components/utility/internal/ToggleCameraFaceButton.js.map +0 -1
- package/dist/src/components/utility/internal/ToggleVideoButton.d.ts +0 -1
- package/dist/src/components/utility/internal/ToggleVideoButton.js.map +0 -1
- package/dist/src/icons/ArrowRight.d.ts +0 -5
- package/dist/src/icons/ArrowRight.js +0 -13
- package/dist/src/icons/ArrowRight.js.map +0 -1
- package/dist/src/icons/Cross.d.ts +0 -6
- package/dist/src/icons/Cross.js +0 -13
- package/dist/src/icons/Cross.js.map +0 -1
- package/dist/src/icons/Pin.d.ts +0 -5
- package/dist/src/icons/Pin.js +0 -13
- package/dist/src/icons/Pin.js.map +0 -1
- package/dist/src/icons/VideoDisabled.d.ts +0 -5
- package/dist/src/icons/VideoDisabled.js +0 -14
- package/dist/src/icons/VideoDisabled.js.map +0 -1
- package/src/components/call/CallControls.tsx +0 -195
- package/src/components/participants/ParticipantsInfoBadge.tsx +0 -70
- package/src/components/participants/ParticipantsInfoList.tsx +0 -319
- package/src/components/participants/internal/ParticipantActions.tsx +0 -289
- package/src/icons/ArrowRight.tsx +0 -17
- package/src/icons/Cross.tsx +0 -15
- package/src/icons/Pin.tsx +0 -17
- package/src/icons/VideoDisabled.tsx +0 -23
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { useCall } from '@stream-io/video-react-bindings';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { CallControlsButton } from './CallControlsButton';
|
|
4
|
+
import { theme } from '../../../theme';
|
|
5
|
+
import { Phone } from '../../../icons';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The props for the Accept Call button.
|
|
9
|
+
*/
|
|
10
|
+
type AcceptCallButtonProps = {
|
|
11
|
+
/**
|
|
12
|
+
* Handler to be called when the accept call button is pressed.
|
|
13
|
+
*/
|
|
14
|
+
onPressHandler?: () => void;
|
|
15
|
+
/**
|
|
16
|
+
* Handler to be called after the incoming call is accepted.
|
|
17
|
+
*
|
|
18
|
+
* Note: If the `onPressHandler` is passed this handler will not be executed.
|
|
19
|
+
*/
|
|
20
|
+
onAcceptHandler?: () => void;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Button to accept a call.
|
|
25
|
+
*
|
|
26
|
+
* Mostly calls call.join() internally.
|
|
27
|
+
*/
|
|
28
|
+
export const AcceptCallButton = ({
|
|
29
|
+
onPressHandler,
|
|
30
|
+
onAcceptHandler,
|
|
31
|
+
}: AcceptCallButtonProps) => {
|
|
32
|
+
const call = useCall();
|
|
33
|
+
const acceptCallHandler = async () => {
|
|
34
|
+
if (onPressHandler) {
|
|
35
|
+
onPressHandler();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
await call?.join();
|
|
40
|
+
if (onAcceptHandler) {
|
|
41
|
+
onAcceptHandler();
|
|
42
|
+
}
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.log('Error joining Call', error);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<CallControlsButton
|
|
50
|
+
onPress={acceptCallHandler}
|
|
51
|
+
color={theme.light.info}
|
|
52
|
+
style={theme.button.lg}
|
|
53
|
+
svgContainerStyle={theme.icon.lg}
|
|
54
|
+
>
|
|
55
|
+
<Phone color={theme.light.static_white} />
|
|
56
|
+
</CallControlsButton>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet, View, ViewProps } from 'react-native';
|
|
3
|
+
import { theme } from '../../../theme';
|
|
4
|
+
import { ToggleAudioPublishingButton } from './ToggleAudioPublishingButton';
|
|
5
|
+
import { ToggleVideoPublishingButton } from './ToggleVideoPublishingButton';
|
|
6
|
+
import { ToggleCameraFaceButton } from './ToggleCameraFaceButton';
|
|
7
|
+
import { Z_INDEX } from '../../../constants';
|
|
8
|
+
import { HangUpCallButton } from './HangupCallButton';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Props for the CallControls Component.
|
|
12
|
+
*/
|
|
13
|
+
export interface CallControlsType extends Pick<ViewProps, 'style'> {
|
|
14
|
+
/**
|
|
15
|
+
* Handler to override the hang up handler when the hangup button is pressed.
|
|
16
|
+
* @returns void
|
|
17
|
+
*/
|
|
18
|
+
onHangupCallHandler?: () => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A list/row of controls (mute audio/video, toggle front/back camera, hangup call etc.)
|
|
23
|
+
* the user can trigger within an active call.
|
|
24
|
+
*/
|
|
25
|
+
export const CallControls = ({
|
|
26
|
+
onHangupCallHandler,
|
|
27
|
+
style,
|
|
28
|
+
}: CallControlsType) => {
|
|
29
|
+
return (
|
|
30
|
+
<View style={[styles.container, style]}>
|
|
31
|
+
<ToggleVideoPublishingButton />
|
|
32
|
+
<ToggleAudioPublishingButton />
|
|
33
|
+
<ToggleCameraFaceButton />
|
|
34
|
+
<HangUpCallButton onPressHandler={onHangupCallHandler} />
|
|
35
|
+
</View>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const styles = StyleSheet.create({
|
|
40
|
+
container: {
|
|
41
|
+
paddingTop: theme.padding.md,
|
|
42
|
+
paddingBottom: theme.padding.lg,
|
|
43
|
+
flexDirection: 'row',
|
|
44
|
+
justifyContent: 'space-evenly',
|
|
45
|
+
zIndex: Z_INDEX.IN_FRONT,
|
|
46
|
+
backgroundColor: theme.light.static_grey,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
@@ -19,7 +19,7 @@ interface CallControlsButtonProps {
|
|
|
19
19
|
*/
|
|
20
20
|
color?: string;
|
|
21
21
|
/**
|
|
22
|
-
* Boolean to enable/
|
|
22
|
+
* Boolean to enable/disable the button
|
|
23
23
|
*/
|
|
24
24
|
disabled?: boolean;
|
|
25
25
|
/**
|
|
@@ -34,6 +34,10 @@ interface CallControlsButtonProps {
|
|
|
34
34
|
* Accessibility label for the button.
|
|
35
35
|
*/
|
|
36
36
|
testID?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Invoked on mount and layout changes with
|
|
39
|
+
* {nativeEvent: { layout: {x, y, width, height}}}.
|
|
40
|
+
*/
|
|
37
41
|
onLayout?: View['props']['onLayout'];
|
|
38
42
|
}
|
|
39
43
|
|
|
@@ -61,7 +65,7 @@ export const CallControlsButton = (
|
|
|
61
65
|
backgroundColor: color,
|
|
62
66
|
opacity: pressed ? 0.2 : 1,
|
|
63
67
|
},
|
|
64
|
-
style
|
|
68
|
+
style,
|
|
65
69
|
disabled ? styles.disabledStyle : null,
|
|
66
70
|
];
|
|
67
71
|
|
|
@@ -73,13 +77,7 @@ export const CallControlsButton = (
|
|
|
73
77
|
testID={testID}
|
|
74
78
|
onLayout={onLayout}
|
|
75
79
|
>
|
|
76
|
-
<View
|
|
77
|
-
style={[
|
|
78
|
-
styles.svgContainerStyle,
|
|
79
|
-
DEFAULT_ICON_SIZE,
|
|
80
|
-
svgContainerStyle ?? null,
|
|
81
|
-
]}
|
|
82
|
-
>
|
|
80
|
+
<View style={[DEFAULT_ICON_SIZE, svgContainerStyle ?? null]}>
|
|
83
81
|
{children}
|
|
84
82
|
</View>
|
|
85
83
|
</Pressable>
|
|
@@ -92,8 +90,18 @@ const styles = StyleSheet.create({
|
|
|
92
90
|
borderWidth: 1,
|
|
93
91
|
borderColor: theme.light.content_bg,
|
|
94
92
|
alignItems: 'center',
|
|
93
|
+
// For iOS
|
|
94
|
+
shadowColor: '#000',
|
|
95
|
+
shadowOffset: {
|
|
96
|
+
width: 0,
|
|
97
|
+
height: 2,
|
|
98
|
+
},
|
|
99
|
+
shadowOpacity: 0.25,
|
|
100
|
+
shadowRadius: 8,
|
|
101
|
+
|
|
102
|
+
// For android
|
|
103
|
+
elevation: 6,
|
|
95
104
|
},
|
|
96
|
-
svgContainerStyle: {},
|
|
97
105
|
disabledStyle: {
|
|
98
106
|
backgroundColor: theme.light.disabled,
|
|
99
107
|
},
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet, Text, View } from 'react-native';
|
|
3
|
+
import { CallControlsButton } from './CallControlsButton';
|
|
4
|
+
import { theme } from '../../../theme';
|
|
5
|
+
import { Chat } from '../../../icons';
|
|
6
|
+
import { ComponentTestIds } from '../../../constants/TestIds';
|
|
7
|
+
import { Z_INDEX } from '../../../constants';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The props for the Chat Button in the Call Controls.
|
|
11
|
+
*/
|
|
12
|
+
export type ChatButtonProps = {
|
|
13
|
+
/**
|
|
14
|
+
* Handler to be called when the chat button is pressed.
|
|
15
|
+
* @returns void
|
|
16
|
+
*/
|
|
17
|
+
onPressHandler?: () => void;
|
|
18
|
+
/**
|
|
19
|
+
* The count of the current unread message to be displayed above on the Chat button.
|
|
20
|
+
*/
|
|
21
|
+
unreadBadgeCount?: number;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Button to open the Chat window while in the call.
|
|
26
|
+
*
|
|
27
|
+
* This call also display the unread count indicator/badge is there messages that are unread.
|
|
28
|
+
*/
|
|
29
|
+
export const ChatButton = ({
|
|
30
|
+
onPressHandler,
|
|
31
|
+
unreadBadgeCount,
|
|
32
|
+
}: ChatButtonProps) => {
|
|
33
|
+
return (
|
|
34
|
+
<View>
|
|
35
|
+
<CallControlsButton
|
|
36
|
+
color={theme.light.static_white}
|
|
37
|
+
onPress={onPressHandler}
|
|
38
|
+
svgContainerStyle={styles.svgContainerStyle}
|
|
39
|
+
>
|
|
40
|
+
<UnreadBadgeCountIndicator count={unreadBadgeCount} />
|
|
41
|
+
<Chat color={theme.light.static_black} />
|
|
42
|
+
</CallControlsButton>
|
|
43
|
+
</View>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const UnreadBadgeCountIndicator = ({
|
|
48
|
+
count,
|
|
49
|
+
}: {
|
|
50
|
+
count: ChatButtonProps['unreadBadgeCount'];
|
|
51
|
+
}) => {
|
|
52
|
+
// Don't show badge if count is 0 or undefined
|
|
53
|
+
if (!count) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<View
|
|
59
|
+
testID={ComponentTestIds.CHAT_UNREAD_BADGE_COUNT_INDICATOR}
|
|
60
|
+
style={styles.chatBadge}
|
|
61
|
+
>
|
|
62
|
+
<Text style={styles.chatBadgeText}>{count}</Text>
|
|
63
|
+
</View>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const styles = StyleSheet.create({
|
|
68
|
+
svgContainerStyle: {
|
|
69
|
+
paddingTop: theme.padding.xs,
|
|
70
|
+
},
|
|
71
|
+
chatBadge: {
|
|
72
|
+
backgroundColor: theme.light.error,
|
|
73
|
+
borderRadius: theme.rounded.xl,
|
|
74
|
+
position: 'absolute',
|
|
75
|
+
left: 15,
|
|
76
|
+
bottom: 20,
|
|
77
|
+
zIndex: Z_INDEX.IN_FRONT,
|
|
78
|
+
height: 30,
|
|
79
|
+
width: 30,
|
|
80
|
+
justifyContent: 'center',
|
|
81
|
+
},
|
|
82
|
+
chatBadgeText: {
|
|
83
|
+
color: theme.light.static_white,
|
|
84
|
+
textAlign: 'center',
|
|
85
|
+
...theme.fonts.bodyBold,
|
|
86
|
+
},
|
|
87
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { CallControlsButton } from './CallControlsButton';
|
|
3
3
|
import { theme } from '../../../theme';
|
|
4
|
-
import { StyleProp,
|
|
4
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
5
5
|
import { PhoneDown } from '../../../icons';
|
|
6
6
|
import { ButtonTestIds } from '../../../constants/TestIds';
|
|
7
7
|
import { useCall, useCallStateHooks } from '@stream-io/video-react-bindings';
|
|
@@ -16,15 +16,26 @@ export type HangUpCallButtonProps = {
|
|
|
16
16
|
* @returns void
|
|
17
17
|
*/
|
|
18
18
|
onPressHandler?: () => void;
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Handler to be called when the call is hanged up.
|
|
21
|
+
*
|
|
22
|
+
* Note: If the `onPressHandler` is passed this handler will not be executed.
|
|
23
|
+
*/
|
|
24
|
+
onHangUpCall?: () => void;
|
|
20
25
|
/**
|
|
21
26
|
* Style of the Button Container
|
|
22
27
|
*/
|
|
23
28
|
style?: StyleProp<ViewStyle>;
|
|
24
29
|
};
|
|
25
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Button to hangup a call.
|
|
33
|
+
*
|
|
34
|
+
* Mostly calls call.leave() internally.
|
|
35
|
+
*/
|
|
26
36
|
export const HangUpCallButton = ({
|
|
27
37
|
onPressHandler,
|
|
38
|
+
onHangUpCall,
|
|
28
39
|
style,
|
|
29
40
|
}: HangUpCallButtonProps) => {
|
|
30
41
|
const call = useCall();
|
|
@@ -41,6 +52,9 @@ export const HangUpCallButton = ({
|
|
|
41
52
|
return;
|
|
42
53
|
}
|
|
43
54
|
await call?.leave();
|
|
55
|
+
if (onHangUpCall) {
|
|
56
|
+
onHangUpCall();
|
|
57
|
+
}
|
|
44
58
|
} catch (error) {
|
|
45
59
|
console.error('Error leaving call:', error);
|
|
46
60
|
}
|
|
@@ -51,25 +65,10 @@ export const HangUpCallButton = ({
|
|
|
51
65
|
<CallControlsButton
|
|
52
66
|
onPress={hangUpCallHandler}
|
|
53
67
|
color={theme.light.error}
|
|
54
|
-
style={[
|
|
68
|
+
style={[{ shadowColor: theme.light.error }, style]}
|
|
55
69
|
testID={ButtonTestIds.HANG_UP_CALL}
|
|
56
70
|
>
|
|
57
71
|
<PhoneDown color={theme.light.static_white} />
|
|
58
72
|
</CallControlsButton>
|
|
59
73
|
);
|
|
60
74
|
};
|
|
61
|
-
|
|
62
|
-
const styles = StyleSheet.create({
|
|
63
|
-
button: {
|
|
64
|
-
// For iOS
|
|
65
|
-
shadowOffset: {
|
|
66
|
-
width: 0,
|
|
67
|
-
height: 6,
|
|
68
|
-
},
|
|
69
|
-
shadowOpacity: 0.37,
|
|
70
|
-
shadowRadius: 7.49,
|
|
71
|
-
|
|
72
|
-
// For android
|
|
73
|
-
elevation: 6,
|
|
74
|
-
},
|
|
75
|
-
});
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Restricted } from '@stream-io/video-react-bindings';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { CallControlsButton } from './CallControlsButton';
|
|
4
|
+
import { OwnCapability } from '@stream-io/video-client';
|
|
5
|
+
import { ButtonTestIds } from '../../../constants/TestIds';
|
|
6
|
+
import { theme } from '../../../theme';
|
|
7
|
+
import { Reaction } from '../../../icons';
|
|
8
|
+
import { ReactionsPicker } from '../ReactionsPicker';
|
|
9
|
+
import { StreamVideoRN } from '../../../utils';
|
|
10
|
+
import { LayoutChangeEvent, LayoutRectangle } from 'react-native';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Props for the Reaction button
|
|
14
|
+
*/
|
|
15
|
+
export type ReactionButtonProps = {
|
|
16
|
+
/**
|
|
17
|
+
* Handler to be called when the reaction button is pressed.
|
|
18
|
+
*/
|
|
19
|
+
onPressHandler?: () => void;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Button to display the list of Reactions supported in the call.
|
|
24
|
+
* On press, it opens a view that can be used to send Reaction.
|
|
25
|
+
*/
|
|
26
|
+
export const ReactionButton = ({ onPressHandler }: ReactionButtonProps) => {
|
|
27
|
+
const [showReactionsPicker, setShowReactionsPicker] =
|
|
28
|
+
useState<boolean>(false);
|
|
29
|
+
const [reactionsButtonLayoutRectangle, setReactionsButtonLayoutRectangle] =
|
|
30
|
+
useState<LayoutRectangle>();
|
|
31
|
+
|
|
32
|
+
// This is for the reaction picker
|
|
33
|
+
const onReactionsButtonLayout = (event: LayoutChangeEvent) => {
|
|
34
|
+
const layout = event.nativeEvent.layout;
|
|
35
|
+
setReactionsButtonLayoutRectangle((prev) => {
|
|
36
|
+
if (
|
|
37
|
+
prev &&
|
|
38
|
+
prev.width === layout.width &&
|
|
39
|
+
prev.height === layout.height &&
|
|
40
|
+
prev.x === layout.x &&
|
|
41
|
+
prev.y === layout.y
|
|
42
|
+
) {
|
|
43
|
+
return prev;
|
|
44
|
+
}
|
|
45
|
+
return layout;
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const reactionButtonHandler = () => {
|
|
50
|
+
if (onPressHandler) {
|
|
51
|
+
onPressHandler();
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
setShowReactionsPicker(true);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<>
|
|
59
|
+
<Restricted requiredGrants={[OwnCapability.CREATE_REACTION]}>
|
|
60
|
+
<CallControlsButton
|
|
61
|
+
testID={ButtonTestIds.REACTION}
|
|
62
|
+
onPress={reactionButtonHandler}
|
|
63
|
+
color={theme.light.static_white}
|
|
64
|
+
onLayout={onReactionsButtonLayout}
|
|
65
|
+
>
|
|
66
|
+
<Reaction color={theme.light.static_black} />
|
|
67
|
+
</CallControlsButton>
|
|
68
|
+
</Restricted>
|
|
69
|
+
{showReactionsPicker && (
|
|
70
|
+
<ReactionsPicker
|
|
71
|
+
reactions={StreamVideoRN.getConfig().supportedReactions}
|
|
72
|
+
reactionsButtonLayoutRectangle={reactionsButtonLayoutRectangle}
|
|
73
|
+
onRequestedClose={() => {
|
|
74
|
+
setShowReactionsPicker(false);
|
|
75
|
+
}}
|
|
76
|
+
/>
|
|
77
|
+
)}
|
|
78
|
+
</>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { useCall, useCallStateHooks } from '@stream-io/video-react-bindings';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { CallControlsButton } from './CallControlsButton';
|
|
4
|
+
import { theme } from '../../../theme';
|
|
5
|
+
import { PhoneDown } from '../../../icons';
|
|
6
|
+
import { CallingState } from '@stream-io/video-client';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The props for the Reject Call button.
|
|
10
|
+
*/
|
|
11
|
+
type RejectCallButtonProps = {
|
|
12
|
+
/**
|
|
13
|
+
* Handler to be called when the accept call button is pressed.
|
|
14
|
+
* @returns void
|
|
15
|
+
*/
|
|
16
|
+
onPressHandler?: () => void;
|
|
17
|
+
/**
|
|
18
|
+
* Handler to be called when the reject call button is pressed.
|
|
19
|
+
*
|
|
20
|
+
* Note: If the `onPressHandler` is passed this handler will not be executed.
|
|
21
|
+
*/
|
|
22
|
+
onRejectHandler?: () => void;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Button to reject a call.
|
|
27
|
+
*
|
|
28
|
+
* Mostly calls call.leave({ reject: true }) internally.
|
|
29
|
+
*/
|
|
30
|
+
export const RejectCallButton = ({
|
|
31
|
+
onPressHandler,
|
|
32
|
+
onRejectHandler,
|
|
33
|
+
}: RejectCallButtonProps) => {
|
|
34
|
+
const call = useCall();
|
|
35
|
+
const { useCallCallingState } = useCallStateHooks();
|
|
36
|
+
const callingState = useCallCallingState();
|
|
37
|
+
const rejectCallHandler = async () => {
|
|
38
|
+
if (onPressHandler) {
|
|
39
|
+
onPressHandler();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
if (callingState === CallingState.LEFT) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
await call?.leave({ reject: true });
|
|
47
|
+
if (onRejectHandler) {
|
|
48
|
+
onRejectHandler();
|
|
49
|
+
}
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.log('Error rejecting Call', error);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<CallControlsButton
|
|
57
|
+
onPress={rejectCallHandler}
|
|
58
|
+
color={theme.light.error}
|
|
59
|
+
style={theme.button.lg}
|
|
60
|
+
svgContainerStyle={theme.icon.lg}
|
|
61
|
+
>
|
|
62
|
+
<PhoneDown color={theme.light.static_white} />
|
|
63
|
+
</CallControlsButton>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CallControlsButton } from './CallControlsButton';
|
|
3
|
+
import { theme } from '../../../theme';
|
|
4
|
+
import { Mic, MicOff } from '../../../icons';
|
|
5
|
+
import { useMediaStreamManagement } from '../../../providers';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Props for the Toggle Audio preview button
|
|
9
|
+
*/
|
|
10
|
+
export type ToggleAudioPreviewButtonProps = {
|
|
11
|
+
/**
|
|
12
|
+
* Handler to be called when the the audio preview button is pressed.
|
|
13
|
+
* @returns void
|
|
14
|
+
*/
|
|
15
|
+
onPressHandler?: () => void;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Button to toggle audio mute/unmute status before joining the call.
|
|
20
|
+
*/
|
|
21
|
+
export const ToggleAudioPreviewButton = ({
|
|
22
|
+
onPressHandler,
|
|
23
|
+
}: ToggleAudioPreviewButtonProps) => {
|
|
24
|
+
const { initialAudioEnabled, toggleInitialAudioMuteState } =
|
|
25
|
+
useMediaStreamManagement();
|
|
26
|
+
|
|
27
|
+
const MicIcon = !initialAudioEnabled ? (
|
|
28
|
+
<MicOff color={theme.light.static_white} />
|
|
29
|
+
) : (
|
|
30
|
+
<Mic color={theme.light.static_black} />
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const toggleAudioPreviewHandler = () => {
|
|
34
|
+
if (onPressHandler) {
|
|
35
|
+
onPressHandler();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
toggleInitialAudioMuteState();
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<CallControlsButton
|
|
43
|
+
onPress={toggleAudioPreviewHandler}
|
|
44
|
+
color={
|
|
45
|
+
initialAudioEnabled
|
|
46
|
+
? theme.light.static_white
|
|
47
|
+
: theme.light.static_black
|
|
48
|
+
}
|
|
49
|
+
style={[
|
|
50
|
+
theme.button.md,
|
|
51
|
+
{
|
|
52
|
+
shadowColor: initialAudioEnabled
|
|
53
|
+
? theme.light.static_white
|
|
54
|
+
: theme.light.static_black,
|
|
55
|
+
},
|
|
56
|
+
]}
|
|
57
|
+
>
|
|
58
|
+
{MicIcon}
|
|
59
|
+
</CallControlsButton>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
@@ -10,17 +10,34 @@ import { CallControlsButton } from './CallControlsButton';
|
|
|
10
10
|
import { usePermissionNotification } from '../../../hooks';
|
|
11
11
|
import { theme } from '../../../theme';
|
|
12
12
|
import { Mic, MicOff } from '../../../icons';
|
|
13
|
-
import { Alert
|
|
13
|
+
import { Alert } from 'react-native';
|
|
14
14
|
import { muteStatusColor } from '../../../utils';
|
|
15
15
|
import { useMediaStreamManagement } from '../../../providers';
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Props for the Toggle Audio publishing button
|
|
19
|
+
*/
|
|
20
|
+
export type ToggleAudioPublishingButtonProps = {
|
|
21
|
+
/**
|
|
22
|
+
* Handler to be called when the the video publishing button is pressed.
|
|
23
|
+
* @returns void
|
|
24
|
+
*/
|
|
25
|
+
onPressHandler?: () => void;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Button to toggle audio mute/unmute status while in the call.
|
|
30
|
+
*/
|
|
31
|
+
export const ToggleAudioPublishingButton = ({
|
|
32
|
+
onPressHandler,
|
|
33
|
+
}: ToggleAudioPublishingButtonProps) => {
|
|
18
34
|
const [isAwaitingApproval, setIsAwaitingApproval] = useState(false);
|
|
19
35
|
const { isAudioMuted, toggleAudioMuted } = useMediaStreamManagement();
|
|
20
36
|
const userHasSendAudioCapability = useHasPermissions(
|
|
21
37
|
OwnCapability.SEND_AUDIO,
|
|
22
38
|
);
|
|
23
39
|
const { t } = useI18n();
|
|
40
|
+
const call = useCall();
|
|
24
41
|
|
|
25
42
|
usePermissionNotification({
|
|
26
43
|
permission: OwnCapability.SEND_AUDIO,
|
|
@@ -28,8 +45,6 @@ export const ToggleAudioButton = () => {
|
|
|
28
45
|
messageRevoked: t('You can no longer speak.'),
|
|
29
46
|
});
|
|
30
47
|
|
|
31
|
-
const call = useCall();
|
|
32
|
-
|
|
33
48
|
useEffect(() => {
|
|
34
49
|
if (userHasSendAudioCapability) {
|
|
35
50
|
setIsAwaitingApproval(false);
|
|
@@ -57,8 +72,12 @@ export const ToggleAudioButton = () => {
|
|
|
57
72
|
);
|
|
58
73
|
|
|
59
74
|
const handleToggleAudioButton = async () => {
|
|
75
|
+
if (onPressHandler) {
|
|
76
|
+
onPressHandler();
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
60
79
|
if (userHasSendAudioCapability) {
|
|
61
|
-
|
|
80
|
+
toggleAudioMuted();
|
|
62
81
|
return;
|
|
63
82
|
}
|
|
64
83
|
if (!isAwaitingApproval) {
|
|
@@ -73,7 +92,6 @@ export const ToggleAudioButton = () => {
|
|
|
73
92
|
<CallControlsButton
|
|
74
93
|
onPress={handleToggleAudioButton}
|
|
75
94
|
color={muteStatusColor(isAudioMuted)}
|
|
76
|
-
style={!isAudioMuted ? styles.button : null}
|
|
77
95
|
>
|
|
78
96
|
{isAudioMuted ? (
|
|
79
97
|
<MicOff color={theme.light.static_white} />
|
|
@@ -84,21 +102,3 @@ export const ToggleAudioButton = () => {
|
|
|
84
102
|
</Restricted>
|
|
85
103
|
);
|
|
86
104
|
};
|
|
87
|
-
|
|
88
|
-
const styles = StyleSheet.create({
|
|
89
|
-
button: {
|
|
90
|
-
// For iOS
|
|
91
|
-
shadowOffset: {
|
|
92
|
-
width: 0,
|
|
93
|
-
height: 6,
|
|
94
|
-
},
|
|
95
|
-
shadowOpacity: 0.37,
|
|
96
|
-
shadowRadius: 7.49,
|
|
97
|
-
|
|
98
|
-
// For android
|
|
99
|
-
elevation: 6,
|
|
100
|
-
},
|
|
101
|
-
svgContainerStyle: {
|
|
102
|
-
paddingTop: theme.padding.xs,
|
|
103
|
-
},
|
|
104
|
-
});
|
|
@@ -6,19 +6,41 @@ import { useMediaStreamManagement } from '../../../providers/MediaStreamManageme
|
|
|
6
6
|
import { muteStatusColor } from '../../../utils';
|
|
7
7
|
import { CameraSwitch } from '../../../icons';
|
|
8
8
|
import { theme } from '../../../theme';
|
|
9
|
-
import { StyleSheet } from 'react-native';
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Props for the Toggle Camera face button.
|
|
12
|
+
*/
|
|
13
|
+
export type ToggleCameraFaceButtonProps = {
|
|
14
|
+
/**
|
|
15
|
+
* Handler to be called when the the video publishing button is pressed.
|
|
16
|
+
* @returns void
|
|
17
|
+
*/
|
|
18
|
+
onPressHandler?: () => void;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Button to toggle camera face(front/back) when in the call.
|
|
23
|
+
*/
|
|
24
|
+
export const ToggleCameraFaceButton = ({
|
|
25
|
+
onPressHandler,
|
|
26
|
+
}: ToggleCameraFaceButtonProps) => {
|
|
12
27
|
const { isVideoMuted, isCameraOnFrontFacingMode, toggleCameraFacingMode } =
|
|
13
28
|
useMediaStreamManagement();
|
|
14
29
|
|
|
30
|
+
const toggleCameraFaceHandler = () => {
|
|
31
|
+
if (onPressHandler) {
|
|
32
|
+
onPressHandler();
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
toggleCameraFacingMode();
|
|
36
|
+
};
|
|
37
|
+
|
|
15
38
|
return (
|
|
16
39
|
<Restricted requiredGrants={[OwnCapability.SEND_VIDEO]}>
|
|
17
40
|
<CallControlsButton
|
|
18
41
|
disabled={isVideoMuted}
|
|
19
|
-
onPress={
|
|
42
|
+
onPress={toggleCameraFaceHandler}
|
|
20
43
|
color={muteStatusColor(!isCameraOnFrontFacingMode)}
|
|
21
|
-
style={isCameraOnFrontFacingMode ? styles.button : null}
|
|
22
44
|
>
|
|
23
45
|
<CameraSwitch
|
|
24
46
|
color={
|
|
@@ -31,18 +53,3 @@ export const ToggleCameraFaceButton = () => {
|
|
|
31
53
|
</Restricted>
|
|
32
54
|
);
|
|
33
55
|
};
|
|
34
|
-
|
|
35
|
-
const styles = StyleSheet.create({
|
|
36
|
-
button: {
|
|
37
|
-
// For iOS
|
|
38
|
-
shadowOffset: {
|
|
39
|
-
width: 0,
|
|
40
|
-
height: 6,
|
|
41
|
-
},
|
|
42
|
-
shadowOpacity: 0.37,
|
|
43
|
-
shadowRadius: 7.49,
|
|
44
|
-
|
|
45
|
-
// For android
|
|
46
|
-
elevation: 6,
|
|
47
|
-
},
|
|
48
|
-
});
|