Remove code that watches for JavaScript setting change — that change needs to be handled elsewhere.
This commit is contained in:
parent
2bdd60cdf5
commit
faaf1baba9
|
@ -63,11 +63,6 @@ final class DetailWebViewController: NSViewController {
|
||||||
private var waitingForFirstReload = false
|
private var waitingForFirstReload = false
|
||||||
private let keyboardDelegate = DetailKeyboardDelegate()
|
private let keyboardDelegate = DetailKeyboardDelegate()
|
||||||
private var windowScrollY: CGFloat?
|
private var windowScrollY: CGFloat?
|
||||||
private var isArticleContentJavascriptEnabled = AppDefaults.shared.isArticleContentJavascriptEnabled {
|
|
||||||
didSet {
|
|
||||||
reloadHTML()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private var isShowingExtractedArticle: Bool {
|
private var isShowingExtractedArticle: Bool {
|
||||||
switch state {
|
switch state {
|
||||||
|
@ -102,7 +97,7 @@ final class DetailWebViewController: NSViewController {
|
||||||
|
|
||||||
let configuration = WKWebViewConfiguration()
|
let configuration = WKWebViewConfiguration()
|
||||||
configuration.preferences = preferences
|
configuration.preferences = preferences
|
||||||
configuration.defaultWebpagePreferences.allowsContentJavaScript = isArticleContentJavascriptEnabled
|
configuration.defaultWebpagePreferences.allowsContentJavaScript = AppDefaults.shared.isArticleContentJavascriptEnabled
|
||||||
configuration.setURLSchemeHandler(detailIconSchemeHandler, forURLScheme: ArticleRenderer.imageIconScheme)
|
configuration.setURLSchemeHandler(detailIconSchemeHandler, forURLScheme: ArticleRenderer.imageIconScheme)
|
||||||
|
|
||||||
let userContentController = WKUserContentController()
|
let userContentController = WKUserContentController()
|
||||||
|
@ -172,19 +167,8 @@ final class DetailWebViewController: NSViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func userDefaultsDidChange(_ note: Notification) {
|
@objc func userDefaultsDidChange(_ note: Notification) {
|
||||||
|
|
||||||
var shouldReloadHTML = false
|
|
||||||
|
|
||||||
if articleTextSize != AppDefaults.shared.articleTextSize {
|
if articleTextSize != AppDefaults.shared.articleTextSize {
|
||||||
articleTextSize = AppDefaults.shared.articleTextSize
|
articleTextSize = AppDefaults.shared.articleTextSize
|
||||||
shouldReloadHTML = true
|
|
||||||
}
|
|
||||||
if AppDefaults.shared.isArticleContentJavascriptEnabled != isArticleContentJavascriptEnabled {
|
|
||||||
isArticleContentJavascriptEnabled = AppDefaults.shared.isArticleContentJavascriptEnabled
|
|
||||||
shouldReloadHTML = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if shouldReloadHTML {
|
|
||||||
reloadHTMLMaintainingScrollPosition()
|
reloadHTMLMaintainingScrollPosition()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -266,7 +250,6 @@ extension DetailWebViewController: WKNavigationDelegate, WKUIDelegate {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
webView.configuration.defaultWebpagePreferences.allowsContentJavaScript = isArticleContentJavascriptEnabled
|
|
||||||
decisionHandler(.allow)
|
decisionHandler(.allow)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue