feat: skip intro

Added skip intro logic
Updated control button to take an icon or text

Signed-off-by: Lance Chant <13349722+lancechant@users.noreply.github.com>
This commit is contained in:
Lance Chant
2026-01-27 09:01:32 +02:00
parent 44caf4b1ff
commit 715daf1635
2 changed files with 30 additions and 2 deletions

View File

@@ -4,12 +4,14 @@ import {
Pressable,
Animated as RNAnimated,
StyleSheet,
Text,
type View,
} from "react-native";
import { useTVFocusAnimation } from "./hooks/useTVFocusAnimation";
export interface TVControlButtonProps {
icon: keyof typeof Ionicons.glyphMap;
icon?: keyof typeof Ionicons.glyphMap;
text?: string;
onPress: () => void;
onLongPress?: () => void;
onPressOut?: () => void;
@@ -23,6 +25,7 @@ export interface TVControlButtonProps {
export const TVControlButton: FC<TVControlButtonProps> = ({
icon,
text,
onPress,
onLongPress,
onPressOut,
@@ -63,7 +66,11 @@ export const TVControlButton: FC<TVControlButtonProps> = ({
},
]}
>
<Ionicons name={icon} size={size} color='#fff' />
{text ? (
<Text style={[styles.text, { fontSize: size * 0.4 }]}>{text}</Text>
) : (
<Ionicons name={icon!} size={size} color='#fff' />
)}
</RNAnimated.View>
</Pressable>
);
@@ -78,4 +85,9 @@ const styles = StyleSheet.create({
justifyContent: "center",
alignItems: "center",
},
text: {
color: "#fff",
fontWeight: "600",
textAlign: "center",
},
});

View File

@@ -33,6 +33,7 @@ import { TVControlButton, TVNextEpisodeCountdown } from "@/components/tv";
import { TVFocusableProgressBar } from "@/components/tv/TVFocusableProgressBar";
import { useScaledTVTypography } from "@/constants/TVTypography";
import useRouter from "@/hooks/useAppRouter";
import { useIntroSkipper } from "@/hooks/useIntroSkipper";
import { usePlaybackManager } from "@/hooks/usePlaybackManager";
import { useTrickplay } from "@/hooks/useTrickplay";
import { useTVOptionModal } from "@/hooks/useTVOptionModal";
@@ -375,6 +376,15 @@ export const Controls: FC<Props> = ({
isSeeking,
});
const { showSkipButton, skipIntro } = useIntroSkipper(
item.Id!,
currentTime,
seek,
_play,
false,
api,
);
const getFinishTime = () => {
const now = new Date();
const finishTime = new Date(now.getTime() + remainingTime);
@@ -1045,6 +1055,12 @@ export const Controls: FC<Props> = ({
disabled={false || !nextItem}
size={28}
/>
<TVControlButton
text='skip intro'
onPress={skipIntro}
disabled={!showSkipButton}
size={28}
/>
<View style={styles.controlButtonsSpacer} />