fix(utils): Allow characters to be included after normalizing numbers

Android's normalizing function stripped out characters too aggressively leading to false matches between different numbers. This commit introduces a faster normalizing function that includes characters.
This commit is contained in:
Inhishonor
2026-03-07 12:09:43 -08:00
parent 1200cb9008
commit c5f4fd54ab
2 changed files with 12 additions and 3 deletions
@@ -68,9 +68,8 @@ class PhoneNumberUtils @Inject constructor(context: Context) {
return PhoneNumberUtils.formatNumber(number.toString(), countryCode) ?: number.toString()
}
fun normalizeNumber(number: String): String {
return PhoneNumberUtils.stripSeparators(number)
}
fun normalizeNumber(number: String): String =
number.filter { it.isLetterOrDigit() || it in "+*#" }
private fun parse(number: CharSequence): Phonenumber.PhoneNumber? {
return tryOrNull(false) { phoneNumberUtil.parse(number, countryCode) }