From 4e2a2e595ecfabbe8609bae2d48f136f0b4d10e8 Mon Sep 17 00:00:00 2001 From: Satindar Dhillon Date: Wed, 27 Apr 2022 12:32:06 -0700 Subject: [PATCH] set nav bar hidded modifier on the navlink view --- .../Components/FeedCardNavigationLink.swift | 22 +++++++++++++++---- .../App/Views/LinkItemDetailView.swift | 3 --- .../Views/WebReader/WebReaderContainer.swift | 3 --- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/Components/FeedCardNavigationLink.swift b/apple/OmnivoreKit/Sources/App/Views/Home/Components/FeedCardNavigationLink.swift index d6a807959..3dc9f8e0e 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/Components/FeedCardNavigationLink.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/Components/FeedCardNavigationLink.swift @@ -11,9 +11,16 @@ struct FeedCardNavigationLink: View { @ObservedObject var viewModel: HomeFeedViewModel var body: some View { - ZStack { + let destination = LinkItemDetailView(viewModel: LinkItemDetailViewModel(item: item, homeFeedViewModel: viewModel)) + #if os(iOS) + let modifiedDestination = destination.navigationBarHidden(true) + #else + let modifiedDestination = destination + #endif + + return ZStack { NavigationLink( - destination: LinkItemDetailView(viewModel: LinkItemDetailViewModel(item: item, homeFeedViewModel: viewModel)), + destination: modifiedDestination, tag: item, selection: $viewModel.selectedLinkItem ) { @@ -42,9 +49,16 @@ struct GridCardNavigationLink: View { @ObservedObject var viewModel: HomeFeedViewModel var body: some View { - ZStack { + let destination = LinkItemDetailView(viewModel: LinkItemDetailViewModel(item: item, homeFeedViewModel: viewModel)) + #if os(iOS) + let modifiedDestination = destination.navigationBarHidden(true) + #else + let modifiedDestination = destination + #endif + + return ZStack { NavigationLink( - destination: LinkItemDetailView(viewModel: LinkItemDetailViewModel(item: item, homeFeedViewModel: viewModel)), + destination: modifiedDestination, tag: item, selection: $viewModel.selectedLinkItem ) { diff --git a/apple/OmnivoreKit/Sources/App/Views/LinkItemDetailView.swift b/apple/OmnivoreKit/Sources/App/Views/LinkItemDetailView.swift index 2277e30d0..f478035a8 100644 --- a/apple/OmnivoreKit/Sources/App/Views/LinkItemDetailView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/LinkItemDetailView.swift @@ -248,9 +248,7 @@ struct LinkItemDetailView: View { navBar Spacer() } - .navigationBarHidden(true) } - } else { VStack(spacing: 0) { navBar @@ -262,7 +260,6 @@ struct LinkItemDetailView: View { rawAuthCookie: authenticator.omnivoreAuthCookieString ) } - .navigationBarHidden(true) } } #endif diff --git a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift index 67a45339b..ebd821451 100644 --- a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift +++ b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift @@ -222,13 +222,10 @@ import WebKit navBar Spacer() } - .navigationBarHidden(true) - }.onDisappear { // Clear the shared webview content when exiting WebViewManager.shared().loadHTMLString("", baseURL: nil) } - .navigationBarHidden(true) } } #endif