Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -1674,7 +1674,6 @@ class BrowserTabFragment :

if (!viewState.isLoading && lastSeenBrowserViewState?.browserShowing == true) {
swipeRefreshContainer.isRefreshing = false
webView?.detectOverscrollBehavior()
}
}
}
Expand Down
15 changes: 0 additions & 15 deletions app/src/main/java/com/duckduckgo/app/browser/DuckDuckGoWebView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,6 @@ class DuckDuckGoWebView : WebView, NestedScrollingChild {
lastY -= scrollOffset[1]
}

if (canSwipeToRefresh && scrollY == 0 && lastClampedTopY && nestedOffsetY == 0) {
// we are on a new gesture, have reached the top, are clamped vertically and nestedScrollY is done too -> enable swipeRefresh (by default always disabled)
enableSwipeRefresh(true)
}

lastDeltaY = deltaY
}

Expand Down Expand Up @@ -176,16 +171,6 @@ class DuckDuckGoWebView : WebView, NestedScrollingChild {
enableSwipeRefreshCallback = callback
}

/**
* Allows us to determine whether to (de)activate Swipe to Refresh behavior for the current page content, e.g. if page implements a swipe behavior of its
* own already (see twitter.com).
*/
fun detectOverscrollBehavior() {
evaluateJavascript("(function() { return getComputedStyle(document.querySelector('body')).overscrollBehaviorY; })();") { behavior ->
setContentAllowsSwipeToRefresh(behavior.replace("\"", "") == "auto")
}
}

private fun enableSwipeRefresh(enable: Boolean) {
enableSwipeRefreshCallback?.invoke(enable && contentAllowsSwipeToRefresh)
}
Expand Down