aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt7
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt17
-rw-r--r--app/src/main/play/en-US/whatsnew2
3 files changed, 23 insertions, 3 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
index 187ab9eb..0988e331 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
@@ -89,7 +89,9 @@ class FrostJSI(val web: FrostWebView) {
@JavascriptInterface
fun longClick(start: Boolean) {
activity?.viewPager?.enableSwipe = !start
- web.parent.swipeEnabled = !start
+ if (web.frostWebClient.urlSupportsRefresh) {
+ web.parent.swipeEnabled = !start
+ }
}
/**
@@ -97,6 +99,9 @@ class FrostJSI(val web: FrostWebView) {
*/
@JavascriptInterface
fun disableSwipeRefresh(disable: Boolean) {
+ if (!web.frostWebClient.urlSupportsRefresh) {
+ return
+ }
web.parent.swipeEnabled = !disable
if (disable) {
// locked onto an input field; ensure content is visible
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
index f6279611..ab7ee087 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
@@ -24,6 +24,7 @@ import android.webkit.WebView
import android.webkit.WebViewClient
import ca.allanwang.kau.utils.withAlpha
import com.pitchedapps.frost.facebook.FACEBOOK_BASE_COM
+import com.pitchedapps.frost.facebook.FB_URL_BASE
import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.facebook.FbItem
import com.pitchedapps.frost.facebook.WWW_FACEBOOK_COM
@@ -69,10 +70,24 @@ open class FrostWebViewClient(val web: FrostWebView) : BaseWebViewClient() {
private val refresh: SendChannel<Boolean> = web.parent.refreshChannel
private val isMain = web.parent.baseEnum != null
+ /**
+ * True if current url supports refresh. See [doUpdateVisitedHistory] for updates
+ */
+ internal var urlSupportsRefresh: Boolean = true
override fun doUpdateVisitedHistory(view: WebView, url: String?, isReload: Boolean) {
- v { "History $url" }
super.doUpdateVisitedHistory(view, url, isReload)
+ urlSupportsRefresh = urlSupportsRefresh(url)
+ web.parent.swipeEnabled = urlSupportsRefresh
+ v { "History $url; refresh $urlSupportsRefresh" }
+ }
+
+ private fun urlSupportsRefresh(url: String?): Boolean {
+ if (url == null) return false
+ if (!url.isFacebookUrl) return true
+ if (url == "$FB_URL_BASE?soft=composer") return false
+ if (url.contains("sharer.php") || url.contains("sharer-dialog.php")) return false
+ return true
}
protected inline fun v(crossinline message: () -> Any?) = L.v { "web client: ${message()}" }
diff --git a/app/src/main/play/en-US/whatsnew b/app/src/main/play/en-US/whatsnew
index 02fdef9b..2c68cc55 100644
--- a/app/src/main/play/en-US/whatsnew
+++ b/app/src/main/play/en-US/whatsnew
@@ -3,4 +3,4 @@ v2.4.1
* Add better support for mobile url conversions
* Notification tab will keep first page in the same window; fixes marking notifications as read
* Fix nav and status bar icon colors for custom themes (Android O+)
-* Fix biometric prompt, and prompt on activity resume
+* Fix biometric prompt, and prompt on activity resume \ No newline at end of file