remove checks for other country codes since it's expensive

Unfortunately calls to `NBPhoneNumberUtil parse:defaultRegion:error` are
not cheap, calling it with a bunch of permutations on every contact is
too expensive to justify it's incremental value unless we can get
upstream optimized.

e.g. for US numbers this was 26 extra calls per phone number

// FREEBIE
pull/1/head
Michael Kirk 8 years ago
parent 57a799ef92
commit e585b9052e

@ -169,18 +169,6 @@ static NSString *const RPDefaultsKeyPhoneNumberCanonical = @"RPDefaultsKeyPhoneN
callingCodeForLocalNumber,
sanitizedString],
[self defaultRegionCode]);
// It's gratuitous to try all country codes associated with a given
// calling code, but it can't hurt and this isn't a performance
// hotspot.
NSArray *possibleLocalCountryCodes = [PhoneNumberUtil.sharedUtil
countryCodesFromCallingCode:[NSString stringWithFormat:@"+%@", callingCodeForLocalNumber]];
for (NSString *countryCode in possibleLocalCountryCodes) {
tryParsingWithCountryCode([NSString stringWithFormat:@"+%@%@",
callingCodeForLocalNumber,
sanitizedString],
countryCode);
}
}
}

Loading…
Cancel
Save