From af150b9b423127b8b95d3667cdd91608daa4d52a Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Tue, 12 Feb 2019 22:55:26 -0800 Subject: [PATCH] Remove baseURL from ArticleRenderer. --- .../MainWindow/Detail/ArticleRenderer.swift | 32 ------------------- 1 file changed, 32 deletions(-) diff --git a/NetNewsWire/MainWindow/Detail/ArticleRenderer.swift b/NetNewsWire/MainWindow/Detail/ArticleRenderer.swift index 8baa9bdbc..bd47c9a5a 100644 --- a/NetNewsWire/MainWindow/Detail/ArticleRenderer.swift +++ b/NetNewsWire/MainWindow/Detail/ArticleRenderer.swift @@ -13,7 +13,6 @@ import Account struct ArticleRenderer { - private let baseURL: URL? private let article: Article? private let articleStyle: ArticleStyle private let appearance: NSAppearance? @@ -24,12 +23,6 @@ struct ArticleRenderer { self.articleStyle = style self.appearance = appearance self.title = article?.title ?? "" - if let article = article { - self.baseURL = ArticleRenderer.baseURL(for: article) - } - else { - self.baseURL = nil - } } // MARK: - API @@ -48,31 +41,6 @@ struct ArticleRenderer { let renderer = ArticleRenderer(article: nil, style: style, appearance: appearance) return renderer.noSelectionHTML } - - static func baseURL(for article: Article) -> URL? { - var s = article.url - if s == nil { - s = article.feed?.homePageURL - } - if s == nil { - s = article.feed?.url - } - - guard let urlString = s else { - return nil - } - var urlComponents = URLComponents(string: urlString) - if urlComponents == nil { - return nil - } - - // Can’t use url-with-fragment as base URL. The webview won’t load. See scripting.com/rss.xml for example. - urlComponents!.fragment = nil - guard let url = urlComponents!.url, url.scheme == "http" || url.scheme == "https" else { - return nil - } - return url - } } // MARK: - Private