Remove code that watches for JavaScript setting change — that change needs to be handled elsewhere.

This commit is contained in:
Brent Simmons 2023-11-27 21:46:02 -08:00
parent 2bdd60cdf5
commit faaf1baba9
1 changed files with 1 additions and 18 deletions

View File

@ -63,11 +63,6 @@ final class DetailWebViewController: NSViewController {
private var waitingForFirstReload = false
private let keyboardDelegate = DetailKeyboardDelegate()
private var windowScrollY: CGFloat?
private var isArticleContentJavascriptEnabled = AppDefaults.shared.isArticleContentJavascriptEnabled {
didSet {
reloadHTML()
}
}
private var isShowingExtractedArticle: Bool {
switch state {
@ -102,7 +97,7 @@ final class DetailWebViewController: NSViewController {
let configuration = WKWebViewConfiguration()
configuration.preferences = preferences
configuration.defaultWebpagePreferences.allowsContentJavaScript = isArticleContentJavascriptEnabled
configuration.defaultWebpagePreferences.allowsContentJavaScript = AppDefaults.shared.isArticleContentJavascriptEnabled
configuration.setURLSchemeHandler(detailIconSchemeHandler, forURLScheme: ArticleRenderer.imageIconScheme)
let userContentController = WKUserContentController()
@ -172,19 +167,8 @@ final class DetailWebViewController: NSViewController {
}
@objc func userDefaultsDidChange(_ note: Notification) {
var shouldReloadHTML = false
if articleTextSize != AppDefaults.shared.articleTextSize {
articleTextSize = AppDefaults.shared.articleTextSize
shouldReloadHTML = true
}
if AppDefaults.shared.isArticleContentJavascriptEnabled != isArticleContentJavascriptEnabled {
isArticleContentJavascriptEnabled = AppDefaults.shared.isArticleContentJavascriptEnabled
shouldReloadHTML = true
}
if shouldReloadHTML {
reloadHTMLMaintainingScrollPosition()
}
}
@ -266,7 +250,6 @@ extension DetailWebViewController: WKNavigationDelegate, WKUIDelegate {
return
}
webView.configuration.defaultWebpagePreferences.allowsContentJavaScript = isArticleContentJavascriptEnabled
decisionHandler(.allow)
}