Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix showing bars on tapping bottom of the screen #3684

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions DuckDuckGo/TabViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ class TabViewController: UIViewController {
}

@IBAction func onBottomOfScreenTapped(_ sender: UITapGestureRecognizer) {
showBars(animated: false)
showBars()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this was on purpose, but tested with animation (the same as when tapping area on top) and it worked.

}

private func showBars(animated: Bool = true) {
Expand Down Expand Up @@ -2479,13 +2479,15 @@ extension TabViewController: UIGestureRecognizerDelegate {
}

private func isShowBarsTap(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
let y = gestureRecognizer.location(in: webView).y
let y = gestureRecognizer.location(in: self.view).y
return gestureRecognizer == showBarsTapGestureRecogniser && chromeDelegate?.isToolbarHidden == true && isBottom(yPosition: y)
}

private func isBottom(yPosition y: CGFloat) -> Bool {
guard let chromeDelegate = chromeDelegate else { return false }
return y > (view.frame.size.height - chromeDelegate.toolbarHeight)
let webViewFrameInTabView = webView.convert(webView.bounds, to: view)
let bottomOfWebViewInTabView = webViewFrameInTabView.maxY - webView.scrollView.contentInset.bottom

return y > bottomOfWebViewInTabView
}

func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldBeRequiredToFailBy otherRecognizer: UIGestureRecognizer) -> Bool {
Expand Down
Loading