Render article on to be recycled web view and delay new web view showing to 0.3. Issue #1780
This commit is contained in:
parent
d01e9cef42
commit
58b8a9adb0
|
@ -406,6 +406,7 @@ private extension WebViewController {
|
||||||
coordinator.webViewProvider.dequeueWebView() { webView in
|
coordinator.webViewProvider.dequeueWebView() { webView in
|
||||||
|
|
||||||
let webViewToRecycle = self.webView
|
let webViewToRecycle = self.webView
|
||||||
|
self.renderPage(webViewToRecycle)
|
||||||
|
|
||||||
// Add the webview
|
// Add the webview
|
||||||
webView.translatesAutoresizingMaskIntoConstraints = false
|
webView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
@ -436,8 +437,10 @@ private extension WebViewController {
|
||||||
webView.configuration.userContentController.add(WrapperScriptMessageHandler(self), name: MessageName.imageWasClicked)
|
webView.configuration.userContentController.add(WrapperScriptMessageHandler(self), name: MessageName.imageWasClicked)
|
||||||
webView.configuration.userContentController.add(WrapperScriptMessageHandler(self), name: MessageName.imageWasShown)
|
webView.configuration.userContentController.add(WrapperScriptMessageHandler(self), name: MessageName.imageWasShown)
|
||||||
|
|
||||||
self.renderPage()
|
self.renderPage(webView)
|
||||||
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
|
||||||
self.recycleWebView(webViewToRecycle)
|
self.recycleWebView(webViewToRecycle)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,7 +462,7 @@ private extension WebViewController {
|
||||||
coordinator.webViewProvider.enqueueWebView(webView)
|
coordinator.webViewProvider.enqueueWebView(webView)
|
||||||
}
|
}
|
||||||
|
|
||||||
func renderPage() {
|
func renderPage(_ webView: WKWebView?) {
|
||||||
guard let webView = webView else { return }
|
guard let webView = webView else { return }
|
||||||
|
|
||||||
let style = ArticleStylesManager.shared.currentStyle
|
let style = ArticleStylesManager.shared.currentStyle
|
||||||
|
|
Loading…
Reference in New Issue