Fix scrolling code so that it takes into consideration the content is under the bars now. Issue #1633

This commit is contained in:
Maurice Parker 2020-01-16 19:40:13 -07:00
parent cbaa5f81b0
commit 2584462bc1
2 changed files with 5 additions and 9 deletions

View File

@ -228,10 +228,6 @@ class ArticleViewController: UIViewController {
currentWebViewController?.focus()
}
func finalScrollPosition() -> CGFloat {
return currentWebViewController?.finalScrollPosition() ?? 0.0
}
func canScrollDown() -> Bool {
return currentWebViewController?.canScrollDown() ?? false
}

View File

@ -192,17 +192,13 @@ class WebViewController: UIViewController {
webView.becomeFirstResponder()
}
func finalScrollPosition() -> CGFloat {
return webView.scrollView.contentSize.height - webView.scrollView.bounds.size.height + webView.scrollView.contentInset.bottom
}
func canScrollDown() -> Bool {
return webView.scrollView.contentOffset.y < finalScrollPosition()
}
func scrollPageDown() {
let scrollToY: CGFloat = {
let fullScroll = webView.scrollView.contentOffset.y + webView.scrollView.bounds.size.height
let fullScroll = webView.scrollView.contentOffset.y + webView.scrollView.layoutMarginsGuide.layoutFrame.height
let final = finalScrollPosition()
return fullScroll < final ? fullScroll : final
}()
@ -464,6 +460,10 @@ private struct ImageClickMessage: Codable {
private extension WebViewController {
func finalScrollPosition() -> CGFloat {
return webView.scrollView.contentSize.height - webView.scrollView.bounds.height + webView.scrollView.safeAreaInsets.bottom
}
func startArticleExtractor() {
if let link = article?.preferredLink, let extractor = ArticleExtractor(link) {
extractor.delegate = self