mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-01-15 15:48:05 +00:00
feat: Expo 54 (new arch) support + new in-house download module (#1174)
Signed-off-by: Lance Chant <13349722+lancechant@users.noreply.github.com> Co-authored-by: sarendsen <coding-mosses0z@icloud.com> Co-authored-by: Lance Chant <13349722+lancechant@users.noreply.github.com> Co-authored-by: Gauvain <68083474+Gauvino@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
154788cf91
commit
485dc6eeac
@@ -43,26 +43,60 @@ export const useIntroSkipper = (
|
||||
const introTimestamps = segments?.introSegments?.[0];
|
||||
|
||||
useEffect(() => {
|
||||
console.log(`[INTRO_SKIPPER] Hook state:`, {
|
||||
itemId,
|
||||
currentTime,
|
||||
hasSegments: !!segments,
|
||||
segments: segments,
|
||||
introSegmentsCount: segments?.introSegments?.length || 0,
|
||||
introSegments: segments?.introSegments,
|
||||
hasIntroTimestamps: !!introTimestamps,
|
||||
introTimestamps,
|
||||
isVlc,
|
||||
isOffline,
|
||||
});
|
||||
|
||||
if (introTimestamps) {
|
||||
setShowSkipButton(
|
||||
const shouldShow =
|
||||
currentTime > introTimestamps.startTime &&
|
||||
currentTime < introTimestamps.endTime,
|
||||
);
|
||||
currentTime < introTimestamps.endTime;
|
||||
|
||||
console.log(`[INTRO_SKIPPER] Button visibility check:`, {
|
||||
currentTime,
|
||||
introStart: introTimestamps.startTime,
|
||||
introEnd: introTimestamps.endTime,
|
||||
afterStart: currentTime > introTimestamps.startTime,
|
||||
beforeEnd: currentTime < introTimestamps.endTime,
|
||||
shouldShow,
|
||||
});
|
||||
|
||||
setShowSkipButton(shouldShow);
|
||||
} else {
|
||||
if (showSkipButton) {
|
||||
console.log(`[INTRO_SKIPPER] No intro timestamps, hiding button`);
|
||||
setShowSkipButton(false);
|
||||
}
|
||||
}
|
||||
}, [introTimestamps, currentTime]);
|
||||
}, [introTimestamps, currentTime, showSkipButton]);
|
||||
|
||||
const skipIntro = useCallback(() => {
|
||||
if (!introTimestamps) return;
|
||||
try {
|
||||
console.log(
|
||||
`[INTRO_SKIPPER] Skipping intro to:`,
|
||||
introTimestamps.endTime,
|
||||
);
|
||||
lightHapticFeedback();
|
||||
wrappedSeek(introTimestamps.endTime);
|
||||
setTimeout(() => {
|
||||
play();
|
||||
}, 200);
|
||||
} catch (error) {
|
||||
console.error("Error skipping intro", error);
|
||||
console.error("[INTRO_SKIPPER] Error skipping intro", error);
|
||||
}
|
||||
}, [introTimestamps, lightHapticFeedback, wrappedSeek, play]);
|
||||
|
||||
console.log(`[INTRO_SKIPPER] Returning state:`, { showSkipButton });
|
||||
|
||||
return { showSkipButton, skipIntro };
|
||||
};
|
||||
|
||||
@@ -66,8 +66,8 @@ const JELLYSEERR_USER = "JELLYSEERR_USER";
|
||||
const JELLYSEERR_COOKIES = "JELLYSEERR_COOKIES";
|
||||
|
||||
export const clearJellyseerrStorageData = () => {
|
||||
storage.delete(JELLYSEERR_USER);
|
||||
storage.delete(JELLYSEERR_COOKIES);
|
||||
storage.remove(JELLYSEERR_USER);
|
||||
storage.remove(JELLYSEERR_COOKIES);
|
||||
};
|
||||
|
||||
export enum Endpoints {
|
||||
|
||||
@@ -1,7 +1,23 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { Platform } from "react-native";
|
||||
import * as ScreenOrientation from "@/packages/expo-screen-orientation";
|
||||
import orientationToOrientationLock from "@/utils/OrientationLockConverter";
|
||||
import { OrientationLock } from "@/packages/expo-screen-orientation";
|
||||
import { Orientation } from "../packages/expo-screen-orientation.tv";
|
||||
|
||||
const orientationToOrientationLock = (
|
||||
orientation: Orientation,
|
||||
): OrientationLock => {
|
||||
switch (orientation) {
|
||||
case Orientation.LANDSCAPE_LEFT:
|
||||
return OrientationLock.LANDSCAPE_LEFT;
|
||||
case Orientation.LANDSCAPE_RIGHT:
|
||||
return OrientationLock.LANDSCAPE_RIGHT;
|
||||
case Orientation.PORTRAIT_UP:
|
||||
return OrientationLock.PORTRAIT_UP;
|
||||
default:
|
||||
return OrientationLock.PORTRAIT_UP;
|
||||
}
|
||||
};
|
||||
|
||||
export const useOrientation = () => {
|
||||
const [orientation, setOrientation] = useState(
|
||||
@@ -29,5 +45,20 @@ export const useOrientation = () => {
|
||||
};
|
||||
}, []);
|
||||
|
||||
return { orientation, setOrientation };
|
||||
const lockOrientation = async (lock: OrientationLock) => {
|
||||
if (Platform.isTV) return;
|
||||
|
||||
if (lock === ScreenOrientation.OrientationLock.DEFAULT) {
|
||||
await ScreenOrientation.unlockAsync();
|
||||
} else {
|
||||
await ScreenOrientation.lockAsync(lock);
|
||||
}
|
||||
};
|
||||
|
||||
const unlockOrientation = async () => {
|
||||
if (Platform.isTV) return;
|
||||
await ScreenOrientation.unlockAsync();
|
||||
};
|
||||
|
||||
return { orientation, setOrientation, lockOrientation, unlockOrientation };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user