From 8f3980b582fc22d9087868813781e1284b943228 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Thu, 7 Jan 2016 14:37:35 +0100 Subject: [PATCH] assistant: password is not mandatory anymore on external sip domains --- Classes/AssistantView.h | 2 +- Classes/AssistantView.m | 15 ++++++++++----- Classes/Base.lproj/AssistantView.xib | 16 ++-------------- Classes/Base.lproj/AssistantViewScreens.xib | 2 +- Resources/assistant_external_sip.rc | 2 ++ Resources/assistant_linphone_create.rc | 2 ++ Resources/assistant_linphone_existing.rc | 2 ++ 7 files changed, 20 insertions(+), 21 deletions(-) diff --git a/Classes/AssistantView.h b/Classes/AssistantView.h index 25226c189..524f22643 100644 --- a/Classes/AssistantView.h +++ b/Classes/AssistantView.h @@ -22,7 +22,7 @@ #import "UICompositeView.h" #import "TPKeyboardAvoidingScrollView.h" -@interface AssistantView : TPMultiLayoutViewController { +@interface AssistantView : UIViewController { @private LinphoneAccountCreator *account_creator; UIView *currentView; diff --git a/Classes/AssistantView.m b/Classes/AssistantView.m index 0c5d54e7d..ea7b00b1b 100644 --- a/Classes/AssistantView.m +++ b/Classes/AssistantView.m @@ -37,7 +37,7 @@ typedef enum _ViewElement { ViewElement_Domain = 104, ViewElement_URL = 105, ViewElement_DisplayName = 106, - ViewElement_TextFieldCount = 6, + ViewElement_TextFieldCount = 7, ViewElement_Transport = 110, ViewElement_Username_Label = 120, ViewElement_NextButton = 130, @@ -399,7 +399,7 @@ static UICompositeViewDescription *compositeDescription = nil; for (int i = 0; i < ViewElement_TextFieldCount; i++) { UIAssistantTextField *field = [self findTextField:100 + i]; if (field) { - invalidInputs |= (field.isInvalid || field.lastText.length == 0); + invalidInputs |= field.isInvalid; } } [self findButton:ViewElement_NextButton].enabled = !invalidInputs; @@ -639,6 +639,7 @@ void assistant_validation_tested(LinphoneAccountCreator *creator, LinphoneAccoun - (void)textFieldDidEndEditing:(UITextField *)textField { UIAssistantTextField *atf = (UIAssistantTextField *)textField; [atf textFieldDidEndEditing:atf]; + [self shouldEnableNextButton]; } - (BOOL)textFieldShouldReturn:(UITextField *)textField { @@ -664,14 +665,18 @@ void assistant_validation_tested(LinphoneAccountCreator *creator, LinphoneAccoun shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { UIAssistantTextField *atf = (UIAssistantTextField *)textField; + BOOL replace = YES; + // if we are hitting backspace, invalid range is given (length=1 instead of text size, new string="") + if ([string isEqual:@""]) { + range = NSMakeRange(0, atf.text.length); + } [atf textField:atf shouldChangeCharactersInRange:range replacementString:string]; if (atf.tag == ViewElement_Username && currentView == _createAccountView) { atf.text = [atf.text stringByReplacingCharactersInRange:range withString:string.lowercaseString]; - [self shouldEnableNextButton]; - return NO; + replace = NO; } [self shouldEnableNextButton]; - return YES; + return replace; } #pragma mark - Action Functions diff --git a/Classes/Base.lproj/AssistantView.xib b/Classes/Base.lproj/AssistantView.xib index 2462d7a2c..085bef1d5 100644 --- a/Classes/Base.lproj/AssistantView.xib +++ b/Classes/Base.lproj/AssistantView.xib @@ -1,16 +1,14 @@ - + - + - - @@ -31,12 +29,10 @@ - - - - - diff --git a/Classes/Base.lproj/AssistantViewScreens.xib b/Classes/Base.lproj/AssistantViewScreens.xib index 885ad3d69..60e88fe56 100644 --- a/Classes/Base.lproj/AssistantViewScreens.xib +++ b/Classes/Base.lproj/AssistantViewScreens.xib @@ -505,7 +505,7 @@ -