Make baseURL a private extension computed var for Article.
This commit is contained in:
parent
350ab27371
commit
9b92fcfc2c
|
@ -121,19 +121,22 @@ private extension DetailWebViewController {
|
||||||
html = ArticleRenderer.multipleSelectionHTML(style: style, appearance: appearance)
|
html = ArticleRenderer.multipleSelectionHTML(style: style, appearance: appearance)
|
||||||
case .article(let article):
|
case .article(let article):
|
||||||
html = ArticleRenderer.articleHTML(article: article, style: style, appearance: appearance)
|
html = ArticleRenderer.articleHTML(article: article, style: style, appearance: appearance)
|
||||||
baseURL = DetailWebViewController.baseURL(for: article)
|
baseURL = article.baseURL
|
||||||
}
|
}
|
||||||
|
|
||||||
webview.loadHTMLString(html, baseURL: baseURL)
|
webview.loadHTMLString(html, baseURL: baseURL)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static func baseURL(for article: Article) -> URL? {
|
private extension Article {
|
||||||
var s = article.url
|
|
||||||
|
var baseURL: URL? {
|
||||||
|
var s = url
|
||||||
if s == nil {
|
if s == nil {
|
||||||
s = article.feed?.homePageURL
|
s = feed?.homePageURL
|
||||||
}
|
}
|
||||||
if s == nil {
|
if s == nil {
|
||||||
s = article.feed?.url
|
s = feed?.url
|
||||||
}
|
}
|
||||||
|
|
||||||
guard let urlString = s else {
|
guard let urlString = s else {
|
||||||
|
|
Loading…
Reference in New Issue