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 19d65e527..03cca0ed3 100644 Binary files a/Resources/en.lproj/Localizable.strings and b/Resources/en.lproj/Localizable.strings differ diff --git a/Resources/fr.lproj/Localizable.strings b/Resources/fr.lproj/Localizable.strings index e4ddf09cd..93ea9abbb 100644 Binary files a/Resources/fr.lproj/Localizable.strings and b/Resources/fr.lproj/Localizable.strings differ 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 19d65e527..03cca0ed3 100644 Binary files a/linphone.ldb/Resources/Resources/Localizable/1/Localizable.strings and b/linphone.ldb/Resources/Resources/Localizable/1/Localizable.strings differ