Use noContentHTML rather than noSelectionHTML for prepared web views.

Added a noContentHTML to ArticleRenderer. Use that for the initial content
for queued web views so that we don't see a temporary flash of "No
Selection" when pushing to an article that doesn't load instantly.
This commit is contained in:
Jim Correia 2019-08-31 15:03:03 -07:00
parent fe2e0155da
commit 5f11c42fc2
2 changed files with 10 additions and 1 deletions

View File

@ -41,6 +41,11 @@ struct ArticleRenderer {
let renderer = ArticleRenderer(article: nil, style: style)
return renderer.noSelectionHTML
}
static func noContentHTML(style: ArticleStyle) -> String {
let renderer = ArticleRenderer(article: nil, style: style)
return renderer.noContentHTML
}
}
// MARK: - Private
@ -62,6 +67,10 @@ private extension ArticleRenderer {
return renderHTML(withBody: body)
}
private var noContentHTML: String {
return renderHTML(withBody: "")
}
static var faviconImgTagCache = [Feed: String]()
static var feedIconImgTagCache = [Feed: String]()

View File

@ -270,7 +270,7 @@ class DetailViewControllerWebViewProvider {
webView.uiDelegate = nil
webView.navigationDelegate = nil
let html = ArticleRenderer.noSelectionHTML(style: .defaultStyle)
let html = ArticleRenderer.noContentHTML(style: .defaultStyle)
webView.loadHTMLString(html, baseURL: nil)
queue.insert(webView, at: 0)