mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 19:38:52 +01:00
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:
@@ -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) }
|
||||
|
||||
Reference in New Issue
Block a user