Update libphonenumber to 8.13.23

This commit is contained in:
Greyson Parrelli
2023-11-17 11:16:18 -05:00
parent fed9c64113
commit 5a159ce01f
6 changed files with 43 additions and 3 deletions

View File

@@ -127,6 +127,7 @@ public class PhoneNumberFormatter {
}
if (isShortCode(bareNumber, localCountryCode)) {
Log.i(TAG, "Recognized number as short code.");
return bareNumber;
}
@@ -134,7 +135,13 @@ public class PhoneNumberFormatter {
try {
Phonenumber.PhoneNumber parsedNumber = phoneNumberUtil.parse(processedNumber, localCountryCode);
return phoneNumberUtil.format(parsedNumber, PhoneNumberUtil.PhoneNumberFormat.E164);
String formatted = phoneNumberUtil.format(parsedNumber, PhoneNumberUtil.PhoneNumberFormat.E164);
if (formatted.startsWith("+")) {
return formatted;
} else {
throw new NumberParseException(NumberParseException.ErrorType.NOT_A_NUMBER, "After formatting, the number did not start with +! hasRawInput: " + parsedNumber.hasRawInput());
}
} catch (NumberParseException e) {
Log.w(TAG, e.toString());
if (bareNumber.charAt(0) == '+') {