fix(chromecast): resolve TypeScript errors and improve type safety

- Fix deviceName property to use friendlyName
- Update disconnect to use stop() instead of endSession()
- Fix null handling in getPosterUrl and useTrickplay
- Remove unused variables and imports
- Add proper null checks in segment skipping
- Disable auto-skip until settings are available
This commit is contained in:
Uruk
2026-01-19 22:13:54 +01:00
committed by Gauvain
parent 5e60b6c2f8
commit 71d922beeb
4 changed files with 19 additions and 21 deletions

View File

@@ -5,7 +5,6 @@
import { Ionicons } from "@expo/vector-icons";
import { Image } from "expo-image";
import { useRouter } from "expo-router";
import { useAtomValue } from "jotai";
import React, { useCallback, useMemo, useState } from "react";
import {
@@ -48,9 +47,8 @@ export const ChromecastPlayer: React.FC<ChromecastPlayerProps> = ({
visible,
onClose,
}) => {
const _router = useRouter();
const insets = useSafeAreaInsets();
const { height: screenHeight, width: screenWidth } = useWindowDimensions();
const { height: screenHeight } = useWindowDimensions();
const api = useAtomValue(apiAtom);
const {
@@ -58,9 +56,6 @@ export const ChromecastPlayer: React.FC<ChromecastPlayerProps> = ({
showControls,
currentItem,
nextItem,
castDevice,
play,
pause,
stop,
togglePlay,
seek,
@@ -75,11 +70,12 @@ export const ChromecastPlayer: React.FC<ChromecastPlayerProps> = ({
settings,
} = useChromecastPlayer();
const { segments, currentSegment, skipSegment, hasIntro, hasCredits } =
useChromecastSegments(currentItem, playerState.progress);
const { currentSegment, skipSegment } = useChromecastSegments(
currentItem,
playerState.progress,
);
const { trickPlayUrl, calculateTrickplayUrl, trickplayInfo } =
useTrickplay(currentItem);
const { calculateTrickplayUrl, trickplayInfo } = useTrickplay(currentItem!);
const [_showMenu, setShowMenu] = useState(false);
const [_showDeviceSheet, setShowDeviceSheet] = useState(false);