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

Miha/Kevin Audio Download/Delete #35

Open
wants to merge 29 commits into
base: main
Choose a base branch
from

Conversation

miha-bhaskaran
Copy link
Contributor

@miha-bhaskaran miha-bhaskaran commented Apr 9, 2023

🎉 What's new in this PR 🎉

Audio can now be downloaded to Expo File System and deleted from the File System.

☁️ ☁️ Description ☁️ ☁️

With the audio ID, audio will be downloaded from Firebase into the Expo File System. We have also implemented a delete function that will delete the audio from the File System using the deleteAsync function that takes in the Audio's ID that needs to be deleted.

Screenshots 📲

⚡ How to review ⚡

We tested this by integrating Audio Demo into the play screen. There, you can input any valid audio ID from cs-firebase and on terminal you should get log info messages that let you know if the audio exists in FileSystema and if its deleted. We set it up so that after an ID is inputted, it will get downloaded and then immediately deleted. These should be console logged to terminal to show if it exists or not.

Screenshot 2023-04-17 at 4 51 54 PM

🌱 Next steps 🌱

Relevant Links 🔗

Expo File System Documentation: https://docs.expo.dev/versions/latest/sdk/filesystem/#saf-uri

Online sources ℹ️

Related PRs 🙌

CC: @davidqing6432

Copy link
Collaborator

@davidqing6432 davidqing6432 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to merge!

const audios = await downLoadAudio(audio_id);
const didItDownload = await getInfoAsync(audios);
// eslint-disable-next-line no-console
console.log(didItDownload);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isDownloaded instead

console.log(didItDownload);

deleteAudio(audios);
const didItDelete = await getInfoAsync(audios);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isDeleted instead


export default function QueriesDemo() {
const [audio] = useState<Audio[]>([]);
// eslint-disable-next-line camelcase
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to camelcase

import { Button, Text, TextInput, View } from 'react-native';
import { getInfoAsync } from 'expo-file-system';
import { Audio } from '../types/schema';
// import { getAllAudio, getAudioID } from './queries/audioQueries';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we shouldn't be using an audio demos file, move this elsewhere or delete the file

console.log(didItDownload);

deleteAudio(audios);
const didItDelete = await getInfoAsync(audios);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isDeleted

yarn.lock Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should not have yarn; only use npm

App.tsx Outdated
import RootNavigation from './src/navigation/RootNavigator';
// import QueriesDemo from './src/firebase/QueriesDemo';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these should be removed

App.tsx Outdated
await SplashScreen.hideAsync();
}
}, [resourcesLoaded]);

return !resourcesLoaded ? null : (
<View style={styles.container} onLayout={onLayoutRootView}>
{/* <AudioDemos /> */}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

console.log(didItDelete);
};

// useEffect(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be removed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants