feat: download history

This commit is contained in:
Adrian Castro
2024-03-20 19:32:39 +01:00
parent bc9116237f
commit fe93b9a92f
3 changed files with 49 additions and 8 deletions

View File

@@ -5,7 +5,7 @@ import ContextMenu from "react-native-context-menu-view";
import { useRouter } from "expo-router";
import { Image, Text, View } from "tamagui";
// import { useDownloadManager } from "~/hooks/DownloadManagerContext";
import { useDownloadManager } from "~/hooks/DownloadManagerContext";
import { usePlayerStore } from "~/stores/player/store";
export interface ItemData {
@@ -19,7 +19,7 @@ export interface ItemData {
export default function Item({ data }: { data: ItemData }) {
const resetVideo = usePlayerStore((state) => state.resetVideo);
const router = useRouter();
// const { startDownload } = useDownloadManager();
const { startDownload } = useDownloadManager();
const { title, type, year, posterUrl } = data;
@@ -41,10 +41,10 @@ export default function Item({ data }: { data: ItemData }) {
e: NativeSyntheticEvent<ContextMenuOnPressNativeEvent>,
) => {
console.log(e.nativeEvent.name);
// startDownload(
// "https://samplelib.com/lib/preview/mp4/sample-5s.mp4",
// "mp4",
// ).catch(console.error);
startDownload(
"https://samplelib.com/lib/preview/mp4/sample-5s.mp4",
"mp4",
).catch(console.error);
};
return (