From 37a601d765cee6fe85a096a4d7bfd391a82a3795 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Wed, 17 May 2017 15:24:24 -0400 Subject: [PATCH 1/2] Honor the local calling code in select recipient view. // FREEBIE --- .../SelectRecipientViewController.m | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/Signal/src/ViewControllers/SelectRecipientViewController.m b/Signal/src/ViewControllers/SelectRecipientViewController.m index 12170a862..f7413ae45 100644 --- a/Signal/src/ViewControllers/SelectRecipientViewController.m +++ b/Signal/src/ViewControllers/SelectRecipientViewController.m @@ -214,10 +214,28 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien - (void)populateDefaultCountryNameAndCode { - NSLocale *locale = NSLocale.currentLocale; - NSString *countryCode = [locale objectForKey:NSLocaleCountryCode]; - NSNumber *callingCode = [[PhoneNumberUtil sharedUtil].nbPhoneNumberUtil getCountryCodeForRegion:countryCode]; + PhoneNumber *localNumber = [PhoneNumber phoneNumberFromE164:[TSAccountManager localNumber]]; + OWSAssert(localNumber); + + NSString *countryCode; + NSNumber *callingCode; + if (localNumber) { + callingCode = [localNumber getCountryCode]; + OWSAssert(callingCode); + if (callingCode) { + countryCode = [[PhoneNumberUtil sharedUtil] + probableCountryCodeForCallingCode:[@"+" stringByAppendingString:[callingCode description]]]; + } + } + + if (!countryCode || !callingCode) { + NSLocale *locale = NSLocale.currentLocale; + countryCode = [locale objectForKey:NSLocaleCountryCode]; + callingCode = [[PhoneNumberUtil sharedUtil].nbPhoneNumberUtil getCountryCodeForRegion:countryCode]; + } + NSString *countryName = [PhoneNumberUtil countryNameFromCountryCode:countryCode]; + [self updateCountryWithName:countryName callingCode:[NSString stringWithFormat:@"%@%@", COUNTRY_CODE_PREFIX, callingCode] countryCode:countryCode]; From 07cc8baa60a449e2cb88af2ec0f37113c793638a Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Thu, 18 May 2017 09:53:48 -0400 Subject: [PATCH 2/2] [SSK] Honor the local calling code in select recipient view. // FREEBIE --- Podfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Podfile.lock b/Podfile.lock index 138d3f9cf..2fc72a4b2 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -134,7 +134,7 @@ CHECKOUT OPTIONS: :commit: 7054e4b13ee5bcd6d524adb6dc9a726e8c466308 :git: https://github.com/WhisperSystems/JSQMessagesViewController.git SignalServiceKit: - :commit: cd4cb1709c70e6224180b30b7b1ede59bf978615 + :commit: 2f7e76f82c98a43e8f6f57e6bd8c2783cdb73edf :git: https://github.com/WhisperSystems/SignalServiceKit.git SocketRocket: :commit: 877ac7438be3ad0b45ef5ca3969574e4b97112bf