mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-04-21 00:32:04 +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)
|
// Sort collection movies by year (oldest to newest)
|
||||||
|
// Upcoming/unreleased movies without a year will be sorted last
|
||||||
const sortedCollectionMovies = React.useMemo(() => {
|
const sortedCollectionMovies = React.useMemo(() => {
|
||||||
if (!collectionMovies) return [];
|
if (!collectionMovies) return [];
|
||||||
|
|
||||||
|
const FUTURE_YEAR_PLACEHOLDER = 9999; // Very large number to sort unreleased movies last
|
||||||
|
|
||||||
return [...collectionMovies].sort((a, b) => {
|
return [...collectionMovies].sort((a, b) => {
|
||||||
const yearA = a.year ? parseInt(a.year.toString()) : 0;
|
// Treat missing years as future year placeholder (sorts last)
|
||||||
const yearB = b.year ? parseInt(b.year.toString()) : 0;
|
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
|
return yearA - yearB; // Oldest to newest
|
||||||
});
|
});
|
||||||
}, [collectionMovies]);
|
}, [collectionMovies]);
|
||||||
|
|
|
||||||
|
|
@ -405,19 +405,6 @@ const HomeScreen = () => {
|
||||||
StatusBar.setBarStyle("light-content");
|
StatusBar.setBarStyle("light-content");
|
||||||
StatusBar.setTranslucent(true);
|
StatusBar.setTranslucent(true);
|
||||||
StatusBar.setBackgroundColor('transparent');
|
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
|
// For iOS specifically
|
||||||
if (Platform.OS === 'ios') {
|
if (Platform.OS === 'ios') {
|
||||||
|
|
@ -427,6 +414,9 @@ const HomeScreen = () => {
|
||||||
|
|
||||||
statusBarConfig();
|
statusBarConfig();
|
||||||
|
|
||||||
|
// Unlock orientation to allow free rotation
|
||||||
|
ScreenOrientation.unlockAsync().catch(() => {});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
// Keep translucent when unfocusing to prevent layout shifts
|
// Keep translucent when unfocusing to prevent layout shifts
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1076,15 +1076,10 @@ export const StreamsScreen = () => {
|
||||||
}
|
}
|
||||||
}, [settings.preferredPlayer, settings.useExternalPlayer, navigateToPlayer]);
|
}, [settings.preferredPlayer, settings.useExternalPlayer, navigateToPlayer]);
|
||||||
|
|
||||||
// Ensure portrait when returning to this screen on iOS
|
// Ensure proper rendering when returning to this screen
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
if (Platform.OS === 'ios') {
|
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
|
// iOS-specific: Force a re-render to prevent background glitches
|
||||||
// This helps ensure the background is properly rendered when returning from player
|
// This helps ensure the background is properly rendered when returning from player
|
||||||
const renderTimer = setTimeout(() => {
|
const renderTimer = setTimeout(() => {
|
||||||
|
|
@ -1093,7 +1088,6 @@ export const StreamsScreen = () => {
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
clearTimeout(orientationTimer);
|
|
||||||
clearTimeout(renderTimer);
|
clearTimeout(renderTimer);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue