Skip to content

Commit

Permalink
fix: It will now show an error message for invalid phone numbers.
Browse files Browse the repository at this point in the history
  • Loading branch information
itsPronay committed Mar 22, 2024
1 parent 176ce50 commit 8efd72b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,14 @@ class RegistrationFragment : BaseFragment() {
false
}

viewModel.isPhoneNumberNotValid(phoneNumberContent) ->{
Toaster.show(
view,
getString(R.string.invalid_phn_number),
)
false
}

viewModel.isInputFieldBlank(emailContent) -> {
Toaster.show(
view,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ class RegistrationViewModel @Inject constructor(private val userAuthRepositoryIm
return fieldText.trim().contains(" ")
}

fun isPhoneNumberNotValid(fieldText: String): Boolean{
return fieldText.toIntOrNull() == null
}

fun hasLeadingTrailingSpaces(fieldText: String): Boolean {
return fieldText.trim().length < fieldText.length
}
Expand Down

0 comments on commit 8efd72b

Please sign in to comment.