Skip to content

Commit

Permalink
Code cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
Husamui committed Mar 15, 2024
1 parent 5e56674 commit 65451ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 143 deletions.
122 changes: 4 additions & 118 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -1,116 +1,10 @@
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
*/
import Daily, {
DailyEvent,
DailyCall,
DailyEventObject,
DailyEventObjectAppMessage,
} from '@daily-co/react-native-daily-js';
import React from 'react';
import { Button, SafeAreaView } from 'react-native';

import React, {useEffect, useState} from 'react';
import type {PropsWithChildren} from 'react';
import {
Button,
SafeAreaView,
ScrollView,
StatusBar,
StyleSheet,
Text,
useColorScheme,
View,
} from 'react-native';

import {
Colors,
DebugInstructions,
Header,
LearnMoreLinks,
ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';
import {useVapi} from './useVapi';

type SectionProps = PropsWithChildren<{
title: string;
}>;

function Section({children, title}: SectionProps): React.JSX.Element {
const isDarkMode = useColorScheme() === 'dark';
return (
<View style={styles.sectionContainer}>
<Text
style={[
styles.sectionTitle,
{
color: isDarkMode ? Colors.white : Colors.black,
},
]}>
{title}
</Text>
<Text
style={[
styles.sectionDescription,
{
color: isDarkMode ? Colors.light : Colors.dark,
},
]}>
{children}
</Text>
</View>
);
}

enum AppState {
Idle,
Creating,
Joining,
Joined,
Leaving,
Error,
}
import { useVapi } from './useVapi';

function App(): React.JSX.Element {
const {toggleCall, joinCall} = useVapi();

// const [appState, setAppState] = useState(AppState.Idle);
// const [roomUrl, setRoomUrl] = useState<string | undefined>(undefined);
// const [roomCreateError, setRoomCreateError] = useState<boolean>(false);
// const [callObject, setCallObject] = useState<DailyCall | null>(null);
// const [roomUrlFieldValue, setRoomUrlFieldValue] = useState<
// string | undefined
// >(undefined);

// useEffect(() => {
// if (!callObject || !roomUrl) {
// return;
// }
// callObject.join({url: roomUrl}).catch(_ => {
// // Doing nothing here since we handle fatal join errors in another way,
// // via our listener attached to the 'error' event
// });
// setAppState(AppState.Joining);
// }, [callObject, roomUrl]);

// /**
// * Create the callObject as soon as we have a roomUrl.
// * This will trigger the call starting.
// */
// useEffect(() => {
// if (!roomUrl) {
// return;
// }
// const newCallObject = Daily.createCallObject({
// /*dailyConfig: {
// // Point to a specific version of the call-machine bundle
// // @ts-ignore
// callObjectBundleUrlOverride: 'https://b.staging.daily.co/call-ui/0a8807ac0fc0147c996b6db8d8b4c17f640dcd47/static/call-machine-object-bundle.js'
// }*/
// });
// setCallObject(newCallObject);
// }, [roomUrl]);
const { toggleCall } = useVapi();

return (
<SafeAreaView>
Expand All @@ -121,14 +15,6 @@ function App(): React.JSX.Element {
console.log('toggling call');
}}
/>
<Button
title="Join call"
onPress={() => {
joinCall().then(() => {
console.log('joined the call call');
});
}}
/>
</SafeAreaView>
);
}
Expand Down
25 changes: 0 additions & 25 deletions vapiMedia.tsx

This file was deleted.

0 comments on commit 65451ff

Please sign in to comment.