Skip showing connection prompt when loaded URL is local or api path (#3232)

* Skip showing connection prompt when loaded URL is local or api path

* Only check first segment to limit false positives
This commit is contained in:
Daniel Shokouhi 2023-01-20 11:02:55 -08:00 committed by GitHub
parent 346ef3da5f
commit 33fc6c3779
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -109,6 +109,7 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.withContext
import okhttp3.HttpUrl.Companion.toHttpUrl
import org.chromium.net.CronetEngine
import org.json.JSONObject
import java.util.concurrent.Executors
@ -1321,7 +1322,11 @@ class WebViewActivity : BaseActivity(), io.homeassistant.companion.android.webvi
private fun waitForConnection() {
Handler(Looper.getMainLooper()).postDelayed(
{
if (!isConnected) {
if (
!isConnected &&
!loadedUrl.toHttpUrl().pathSegments.first().contains("api") &&
!loadedUrl.toHttpUrl().pathSegments.first().contains("local")
) {
showError()
}
},