chore: url parsing stuff for later when I have time

This commit is contained in:
Adrian Castro
2024-04-01 18:20:56 +02:00
parent 2399926cbc
commit 30e52c2b72
4 changed files with 21 additions and 12 deletions

View File

@@ -1,10 +1,3 @@
import { LogBox } from "react-native";
import "expo-router/entry"; import "expo-router/entry";
import "react-native-gesture-handler"; import "react-native-gesture-handler";
import "@react-native-anywhere/polyfill-base64"; import "@react-native-anywhere/polyfill-base64";
LogBox.ignoreLogs([
/Couldn't determine the version of the native part of Reanimated/,
/Cannot update a component/,
]);

View File

@@ -1,6 +1,7 @@
import { Platform } from "react-native"; import { Platform } from "react-native";
import * as Haptics from "expo-haptics"; import * as Haptics from "expo-haptics";
import { Tabs } from "expo-router"; import * as Linking from "expo-linking";
import { Tabs, useRouter } from "expo-router";
import * as ScreenOrientation from "expo-screen-orientation"; import * as ScreenOrientation from "expo-screen-orientation";
import { useTheme, View } from "tamagui"; import { useTheme, View } from "tamagui";
@@ -11,6 +12,21 @@ import TabBarIcon from "~/components/TabBarIcon";
export default function TabLayout() { export default function TabLayout() {
const theme = useTheme(); const theme = useTheme();
// const url = Linking.useURL();
// const router = useRouter();
//
// if (url) {
// const { hostname, queryParams } = Linking.parse(url);
//
// switch (hostname) {
// case "media":
// return router.push({
// pathname: "/videoPlayer",
// params: { data: JSON.stringify(queryParams) }
// });
// }
// }
return ( return (
<Tabs <Tabs
sceneContainerStyle={{ sceneContainerStyle={{

View File

@@ -16,7 +16,7 @@ export default function VideoPlayerWrapper() {
const params = useLocalSearchParams(); const params = useLocalSearchParams();
const data = params.data const data = params.data
? (JSON.parse(params.data as string) as ItemData) ? (JSON.parse(params.data as string) as Partial<ItemData>)
: undefined; : undefined;
const media = params.media const media = params.media
? (JSON.parse(params.media as string) as ScrapeMedia) ? (JSON.parse(params.media as string) as ScrapeMedia)

View File

@@ -27,7 +27,7 @@ import { usePlayerStore } from "~/stores/player/store";
import { ScrapeCard, ScrapeItem } from "./ScrapeCard"; import { ScrapeCard, ScrapeItem } from "./ScrapeCard";
interface ScraperProcessProps { interface ScraperProcessProps {
data?: ItemData; data?: Partial<ItemData>;
media?: ScrapeMedia; media?: ScrapeMedia;
download?: boolean; download?: boolean;
} }
@@ -53,12 +53,12 @@ export const ScraperProcess = ({
useEffect(() => { useEffect(() => {
const fetchData = async () => { const fetchData = async () => {
if (!data && !media) return router.back(); if (!data?.id && !media) return router.back();
let streamResult: RunOutput | null = null; let streamResult: RunOutput | null = null;
let meta: PlayerMeta | undefined = undefined; let meta: PlayerMeta | undefined = undefined;
if (!media && data) { if (!media && data?.id && data.type) {
meta = await convertIdToMeta(data.id, data.type); meta = await convertIdToMeta(data.id, data.type);
if (!meta) return router.back(); if (!meta) return router.back();
} }