From 7306803ae7705927f4b5feb11a0be7b30e9e7ac0 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Thu, 30 Mar 2017 23:21:56 -0400 Subject: [PATCH] Add explicit calling code state to registration view. // FREEBIE --- Signal/src/ViewControllers/RegistrationViewController.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Signal/src/ViewControllers/RegistrationViewController.m b/Signal/src/ViewControllers/RegistrationViewController.m index 8bcdf61a6..b7eb145e4 100644 --- a/Signal/src/ViewControllers/RegistrationViewController.m +++ b/Signal/src/ViewControllers/RegistrationViewController.m @@ -16,6 +16,8 @@ static NSString *const kCodeSentSegue = @"codeSent"; @interface RegistrationViewController () +@property (nonatomic) NSString *lastCallingCode; + @end @implementation RegistrationViewController @@ -70,6 +72,9 @@ static NSString *const kCodeSentSegue = @"codeSent"; - (void)updateCountryWithName:(NSString *)countryName callingCode:(NSString *)callingCode countryCode:(NSString *)countryCode { + + _lastCallingCode = callingCode; + NSString *title = [NSString stringWithFormat:@"%@ (%@)", callingCode, countryCode.uppercaseString]; @@ -123,8 +128,7 @@ static NSString *const kCodeSentSegue = @"codeSent"; } - (IBAction)sendCodeAction:(id)sender { - NSString *phoneNumber = - [NSString stringWithFormat:@"%@%@", _countryCodeButton.titleLabel.text, _phoneNumberTextField.text]; + NSString *phoneNumber = [NSString stringWithFormat:@"%@%@", _lastCallingCode, _phoneNumberTextField.text]; PhoneNumber *localNumber = [PhoneNumber tryParsePhoneNumberFromUserSpecifiedText:phoneNumber]; [_sendCodeButton setEnabled:NO];