From fe5b67bac5d41a4ada6c6b1b8f8638efcbf36afd Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Fri, 28 Sep 2012 11:11:01 +0200 Subject: [PATCH] Fix tap on button in Wizard Add check on external/linphone.org account --- Classes/WizardViewController.h | 2 +- Classes/WizardViewController.m | 63 ++++++++++++++++-- Resources/en.lproj/Localizable.strings | Bin 16862 -> 17258 bytes Resources/fr.lproj/Localizable.strings | Bin 17432 -> 17858 bytes linphone.ldb/Contents.plist | 60 ++++++++++++++++- .../Localizable/1/Localizable.strings | Bin 16862 -> 17258 bytes 6 files changed, 116 insertions(+), 9 deletions(-) diff --git a/Classes/WizardViewController.h b/Classes/WizardViewController.h index 2d4ab4f47..3d0223b2c 100644 --- a/Classes/WizardViewController.h +++ b/Classes/WizardViewController.h @@ -21,7 +21,7 @@ #import #import "UICompositeViewController.h" -@interface WizardViewController : TPMultiLayoutViewController { +@interface WizardViewController : TPMultiLayoutViewController { @private UITextField *activeTextField; UIView *currentView; diff --git a/Classes/WizardViewController.m b/Classes/WizardViewController.m index c17b7e0b9..408abb40a 100644 --- a/Classes/WizardViewController.m +++ b/Classes/WizardViewController.m @@ -154,6 +154,7 @@ static UICompositeViewDescription *compositeDescription = nil; [super viewDidLoad]; [viewTapGestureRecognizer setCancelsTouchesInView:FALSE]; + [viewTapGestureRecognizer setDelegate:self]; [contentView addGestureRecognizer:viewTapGestureRecognizer]; if([LinphoneManager runningOnIpad]) { @@ -490,20 +491,59 @@ static UICompositeViewDescription *compositeDescription = nil; } - (IBAction)onSignInExternalClick:(id)sender { - [self.waitView setHidden:false]; NSString *username = [WizardViewController findTextField:ViewElement_Username view:contentView].text; NSString *password = [WizardViewController findTextField:ViewElement_Password view:contentView].text; NSString *domain = [WizardViewController findTextField:ViewElement_Domain view:contentView].text; - [self addProxyConfig:username password:password domain:domain server:nil]; + + + NSMutableString *errors = [NSMutableString string]; + if ([username length] == 0) { + + [errors appendString:[NSString stringWithFormat:NSLocalizedString(@"Please enter a username.\n", nil)]]; + } + + if ([domain length] == 0) { + [errors appendString:[NSString stringWithFormat:NSLocalizedString(@"Please enter a domain.\n", nil)]]; + } + + if([errors length]) { + UIAlertView* errorView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Check error(s)",nil) + message:[errors substringWithRange:NSMakeRange(0, [errors length] - 1)] + delegate:nil + cancelButtonTitle:NSLocalizedString(@"Continue",nil) + otherButtonTitles:nil,nil]; + [errorView show]; + [errorView release]; + } else { + [self.waitView setHidden:false]; + [self addProxyConfig:username password:password domain:domain server:nil]; + } } - (IBAction)onSignInClick:(id)sender { - [self.waitView setHidden:false]; NSString *username = [WizardViewController findTextField:ViewElement_Username view:contentView].text; NSString *password = [WizardViewController findTextField:ViewElement_Password view:contentView].text; - [self addProxyConfig:username password:password - domain:[[LinphoneManager instance] lpConfigStringForKey:@"domain" forSection:@"wizard"] - server:[[LinphoneManager instance] lpConfigStringForKey:@"proxy" forSection:@"wizard"]]; + + NSMutableString *errors = [NSMutableString string]; + if ([username length] == 0) { + + [errors appendString:[NSString stringWithFormat:NSLocalizedString(@"Please enter a username.\n", nil)]]; + } + + if([errors length]) { + UIAlertView* errorView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Check error(s)",nil) + message:[errors substringWithRange:NSMakeRange(0, [errors length] - 1)] + delegate:nil + cancelButtonTitle:NSLocalizedString(@"Continue",nil) + otherButtonTitles:nil,nil]; + [errorView show]; + [errorView release]; + } else { + [self.waitView setHidden:false]; + [self addProxyConfig:username password:password + domain:[[LinphoneManager instance] lpConfigStringForKey:@"domain" forSection:@"wizard"] + server:[[LinphoneManager instance] lpConfigStringForKey:@"proxy" forSection:@"wizard"]]; + } } - (IBAction)onRegisterClick:(id)sender { @@ -732,4 +772,15 @@ static UICompositeViewDescription *compositeDescription = nil; view.autoresizingMask = [[attributes objectForKey:@"autoresizingMask"] integerValue]; } + +#pragma mark - UIGestureRecognizerDelegate Functions + +- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch { + if ([touch.view isKindOfClass:[UIButton class]]) { //Avoid tap gesture on Button + [LinphoneUtils findAndResignFirstResponder:currentView]; + return NO; + } + return YES; +} + @end diff --git a/Resources/en.lproj/Localizable.strings b/Resources/en.lproj/Localizable.strings index 19d65e527bc4da5700aac000032c9f2a38f265c8..03cca0ed321fd679ee7af4f251e531bc1565bb23 100644 GIT binary patch delta 206 zcmccD%=oH}aYLzgXevVPS+5)i>LjXe# zP-P-RF_2UMVoaU6Kv|&9$rsGxC#P%k#iFYz1?w#W>IB)5N}>&Dx=aXp3@hP=stWhK>1fjk8u z&IihX)TBaH<^t7%RHj1IPHc>v{6U9L72VKMhGMW4d0?ZVia`c50}Y;B=%~sHwhE|y q^9P+{+{_?rFIpu|4zLoKtY&!%iQfcbZ@y^d%m@{X-&|y~j2!?v`8fLk delta 43 wcmX@q%{Zfjal=2I%`^0Na8I6OT`>8G)hQtTX!0b>gvmE-Ky=(@8M|fd0MT_6umAu6 diff --git a/linphone.ldb/Contents.plist b/linphone.ldb/Contents.plist index 212d5e672..a1bb4d322 100644 --- a/linphone.ldb/Contents.plist +++ b/linphone.ldb/Contents.plist @@ -11997,7 +11997,7 @@ change date - 2012-09-27T16:22:23Z + 2012-09-28T08:39:17Z changed values class @@ -12007,7 +12007,7 @@ flags 0 hash - 6b28bbe0cc4362b29f1a00eec7d9ad2d + 974d882db652398dc5678a38298fec69 name Localizable.strings @@ -13589,6 +13589,62 @@ La cause était: %2$@ snapshots + + change date + 2001-01-01T00:00:00Z + changed values + + class + BLStringKeyObject + comment + No comment provided by engineer. + errors + + flags + 0 + key + Please enter a doamin. + + localizations + + en + Please enter a domain. + + fr + Entrez un nom de domaine. + + + snapshots + + + + change date + 2001-01-01T00:00:00Z + changed values + + class + BLStringKeyObject + comment + No comment provided by engineer. + errors + + flags + 0 + key + Please enter a username. + + localizations + + en + Please enter a username. + + fr + Entrez un nom d'utilisateur. + + + snapshots + + change date 2001-01-01T00:00:00Z diff --git a/linphone.ldb/Resources/Resources/Localizable/1/Localizable.strings b/linphone.ldb/Resources/Resources/Localizable/1/Localizable.strings index 19d65e527bc4da5700aac000032c9f2a38f265c8..03cca0ed321fd679ee7af4f251e531bc1565bb23 100644 GIT binary patch delta 206 zcmccD%=oH}aYLzgXevVPS+5)i>LjXe# zP-P-RF_2UMVoaU6Kv|&9$rsGxC#P%k#iFYz1?w#W>IB)5N}>&Dx