mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2025-01-18 12:56:45 -06:00
[API/Librus] Fix doubled sync on reCaptcha timeout.
This commit is contained in:
parent
f883318bd2
commit
300e2c4bc2
@ -36,11 +36,14 @@ class LibrusRecaptchaHelper(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private var timeout: Job? = null
|
private var timeout: Job? = null
|
||||||
|
private var timedOut = false
|
||||||
|
|
||||||
inner class WebViewClient : android.webkit.WebViewClient() {
|
inner class WebViewClient : android.webkit.WebViewClient() {
|
||||||
override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
|
override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
|
||||||
timeout?.cancel()
|
timeout?.cancel()
|
||||||
onSuccess(url)
|
if (!timedOut) {
|
||||||
|
onSuccess(url)
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -50,6 +53,7 @@ class LibrusRecaptchaHelper(
|
|||||||
webView.loadDataWithBaseURL(url, html, "text/html", "UTF-8", null)
|
webView.loadDataWithBaseURL(url, html, "text/html", "UTF-8", null)
|
||||||
}
|
}
|
||||||
timeout = startCoroutineTimer(delayMillis = 10000L) {
|
timeout = startCoroutineTimer(delayMillis = 10000L) {
|
||||||
|
timedOut = true
|
||||||
onTimeout()
|
onTimeout()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user