Add scroll or go to next unread keyboard shortcut

This commit is contained in:
Maurice Parker
2019-09-05 21:14:19 -05:00
parent 18d442d901
commit a2dda5f0f8
4 changed files with 36 additions and 1 deletions

View File

@@ -184,7 +184,32 @@ class DetailViewController: 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 final = finalScrollPosition()
if fullScroll < final {
return fullScroll
} else {
return final
}
}()
let convertedPoint = self.view.convert(CGPoint(x: 0, y: 0), to: webView.scrollView)
let scrollToPoint = CGPoint(x: convertedPoint.x, y: scrollToY)
webView.scrollView.setContentOffset(scrollToPoint, animated: true)
}
}
//print("\(candidateY) : \(webView.scrollView.contentSize.height)")
class ArticleActivityItemSource: NSObject, UIActivityItemSource {