mirror of
https://github.com/movie-web/native-app.git
synced 2025-09-13 17:13:25 +00:00
feat: episode selection
This commit is contained in:
@@ -25,15 +25,25 @@ export default function LoadingScreenWrapper() {
|
||||
const data = params.data
|
||||
? (JSON.parse(params.data as string) as ItemData)
|
||||
: null;
|
||||
return <LoadingScreen sourceId={sourceId} data={data} />;
|
||||
const seasonData = params.seasonData
|
||||
? (JSON.parse(params.seasonData as string) as {
|
||||
season: number;
|
||||
episode: number;
|
||||
})
|
||||
: null;
|
||||
return (
|
||||
<LoadingScreen sourceId={sourceId} data={data} seasonData={seasonData} />
|
||||
);
|
||||
}
|
||||
|
||||
function LoadingScreen({
|
||||
sourceId,
|
||||
data,
|
||||
seasonData,
|
||||
}: {
|
||||
sourceId: string | undefined;
|
||||
data: ItemData | null;
|
||||
seasonData: { season: number; episode: number } | null;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [eventLog, setEventLog] = useState<Event[]>([]);
|
||||
@@ -60,8 +70,8 @@ function LoadingScreen({
|
||||
let episode: number | undefined;
|
||||
|
||||
if (type === "tv") {
|
||||
// season = <chosen by user / continue watching> ?? undefined;
|
||||
// episode = <chosen by user / continue watching> ?? undefined;
|
||||
season = seasonData?.season ?? undefined;
|
||||
episode = seasonData?.episode ?? undefined;
|
||||
}
|
||||
|
||||
const scrapeMedia = transformSearchResultToScrapeMedia(
|
||||
@@ -100,7 +110,7 @@ function LoadingScreen({
|
||||
};
|
||||
|
||||
void initialize();
|
||||
}, [data, router, sourceId]);
|
||||
}, [data, router, seasonData?.episode, seasonData?.season, sourceId]);
|
||||
|
||||
return (
|
||||
<ScreenLayout
|
||||
|
@@ -14,7 +14,7 @@ export const SeasonEpisodeSelector = () => {
|
||||
const data = usePlayerStore((state) => state.interface.data);
|
||||
const seasonData = usePlayerStore((state) => state.interface.seasonData);
|
||||
const { isTrue, on, off } = useBoolean();
|
||||
const _router = useRouter();
|
||||
const router = useRouter();
|
||||
|
||||
return data?.type === "movie" || !seasonData ? null : (
|
||||
<View className="max-w-36 flex-1">
|
||||
@@ -44,10 +44,16 @@ export const SeasonEpisodeSelector = () => {
|
||||
title={episode.name}
|
||||
onPress={() => {
|
||||
off();
|
||||
// router.push({
|
||||
// pathname: "/videoPlayer/loading",
|
||||
// params: { sourceID: source.id, data: JSON.stringify(data) },
|
||||
// });
|
||||
router.push({
|
||||
pathname: "/videoPlayer/loading",
|
||||
params: {
|
||||
data: JSON.stringify(data),
|
||||
seasonData: JSON.stringify({
|
||||
season: seasonData.season_number,
|
||||
episode: episode.episode_number,
|
||||
}),
|
||||
},
|
||||
});
|
||||
}}
|
||||
className="max-w-16"
|
||||
/>
|
||||
|
Reference in New Issue
Block a user