diff --git a/NetNewsWire/MainWindow/Detail/ArticleRenderer.swift b/NetNewsWire/MainWindow/Detail/ArticleRenderer.swift index bd47c9a5a..7cf213835 100644 --- a/NetNewsWire/MainWindow/Detail/ArticleRenderer.swift +++ b/NetNewsWire/MainWindow/Detail/ArticleRenderer.swift @@ -15,30 +15,28 @@ struct ArticleRenderer { private let article: Article? private let articleStyle: ArticleStyle - private let appearance: NSAppearance? private let title: String - private init(article: Article?, style: ArticleStyle, appearance: NSAppearance?) { + private init(article: Article?, style: ArticleStyle) { self.article = article self.articleStyle = style - self.appearance = appearance self.title = article?.title ?? "" } // MARK: - API - static func articleHTML(article: Article, style: ArticleStyle, appearance: NSAppearance?) -> String { - let renderer = ArticleRenderer(article: article, style: style, appearance: appearance) + static func articleHTML(article: Article, style: ArticleStyle) -> String { + let renderer = ArticleRenderer(article: article, style: style) return renderer.articleHTML } - static func multipleSelectionHTML(style: ArticleStyle, appearance: NSAppearance?) -> String { - let renderer = ArticleRenderer(article: nil, style: style, appearance: appearance) + static func multipleSelectionHTML(style: ArticleStyle) -> String { + let renderer = ArticleRenderer(article: nil, style: style) return renderer.multipleSelectionHTML } - static func noSelectionHTML(style: ArticleStyle, appearance: NSAppearance?) -> String { - let renderer = ArticleRenderer(article: nil, style: style, appearance: appearance) + static func noSelectionHTML(style: ArticleStyle) -> String { + let renderer = ArticleRenderer(article: nil, style: style) return renderer.noSelectionHTML } } @@ -338,8 +336,7 @@ private extension ArticleRenderer { """ - let appearanceClass = appearance?.isDarkMode ?? false ? "dark" : "light" - s += "\n\n\n\n" + s += "\n\n\n\n" s += body s += "\n\n" diff --git a/NetNewsWire/MainWindow/Detail/DetailWebViewController.swift b/NetNewsWire/MainWindow/Detail/DetailWebViewController.swift index a30058998..25a35e97a 100644 --- a/NetNewsWire/MainWindow/Detail/DetailWebViewController.swift +++ b/NetNewsWire/MainWindow/Detail/DetailWebViewController.swift @@ -61,12 +61,8 @@ final class DetailWebViewController: NSViewController, WKUIDelegate { } view = webview - - DispatchQueue.main.async { - // Must do this async, because reloadHTML references view.effectiveAppearance, - // which causes loadView to get called. Infinite loop. - self.reloadHTML() - } + + self.reloadHTML() } // MARK: Scrolling @@ -119,17 +115,16 @@ private extension DetailWebViewController { func reloadHTML() { let style = ArticleStylesManager.shared.currentStyle - let appearance = view.effectiveAppearance let html: String var baseURL: URL? = nil switch state { case .noSelection: - html = ArticleRenderer.noSelectionHTML(style: style, appearance: appearance) + html = ArticleRenderer.noSelectionHTML(style: style) case .multipleSelection: - html = ArticleRenderer.multipleSelectionHTML(style: style, appearance: appearance) + html = ArticleRenderer.multipleSelectionHTML(style: style) case .article(let article): - html = ArticleRenderer.articleHTML(article: article, style: style, appearance: appearance) + html = ArticleRenderer.articleHTML(article: article, style: style) baseURL = article.baseURL } diff --git a/NetNewsWire/MainWindow/Timeline/ArticlePasteboardWriter.swift b/NetNewsWire/MainWindow/Timeline/ArticlePasteboardWriter.swift index aa05fa45d..4f55cd110 100644 --- a/NetNewsWire/MainWindow/Timeline/ArticlePasteboardWriter.swift +++ b/NetNewsWire/MainWindow/Timeline/ArticlePasteboardWriter.swift @@ -20,7 +20,7 @@ import RSCore static let articleUTIInternalType = NSPasteboard.PasteboardType(rawValue: articleUTIInternal) private lazy var renderedHTML: String = { - return ArticleRenderer.articleHTML(article: article, style: ArticleStylesManager.shared.currentStyle, appearance: nil) + return ArticleRenderer.articleHTML(article: article, style: ArticleStylesManager.shared.currentStyle) }() init(article: Article) {