diff options
author | Allan Wang <me@allanwang.ca> | 2019-09-28 22:48:50 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2019-09-28 22:48:50 -0700 |
commit | 8fb903398a3692e42d4ea8ddcf047937841f5901 (patch) | |
tree | 7d71b36131dd9a4a3895755f181f563f25377e6e /app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt | |
parent | 96908453abbd7e40e13af4359d1bce4524b979a6 (diff) | |
download | frost-8fb903398a3692e42d4ea8ddcf047937841f5901.tar.gz frost-8fb903398a3692e42d4ea8ddcf047937841f5901.tar.bz2 frost-8fb903398a3692e42d4ea8ddcf047937841f5901.zip |
Convert desktop urls to mobile ones
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt | 7 |
1 files changed, 7 insertions, 0 deletions
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 9e45d4fe..add643c5 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt @@ -23,8 +23,10 @@ import android.webkit.WebResourceResponse 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.FbCookie import com.pitchedapps.frost.facebook.FbItem +import com.pitchedapps.frost.facebook.WWW_FACEBOOK_COM import com.pitchedapps.frost.facebook.formattedFbUrl import com.pitchedapps.frost.injectors.CssHider import com.pitchedapps.frost.injectors.JsActions @@ -188,6 +190,11 @@ open class FrostWebViewClient(val web: FrostWebView) : BaseWebViewClient() { if (Prefs.linksInDefaultApp && view.context.resolveActivityForUri(request.url)) { return true } + // Convert desktop urls to mobile ones + if (url.contains("https://www.facebook.com")) { + view.loadUrl(url.replace(WWW_FACEBOOK_COM, FACEBOOK_BASE_COM)) + return true + } return super.shouldOverrideUrlLoading(view, request) } } |