Remove unintended web view load when changing the article.

This commit is contained in:
Maurice Parker 2020-02-13 16:08:44 -08:00
parent 2ae021960b
commit d01e9cef42
1 changed files with 5 additions and 5 deletions

View File

@ -46,11 +46,7 @@ class WebViewController: UIViewController {
windowScrollY = 0 windowScrollY = 0
} }
} }
var isShowingExtractedArticle = false { var isShowingExtractedArticle = false
didSet {
loadWebView()
}
}
var articleExtractorButtonState: ArticleExtractorButtonState = .off { var articleExtractorButtonState: ArticleExtractorButtonState = .off {
didSet { didSet {
@ -189,11 +185,13 @@ class WebViewController: UIViewController {
guard articleExtractor?.state != .processing else { guard articleExtractor?.state != .processing else {
stopArticleExtractor() stopArticleExtractor()
loadWebView()
return return
} }
guard !isShowingExtractedArticle else { guard !isShowingExtractedArticle else {
isShowingExtractedArticle = false isShowingExtractedArticle = false
loadWebView()
articleExtractorButtonState = .off articleExtractorButtonState = .off
return return
} }
@ -201,6 +199,7 @@ class WebViewController: UIViewController {
if let articleExtractor = articleExtractor { if let articleExtractor = articleExtractor {
if article.preferredLink == articleExtractor.articleLink { if article.preferredLink == articleExtractor.articleLink {
isShowingExtractedArticle = true isShowingExtractedArticle = true
loadWebView()
articleExtractorButtonState = .on articleExtractorButtonState = .on
} }
} else { } else {
@ -241,6 +240,7 @@ extension WebViewController: ArticleExtractorDelegate {
if articleExtractor?.state != .cancelled { if articleExtractor?.state != .cancelled {
self.extractedArticle = extractedArticle self.extractedArticle = extractedArticle
isShowingExtractedArticle = true isShowingExtractedArticle = true
loadWebView()
articleExtractorButtonState = .on articleExtractorButtonState = .on
} }
} }