diff options
author | Allan Wang <me@allanwang.ca> | 2018-11-06 22:35:58 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-06 22:35:58 -0500 |
commit | da63f00eb50a8c413ee55652eff8a4fcc5f83e5a (patch) | |
tree | 33b2eb5da6963ba267877ae836ecba0dcef344ca /app/src/main/kotlin/com/pitchedapps/frost/views/FrostWebView.kt | |
parent | bffa6474f36b990c1de0eaeb8df2cf80d094d3fa (diff) | |
download | frost-da63f00eb50a8c413ee55652eff8a4fcc5f83e5a.tar.gz frost-da63f00eb50a8c413ee55652eff8a4fcc5f83e5a.tar.bz2 frost-da63f00eb50a8c413ee55652eff8a4fcc5f83e5a.zip |
Fix/duplicate back (#1177)
* Merge potential fix for text zoom
* Actually fix the duplicate back
* Prepare fixing dependent notifications
* Add notification fallback url
* Add back acontext to url, fixes #1137
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/views/FrostWebView.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/views/FrostWebView.kt | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostWebView.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostWebView.kt index 14596935..8230c338 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostWebView.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostWebView.kt @@ -11,6 +11,7 @@ import ca.allanwang.kau.utils.AnimHolder import com.pitchedapps.frost.contracts.FrostContentContainer import com.pitchedapps.frost.contracts.FrostContentCore import com.pitchedapps.frost.contracts.FrostContentParent +import com.pitchedapps.frost.facebook.FB_HOME_URL import com.pitchedapps.frost.facebook.USER_AGENT_BASIC import com.pitchedapps.frost.fragments.WebFragment import com.pitchedapps.frost.utils.Prefs @@ -88,8 +89,20 @@ class FrostWebView @JvmOverloads constructor( loadUrl(parent.baseUrl, animate) } + /** + * By 2018-10-17, facebook automatically adds their home page to the back stack, + * regardless of the loaded url. We will make sure we skip it when going back. + */ override fun onBackPressed(): Boolean { - if (canGoBack()) { + if (canGoBackOrForward(-2)) { + goBack() + return true + } + val list = copyBackForwardList() + if (list.currentIndex == 1 && list.getItemAtIndex(0).url == FB_HOME_URL) { + return false + } + if (list.currentIndex > 0) { goBack() return true } |