Fix account creation

This commit is contained in:
REIS Benjamin 2016-10-07 11:04:55 +02:00
parent 18aef75ca1
commit b1071d5fa1
2 changed files with 5 additions and 15 deletions

View file

@ -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);
}

View file

@ -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;
}
}