diff --git a/apple/Omnivore.xcworkspace/xcshareddata/swiftpm/Package.resolved b/apple/Omnivore.xcworkspace/xcshareddata/swiftpm/Package.resolved index e79bf771f..fa6f4cbb3 100644 --- a/apple/Omnivore.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/apple/Omnivore.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -135,6 +135,15 @@ "version" : "2.0.0" } }, + { + "identity" : "pspdfkit-sp", + "kind" : "remoteSourceControl", + "location" : "https://github.com/PSPDFKit/PSPDFKit-SP", + "state" : { + "branch" : "master", + "revision" : "0e18629c443e3f39ecfee0f600d9ef5551ecf488" + } + }, { "identity" : "sovran-swift", "kind" : "remoteSourceControl", diff --git a/apple/OmnivoreKit/Package.swift b/apple/OmnivoreKit/Package.swift index 1eafb078f..6fafc0cb0 100644 --- a/apple/OmnivoreKit/Package.swift +++ b/apple/OmnivoreKit/Package.swift @@ -55,9 +55,9 @@ let package = Package( var appPackageDependencies: [Target.Dependency] { var deps: [Target.Dependency] = ["Views", "Services", "Models", "Utils"] - #if canImport(UIKit) - deps.append(.product(name: "PSPDFKit", package: "PSPDFKit-SP")) - #endif +// #if canImport(UIKit) + deps.append(.product(name: "PSPDFKit", package: "PSPDFKit-SP")) +// #endif return deps } @@ -69,8 +69,8 @@ var dependencies: [Package.Dependency] { .package(url: "https://github.com/siteline/SwiftUI-Introspect.git", from: "0.1.4"), .package(url: "git@github.com:segmentio/analytics-swift.git", .upToNextMajor(from: "1.0.0")) ] - #if canImport(UIKit) - deps.append(.package(url: "https://github.com/PSPDFKit/PSPDFKit-SP", branch: "master")) - #endif +// #if canImport(UIKit) + deps.append(.package(url: "https://github.com/PSPDFKit/PSPDFKit-SP", branch: "master")) +// #endif return deps } diff --git a/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewer.swift b/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewer.swift index 9a6789b1c..1c6672f7b 100644 --- a/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewer.swift +++ b/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewer.swift @@ -11,6 +11,7 @@ import Utils final class PDFStateObject: ObservableObject { @Published var document: Document? @Published var coordinator: PDFViewCoordinator? + @Published var controllerNeedsConfig = true } @EnvironmentObject var dataService: DataService @@ -40,6 +41,8 @@ import Utils builder.textSelectionShouldSnapToWord = true } .updateControllerConfiguration { controller in + // Store config state so we only run this update closure once + guard pdfStateObject.controllerNeedsConfig else { return } print("document is valid", document.isValid) coordinator.setController(controller: controller, dataService: dataService) @@ -81,6 +84,7 @@ import Utils } controller.navigationItem.setRightBarButtonItems(barButtonItems, for: .document, animated: false) + pdfStateObject.controllerNeedsConfig = false } .onShouldShowMenuItemsForSelectedText(perform: { pageView, menuItems, selectedText in let copy = menuItems.first(where: { $0.identifier == "Copy" })