mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
use shared webview and remove message handlers before each use
This commit is contained in:
parent
6bb8f76f40
commit
e85558114c
1 changed files with 3 additions and 1 deletions
|
|
@ -28,7 +28,7 @@ struct WebReader: UIViewRepresentable {
|
|||
}
|
||||
|
||||
func makeUIView(context: Context) -> WKWebView {
|
||||
let webView = WebViewManager.create()
|
||||
let webView = WebViewManager.shared()
|
||||
let contentController = WKUserContentController()
|
||||
|
||||
webView.loadHTMLString(
|
||||
|
|
@ -52,6 +52,8 @@ struct WebReader: UIViewRepresentable {
|
|||
webView.scrollView.contentInset.top = readerViewNavBarHeight
|
||||
webView.scrollView.verticalScrollIndicatorInsets.top = readerViewNavBarHeight
|
||||
|
||||
webView.configuration.userContentController.removeAllScriptMessageHandlers()
|
||||
|
||||
for action in WebViewAction.allCases {
|
||||
webView.configuration.userContentController.add(context.coordinator, name: action.rawValue)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue