aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/web
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2018-12-28 22:15:08 -0500
committerAllan Wang <me@allanwang.ca>2018-12-28 22:15:08 -0500
commit7f545a19dcb52073bc22d2bb59e6cb4beecac4a6 (patch)
tree19f1458e408da149291ea7260b2196576ece0de9 /app/src/main/kotlin/com/pitchedapps/frost/web
parent9c3d7c8b6cca17dc10fc310d41e547d1fe1725ea (diff)
downloadfrost-7f545a19dcb52073bc22d2bb59e6cb4beecac4a6.tar.gz
frost-7f545a19dcb52073bc22d2bb59e6cb4beecac4a6.tar.bz2
frost-7f545a19dcb52073bc22d2bb59e6cb4beecac4a6.zip
Switch default user agent to android, resolves #1245, #1229
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt13
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt2
2 files changed, 7 insertions, 8 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt
index e2d294f7..490c02e5 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt
@@ -84,7 +84,7 @@ fun FrostWebView.requestWebOverlay(url: String): Boolean {
context.launchWebOverlayBasic(url)
return true
}
- if (context is WebOverlayBasicActivity && !shouldUseBasic) {
+ if (userAgentString == USER_AGENT_BASIC && !shouldUseBasic) {
L.i { "Switch from basic agent" }
context.launchWebOverlay(url)
return true
@@ -105,10 +105,9 @@ val messageWhitelist: Set<String> =
.mapTo(mutableSetOf(), FbItem::url)
val String.shouldUseBasicAgent: Boolean
- get() {
- if (contains("story.php")) // do not use basic for comment section
- return false
- if (contains("/events/")) // do not use for events (namely the map)
- return false
- return true // use for everything else
+ get() = when {
+ contains("story.php") -> false // do not use basic for comment section
+ contains("/events/") -> false // do not use for events (namely the map)
+ contains("/messages") -> true // must use for messages
+ else -> false // default to normal user agent
}
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 cb212b0a..ab97c0a8 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
@@ -72,7 +72,7 @@ open class FrostWebViewClient(val web: FrostWebView) : BaseWebViewClient() {
override fun onPageStarted(view: WebView, url: String?, favicon: Bitmap?) {
super.onPageStarted(view, url, favicon)
if (url == null) return
- v { "loading $url" }
+ v { "loading $url ${web.settings.userAgentString}" }
refresh.offer(true)
}