Skip to content

Commit

Permalink
fix(cookies): intercept the loading of non-HTTP(s) URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
JunkFood02 committed Apr 8, 2024
1 parent dfb824a commit 35859c2
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.junkfood.seal.ui.page.settings.network
import android.annotation.SuppressLint
import android.util.Log
import android.webkit.CookieManager
import android.webkit.WebResourceRequest
import android.webkit.WebView
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
Expand All @@ -27,7 +28,6 @@ import com.google.accompanist.web.WebView
import com.google.accompanist.web.rememberWebViewState
import com.google.android.material.R
import com.junkfood.seal.util.PreferenceUtil.updateString
import com.junkfood.seal.util.USER_AGENT
import com.junkfood.seal.util.USER_AGENT_STRING
import com.junkfood.seal.util.connectWithDelimiter

Expand Down Expand Up @@ -116,6 +116,15 @@ fun WebViewPage(
super.onPageFinished(view, url)
if (url.isNullOrEmpty()) return
}

override fun shouldOverrideUrlLoading(
view: WebView?,
request: WebResourceRequest?
): Boolean {
return if (request?.url?.scheme?.contains("http") == true)
super.shouldOverrideUrlLoading(view, request)
else true
}
}

}
Expand Down

0 comments on commit 35859c2

Please sign in to comment.