Improve UX when Login WebView fails to load the page (#2492)

Previously we simply closed the screen with the login WebView which
could cause confusion. Now we specify that page could not be loaded.

As a side effect it will also show the error message which the server
returns (if any).
This commit is contained in:
Ivan Kupalov 2022-05-03 19:14:55 +02:00 committed by GitHub
commit f3d7923803
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 2 deletions

View file

@ -68,7 +68,9 @@ class LoginActivity : BaseActivity(), Injectable {
// Authorization failed. Put the error response where the user can read it and they
// can try again.
setLoading(false)
binding.domainTextInputLayout.error = getString(R.string.error_authorization_denied)
// Use error returned by the server or fall back to the generic message
binding.domainTextInputLayout.error =
result.errorMessage.ifBlank { getString(R.string.error_authorization_denied) }
Log.e(
TAG,
"%s %s".format(

View file

@ -117,7 +117,7 @@ class LoginWebViewActivity : BaseActivity(), Injectable {
error: WebResourceError
) {
Log.d("LoginWeb", "Failed to load ${data.url}: $error")
finishWithoutSlideOutAnimation()
sendResult(LoginResult.Err(getString(R.string.error_could_not_load_login_page)))
}
override fun shouldOverrideUrlLoading(