diff --git a/Classes/AssistantView.m b/Classes/AssistantView.m index 25ce0695a..c07309e91 100644 --- a/Classes/AssistantView.m +++ b/Classes/AssistantView.m @@ -49,7 +49,7 @@ typedef enum _ViewElement { - (id)init { self = [super initWithNibName:NSStringFromClass(self.class) bundle:[NSBundle mainBundle]]; if (self != nil) { - [[NSBundle mainBundle] loadNibNamed:@"AssistantSubviews" owner:self options:nil]; + [[NSBundle mainBundle] loadNibNamed:@"AssistantViewScreens" owner:self options:nil]; historyViews = [[NSMutableArray alloc] init]; currentView = nil; } @@ -91,6 +91,7 @@ static UICompositeViewDescription *compositeDescription = nil; name:kLinphoneConfiguringStateUpdate object:nil]; new_config = NULL; + [self resetTextFields]; [self changeView:_welcomeView back:FALSE animation:FALSE]; } @@ -211,7 +212,11 @@ static UICompositeViewDescription *compositeDescription = nil; LinphoneManager *lm = [LinphoneManager instance]; if (new_config != NULL && proxy != new_config) { + const LinphoneAuthInfo *auth = linphone_proxy_config_find_auth_info(new_config); linphone_core_remove_proxy_config(lc, new_config); + if (auth) { + linphone_core_remove_auth_info(lc, auth); + } } new_config = proxy; @@ -455,7 +460,7 @@ static UICompositeViewDescription *compositeDescription = nil; forProxy:(LinphoneProxyConfig *)proxy message:(NSString *)message { // in assistant we only care about ourself - if (proxy != linphone_core_get_default_proxy_config([LinphoneManager getLc])) { + if (proxy != new_config) { return; } @@ -529,9 +534,11 @@ static UICompositeViewDescription *compositeDescription = nil; void assistant_existence_tested(LinphoneAccountCreator *creator, LinphoneAccountCreatorStatus status) { AssistantView *thiz = (__bridge AssistantView *)(linphone_account_creator_get_user_data(creator)); thiz.waitView.hidden = YES; - if (status == LinphoneAccountCreatorOk) { + if (status == LinphoneAccountCreatorFailed) { [[thiz findTextField:ViewElement_Username] showError:NSLocalizedString(@"This name is already taken.", nil)]; [thiz findButton:ViewElement_NextButton].enabled = NO; + } else { + [thiz changeView:thiz.createAccountActivationView back:FALSE animation:TRUE]; } } @@ -539,18 +546,15 @@ void assistant_create_account(LinphoneAccountCreator *creator, LinphoneAccountCr AssistantView *thiz = (__bridge AssistantView *)(linphone_account_creator_get_user_data(creator)); thiz.waitView.hidden = YES; if (status == LinphoneAccountCreatorOk) { - NSString *username = [thiz findTextField:ViewElement_Username].text; - NSString *password = [thiz findTextField:ViewElement_Password].text; - [thiz changeView:thiz.createAccountActivationView back:FALSE animation:TRUE]; - [thiz findTextField:ViewElement_Username].text = username; - [thiz findTextField:ViewElement_Password].text = password; + thiz.waitView.hidden = NO; + linphone_account_creator_test_validation(thiz->account_creator); } else { - UIAlertView *errorView = - [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Account creation issue", nil) - message:NSLocalizedString(@"Can't create the account. Please try again.", nil) - delegate:nil - cancelButtonTitle:NSLocalizedString(@"Continue", nil) - otherButtonTitles:nil, nil]; + UIAlertView *errorView = [[UIAlertView alloc] + initWithTitle:NSLocalizedString(@"Account validation issue", nil) + message:NSLocalizedString(@"Your account could not be created, please try again later.", nil) + delegate:nil + cancelButtonTitle:NSLocalizedString(@"Continue", nil) + otherButtonTitles:nil, nil]; [errorView show]; } } @@ -596,6 +600,7 @@ void assistant_validation_tested(LinphoneAccountCreator *creator, LinphoneAccoun [atf textField:atf shouldChangeCharactersInRange:range replacementString:string]; if (atf.tag == ViewElement_Username && currentView == _createAccountView) { textField.text = [textField.text stringByReplacingCharactersInRange:range withString:string.lowercaseString]; + [self shouldEnableNextButton]; return NO; } [self shouldEnableNextButton]; diff --git a/Classes/Base.lproj/AssistantView.xib b/Classes/Base.lproj/AssistantView.xib index bf56c42db..e870f256c 100644 --- a/Classes/Base.lproj/AssistantView.xib +++ b/Classes/Base.lproj/AssistantView.xib @@ -36,7 +36,7 @@ - + diff --git a/Classes/Base.lproj/AssistantSubviews.xib b/Classes/Base.lproj/AssistantViewScreens.xib similarity index 99% rename from Classes/Base.lproj/AssistantSubviews.xib rename to Classes/Base.lproj/AssistantViewScreens.xib index d62e30100..6d142da95 100644 --- a/Classes/Base.lproj/AssistantSubviews.xib +++ b/Classes/Base.lproj/AssistantViewScreens.xib @@ -49,7 +49,7 @@ - + @@ -64,7 +64,7 @@ - + @@ -78,29 +78,11 @@ - + @@ -233,7 +233,7 @@ - + @@ -302,7 +302,7 @@ - + @@ -381,7 +381,7 @@ - + @@ -393,7 +393,7 @@ - + @@ -472,7 +472,7 @@ - + @@ -493,7 +493,7 @@ - + @@ -527,7 +527,7 @@ - + @@ -597,11 +597,11 @@ - + - + @@ -676,7 +676,7 @@ - + @@ -697,7 +697,7 @@ - + @@ -709,7 +709,7 @@ - + diff --git a/Classes/Base.lproj/ChatConversationCreateView.xib b/Classes/Base.lproj/ChatConversationCreateView.xib index 44d8a1ff2..83aa63385 100644 --- a/Classes/Base.lproj/ChatConversationCreateView.xib +++ b/Classes/Base.lproj/ChatConversationCreateView.xib @@ -48,7 +48,7 @@ - + @@ -59,7 +59,7 @@ - + @@ -77,7 +77,7 @@ - + diff --git a/Classes/Base.lproj/ChatConversationView.xib b/Classes/Base.lproj/ChatConversationView.xib index 8bf5985ed..03ab99171 100644 --- a/Classes/Base.lproj/ChatConversationView.xib +++ b/Classes/Base.lproj/ChatConversationView.xib @@ -131,14 +131,14 @@ - + - + - + @@ -233,7 +233,7 @@ - + diff --git a/Classes/Base.lproj/ChatsListView.xib b/Classes/Base.lproj/ChatsListView.xib index 80291a1c8..16aa31d65 100644 --- a/Classes/Base.lproj/ChatsListView.xib +++ b/Classes/Base.lproj/ChatsListView.xib @@ -35,14 +35,14 @@ - + - + - + @@ -112,7 +112,7 @@ - + diff --git a/Classes/Base.lproj/ContactDetailsView.xib b/Classes/Base.lproj/ContactDetailsView.xib index 5e146ae4e..513c57641 100644 --- a/Classes/Base.lproj/ContactDetailsView.xib +++ b/Classes/Base.lproj/ContactDetailsView.xib @@ -112,7 +112,7 @@ - + diff --git a/Classes/Base.lproj/ContactsListView.xib b/Classes/Base.lproj/ContactsListView.xib index 8ff83ca98..47e71fe13 100644 --- a/Classes/Base.lproj/ContactsListView.xib +++ b/Classes/Base.lproj/ContactsListView.xib @@ -137,14 +137,14 @@ - + - + - + diff --git a/Classes/Base.lproj/HistoryDetailsView.xib b/Classes/Base.lproj/HistoryDetailsView.xib index 9982442fc..7919b67e6 100644 --- a/Classes/Base.lproj/HistoryDetailsView.xib +++ b/Classes/Base.lproj/HistoryDetailsView.xib @@ -35,7 +35,7 @@