private fun validateAccountInformationScreen(): AccountInformationErrors? { val emailValid = InputValidator.checkIfFieldRequired(uiState.value.email.value?:"", true) val userNameValid = InputValidator.checkIfFieldRequired(uiState.value.userName.value?:"", true) val passwordValid = InputValidator.checkIfFieldRequired(uiState.value.password.value?:"", true) val confirmPasswordValid = InputValidator.checkIfFieldRequired(uiState.value.confirmPassword.value?:"", true) return if (emailValid == null && userNameValid == null && passwordValid == null && confirmPasswordValid == null) { null } else { AccountInformationErrors( emailNameErrorId = emailValid, userNameErrorId = userNameValid, passwordErrorId = passwordValid, verifyPasswordErrorId = confirmPasswordValid ) } }
This function validates the information on the Account Information screen. If input validation fails for any of the fields, this functions assigns the error strings to be shown by the UI