mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
run controller config once
This commit is contained in:
parent
c748ceb26b
commit
b46576e937
3 changed files with 19 additions and 6 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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" })
|
||||
|
|
|
|||
Loading…
Reference in a new issue