Trim e-mail and username to ease the login process

Spaces aren't visible in EditText and it's possible to
get authentication errors because of that invisible space.
This commit is contained in:
Kirill Kamakin
2022-04-04 21:19:57 +05:00
parent 2e5684c8a3
commit 97ffbff89a
3 changed files with 29 additions and 21 deletions

View File

@@ -39,13 +39,18 @@ class AuthenticationFragment : Fragment(R.layout.fragment_authentication) {
private fun onLoginClicked(): Unit = with(binding) {
Timber.v("onLoginClicked() called")
val email: String = emailInput.checkIfInputIsEmpty(emailInputLayout, lifecycleScope) {
getString(R.string.fragment_authentication_email_input_empty)
} ?: return
val email: String = emailInput.checkIfInputIsEmpty(
inputLayout = emailInputLayout,
lifecycleOwner = viewLifecycleOwner,
stringId = R.string.fragment_authentication_email_input_empty,
) ?: return
val pass: String = passwordInput.checkIfInputIsEmpty(passwordInputLayout, lifecycleScope) {
getString(R.string.fragment_authentication_password_input_empty)
} ?: return
val pass: String = passwordInput.checkIfInputIsEmpty(
inputLayout = passwordInputLayout,
lifecycleOwner = viewLifecycleOwner,
stringId = R.string.fragment_authentication_password_input_empty,
trim = false,
) ?: return
button.isClickable = false
viewLifecycleOwner.lifecycleScope.launch {