From 058ee84a2ab2fb05d757ca92b885e5066b1de333 Mon Sep 17 00:00:00 2001 From: tapframe Date: Thu, 4 Sep 2025 17:26:21 +0530 Subject: [PATCH] some minor fixes --- src/components/player/AndroidVideoPlayer.tsx | 31 +++++------------ src/components/player/VideoPlayer.tsx | 20 ++++------- src/screens/StreamsScreen.tsx | 36 +++++++++++--------- 3 files changed, 34 insertions(+), 53 deletions(-) diff --git a/src/components/player/AndroidVideoPlayer.tsx b/src/components/player/AndroidVideoPlayer.tsx index 6cbc6dc1..13c099ce 100644 --- a/src/components/player/AndroidVideoPlayer.tsx +++ b/src/components/player/AndroidVideoPlayer.tsx @@ -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 }); } }); diff --git a/src/components/player/VideoPlayer.tsx b/src/components/player/VideoPlayer.tsx index d65ad6b8..2689a419 100644 --- a/src/components/player/VideoPlayer.tsx +++ b/src/components/player/VideoPlayer.tsx @@ -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 }); } }; diff --git a/src/screens/StreamsScreen.tsx b/src/screens/StreamsScreen.tsx index 2e8f0e8e..29582828 100644 --- a/src/screens/StreamsScreen.tsx +++ b/src/screens/StreamsScreen.tsx @@ -1519,24 +1519,26 @@ export const StreamsScreen = () => { /> - - - - - {type === 'series' ? 'Back to Episodes' : 'Back to Info'} - - - + + + + {type === 'series' ? 'Back to Episodes' : 'Back to Info'} + + + + )} {type === 'movie' && metadata && (