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();
if (Platform.OS === 'ios') {
// iOS: rebuild stack so Streams is presented as modal above Metadata
if (type === 'series' && id && episodeId) {
(navigation as any).reset({
index: 2,
routes: [
{ 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');
}
// 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 {
// Android: hard reset to avoid stacking multiple pages/modals
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();
}
navigation.goBack();
}
}).catch(() => {
// Fallback: still try to restore portrait then navigate
@ -822,34 +804,16 @@ const AndroidVideoPlayer: React.FC = () => {
}
disableImmersiveMode();
if (Platform.OS === 'ios') {
// iOS: rebuild stack so Streams is presented as modal above Metadata
if (type === 'series' && id && episodeId) {
(navigation as any).reset({
index: 2,
routes: [
{ 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');
}
// 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 {
// Android: hard reset to avoid stacking multiple pages/modals
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();
}
navigation.goBack();
}
});

View file

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