diff --git a/Classes/AssistantLinkView.m b/Classes/AssistantLinkView.m index 6218ab01d..2c666adaa 100644 --- a/Classes/AssistantLinkView.m +++ b/Classes/AssistantLinkView.m @@ -191,8 +191,9 @@ void assistant_activate_phone_number_link(LinphoneAccountCreator *creator, Linph - (IBAction)onLinkAccount:(id)sender { _waitView.hidden = NO; + NSString *newStr = [_countryCodeField.text substringWithRange:NSMakeRange(1, [_countryCodeField.text length]-1)]; linphone_account_creator_set_phone_number(account_creator, _phoneField.text.UTF8String, - _countryCodeField.text.UTF8String); + newStr.UTF8String); linphone_account_creator_link_phone_number_with_account(account_creator); } diff --git a/Classes/AssistantView.m b/Classes/AssistantView.m index 102a747dd..b57950cab 100644 --- a/Classes/AssistantView.m +++ b/Classes/AssistantView.m @@ -506,8 +506,10 @@ static UICompositeViewDescription *compositeDescription = nil; UIAssistantTextField *createPhone = [self findTextField:ViewElement_Phone]; [createPhone showError:[AssistantView errorForStatus:LinphoneAccountCreatorPhoneNumberInvalid] when:^BOOL(NSString *inputEntry) { + UIAssistantTextField* countryCodeField = [self findTextField:ViewElement_PhoneCC]; - NSString *prefix = (inputEntry.length > 0) ? countryCodeField.text : nil; + NSString *newStr = [countryCodeField.text substringWithRange:NSMakeRange(1, [countryCodeField.text length]-1)]; + NSString *prefix = (inputEntry.length > 0) ? newStr : nil; LinphoneAccountCreatorStatus s = linphone_account_creator_set_phone_number(account_creator, inputEntry.length > 0 ? inputEntry.UTF8String : NULL, prefix.UTF8String); if (s != LinphoneAccountCreatorOK) { @@ -931,19 +933,6 @@ void assistant_is_account_activated(LinphoneAccountCreator *creator, LinphoneAcc } [self shouldEnableNextButton]; - //remove the + from the country code to avoir error when checking its validity - NSString *newStr = [[self findTextField:ViewElement_PhoneCC].text substringWithRange:NSMakeRange(1, [[self findTextField:ViewElement_PhoneCC].text length]-1)]; - LinphoneAccountCreatorStatus status = linphone_account_creator_set_phone_number(account_creator, [[self findTextField:ViewElement_Phone].text UTF8String], [newStr UTF8String]); - if (status == LinphoneAccountCreatorPhoneNumberTooLong || [self findTextField:ViewElement_Phone].text.length < 8) { - [self findTextField:ViewElement_Phone].layer.borderWidth = .8; - [self findTextField:ViewElement_Phone].layer.cornerRadius = 4.f; - [self findTextField:ViewElement_Phone].layer.borderColor = [[UIColor redColor] CGColor]; - [self findButton:ViewElement_NextButton].enabled = FALSE; - } else { - [self findTextField:ViewElement_Phone].layer.borderColor = [[UIColor clearColor] CGColor]; - [self findButton:ViewElement_NextButton].enabled = TRUE; - } - return replace; } }