Fix short code check!

It was returning true when it should return false

Broke it while trying to fix https://github.com/FossifyOrg/Messages/issues/115
This commit is contained in:
Naveen Singh 2025-01-04 16:20:07 +05:30
parent b920dbd482
commit f0ef2bfe10
No known key found for this signature in database
GPG key ID: AF5D43C216778C0B

View file

@ -102,11 +102,10 @@ fun Context.sendMessageCompat(
* contains outdated information regarding max number of digits. The exact parameters for short codes can vary by country and by carrier.
*/
fun isShortCodeWithLetters(address: String): Boolean {
val hasLetters = address.any { it.isLetter() }
return if (hasLetters) {
if (Patterns.EMAIL_ADDRESS.matcher(address).matches()) {
// emails are not short codes: https://github.com/FossifyOrg/Messages/issues/115
!Patterns.EMAIL_ADDRESS.matcher(address).matches()
} else {
true
return false
}
return address.any { it.isLetter() }
}