mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Reset all the web views when coming back to the foreground incase one of them is unavailable now
This commit is contained in:
@@ -148,7 +148,8 @@ class WebViewController: UIViewController {
|
||||
}
|
||||
|
||||
func fullReload() {
|
||||
self.loadWebView()
|
||||
view.subviews.first?.removeFromSuperview()
|
||||
loadWebView()
|
||||
}
|
||||
|
||||
func showBars() {
|
||||
@@ -288,10 +289,10 @@ extension WebViewController: UIContextMenuInteractionDelegate {
|
||||
// MARK: WKNavigationDelegate
|
||||
|
||||
extension WebViewController: WKNavigationDelegate {
|
||||
|
||||
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
|
||||
|
||||
if navigationAction.navigationType == .linkActivated {
|
||||
|
||||
guard let url = navigationAction.request.url else {
|
||||
decisionHandler(.allow)
|
||||
return
|
||||
@@ -313,13 +314,13 @@ extension WebViewController: WKNavigationDelegate {
|
||||
} else {
|
||||
decisionHandler(.allow)
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
decisionHandler(.allow)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func webViewWebContentProcessDidTerminate(_ webView: WKWebView) {
|
||||
fullReload()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user