Commit 130848ba authored by Daniel Wolf's avatar Daniel Wolf
Browse files

User-defined servers could have an empty host

parent cdfdac8b
......@@ -286,10 +286,9 @@ class NewServerDialog(
private fun addUrlTextWatcher(input: TextInputLayout, editText: TextInputEditText, emptyAllowed: Boolean) {
editText.addTextChangedListener(object : TextWatcher {
override fun afterTextChanged(s: Editable) {
val valid =
(emptyAllowed && s.isBlank()) || (dnsOverHttps && SERVER_URL_REGEX.matches(s.toString())) || (!dnsOverHttps && TLS_REGEX.matches(
s.toString()
))
var valid = (emptyAllowed && s.isBlank())
valid = valid || (!s.isBlank() && dnsOverHttps && SERVER_URL_REGEX.matches(s.toString()))
valid = valid || (!s.isBlank() && !dnsOverHttps && TLS_REGEX.matches(s.toString()))
input.error = if (valid) {
null
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment