mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-01-11 20:10:25 +00:00
orientation lock removed
This commit is contained in:
parent
5a3ebe6c01
commit
d6af98c6d7
3 changed files with 10 additions and 22 deletions
|
|
@ -117,12 +117,16 @@ export const CollectionSection: React.FC<CollectionSectionProps> = ({
|
|||
};
|
||||
|
||||
// Sort collection movies by year (oldest to newest)
|
||||
// Upcoming/unreleased movies without a year will be sorted last
|
||||
const sortedCollectionMovies = React.useMemo(() => {
|
||||
if (!collectionMovies) return [];
|
||||
|
||||
const FUTURE_YEAR_PLACEHOLDER = 9999; // Very large number to sort unreleased movies last
|
||||
|
||||
return [...collectionMovies].sort((a, b) => {
|
||||
const yearA = a.year ? parseInt(a.year.toString()) : 0;
|
||||
const yearB = b.year ? parseInt(b.year.toString()) : 0;
|
||||
// Treat missing years as future year placeholder (sorts last)
|
||||
const yearA = a.year ? parseInt(a.year.toString()) : FUTURE_YEAR_PLACEHOLDER;
|
||||
const yearB = b.year ? parseInt(b.year.toString()) : FUTURE_YEAR_PLACEHOLDER;
|
||||
return yearA - yearB; // Oldest to newest
|
||||
});
|
||||
}, [collectionMovies]);
|
||||
|
|
|
|||
|
|
@ -405,19 +405,6 @@ const HomeScreen = () => {
|
|||
StatusBar.setBarStyle("light-content");
|
||||
StatusBar.setTranslucent(true);
|
||||
StatusBar.setBackgroundColor('transparent');
|
||||
|
||||
// Allow free rotation on tablets; lock portrait on phones
|
||||
try {
|
||||
// Use device physical characteristics, not current orientation
|
||||
const isTabletDevice = Platform.OS === 'ios'
|
||||
? (Platform as any).isPad === true
|
||||
: Math.min(windowWidth, Dimensions.get('screen').height) >= 768;
|
||||
if (isTabletDevice) {
|
||||
ScreenOrientation.unlockAsync();
|
||||
} else {
|
||||
ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.PORTRAIT_UP);
|
||||
}
|
||||
} catch {}
|
||||
|
||||
// For iOS specifically
|
||||
if (Platform.OS === 'ios') {
|
||||
|
|
@ -427,6 +414,9 @@ const HomeScreen = () => {
|
|||
|
||||
statusBarConfig();
|
||||
|
||||
// Unlock orientation to allow free rotation
|
||||
ScreenOrientation.unlockAsync().catch(() => {});
|
||||
|
||||
return () => {
|
||||
// Keep translucent when unfocusing to prevent layout shifts
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1076,15 +1076,10 @@ export const StreamsScreen = () => {
|
|||
}
|
||||
}, [settings.preferredPlayer, settings.useExternalPlayer, navigateToPlayer]);
|
||||
|
||||
// Ensure portrait when returning to this screen on iOS
|
||||
// Ensure proper rendering when returning to this screen
|
||||
useFocusEffect(
|
||||
useCallback(() => {
|
||||
if (Platform.OS === 'ios') {
|
||||
// Add delay before locking orientation to prevent background glitches
|
||||
const orientationTimer = setTimeout(() => {
|
||||
ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.PORTRAIT_UP).catch(() => {});
|
||||
}, 200); // Small delay to let the screen render properly
|
||||
|
||||
// iOS-specific: Force a re-render to prevent background glitches
|
||||
// This helps ensure the background is properly rendered when returning from player
|
||||
const renderTimer = setTimeout(() => {
|
||||
|
|
@ -1093,7 +1088,6 @@ export const StreamsScreen = () => {
|
|||
}, 100);
|
||||
|
||||
return () => {
|
||||
clearTimeout(orientationTimer);
|
||||
clearTimeout(renderTimer);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue