Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ class TattooArtistRegistrationFragment :
this.setBackgroundValid(this.street)
} else {
this.setBackgroundInvalid(this.street)
showValidationError("Campo 'Rua' deve conter apenas letras e números")
}
}

Expand All @@ -184,6 +185,7 @@ class TattooArtistRegistrationFragment :
this.setBackgroundValid(this.city)
} else {
this.setBackgroundInvalid(this.city)
showValidationError("Campo 'Cidade' deve conter apenas letras")
}
}

Expand All @@ -193,6 +195,7 @@ class TattooArtistRegistrationFragment :
this.setBackgroundValid(this.state)
} else {
this.setBackgroundInvalid(this.state)
showValidationError("Campo 'Estado' deve conter apenas letras")
}
}

Expand All @@ -201,19 +204,24 @@ class TattooArtistRegistrationFragment :
}

private fun isStreetValid(street: String): Boolean {
return street.isNotEmpty()
val streetPattern = HAS_SPECIAL_SYMBOL.toRegex()
return street.isNotEmpty() && (!street.matches(streetPattern))
}

private fun isNumberValid(number: String): Boolean {
return number.isNotEmpty()
}

private fun isCityValid(city: String): Boolean {
return city.isNotEmpty()
val simbolCityPattern = HAS_SPECIAL_SYMBOL.toRegex()
val numberCityPattern = HAS_NUMBER.toRegex()
return city.isNotEmpty() && (!city.matches(simbolCityPattern) && !city.matches(numberCityPattern))
}

private fun isStateValid(state: String): Boolean {
return state.isNotEmpty()
val simbolStatePattern = HAS_SPECIAL_SYMBOL.toRegex()
val numberStatePattern = HAS_NUMBER.toRegex()
return state.isNotEmpty() && (!state.matches(simbolStatePattern) && !state.matches(numberStatePattern))
}

override fun conditionChecking(view: View) {
Expand Down