diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift index 978ac9722..b4cd25501 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift @@ -493,7 +493,8 @@ struct AnimatingCellHeight: AnimatableModifier { options: PresentationLinkTransition.SlideTransitionOptions(edge: .trailing, options: PresentationLinkTransition.Options( - modalPresentationCapturesStatusBarAppearance: true + modalPresentationCapturesStatusBarAppearance: true, + preferredPresentationBackgroundColor: ThemeManager.currentBgColor ))), isPresented: $viewModel.presentWebContainer, destination: { diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift index af5d6d68c..27b42b75b 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift @@ -73,7 +73,12 @@ enum LoadingBarStyle { self.linkIsActive = true } } - + + func pushLinkedRequest(request: LinkRequest) { + self.linkRequest = request + self.presentWebContainer = true + } + private var filterState: FetcherFilterState? { if let appliedFilter = appliedFilter { return FetcherFilterState( diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/LibrarySearchView.swift b/apple/OmnivoreKit/Sources/App/Views/Home/LibrarySearchView.swift index d7e768e0a..b75cff002 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/LibrarySearchView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/LibrarySearchView.swift @@ -101,7 +101,8 @@ Spacer() Image(systemName: "chevron.right") }.onTapGesture { - viewModel.linkRequest = LinkRequest(id: UUID(), serverID: item.id) + homeFeedViewModel.pushLinkedRequest(request: LinkRequest(id: UUID(), serverID: item.id)) + dismiss() } } } diff --git a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderLoadingContainer.swift b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderLoadingContainer.swift index 88b14a80d..bdc018795 100644 --- a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderLoadingContainer.swift +++ b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderLoadingContainer.swift @@ -10,6 +10,11 @@ import Views @Published var errorMessage: String? func loadItem(dataService: DataService, username: String, requestID: String) async { + if let cached = Models.LibraryItem.lookup(byID: requestID, inContext: dataService.viewContext) { + item = cached + return + } + guard let objectID = try? await dataService.loadItemContentUsingRequestID(username: username, requestID: requestID) else { @@ -57,8 +62,6 @@ public struct WebReaderLoadingContainer: View { PDFWrapperView(pdfURL: pdfURL) } #endif - } else if item.state == "CONTENT_NOT_FETCHED" { - ProgressView() } else { WebReaderContainerView(item: item) #if os(iOS) @@ -72,11 +75,7 @@ public struct WebReaderLoadingContainer: View { } else { ProgressView() .task { - if let username = dataService.currentViewer?.username { - await viewModel.loadItem(dataService: dataService, username: username, requestID: requestID) - } else { - viewModel.errorMessage = "You are not logged in." - } + await viewModel.loadItem(dataService: dataService, username: "me", requestID: requestID) } } }