feat: improve epub reader controls and annotations
This commit is contained in:
@@ -31,20 +31,33 @@ extension RDEPUBWebView: WKNavigationDelegate {
|
||||
|
||||
public func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
|
||||
RDEPUBWebViewDebug.logNavigationEvent(debugScope, webView: webView, event: "didFinish", url: webView.url)
|
||||
applyReaderPageMediaVisibility()
|
||||
guard readerPageMediaNavigationDidFinish(navigation) else { return }
|
||||
applyPresentation()
|
||||
}
|
||||
|
||||
public func webViewWebContentProcessDidTerminate(_ webView: WKWebView) {
|
||||
RDEPUBWebViewDebug.logNavigationEvent(debugScope, webView: webView, event: "processTerminated", url: webView.url)
|
||||
// WebKit may not complete an in-flight media suspension after its
|
||||
// content process exits. Tearing down flushes the FIFO callbacks and
|
||||
// lets the coordinator activate another page without deadlocking.
|
||||
// Rebuild the page afterward so a cached/current page does not remain
|
||||
// permanently blank after WebKit recovers its content process.
|
||||
let publication = publication
|
||||
let renderRequest = currentRenderRequest
|
||||
teardownWebView()
|
||||
if let publication, let renderRequest {
|
||||
load(publication: publication, request: renderRequest)
|
||||
}
|
||||
}
|
||||
|
||||
public func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
|
||||
RDEPUBWebViewDebug.logNavigationEvent(debugScope, webView: webView, event: "didFail", url: webView.url, error: error)
|
||||
readerPageMediaNavigationDidFail(navigation)
|
||||
}
|
||||
|
||||
public func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
|
||||
RDEPUBWebViewDebug.logNavigationEvent(debugScope, webView: webView, event: "didFailProvisional", url: webView.url, error: error)
|
||||
readerPageMediaNavigationDidFail(navigation)
|
||||
}
|
||||
|
||||
public func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
|
||||
|
||||
Reference in New Issue
Block a user