fix: WebViewActivity try to clear cookie of an intent instead of http(s)

This commit is contained in:
Ahmad Ansori Palembani 2024-06-10 05:55:08 +07:00
parent 6513d43f6e
commit 18bc9e459c
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6

View file

@ -177,8 +177,13 @@ open class WebViewActivity : BaseWebViewActivity() {
private fun clearCookies() {
val url = binding.webview.url ?: return
val cleared = network.cookieJar.remove(url.toHttpUrl())
toast("Cleared $cleared cookies for: $url")
try {
val cleared = network.cookieJar.remove(url.toHttpUrl())
toast("Cleared $cleared cookies for: $url")
} catch (e: IllegalArgumentException) {
Logger.w(e) { "Somehow getting non http url: $url" }
toast("Unable to clear cookies for: $url (Invalid url)")
}
}
private fun openUrlInApp() {