Compare commits

...

1 Commits

Author SHA1 Message Date
Lance Chant
715daf1635 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>
2026-01-27 09:01:32 +02:00
2 changed files with 30 additions and 2 deletions

View File

@@ -4,12 +4,14 @@ import {
Pressable, Pressable,
Animated as RNAnimated, Animated as RNAnimated,
StyleSheet, StyleSheet,
Text,
type View, type View,
} from "react-native"; } from "react-native";
import { useTVFocusAnimation } from "./hooks/useTVFocusAnimation"; import { useTVFocusAnimation } from "./hooks/useTVFocusAnimation";
export interface TVControlButtonProps { export interface TVControlButtonProps {
icon: keyof typeof Ionicons.glyphMap; icon?: keyof typeof Ionicons.glyphMap;
text?: string;
onPress: () => void; onPress: () => void;
onLongPress?: () => void; onLongPress?: () => void;
onPressOut?: () => void; onPressOut?: () => void;
@@ -23,6 +25,7 @@ export interface TVControlButtonProps {
export const TVControlButton: FC<TVControlButtonProps> = ({ export const TVControlButton: FC<TVControlButtonProps> = ({
icon, icon,
text,
onPress, onPress,
onLongPress, onLongPress,
onPressOut, 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> </RNAnimated.View>
</Pressable> </Pressable>
); );
@@ -78,4 +85,9 @@ const styles = StyleSheet.create({
justifyContent: "center", justifyContent: "center",
alignItems: "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 { TVFocusableProgressBar } from "@/components/tv/TVFocusableProgressBar";
import { useScaledTVTypography } from "@/constants/TVTypography"; import { useScaledTVTypography } from "@/constants/TVTypography";
import useRouter from "@/hooks/useAppRouter"; import useRouter from "@/hooks/useAppRouter";
import { useIntroSkipper } from "@/hooks/useIntroSkipper";
import { usePlaybackManager } from "@/hooks/usePlaybackManager"; import { usePlaybackManager } from "@/hooks/usePlaybackManager";
import { useTrickplay } from "@/hooks/useTrickplay"; import { useTrickplay } from "@/hooks/useTrickplay";
import { useTVOptionModal } from "@/hooks/useTVOptionModal"; import { useTVOptionModal } from "@/hooks/useTVOptionModal";
@@ -375,6 +376,15 @@ export const Controls: FC<Props> = ({
isSeeking, isSeeking,
}); });
const { showSkipButton, skipIntro } = useIntroSkipper(
item.Id!,
currentTime,
seek,
_play,
false,
api,
);
const getFinishTime = () => { const getFinishTime = () => {
const now = new Date(); const now = new Date();
const finishTime = new Date(now.getTime() + remainingTime); const finishTime = new Date(now.getTime() + remainingTime);
@@ -1045,6 +1055,12 @@ export const Controls: FC<Props> = ({
disabled={false || !nextItem} disabled={false || !nextItem}
size={28} size={28}
/> />
<TVControlButton
text='skip intro'
onPress={skipIntro}
disabled={!showSkipButton}
size={28}
/>
<View style={styles.controlButtonsSpacer} /> <View style={styles.controlButtonsSpacer} />