@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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Pin.js","sourceRoot":"","sources":["../../../src/icons/Pin.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,uDAA6C;AAMtC,MAAM,GAAG,GAAG,CAAC,EAAE,KAAK,EAAS,EAAE,EAAE,CAAC,CACvC,CAAC,sBAAG,CAAC,OAAO,CAAC,WAAW,CACtB;IAAA,CAAC,uBAAI,CACH,IAAI,CAAC,CAAC,KAAK,CAAC,CACZ,QAAQ,CAAC,SAAS,CAClB,QAAQ,CAAC,SAAS,CAClB,CAAC,CAAC,wlCAAwlC,EAE9lC;EAAA,EAAE,sBAAG,CAAC,CACP,CAAC;AATW,QAAA,GAAG,OASd"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.VideoDisabled = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const react_native_svg_1 = require("react-native-svg");
|
|
9
|
-
const VideoDisabled = ({ color }) => (<react_native_svg_1.Svg viewBox="0 0 24 24">
|
|
10
|
-
<react_native_svg_1.Path d="M 22.1126 16.2238 L 19.1546 13.6686 V 8.37994 L 22.1126 5.82471 L 22.1127 5.82476 L 22.1205 5.81781 C 22.4413 5.53481 22.6269 5.49515 22.686 5.49515 C 22.8267 5.49515 22.8809 5.53948 22.9048 5.56519 C 22.9344 5.59687 23 5.69295 23 5.91262 V 16.1359 C 23 16.3556 22.9344 16.4517 22.9048 16.4833 C 22.8809 16.5091 22.8267 16.5534 22.686 16.5534 C 22.634 16.5534 22.4383 16.5111 22.1205 16.2307 L 22.1206 16.2307 L 22.1126 16.2238 Z M 13.4493 18 H 3.28502 C 2.41817 18 1.87542 17.7686 1.55341 17.4618 C 1.23884 17.162 1 16.6616 1 15.835 V 6.23301 C 1 5.4144 1.24841 4.88792 1.58386 4.5637 C 1.92432 4.23463 2.47262 4 3.28502 4 H 13.5266 C 14.3853 4 14.898 4.23821 15.1995 4.54532 C 15.5041 4.85542 15.7343 5.37926 15.7343 6.23301 V 15.767 C 15.7343 16.6029 15.4949 17.126 15.1733 17.4423 C 14.8492 17.7609 14.3088 18 13.4493 18 Z" fill={'none'} stroke={color} strokeWidth={2}/>
|
|
11
|
-
<react_native_svg_1.Path d="M 5.79311 7.27924 C 5.38794 6.90692 4.73102 6.90692 4.32585 7.27924 C 3.92068 7.65156 3.92068 8.25521 4.32585 8.62753 L 6.90766 11 L 4.32586 13.3725 C 3.92069 13.7448 3.92069 14.3484 4.32586 14.7208 C 4.73103 15.0931 5.38795 15.0931 5.79312 14.7208 L 8.37492 12.3483 L 10.9567 14.7208 C 11.3619 15.0931 12.0188 15.0931 12.424 14.7208 C 12.8291 14.3484 12.8291 13.7448 12.424 13.3725 L 9.84217 11 L 12.424 8.62754 C 12.8291 8.25521 12.8291 7.65156 12.424 7.27924 C 12.0188 6.90692 11.3619 6.90692 10.9567 7.27924 L 8.37492 9.65171 L 5.79311 7.27924 Z" fill={color} fillRule="evenodd" clipRule="evenodd"/>
|
|
12
|
-
</react_native_svg_1.Svg>);
|
|
13
|
-
exports.VideoDisabled = VideoDisabled;
|
|
14
|
-
//# sourceMappingURL=VideoDisabled.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VideoDisabled.js","sourceRoot":"","sources":["../../../src/icons/VideoDisabled.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,uDAA6C;AAMtC,MAAM,aAAa,GAAG,CAAC,EAAE,KAAK,EAAS,EAAE,EAAE,CAAC,CACjD,CAAC,sBAAG,CAAC,OAAO,CAAC,WAAW,CACtB;IAAA,CAAC,uBAAI,CACH,CAAC,CAAC,4zBAA4zB,CAC9zB,IAAI,CAAC,CAAC,MAAM,CAAC,CACb,MAAM,CAAC,CAAC,KAAK,CAAC,CACd,WAAW,CAAC,CAAC,CAAC,CAAC,EAEjB;IAAA,CAAC,uBAAI,CACH,CAAC,CAAC,uiBAAuiB,CACziB,IAAI,CAAC,CAAC,KAAK,CAAC,CACZ,QAAQ,CAAC,SAAS,CAClB,QAAQ,CAAC,SAAS,EAEtB;EAAA,EAAE,sBAAG,CAAC,CACP,CAAC;AAfW,QAAA,aAAa,iBAexB"}
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
LayoutChangeEvent,
|
|
4
|
-
LayoutRectangle,
|
|
5
|
-
StyleSheet,
|
|
6
|
-
Text,
|
|
7
|
-
View,
|
|
8
|
-
ViewProps,
|
|
9
|
-
} from 'react-native';
|
|
10
|
-
import { Chat, Reaction } from '../../icons';
|
|
11
|
-
import { CallControlsButton } from '../utility/internal/CallControlsButton';
|
|
12
|
-
import { theme } from '../../theme';
|
|
13
|
-
import { OwnCapability } from '@stream-io/video-client';
|
|
14
|
-
import { Restricted } from '@stream-io/video-react-bindings';
|
|
15
|
-
import { ToggleAudioButton } from '../utility/internal/ToggleAudioButton';
|
|
16
|
-
import { ToggleVideoButton } from '../utility/internal/ToggleVideoButton';
|
|
17
|
-
import { ButtonTestIds, ComponentTestIds } from '../../constants/TestIds';
|
|
18
|
-
import { Z_INDEX } from '../../constants';
|
|
19
|
-
import { ToggleCameraFaceButton } from '../utility/internal/ToggleCameraFaceButton';
|
|
20
|
-
import {
|
|
21
|
-
HangUpCallButton,
|
|
22
|
-
HangUpCallButtonProps,
|
|
23
|
-
} from '../utility/internal/HangupCallButton';
|
|
24
|
-
import { ReactionsPicker } from './ReactionsPicker';
|
|
25
|
-
import { StreamVideoRN } from '../../utils';
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* The props for the Chat Button in the Call Controls.
|
|
29
|
-
*/
|
|
30
|
-
type ChatButtonProps = {
|
|
31
|
-
/**
|
|
32
|
-
* Handler to be called when the chat button is pressed.
|
|
33
|
-
* @returns void
|
|
34
|
-
*/
|
|
35
|
-
onPressHandler: () => void;
|
|
36
|
-
/**
|
|
37
|
-
* The unread message indicator to be displayed above on the Chat button.
|
|
38
|
-
*/
|
|
39
|
-
unreadBadgeCountIndicator?: number;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Props for the CallControls Component.
|
|
44
|
-
*/
|
|
45
|
-
export interface CallControlsType extends Pick<ViewProps, 'style'> {
|
|
46
|
-
/**
|
|
47
|
-
* Chat Button Props to be passed as an object
|
|
48
|
-
*/
|
|
49
|
-
chatButton?: ChatButtonProps;
|
|
50
|
-
/**
|
|
51
|
-
* Hang up call button props to be passed as an object
|
|
52
|
-
*/
|
|
53
|
-
hangUpCallButton?: HangUpCallButtonProps;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* A list/row of controls (mute audio/video, toggle front/back camera, hangup call etc.)
|
|
58
|
-
* the user can trigger within an active call.
|
|
59
|
-
*/
|
|
60
|
-
export const CallControls = ({
|
|
61
|
-
chatButton,
|
|
62
|
-
hangUpCallButton,
|
|
63
|
-
style,
|
|
64
|
-
}: CallControlsType) => {
|
|
65
|
-
const [showReactionsPicker, setShowReactionsPicker] =
|
|
66
|
-
useState<boolean>(false);
|
|
67
|
-
|
|
68
|
-
const [reactionsButtonLayoutRectangle, setReactionsButtonLayoutRectangle] =
|
|
69
|
-
useState<LayoutRectangle>();
|
|
70
|
-
|
|
71
|
-
// This is for the reaction popup
|
|
72
|
-
const onReactionsButtonLayout = (event: LayoutChangeEvent) => {
|
|
73
|
-
const layout = event.nativeEvent.layout;
|
|
74
|
-
setReactionsButtonLayoutRectangle((prev) => {
|
|
75
|
-
if (
|
|
76
|
-
prev &&
|
|
77
|
-
prev.width === layout.width &&
|
|
78
|
-
prev.height === layout.height &&
|
|
79
|
-
prev.x === layout.x &&
|
|
80
|
-
prev.y === layout.y
|
|
81
|
-
) {
|
|
82
|
-
return prev;
|
|
83
|
-
}
|
|
84
|
-
return layout;
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
return (
|
|
89
|
-
<View style={[styles.container, style]}>
|
|
90
|
-
<Restricted requiredGrants={[OwnCapability.CREATE_REACTION]}>
|
|
91
|
-
<CallControlsButton
|
|
92
|
-
testID={ButtonTestIds.REACTION}
|
|
93
|
-
onPress={() => {
|
|
94
|
-
setShowReactionsPicker(true);
|
|
95
|
-
}}
|
|
96
|
-
color={theme.light.static_white}
|
|
97
|
-
style={styles.button}
|
|
98
|
-
onLayout={onReactionsButtonLayout}
|
|
99
|
-
>
|
|
100
|
-
<Reaction color={theme.light.static_black} />
|
|
101
|
-
</CallControlsButton>
|
|
102
|
-
</Restricted>
|
|
103
|
-
{chatButton && (
|
|
104
|
-
<View>
|
|
105
|
-
<CallControlsButton
|
|
106
|
-
color={theme.light.static_white}
|
|
107
|
-
onPress={chatButton.onPressHandler}
|
|
108
|
-
svgContainerStyle={styles.svgContainerStyle}
|
|
109
|
-
style={styles.button}
|
|
110
|
-
>
|
|
111
|
-
<UnreadBadgeCountIndicator
|
|
112
|
-
count={chatButton.unreadBadgeCountIndicator}
|
|
113
|
-
/>
|
|
114
|
-
<Chat color={theme.light.static_black} />
|
|
115
|
-
</CallControlsButton>
|
|
116
|
-
</View>
|
|
117
|
-
)}
|
|
118
|
-
<ToggleVideoButton />
|
|
119
|
-
<ToggleAudioButton />
|
|
120
|
-
<ToggleCameraFaceButton />
|
|
121
|
-
<HangUpCallButton onPressHandler={hangUpCallButton?.onPressHandler} />
|
|
122
|
-
|
|
123
|
-
{showReactionsPicker && (
|
|
124
|
-
<ReactionsPicker
|
|
125
|
-
reactions={StreamVideoRN.getConfig().supportedReactions}
|
|
126
|
-
reactionsButtonLayoutRectangle={reactionsButtonLayoutRectangle}
|
|
127
|
-
onRequestedClose={() => {
|
|
128
|
-
setShowReactionsPicker(false);
|
|
129
|
-
}}
|
|
130
|
-
/>
|
|
131
|
-
)}
|
|
132
|
-
</View>
|
|
133
|
-
);
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
const UnreadBadgeCountIndicator = ({
|
|
137
|
-
count,
|
|
138
|
-
}: {
|
|
139
|
-
count: ChatButtonProps['unreadBadgeCountIndicator'];
|
|
140
|
-
}) => {
|
|
141
|
-
// Don't show badge if count is 0 or undefined
|
|
142
|
-
if (!count) {
|
|
143
|
-
return null;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
return (
|
|
147
|
-
<View
|
|
148
|
-
testID={ComponentTestIds.CHAT_UNREAD_BADGE_COUNT_INDICATOR}
|
|
149
|
-
style={styles.chatBadge}
|
|
150
|
-
>
|
|
151
|
-
<Text style={styles.chatBadgeText}>{count}</Text>
|
|
152
|
-
</View>
|
|
153
|
-
);
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
const styles = StyleSheet.create({
|
|
157
|
-
container: {
|
|
158
|
-
padding: theme.padding.sm,
|
|
159
|
-
flexDirection: 'row',
|
|
160
|
-
justifyContent: 'space-between',
|
|
161
|
-
zIndex: Z_INDEX.IN_FRONT,
|
|
162
|
-
backgroundColor: theme.light.static_black,
|
|
163
|
-
},
|
|
164
|
-
button: {
|
|
165
|
-
// For iOS
|
|
166
|
-
shadowOffset: {
|
|
167
|
-
width: 0,
|
|
168
|
-
height: 6,
|
|
169
|
-
},
|
|
170
|
-
shadowOpacity: 0.37,
|
|
171
|
-
shadowRadius: 7.49,
|
|
172
|
-
|
|
173
|
-
// For android
|
|
174
|
-
elevation: 6,
|
|
175
|
-
},
|
|
176
|
-
svgContainerStyle: {
|
|
177
|
-
paddingTop: theme.padding.xs,
|
|
178
|
-
},
|
|
179
|
-
chatBadge: {
|
|
180
|
-
backgroundColor: theme.light.error,
|
|
181
|
-
borderRadius: theme.rounded.xl,
|
|
182
|
-
position: 'absolute',
|
|
183
|
-
left: 15,
|
|
184
|
-
bottom: 20,
|
|
185
|
-
zIndex: Z_INDEX.IN_FRONT,
|
|
186
|
-
height: 30,
|
|
187
|
-
width: 30,
|
|
188
|
-
justifyContent: 'center',
|
|
189
|
-
},
|
|
190
|
-
chatBadgeText: {
|
|
191
|
-
color: theme.light.static_white,
|
|
192
|
-
textAlign: 'center',
|
|
193
|
-
...theme.fonts.bodyBold,
|
|
194
|
-
},
|
|
195
|
-
});
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Pressable,
|
|
4
|
-
PressableProps,
|
|
5
|
-
StyleSheet,
|
|
6
|
-
Text,
|
|
7
|
-
View,
|
|
8
|
-
} from 'react-native';
|
|
9
|
-
import { Participants } from '../../icons';
|
|
10
|
-
import { useCallStateHooks } from '@stream-io/video-react-bindings';
|
|
11
|
-
import { theme } from '../../theme';
|
|
12
|
-
import { ButtonTestIds } from '../../constants/TestIds';
|
|
13
|
-
import { Z_INDEX } from '../../constants';
|
|
14
|
-
import { ParticipantsInfoList } from './ParticipantsInfoList';
|
|
15
|
-
|
|
16
|
-
export type ParticipantsInfoBadgeProps = Pick<PressableProps, 'style'>;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Badge that shows the number of participants in the call.
|
|
20
|
-
* When pressed, it opens the ParticipantsInfoList.
|
|
21
|
-
* @param style
|
|
22
|
-
*/
|
|
23
|
-
export const ParticipantsInfoBadge = ({
|
|
24
|
-
style,
|
|
25
|
-
}: ParticipantsInfoBadgeProps) => {
|
|
26
|
-
const { useParticipantCount } = useCallStateHooks();
|
|
27
|
-
const participantCount = useParticipantCount();
|
|
28
|
-
const [isCallParticipantsVisible, setIsCallParticipantsVisible] =
|
|
29
|
-
useState<boolean>(false);
|
|
30
|
-
|
|
31
|
-
const onOpenCallParticipantsInfo = useCallback(() => {
|
|
32
|
-
setIsCallParticipantsVisible(true);
|
|
33
|
-
}, [setIsCallParticipantsVisible]);
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<Pressable
|
|
37
|
-
onPress={onOpenCallParticipantsInfo}
|
|
38
|
-
testID={ButtonTestIds.PARTICIPANTS_INFO}
|
|
39
|
-
style={style}
|
|
40
|
-
>
|
|
41
|
-
<View style={styles.badge}>
|
|
42
|
-
<Text style={styles.badgeText}>{participantCount}</Text>
|
|
43
|
-
</View>
|
|
44
|
-
<View style={theme.icon.md}>
|
|
45
|
-
<Participants color={theme.light.static_white} />
|
|
46
|
-
</View>
|
|
47
|
-
<ParticipantsInfoList
|
|
48
|
-
isCallParticipantsInfoVisible={isCallParticipantsVisible}
|
|
49
|
-
setIsCallParticipantsInfoVisible={setIsCallParticipantsVisible}
|
|
50
|
-
/>
|
|
51
|
-
</Pressable>
|
|
52
|
-
);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const styles = StyleSheet.create({
|
|
56
|
-
badge: {
|
|
57
|
-
backgroundColor: theme.light.text_low_emphasis,
|
|
58
|
-
borderRadius: theme.rounded.xl,
|
|
59
|
-
paddingVertical: theme.padding.xs,
|
|
60
|
-
paddingHorizontal: theme.padding.sm,
|
|
61
|
-
zIndex: Z_INDEX.IN_FRONT,
|
|
62
|
-
top: theme.spacing.sm,
|
|
63
|
-
left: theme.spacing.xl,
|
|
64
|
-
},
|
|
65
|
-
badgeText: {
|
|
66
|
-
color: theme.light.static_white,
|
|
67
|
-
textAlign: 'center',
|
|
68
|
-
...theme.fonts.caption,
|
|
69
|
-
},
|
|
70
|
-
});
|
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
OwnCapability,
|
|
3
|
-
SfuModels,
|
|
4
|
-
StreamVideoParticipant,
|
|
5
|
-
} from '@stream-io/video-client';
|
|
6
|
-
import {
|
|
7
|
-
Restricted,
|
|
8
|
-
useCall,
|
|
9
|
-
useCallStateHooks,
|
|
10
|
-
useConnectedUser,
|
|
11
|
-
useI18n,
|
|
12
|
-
} from '@stream-io/video-react-bindings';
|
|
13
|
-
import {
|
|
14
|
-
Alert,
|
|
15
|
-
FlatList,
|
|
16
|
-
Modal,
|
|
17
|
-
Pressable,
|
|
18
|
-
SafeAreaView,
|
|
19
|
-
Share,
|
|
20
|
-
StyleSheet,
|
|
21
|
-
Text,
|
|
22
|
-
View,
|
|
23
|
-
} from 'react-native';
|
|
24
|
-
import {
|
|
25
|
-
ArrowRight,
|
|
26
|
-
Cross,
|
|
27
|
-
MicOff,
|
|
28
|
-
ScreenShare,
|
|
29
|
-
VideoSlash,
|
|
30
|
-
} from '../../icons';
|
|
31
|
-
import React, { useCallback, useState } from 'react';
|
|
32
|
-
import { generateParticipantTitle } from '../../utils';
|
|
33
|
-
import { ParticipantActions } from './internal/ParticipantActions';
|
|
34
|
-
import { Avatar } from '../utility/Avatar';
|
|
35
|
-
import { theme } from '../../theme';
|
|
36
|
-
import { ButtonTestIds, ComponentTestIds } from '../../constants/TestIds';
|
|
37
|
-
import { Z_INDEX } from '../../constants';
|
|
38
|
-
import { palette } from '../../theme/constants';
|
|
39
|
-
|
|
40
|
-
export interface ParticipantsInfoListProps {
|
|
41
|
-
/**
|
|
42
|
-
* Boolean that decides whether the CallParticipantsInfo modal should be open or not.
|
|
43
|
-
*/
|
|
44
|
-
isCallParticipantsInfoVisible: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* SetState function to set the value of the boolean field `isCallParticipantsVisible` depending upon whether the CallParticipantsInfo modal should be open or not.
|
|
47
|
-
*/
|
|
48
|
-
setIsCallParticipantsInfoVisible: React.Dispatch<
|
|
49
|
-
React.SetStateAction<boolean>
|
|
50
|
-
>;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* A component that shows a list of participants in the call and their information.
|
|
55
|
-
* their mute states, video states, screen share states, etc.
|
|
56
|
-
* Mute all participants, invite participants, etc.
|
|
57
|
-
**/
|
|
58
|
-
export const ParticipantsInfoList = ({
|
|
59
|
-
isCallParticipantsInfoVisible,
|
|
60
|
-
setIsCallParticipantsInfoVisible,
|
|
61
|
-
}: ParticipantsInfoListProps) => {
|
|
62
|
-
const { useParticipants } = useCallStateHooks();
|
|
63
|
-
const participants = useParticipants();
|
|
64
|
-
const { t } = useI18n();
|
|
65
|
-
const [selectedParticipant, setSelectedParticipant] = useState<
|
|
66
|
-
StreamVideoParticipant | undefined
|
|
67
|
-
>(undefined);
|
|
68
|
-
const call = useCall();
|
|
69
|
-
const inviteHandler = async () => {
|
|
70
|
-
try {
|
|
71
|
-
await Share.share({
|
|
72
|
-
url: `https://stream-calls-dogfood.vercel.app/join/${call?.id}`,
|
|
73
|
-
title: 'Stream Calls | Join Call',
|
|
74
|
-
message: `Join me on the call using this link https://stream-calls-dogfood.vercel.app/join/${call?.id}`,
|
|
75
|
-
});
|
|
76
|
-
} catch (error: any) {
|
|
77
|
-
console.log(error.message);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const muteAllParticipantsHandler = async () => {
|
|
82
|
-
try {
|
|
83
|
-
await call?.muteAllUsers('audio');
|
|
84
|
-
Alert.alert('Users Muted Successfully');
|
|
85
|
-
} catch (error) {
|
|
86
|
-
console.log('Error muting users', error);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
const onCloseCallParticipantsVisible = () => {
|
|
91
|
-
setIsCallParticipantsInfoVisible(false);
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const renderItem = useCallback(
|
|
95
|
-
({ item }: { item: StreamVideoParticipant }) => {
|
|
96
|
-
return (
|
|
97
|
-
<ParticipantInfoItem
|
|
98
|
-
key={item.sessionId}
|
|
99
|
-
participant={item}
|
|
100
|
-
setSelectedParticipant={setSelectedParticipant}
|
|
101
|
-
/>
|
|
102
|
-
);
|
|
103
|
-
},
|
|
104
|
-
[],
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
return (
|
|
108
|
-
<Modal
|
|
109
|
-
testID={ComponentTestIds.PARTICIPANTS_INFO}
|
|
110
|
-
animationType="fade"
|
|
111
|
-
transparent
|
|
112
|
-
visible={isCallParticipantsInfoVisible}
|
|
113
|
-
onRequestClose={onCloseCallParticipantsVisible}
|
|
114
|
-
>
|
|
115
|
-
<>
|
|
116
|
-
{/*independent background, needed due to desired opacity only
|
|
117
|
-
on background, exc. modal content*/}
|
|
118
|
-
<SafeAreaView style={styles.backDropBackground}>
|
|
119
|
-
<View style={styles.content}>
|
|
120
|
-
<View style={styles.header}>
|
|
121
|
-
<View style={styles.leftHeaderElement} />
|
|
122
|
-
<Text style={styles.headerText}>
|
|
123
|
-
{t('Participants ({{ numberOfParticipants }})', {
|
|
124
|
-
numberOfParticipants: participants.length,
|
|
125
|
-
})}
|
|
126
|
-
</Text>
|
|
127
|
-
<Pressable
|
|
128
|
-
onPress={onCloseCallParticipantsVisible}
|
|
129
|
-
testID={ButtonTestIds.EXIT_PARTICIPANTS_INFO}
|
|
130
|
-
style={styles.closePressable}
|
|
131
|
-
>
|
|
132
|
-
<Cross color={theme.dark.primary} style={theme.icon.xs} />
|
|
133
|
-
</Pressable>
|
|
134
|
-
</View>
|
|
135
|
-
<FlatList data={participants} renderItem={renderItem} />
|
|
136
|
-
<View style={styles.buttonGroup}>
|
|
137
|
-
<Pressable style={styles.button} onPress={inviteHandler}>
|
|
138
|
-
<Text style={styles.buttonText}>{t('Invite')}</Text>
|
|
139
|
-
</Pressable>
|
|
140
|
-
<Restricted requiredGrants={[OwnCapability.MUTE_USERS]}>
|
|
141
|
-
<Pressable
|
|
142
|
-
style={styles.button}
|
|
143
|
-
onPress={muteAllParticipantsHandler}
|
|
144
|
-
>
|
|
145
|
-
<Text style={styles.buttonText}>{t('Mute All')}</Text>
|
|
146
|
-
</Pressable>
|
|
147
|
-
</Restricted>
|
|
148
|
-
</View>
|
|
149
|
-
</View>
|
|
150
|
-
</SafeAreaView>
|
|
151
|
-
|
|
152
|
-
<Modal
|
|
153
|
-
animationType="fade"
|
|
154
|
-
transparent
|
|
155
|
-
visible={!!selectedParticipant}
|
|
156
|
-
onRequestClose={() => setSelectedParticipant(undefined)}
|
|
157
|
-
>
|
|
158
|
-
<>
|
|
159
|
-
{/*independent background, needed due to desired opacity only
|
|
160
|
-
on background, exc. modal content*/}
|
|
161
|
-
<View style={styles.backDropBackground} />
|
|
162
|
-
<ParticipantActions
|
|
163
|
-
participant={selectedParticipant}
|
|
164
|
-
setSelectedParticipant={setSelectedParticipant}
|
|
165
|
-
/>
|
|
166
|
-
</>
|
|
167
|
-
</Modal>
|
|
168
|
-
</>
|
|
169
|
-
</Modal>
|
|
170
|
-
);
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
type ParticipantInfoType = {
|
|
174
|
-
participant: StreamVideoParticipant;
|
|
175
|
-
setSelectedParticipant: React.Dispatch<
|
|
176
|
-
React.SetStateAction<StreamVideoParticipant | undefined>
|
|
177
|
-
>;
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
const ParticipantInfoItem = (props: ParticipantInfoType) => {
|
|
181
|
-
const { participant, setSelectedParticipant } = props;
|
|
182
|
-
const connectedUser = useConnectedUser();
|
|
183
|
-
const participantIsLocalParticipant =
|
|
184
|
-
participant.userId === connectedUser?.id;
|
|
185
|
-
|
|
186
|
-
const optionsOpenHandler = useCallback(() => {
|
|
187
|
-
if (!participantIsLocalParticipant) {
|
|
188
|
-
setSelectedParticipant(participant);
|
|
189
|
-
}
|
|
190
|
-
}, [participant, setSelectedParticipant, participantIsLocalParticipant]);
|
|
191
|
-
|
|
192
|
-
if (!participant) {
|
|
193
|
-
return null;
|
|
194
|
-
}
|
|
195
|
-
const { publishedTracks } = participant;
|
|
196
|
-
const isAudioMuted = !publishedTracks.includes(SfuModels.TrackType.AUDIO);
|
|
197
|
-
const isVideoMuted = !publishedTracks.includes(SfuModels.TrackType.VIDEO);
|
|
198
|
-
const isScreenSharing = publishedTracks.includes(
|
|
199
|
-
SfuModels.TrackType.SCREEN_SHARE,
|
|
200
|
-
);
|
|
201
|
-
|
|
202
|
-
return (
|
|
203
|
-
<Pressable style={styles.participant} onPress={optionsOpenHandler}>
|
|
204
|
-
<View style={styles.participantInfo}>
|
|
205
|
-
<Avatar size={theme.avatar.xs} participant={participant} />
|
|
206
|
-
|
|
207
|
-
<Text style={styles.name} numberOfLines={1}>
|
|
208
|
-
{(participant.name || generateParticipantTitle(participant.userId)) +
|
|
209
|
-
(participantIsLocalParticipant ? ' (You)' : '')}
|
|
210
|
-
</Text>
|
|
211
|
-
</View>
|
|
212
|
-
|
|
213
|
-
<View style={styles.icons}>
|
|
214
|
-
{isScreenSharing && (
|
|
215
|
-
<View style={[styles.svgContainerStyle, theme.icon.md]}>
|
|
216
|
-
<ScreenShare color={theme.dark.info} />
|
|
217
|
-
</View>
|
|
218
|
-
)}
|
|
219
|
-
{isAudioMuted && (
|
|
220
|
-
<View style={[styles.svgContainerStyle, theme.icon.sm]}>
|
|
221
|
-
<MicOff color={theme.dark.error} />
|
|
222
|
-
</View>
|
|
223
|
-
)}
|
|
224
|
-
{isVideoMuted && (
|
|
225
|
-
<View style={[styles.svgContainerStyle, theme.icon.sm]}>
|
|
226
|
-
<VideoSlash color={theme.dark.error} />
|
|
227
|
-
</View>
|
|
228
|
-
)}
|
|
229
|
-
{!participantIsLocalParticipant && (
|
|
230
|
-
<View style={[styles.svgContainerStyle, theme.icon.sm]}>
|
|
231
|
-
<ArrowRight color={theme.dark.text_high_emphasis} />
|
|
232
|
-
</View>
|
|
233
|
-
)}
|
|
234
|
-
</View>
|
|
235
|
-
</Pressable>
|
|
236
|
-
);
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
const styles = StyleSheet.create({
|
|
240
|
-
backDropBackground: {
|
|
241
|
-
...StyleSheet.absoluteFillObject,
|
|
242
|
-
backgroundColor: theme.dark.overlay,
|
|
243
|
-
zIndex: Z_INDEX.IN_BACK,
|
|
244
|
-
},
|
|
245
|
-
content: {
|
|
246
|
-
zIndex: Z_INDEX.IN_FRONT,
|
|
247
|
-
backgroundColor: theme.dark.bars,
|
|
248
|
-
borderRadius: theme.rounded.md,
|
|
249
|
-
marginHorizontal: theme.margin.md,
|
|
250
|
-
},
|
|
251
|
-
header: {
|
|
252
|
-
flexDirection: 'row',
|
|
253
|
-
justifyContent: 'space-between',
|
|
254
|
-
alignItems: 'center',
|
|
255
|
-
paddingVertical: theme.padding.md,
|
|
256
|
-
},
|
|
257
|
-
leftHeaderElement: {
|
|
258
|
-
marginLeft: theme.margin.md,
|
|
259
|
-
},
|
|
260
|
-
headerText: {
|
|
261
|
-
...theme.fonts.bodyBold,
|
|
262
|
-
color: theme.dark.text_high_emphasis,
|
|
263
|
-
},
|
|
264
|
-
closePressable: {
|
|
265
|
-
padding: theme.padding.sm,
|
|
266
|
-
borderRadius: theme.rounded.xs,
|
|
267
|
-
marginRight: theme.margin.md,
|
|
268
|
-
backgroundColor: palette.grey800,
|
|
269
|
-
},
|
|
270
|
-
buttonGroup: {
|
|
271
|
-
flexDirection: 'row',
|
|
272
|
-
justifyContent: 'space-between',
|
|
273
|
-
paddingVertical: theme.padding.md,
|
|
274
|
-
paddingHorizontal: theme.padding.xs,
|
|
275
|
-
},
|
|
276
|
-
button: {
|
|
277
|
-
flex: 1,
|
|
278
|
-
backgroundColor: theme.dark.primary,
|
|
279
|
-
borderRadius: theme.rounded.lg,
|
|
280
|
-
padding: theme.padding.sm,
|
|
281
|
-
marginHorizontal: theme.margin.sm,
|
|
282
|
-
},
|
|
283
|
-
buttonText: {
|
|
284
|
-
textAlign: 'center',
|
|
285
|
-
color: theme.dark.static_white,
|
|
286
|
-
...theme.fonts.subtitleBold,
|
|
287
|
-
},
|
|
288
|
-
participant: {
|
|
289
|
-
paddingHorizontal: theme.padding.sm,
|
|
290
|
-
paddingVertical: theme.padding.xs,
|
|
291
|
-
flexDirection: 'row',
|
|
292
|
-
alignItems: 'center',
|
|
293
|
-
justifyContent: 'space-between',
|
|
294
|
-
borderBottomColor: theme.dark.borders,
|
|
295
|
-
borderBottomWidth: 1,
|
|
296
|
-
},
|
|
297
|
-
participantInfo: {
|
|
298
|
-
flexDirection: 'row',
|
|
299
|
-
alignItems: 'center',
|
|
300
|
-
flexShrink: 1,
|
|
301
|
-
},
|
|
302
|
-
name: {
|
|
303
|
-
marginLeft: theme.margin.sm,
|
|
304
|
-
color: theme.dark.text_high_emphasis,
|
|
305
|
-
flexShrink: 1,
|
|
306
|
-
...theme.fonts.subtitleBold,
|
|
307
|
-
},
|
|
308
|
-
icons: {
|
|
309
|
-
flexDirection: 'row',
|
|
310
|
-
},
|
|
311
|
-
svgContainerStyle: {
|
|
312
|
-
marginLeft: theme.margin.sm,
|
|
313
|
-
},
|
|
314
|
-
modal: {
|
|
315
|
-
alignItems: 'center',
|
|
316
|
-
justifyContent: 'center',
|
|
317
|
-
backgroundColor: theme.dark.overlay,
|
|
318
|
-
},
|
|
319
|
-
});
|