Fix duplicate e164 short codes cleanup bug.

This commit is contained in:
Cody Henthorne
2025-10-09 15:00:06 -04:00
committed by GitHub
parent 9ab1996f4a
commit f9ddba5aed
3 changed files with 58 additions and 2 deletions

View File

@@ -60,14 +60,14 @@ object SignalE164Util {
* This does not check if the number is *valid* for a given region. Instead, it's very lenient and just
* does it's best to interpret the input string as a number that could be put into the E164 format.
*
* Note that shortcodes will not have leading '+' signs.
* Note that shortcodes will return null.
*
* In other words, if this method returns null, you likely do not have anything that could be considered
* a phone number.
*/
@JvmStatic
fun formatNonShortCodeAsE164(input: String): String? {
return getFormatter().formatAsE164(input)?.takeIf { input.trimStart('+', '0').length > 6 }
return getFormatter().formatAsE164(input)?.takeIf { !getFormatter().isValidShortNumber(input) }
}
/**