forked from mirrors/linphone-iphone
Fix phone number and country code control in Assistant
This commit is contained in:
parent
e68d7d2fd5
commit
18aef75ca1
2 changed files with 18 additions and 2 deletions
|
|
@ -235,8 +235,10 @@ void assistant_activate_phone_number_link(LinphoneAccountCreator *creator, Linph
|
|||
#pragma mark - UITextFieldDelegate Functions
|
||||
|
||||
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
|
||||
LinphoneAccountCreatorStatus status = linphone_account_creator_set_phone_number(account_creator, [_phoneField.text UTF8String], [_countryCodeField.text UTF8String]);
|
||||
if (status == LinphoneAccountCreatorPhoneNumberTooLong || self.phoneField.text.length < 8 || status == LinphoneAccountCreatorPhoneNumberInvalid) {
|
||||
//remove the + from the country code to avoir error when checking its validity
|
||||
NSString *newStr = [_countryCodeField.text substringWithRange:NSMakeRange(1, [_countryCodeField.text length]-1)];
|
||||
LinphoneAccountCreatorStatus status = linphone_account_creator_set_phone_number(account_creator, [_phoneField.text UTF8String], [newStr UTF8String]);
|
||||
if (status == LinphoneAccountCreatorPhoneNumberTooLong || self.phoneField.text.length < 8) {
|
||||
self.phoneField.layer.borderWidth = .8;
|
||||
self.phoneField.layer.cornerRadius = 4.f;
|
||||
self.phoneField.layer.borderColor = [[UIColor redColor] CGColor];
|
||||
|
|
|
|||
|
|
@ -930,6 +930,20 @@ void assistant_is_account_activated(LinphoneAccountCreator *creator, LinphoneAcc
|
|||
[self refreshYourUsername];
|
||||
}
|
||||
[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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue