Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(design-v2): call recording flow #1535

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
c5a7182
feat: add call duration badge and hangup call button
kristian-mkd Oct 15, 2024
ac283e7
feat: add icons and foundation for the top left call controls
kristian-mkd Oct 15, 2024
49b6c58
feat: call top component updates, still work in progress
kristian-mkd Oct 15, 2024
3d8bdcc
feat: configurable duration badge
kristian-mkd Oct 16, 2024
a0f2ba3
Merge branch 'PBE-5855-feat/react-native-video-design-v2' into PBE-58…
kristian-mkd Oct 16, 2024
5e1b3ba
Merge branch 'PBE-5855-feat/react-native-video-design-v2' into PBE-58…
kristian-mkd Oct 16, 2024
1282dd8
feat: network and speech status indicators
kristian-mkd Oct 16, 2024
9b16cc7
chore: move top call components to dogfood app
kristian-mkd Oct 17, 2024
81d0241
chore: code cleanup
kristian-mkd Oct 17, 2024
7dfa473
chore: additional clean up
kristian-mkd Oct 17, 2024
e77d38c
lint: fix reported issues
kristian-mkd Oct 17, 2024
98e742e
feat: add call duration observable in the call state
kristian-mkd Oct 18, 2024
c7399e6
feat(design-v2): adds layout switcher components
kristian-mkd Oct 19, 2024
1b773c0
fix: self code review improvements
kristian-mkd Oct 19, 2024
8220903
feat: add layout context and fix layout icons
kristian-mkd Oct 21, 2024
6cf8e8f
Merge branch 'PBE-5855-feat/react-native-video-design-v2' into PBE-58…
kristian-mkd Oct 22, 2024
6e37dfb
Merge branch 'PBE-5858-call-scene-container' into add-layout-switcher
kristian-mkd Oct 22, 2024
32f94a3
fix: lint reported issues
kristian-mkd Oct 22, 2024
0129827
fix: lint reported issues
kristian-mkd Oct 22, 2024
62b6137
remove duration changes
kristian-mkd Oct 22, 2024
e352c1e
Merge branch 'PBE-5858-call-scene-container' into add-layout-switcher
kristian-mkd Oct 22, 2024
5de1920
fix: lint issue
kristian-mkd Oct 22, 2024
38141b9
fix: lint issues
kristian-mkd Oct 22, 2024
0903b30
fix: lint issues
kristian-mkd Oct 22, 2024
53b908a
fix: lint reported issues
kristian-mkd Oct 22, 2024
23c0554
Merge branch 'PBE-5858-call-scene-container' into add-layout-switcher
kristian-mkd Oct 22, 2024
7539bc6
fix: styling fixes for grid and spotlight layouts
kristian-mkd Oct 24, 2024
fba22f1
Merge branch 'PBE-5855-feat/react-native-video-design-v2' into add-la…
kristian-mkd Oct 24, 2024
2856a31
feat: add fullscreen layout
kristian-mkd Oct 25, 2024
af0c28c
fix: layout improvements
kristian-mkd Oct 25, 2024
cdd2fdd
fix: top controls not sent to activeCall
kristian-mkd Oct 25, 2024
5acff28
fix: lint issues
kristian-mkd Oct 25, 2024
3dbee17
feat: add end recording modal
kristian-mkd Oct 25, 2024
094e60b
feat: call recording flow without consent
kristian-mkd Oct 26, 2024
95d64af
lint: fix issues
kristian-mkd Oct 26, 2024
4324c10
fix: build issues
kristian-mkd Oct 26, 2024
5a0a71a
Merge branch 'add-layout-switcher' into rn-design-v2-record-call-flow
kristian-mkd Oct 26, 2024
518ae32
fix: lint and build issues
kristian-mkd Oct 26, 2024
66f997e
fix: active call props
kristian-mkd Oct 26, 2024
d882e27
fix: onHangupCallHandler in TopControls
kristian-mkd Oct 26, 2024
7eaa092
chore: revert mocks
kristian-mkd Oct 29, 2024
55a63e4
Merge branch 'PBE-5855-feat/react-native-video-design-v2' into add-la…
kristian-mkd Oct 29, 2024
c5b8a62
chore: extract useToggleCallRecording in separate hooks file
kristian-mkd Oct 29, 2024
98b565e
lint: fix imports
kristian-mkd Oct 29, 2024
5e27b61
Merge branch 'PBE-5855-feat/react-native-video-design-v2' into add-la…
kristian-mkd Oct 30, 2024
d8a5739
Merge branch 'add-layout-switcher' into rn-design-v2-record-call-flow
kristian-mkd Oct 30, 2024
cbf53ac
chore: update docs
kristian-mkd Oct 31, 2024
eb516a3
chore: remove commented out code
kristian-mkd Oct 31, 2024
acb5bde
Merge branch 'PBE-5855-feat/react-native-video-design-v2' into rn-des…
kristian-mkd Nov 1, 2024
75b5997
Merge branch 'main' into PBE-5855-feat/react-native-video-design-v2
kristian-mkd Nov 1, 2024
cf88a29
Merge branch 'PBE-5855-feat/react-native-video-design-v2' into rn-des…
kristian-mkd Nov 1, 2024
2cebbba
Merge branch 'PBE-5855-feat/react-native-video-design-v2' into rn-des…
kristian-mkd Nov 1, 2024
b1ee2d8
fix: revert not needed changes
kristian-mkd Nov 1, 2024
f3415d7
fix: revert some more changes
kristian-mkd Nov 1, 2024
2b9233e
fix: useToggleCallRecording import
kristian-mkd Nov 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/react-bindings/src/hooks/callUtilHooks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useCallback, useEffect, useState } from 'react';
import { useCall } from '../contexts';
import { useIsCallRecordingInProgress } from './callStateHooks';

/**
* Custom hook for toggling call recording in a video call.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ id: call-top-view
title: CallTopView
---

import ParticipantsInfoBadge from '../../common-content/ui-components/call/call-content/participants-info-badge.mdx';
import OnBackPressed from '../../common-content/ui-components/call/call-content/on-back-pressed.mdx';
import OnParticipantInfoPress from '../../common-content/ui-components/call/call-content/on-participant-info-press.mdx';

Expand Down
6 changes: 3 additions & 3 deletions packages/react-native-sdk/src/theme/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ const colors: ColorScheme = {
iconAlertSuccess: '#00e2a1',
sheetPrimary: '#000000',
sheetOverlay: '#0c0d0ea6',
typePrimary: '#eff0f1',
typeSecondary: '#b0b4b7',
buttonSecondaryHover: '#323b44',

buttonPrimaryDisabled: '#1b2c43',
buttonPrimaryHover: '#4c8fff',
Expand All @@ -46,7 +49,6 @@ const colors: ColorScheme = {
buttonQuaternaryHover: '#e77b76',
buttonQuaternaryPressed: '#7d3535',
buttonSecondaryDisabled: '#1e262e29',
buttonSecondaryHover: '#323b44',
buttonSecondaryPressed: '#101213',
buttonSecondaryActiveDefault: '#005fff',
buttonSecondaryActiveHover: '#4c8fff',
Expand Down Expand Up @@ -76,9 +78,7 @@ const colors: ColorScheme = {
sheetTertiary: '#19232d',
typeAccent: '#00e2a1',
typeOnAccent: '#eff0f1',
typePrimary: '#eff0f1',
typeQuaternary: '#101213',
typeSecondary: '#b0b4b7',
typeTertiary: '#656b72',
};

Expand Down
43 changes: 33 additions & 10 deletions sample-apps/react-native/dogfood/src/components/ActiveCall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ import {
import { ActivityIndicator, StatusBar, StyleSheet, View } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import { ParticipantsInfoList } from './ParticipantsInfoList';
import {
CallControlsComponent,
BottomControlsProps,
} from './CallControlls/BottomControls';
import { BottomControls } from './CallControlls/BottomControls';
import { useOrientation } from '../hooks/useOrientation';
import { Z_INDEX } from '../constants';
import { TopControls } from './CallControlls/TopControls';
import { useLayout } from '../contexts/LayoutContext';
import { useToggleCallRecording } from '@stream-io/video-react-bindings';

type ActiveCallProps = BottomControlsProps & {
type ActiveCallProps = {
onHangupCallHandler?: () => void;
onCallEnded: () => void;
onChatOpenHandler: () => void;
unreadCountIndicator: number;
};

export const ActiveCall = ({
Expand All @@ -45,15 +45,38 @@ export const ActiveCall = ({
});
}, [call, onCallEnded]);

const CustomControlsComponent = useCallback(() => {
const { toggleCallRecording, isAwaitingResponse, isCallRecordingInProgress } =
useToggleCallRecording();

const CustomBottomControls = useCallback(() => {
return (
<CallControlsComponent
<BottomControls
onParticipantInfoPress={onOpenCallParticipantsInfo}
onChatOpenHandler={onChatOpenHandler}
unreadCountIndicator={unreadCountIndicator}
toggleCallRecording={toggleCallRecording}
isCallRecordingInProgress={isCallRecordingInProgress}
isAwaitingResponse={isAwaitingResponse}
/>
);
}, [
onChatOpenHandler,
onOpenCallParticipantsInfo,
unreadCountIndicator,
toggleCallRecording,
isAwaitingResponse,
isCallRecordingInProgress,
]);

const CustomTopControls = useCallback(() => {
return (
<TopControls
isAwaitingResponse={isAwaitingResponse}
isCallRecordingInProgress={isCallRecordingInProgress}
onHangupCallHandler={onHangupCallHandler}
/>
);
}, [onChatOpenHandler, onOpenCallParticipantsInfo, unreadCountIndicator]);
}, [isAwaitingResponse, isCallRecordingInProgress, onHangupCallHandler]);

if (!call) {
return <ActivityIndicator size={'large'} style={StyleSheet.absoluteFill} />;
Expand All @@ -71,8 +94,8 @@ export const ActiveCall = ({
<SafeAreaView style={styles.safeArea} edges={['top', 'left', 'right']}>
<CallContent
onHangupCallHandler={onHangupCallHandler}
CallTopView={TopControls}
CallControls={CustomControlsComponent}
CallTopView={CustomTopControls}
CallControls={CustomBottomControls}
landscape={currentOrientation === 'landscape'}
layout={selectedLayout}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,18 @@ export type BottomControlsProps = Pick<
onChatOpenHandler?: () => void;
onParticipantInfoPress?: () => void;
unreadCountIndicator?: number;
toggleCallRecording: () => Promise<void>;
isAwaitingResponse: boolean;
isCallRecordingInProgress: boolean;
};

export const CallControlsComponent = ({
export const BottomControls = ({
onChatOpenHandler,
unreadCountIndicator,
onParticipantInfoPress,
toggleCallRecording,
isAwaitingResponse,
isCallRecordingInProgress,
}: BottomControlsProps) => {
const { useMicrophoneState } = useCallStateHooks();
const { isSpeakingWhileMuted } = useMicrophoneState();
Expand All @@ -46,7 +52,11 @@ export const CallControlsComponent = ({
<AudioButton />
<ToggleAudioPublishingButton />
<ToggleVideoPublishingButton />
<RecordCallButton />
<RecordCallButton
toggleCallRecording={toggleCallRecording}
isAwaitingResponse={isAwaitingResponse}
isCallRecordingInProgress={isCallRecordingInProgress}
/>
</View>
<View style={styles.right}>
<ParticipantsButton onParticipantInfoPress={onParticipantInfoPress} />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
import { useTheme } from '@stream-io/video-react-native-sdk';
import { IconWrapper } from '@stream-io/video-react-native-sdk/src/icons';
import { RecordCall } from '@stream-io/video-react-native-sdk/src/icons/RecordCall';
import React, { useMemo } from 'react';
import {
Modal,
View,
Text,
TouchableOpacity,
TouchableWithoutFeedback,
StyleSheet,
} from 'react-native';

interface CallRecordingModalProps {
visible: boolean;
isLoading: boolean;
onCancel: () => void;
onConfirm: () => void;
message: string;
title: string;
confirmButton: string;
cancelButton: string;
isEndRecordingModal: boolean;
}

export const CallRecordingModal: React.FC<CallRecordingModalProps> = ({
visible,
isLoading,
onCancel,
onConfirm,
message,
title,
confirmButton,
cancelButton,
isEndRecordingModal,
}) => {
const styles = useStyles(isEndRecordingModal);
const {
theme: { colors, variants },
} = useTheme();

return (
<Modal
animationType="fade"
transparent={true}
visible={visible}
onRequestClose={onCancel}
>
<TouchableWithoutFeedback onPress={onCancel}>
<View style={styles.overlay}>
<View style={styles.modalView}>
<View style={styles.content}>
<View style={styles.headerContainer}>
<View style={styles.iconContainer}>
<IconWrapper>
<RecordCall
color={colors.iconAlertWarning}
size={variants.roundButtonSizes.sm}
/>
</IconWrapper>
</View>
<Text style={styles.title}>{title}</Text>
</View>
<Text style={styles.message}>{message}</Text>
</View>
<View style={styles.buttonContainer}>
<TouchableOpacity
style={[styles.button, styles.cancelButton]}
onPress={onCancel}
>
<Text style={styles.buttonText}>{cancelButton}</Text>
</TouchableOpacity>
<TouchableOpacity
style={[styles.button, styles.confirmButton]}
onPress={onConfirm}
>
{isLoading ? (
<IconWrapper>
<Text style={styles.buttonText}>Loading...</Text>
</IconWrapper>
) : (
<Text style={styles.buttonText}>{confirmButton}</Text>
)}
</TouchableOpacity>
</View>
</View>
</View>
</TouchableWithoutFeedback>
</Modal>
);
};

const useStyles = (isEndRecordingModal: boolean) => {
const { theme } = useTheme();
return useMemo(
() =>
StyleSheet.create({
overlay: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
modalView: {
backgroundColor: theme.colors.sheetSecondary,
borderRadius: theme.variants.borderRadiusSizes.lg,
padding: theme.variants.spacingSizes.xl,
width: '80%',
maxWidth: 380,
},
content: {
marginBottom: theme.variants.spacingSizes.xl,
},
headerContainer: {
flexDirection: 'row',
alignItems: 'center',
marginBottom: theme.variants.spacingSizes.sm,
},
iconContainer: {
display: 'flex',
marginRight: theme.variants.spacingSizes.sm,
},
title: {
color: theme.colors.typePrimary,
fontSize: theme.variants.fontSizes.lg,
fontWeight: '600',
textAlign: 'center',
},
message: {
color: theme.colors.typeSecondary,
fontSize: theme.variants.fontSizes.md,
fontWeight: '400',
textAlign: 'left',
},
buttonContainer: {
flexDirection: 'row',
justifyContent: 'space-between',
gap: theme.variants.spacingSizes.md,
},
button: {
flex: 1,
borderRadius: theme.variants.roundButtonSizes.md,
justifyContent: 'center',
alignItems: 'center',
},
cancelButton: {
backgroundColor: theme.colors.sheetSecondary,
height: 32,
borderWidth: 1,
borderColor: theme.colors.buttonSecondaryHover,
},
confirmButton: {
height: 32,
backgroundColor: isEndRecordingModal
? theme.colors.iconAlertWarning
: theme.colors.buttonPrimaryDefault,
},
buttonText: {
color: 'white',
fontSize: 13,
fontWeight: '600',
},
}),
[theme, isEndRecordingModal],
);
};
Loading
Loading