some minor fixes

This commit is contained in:
tapframe 2025-09-04 17:26:21 +05:30
parent e8d7eab2e4
commit 058ee84a2a
3 changed files with 34 additions and 53 deletions

View file

@ -807,18 +807,12 @@ const AndroidVideoPlayer: React.FC = () => {
}
disableImmersiveMode();
// For series, hard reset to maintain proper navigation stack with MetadataScreen
if (type === 'series' && id && episodeId) {
(navigation as any).reset({
index: 1,
routes: [
{ name: 'MainTabs' },
{ name: 'Metadata', params: { id, type } },
{ name: 'Streams', params: { id, type: 'series', episodeId, fromPlayer: true } }
]
});
// Simple back navigation (StreamsScreen should be below Player)
if ((navigation as any).canGoBack && (navigation as any).canGoBack()) {
(navigation as any).goBack();
} else {
navigation.goBack();
// Fallback to Streams if stack isn't present
(navigation as any).navigate('Streams', { id, type, episodeId, fromPlayer: true });
}
}).catch(() => {
// Fallback: still try to restore portrait then navigate
@ -829,18 +823,11 @@ const AndroidVideoPlayer: React.FC = () => {
}
disableImmersiveMode();
// For series, hard reset to maintain proper navigation stack with MetadataScreen
if (type === 'series' && id && episodeId) {
(navigation as any).reset({
index: 1,
routes: [
{ name: 'MainTabs' },
{ name: 'Metadata', params: { id, type } },
{ name: 'Streams', params: { id, type: 'series', episodeId, fromPlayer: true } }
]
});
// Simple back navigation fallback path
if ((navigation as any).canGoBack && (navigation as any).canGoBack()) {
(navigation as any).goBack();
} else {
navigation.goBack();
(navigation as any).navigate('Streams', { id, type, episodeId, fromPlayer: true });
}
});

View file

@ -848,27 +848,19 @@ const VideoPlayer: React.FC = () => {
// Disable immersive mode
disableImmersiveMode();
// Navigate back with proper handling for fullscreen modal
// Navigate back to previous screen (StreamsScreen expected to be below Player)
try {
// For series, hard reset to a single Streams route to avoid stacking multiple modals/pages
if (type === 'series' && id && episodeId) {
(navigation as any).reset({
index: 0,
routes: [
{ name: 'Streams', params: { id, type: 'series', episodeId, fromPlayer: true } }
]
});
} else if (navigation.canGoBack()) {
if (navigation.canGoBack()) {
navigation.goBack();
} else {
// Fallback: navigate to main tabs if can't go back
navigation.navigate('MainTabs');
// Fallback: navigate to Streams if stack was not set as expected
(navigation as any).navigate('Streams', { id, type, episodeId, fromPlayer: true });
}
logger.log('[VideoPlayer] Navigation completed');
} catch (navError) {
logger.error('[VideoPlayer] Navigation error:', navError);
// Last resort: try to navigate to home
navigation.navigate('MainTabs');
// Last resort: try to navigate to Streams
(navigation as any).navigate('Streams', { id, type, episodeId, fromPlayer: true });
}
};

View file

@ -1519,24 +1519,26 @@ export const StreamsScreen = () => {
/>
<Animated.View
entering={FadeIn.duration(300)}
style={[styles.backButtonContainer]}
>
<TouchableOpacity
style={[
styles.backButton,
Platform.OS === 'ios' ? { paddingTop: Math.max(insets.top, 12) + 6 } : null
]}
onPress={handleBack}
activeOpacity={0.7}
{Platform.OS !== 'ios' && (
<Animated.View
entering={FadeIn.duration(300)}
style={[styles.backButtonContainer]}
>
<MaterialIcons name="arrow-back" size={24} color={colors.white} />
<Text style={styles.backButtonText}>
{type === 'series' ? 'Back to Episodes' : 'Back to Info'}
</Text>
</TouchableOpacity>
</Animated.View>
<TouchableOpacity
style={[
styles.backButton,
Platform.OS === 'android' ? { paddingTop: 45 } : null
]}
onPress={handleBack}
activeOpacity={0.7}
>
<MaterialIcons name="arrow-back" size={24} color={colors.white} />
<Text style={styles.backButtonText}>
{type === 'series' ? 'Back to Episodes' : 'Back to Info'}
</Text>
</TouchableOpacity>
</Animated.View>
)}
{type === 'movie' && metadata && (
<Animated.View style={[styles.movieTitleContainer, heroStyle]}>