diff options
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web/FrostRequestInterceptor.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/web/FrostRequestInterceptor.kt | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostRequestInterceptor.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostRequestInterceptor.kt index ab910ebc..c4c6b81f 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostRequestInterceptor.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostRequestInterceptor.kt @@ -22,6 +22,7 @@ import android.webkit.WebView import com.pitchedapps.frost.utils.FrostPglAdBlock import com.pitchedapps.frost.utils.L import okhttp3.HttpUrl +import okhttp3.HttpUrl.Companion.toHttpUrlOrNull import java.io.ByteArrayInputStream /** @@ -40,8 +41,8 @@ private val blankResource: WebResourceResponse by lazy { fun WebView.shouldFrostInterceptRequest(request: WebResourceRequest): WebResourceResponse? { val requestUrl = request.url?.toString() ?: return null - val httpUrl = HttpUrl.parse(requestUrl) ?: return null - val host = httpUrl.host() + val httpUrl = requestUrl.toHttpUrlOrNull() ?: return null + val host = httpUrl.host val url = httpUrl.toString() if (host.contains("facebook") || host.contains("fbcdn")) return null if (FrostPglAdBlock.isAd(host)) return blankResource |