mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
show nav bar on tap in the web reader
This commit is contained in:
parent
4b1d772f00
commit
d041c73fd1
3 changed files with 19 additions and 0 deletions
|
|
@ -16,6 +16,7 @@ import WebKit
|
|||
@Binding var increaseFontActionID: UUID?
|
||||
@Binding var decreaseFontActionID: UUID?
|
||||
@Binding var annotationSaveTransactionID: UUID?
|
||||
@Binding var showNavBarActionID: UUID?
|
||||
@Binding var annotation: String
|
||||
|
||||
func makeCoordinator() -> WebReaderCoordinator {
|
||||
|
|
@ -75,6 +76,11 @@ import WebKit
|
|||
(webView as? WebView)?.decreaseFontSize()
|
||||
}
|
||||
|
||||
if showNavBarActionID != context.coordinator.previousShowNavBarActionID {
|
||||
context.coordinator.previousShowNavBarActionID = showNavBarActionID
|
||||
context.coordinator.showNavBar()
|
||||
}
|
||||
|
||||
// If the webview had been terminated `needsReload` will have been set to true
|
||||
if context.coordinator.needsReload {
|
||||
loadContent(webView: webView)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import WebKit
|
|||
@State var increaseFontActionID: UUID?
|
||||
@State var decreaseFontActionID: UUID?
|
||||
@State var annotationSaveTransactionID: UUID?
|
||||
@State var showNavBarActionID: UUID?
|
||||
@State var annotation = String()
|
||||
|
||||
@EnvironmentObject var dataService: DataService
|
||||
|
|
@ -154,8 +155,15 @@ import WebKit
|
|||
increaseFontActionID: $increaseFontActionID,
|
||||
decreaseFontActionID: $decreaseFontActionID,
|
||||
annotationSaveTransactionID: $annotationSaveTransactionID,
|
||||
showNavBarActionID: $showNavBarActionID,
|
||||
annotation: $annotation
|
||||
)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
navBarVisibilityRatio = 1
|
||||
showNavBarActionID = UUID()
|
||||
}
|
||||
}
|
||||
.sheet(item: $safariWebLink) {
|
||||
SafariView(url: $0.url)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ final class WebReaderCoordinator: NSObject {
|
|||
var lastSavedAnnotationID: UUID?
|
||||
var previousIncreaseFontActionID: UUID?
|
||||
var previousDecreaseFontActionID: UUID?
|
||||
var previousShowNavBarActionID: UUID?
|
||||
var updateNavBarVisibilityRatio: (Double) -> Void = { _ in }
|
||||
private var yOffsetAtStartOfDrag: Double?
|
||||
private var lastYOffset: Double = 0
|
||||
|
|
@ -33,6 +34,10 @@ final class WebReaderCoordinator: NSObject {
|
|||
updateNavBarVisibilityRatio(navBarVisibilityRatio)
|
||||
}
|
||||
}
|
||||
|
||||
func showNavBar() {
|
||||
isNavBarHidden = false
|
||||
}
|
||||
}
|
||||
|
||||
extension WebReaderCoordinator: WKScriptMessageHandler {
|
||||
|
|
|
|||
Loading…
Reference in a new issue