mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-07-26 22:42:17 +00:00
Merge pull request #1567 from luqmanfadlli/fix-ios-collection-header
Fix(iOS): Collection Folder catalog filters being obstructed by the native iOS navigation bar
This commit is contained in:
commit
99d1cf345f
2 changed files with 44 additions and 22 deletions
|
|
@ -63,6 +63,7 @@ import com.nuvio.app.features.home.stableKey
|
|||
import com.nuvio.app.features.home.components.HomeCatalogRowSection
|
||||
import com.nuvio.app.features.watched.WatchedRepository
|
||||
import com.nuvio.app.features.watching.application.WatchingState
|
||||
import com.nuvio.app.navigation.LocalUseNativeNavigation
|
||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
import kotlinx.coroutines.flow.filter
|
||||
import kotlinx.coroutines.flow.map
|
||||
|
|
@ -86,6 +87,7 @@ fun FolderDetailScreen(
|
|||
WatchedRepository.uiState
|
||||
}.collectAsState()
|
||||
val folder = uiState.folder
|
||||
val useNativeNavigation = LocalUseNativeNavigation.current
|
||||
val coverImageUrl = folder?.coverImageUrl?.takeIf { it.isNotBlank() }
|
||||
val density = LocalDensity.current
|
||||
val statusBarTop = WindowInsets.statusBars.asPaddingValues().calculateTopPadding()
|
||||
|
|
@ -141,13 +143,15 @@ fun FolderDetailScreen(
|
|||
)
|
||||
}
|
||||
|
||||
NuvioScreenHeader(
|
||||
title = folder?.title ?: uiState.collectionTitle,
|
||||
modifier = Modifier.padding(horizontal = 16.dp),
|
||||
includeStatusBarPadding = coverImageUrl == null,
|
||||
topPadding = if (coverImageUrl != null) statusBarTop * heroCollapseFraction else null,
|
||||
onBack = onBack,
|
||||
)
|
||||
if (!useNativeNavigation) {
|
||||
NuvioScreenHeader(
|
||||
title = folder?.title ?: uiState.collectionTitle,
|
||||
modifier = Modifier.padding(horizontal = 16.dp),
|
||||
includeStatusBarPadding = coverImageUrl == null,
|
||||
topPadding = if (coverImageUrl != null) statusBarTop * heroCollapseFraction else null,
|
||||
onBack = onBack,
|
||||
)
|
||||
}
|
||||
|
||||
if (folder == null && !uiState.isLoading) {
|
||||
Box(
|
||||
|
|
|
|||
|
|
@ -102,19 +102,19 @@ final class RootComposeViewController: UIViewController {
|
|||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
setInteractiveContentPopGestureEnabled(false)
|
||||
configureBackGestures(isVisible: true)
|
||||
}
|
||||
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
super.viewDidAppear(animated)
|
||||
setInteractiveContentPopGestureEnabled(false)
|
||||
configureBackGestures(isVisible: true)
|
||||
if let tabBar = tabBarController?.tabBar {
|
||||
onTabBarAvailable?(tabBar)
|
||||
}
|
||||
}
|
||||
|
||||
override func viewWillDisappear(_ animated: Bool) {
|
||||
setInteractiveContentPopGestureEnabled(true)
|
||||
configureBackGestures(isVisible: false)
|
||||
super.viewWillDisappear(animated)
|
||||
}
|
||||
|
||||
|
|
@ -124,11 +124,12 @@ final class RootComposeViewController: UIViewController {
|
|||
setNeedsStatusBarAppearanceUpdate()
|
||||
}
|
||||
|
||||
private func setInteractiveContentPopGestureEnabled(_ enabled: Bool) {
|
||||
guard disablesInteractiveContentPopGesture else { return }
|
||||
private func configureBackGestures(isVisible: Bool) {
|
||||
if #available(iOS 26.0, *) {
|
||||
navigationController?.interactiveContentPopGestureRecognizer?.isEnabled = enabled
|
||||
navigationController?.interactiveContentPopGestureRecognizer?.isEnabled = false
|
||||
}
|
||||
navigationController?.interactivePopGestureRecognizer?.isEnabled =
|
||||
isVisible ? !disablesInteractiveContentPopGesture : true
|
||||
}
|
||||
|
||||
private func immersiveController(in controller: UIViewController?) -> UIViewController? {
|
||||
|
|
@ -700,7 +701,7 @@ struct DetailComposeView: UIViewControllerRepresentable {
|
|||
)
|
||||
return NuvioComposeHost.wrap(
|
||||
controller,
|
||||
disablesInteractiveContentPopGesture: true
|
||||
disablesInteractiveContentPopGesture: route is PlayerRoute
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -793,18 +794,35 @@ private struct DetailDestinationView: View {
|
|||
wrapper.route is DetailRoute || wrapper.route is StreamRoute
|
||||
}
|
||||
|
||||
private var respectsNativeNavigationSafeArea: Bool {
|
||||
wrapper.route is FolderDetailRoute
|
||||
}
|
||||
|
||||
private var hidesNativeNavigationBar: Bool {
|
||||
wrapper.route.hidesNavigationBar
|
||||
}
|
||||
|
||||
private var showsReadabilityFade: Bool {
|
||||
!wrapper.route.hidesNavigationBar && !usesComposeNavigationHeader
|
||||
!hidesNativeNavigationBar && !usesComposeNavigationHeader
|
||||
}
|
||||
|
||||
private var content: some View {
|
||||
ZStack(alignment: .top) {
|
||||
DetailComposeView(
|
||||
route: wrapper.route,
|
||||
coordinator: coordinator,
|
||||
appCoordinator: appCoordinator
|
||||
)
|
||||
.ignoresSafeArea(.all)
|
||||
if respectsNativeNavigationSafeArea {
|
||||
DetailComposeView(
|
||||
route: wrapper.route,
|
||||
coordinator: coordinator,
|
||||
appCoordinator: appCoordinator
|
||||
)
|
||||
.ignoresSafeArea(.all, edges: [.horizontal, .bottom])
|
||||
} else {
|
||||
DetailComposeView(
|
||||
route: wrapper.route,
|
||||
coordinator: coordinator,
|
||||
appCoordinator: appCoordinator
|
||||
)
|
||||
.ignoresSafeArea(.all)
|
||||
}
|
||||
|
||||
if showsReadabilityFade {
|
||||
NativeToolbarReadabilityFade()
|
||||
|
|
@ -822,7 +840,7 @@ private struct DetailDestinationView: View {
|
|||
}
|
||||
.toolbar(.hidden, for: .tabBar)
|
||||
.toolbar(
|
||||
wrapper.route.hidesNavigationBar ? Visibility.hidden : Visibility.visible,
|
||||
hidesNativeNavigationBar ? Visibility.hidden : Visibility.visible,
|
||||
for: .navigationBar
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue