This commit is contained in:
tapframe 2025-08-14 13:04:16 +05:30
parent f3f68c0ff6
commit 8b7109a529
2 changed files with 30 additions and 84 deletions

View file

@ -784,34 +784,16 @@ const AndroidVideoPlayer: React.FC = () => {
} }
disableImmersiveMode(); disableImmersiveMode();
if (Platform.OS === 'ios') { // For series, hard reset to a single Streams route to avoid stacking multiple modals/pages
// iOS: rebuild stack so Streams is presented as modal above Metadata if (type === 'series' && id && episodeId) {
if (type === 'series' && id && episodeId) { (navigation as any).reset({
(navigation as any).reset({ index: 0,
index: 2, routes: [
routes: [ { name: 'Streams', params: { id, type: 'series', episodeId, fromPlayer: true } }
{ name: 'MainTabs' }, ]
{ name: 'Metadata', params: { id, type } }, });
{ name: 'Streams', params: { id, type: 'series', episodeId, fromPlayer: true } }
]
});
} else if ((navigation as any).canGoBack()) {
(navigation as any).goBack();
} else {
(navigation as any).navigate('MainTabs');
}
} else { } else {
// Android: hard reset to avoid stacking multiple pages/modals navigation.goBack();
if (type === 'series' && id && episodeId) {
(navigation as any).reset({
index: 0,
routes: [
{ name: 'Streams', params: { id, type: 'series', episodeId, fromPlayer: true } }
]
});
} else {
(navigation as any).goBack();
}
} }
}).catch(() => { }).catch(() => {
// Fallback: still try to restore portrait then navigate // Fallback: still try to restore portrait then navigate
@ -822,34 +804,16 @@ const AndroidVideoPlayer: React.FC = () => {
} }
disableImmersiveMode(); disableImmersiveMode();
if (Platform.OS === 'ios') { // For series, hard reset to a single Streams route to avoid stacking multiple modals/pages
// iOS: rebuild stack so Streams is presented as modal above Metadata if (type === 'series' && id && episodeId) {
if (type === 'series' && id && episodeId) { (navigation as any).reset({
(navigation as any).reset({ index: 0,
index: 2, routes: [
routes: [ { name: 'Streams', params: { id, type: 'series', episodeId, fromPlayer: true } }
{ name: 'MainTabs' }, ]
{ name: 'Metadata', params: { id, type } }, });
{ name: 'Streams', params: { id, type: 'series', episodeId, fromPlayer: true } }
]
});
} else if ((navigation as any).canGoBack()) {
(navigation as any).goBack();
} else {
(navigation as any).navigate('MainTabs');
}
} else { } else {
// Android: hard reset to avoid stacking multiple pages/modals navigation.goBack();
if (type === 'series' && id && episodeId) {
(navigation as any).reset({
index: 0,
routes: [
{ name: 'Streams', params: { id, type: 'series', episodeId, fromPlayer: true } }
]
});
} else {
(navigation as any).goBack();
}
} }
}); });

View file

@ -828,37 +828,19 @@ const VideoPlayer: React.FC = () => {
// Navigate back with proper handling for fullscreen modal // Navigate back with proper handling for fullscreen modal
try { try {
// On iOS, ensure Streams shows the CURRENT episode as modal by navigating directly // For series, hard reset to a single Streams route to avoid stacking multiple modals/pages
if (Platform.OS === 'ios') { if (type === 'series' && id && episodeId) {
if (type === 'series' && id && episodeId) { (navigation as any).reset({
// Ensure modal by restoring MainTabs -> Metadata -> Streams index: 0,
(navigation as any).reset({ routes: [
index: 2, { name: 'Streams', params: { id, type: 'series', episodeId, fromPlayer: true } }
routes: [ ]
{ name: 'MainTabs' }, });
{ name: 'Metadata', params: { id, type } }, } else if (navigation.canGoBack()) {
{ name: 'Streams', params: { id, type: 'series', episodeId, fromPlayer: true } } navigation.goBack();
]
});
} else if (navigation.canGoBack()) {
navigation.goBack();
} else {
navigation.navigate('MainTabs');
}
} else { } else {
// Android: hard reset to avoid stacking multiple pages/modals // Fallback: navigate to main tabs if can't go back
if (type === 'series' && id && episodeId) { navigation.navigate('MainTabs');
(navigation as any).reset({
index: 0,
routes: [
{ name: 'Streams', params: { id, type: 'series', episodeId, fromPlayer: true } }
]
});
} else if (navigation.canGoBack()) {
navigation.goBack();
} else {
navigation.navigate('MainTabs');
}
} }
logger.log('[VideoPlayer] Navigation completed'); logger.log('[VideoPlayer] Navigation completed');
} catch (navError) { } catch (navError) {