Show example phone numbers.

// FREEBIE
pull/1/head
Matthew Chen 9 years ago
parent 2bb7459303
commit fb3e2557e0

@ -22,6 +22,8 @@
to:(NSString *)target
stickingRightward:(bool)preferHigh;
+ (NSString *)examplePhoneNumberForCountryCode:(NSString *)countryCode;
+ (instancetype)sharedUtil;
@end

@ -244,4 +244,27 @@
}
}
+ (NSString *)examplePhoneNumberForCountryCode:(NSString *)countryCode
{
NSError *error;
NBPhoneNumber *nbPhoneNumber =
[[[self sharedUtil] nbPhoneNumberUtil] getExampleNumberForType:countryCode
type:NBEPhoneNumberTypeMOBILE
error:&error];
OWSAssert(!error);
if (!nbPhoneNumber) {
nbPhoneNumber =
[[[self sharedUtil] nbPhoneNumberUtil] getExampleNumberForType:countryCode
type:NBEPhoneNumberTypeFIXED_LINE_OR_MOBILE
error:&error];
OWSAssert(!error);
}
NSString *result = (nbPhoneNumber ? [[[self sharedUtil] nbPhoneNumberUtil] format:nbPhoneNumber
numberFormat:NBEPhoneNumberFormatE164
error:&error]
: nil);
OWSAssert(!error);
return result;
}
@end

Loading…
Cancel
Save