From f0ef2bfe10c44a2640d1a4a35b774c554cd4a1bf Mon Sep 17 00:00:00 2001 From: Naveen Singh Date: Sat, 4 Jan 2025 16:20:07 +0530 Subject: [PATCH] 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 --- .../kotlin/org/fossify/messages/messaging/Messaging.kt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/src/main/kotlin/org/fossify/messages/messaging/Messaging.kt b/app/src/main/kotlin/org/fossify/messages/messaging/Messaging.kt index ab904498..99ea2ec5 100644 --- a/app/src/main/kotlin/org/fossify/messages/messaging/Messaging.kt +++ b/app/src/main/kotlin/org/fossify/messages/messaging/Messaging.kt @@ -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() } }