diff --git a/Classes/AssistantLinkView.h b/Classes/AssistantLinkView.h index 0e3dcb1e8..a97aea968 100644 --- a/Classes/AssistantLinkView.h +++ b/Classes/AssistantLinkView.h @@ -20,6 +20,7 @@ @property(weak, nonatomic) IBOutlet UIRoundBorderedButton *checkValidationButton; @property(weak, nonatomic) IBOutlet UIView *waitView; @property(weak, nonatomic) IBOutlet UITextField *phoneField; +@property (weak, nonatomic) IBOutlet UILabel *linkSMSText; @property BOOL firstTime; - (IBAction)onLinkAccount:(id)sender; diff --git a/Classes/AssistantLinkView.m b/Classes/AssistantLinkView.m index b73fc9929..3c35ca5e8 100644 --- a/Classes/AssistantLinkView.m +++ b/Classes/AssistantLinkView.m @@ -136,6 +136,8 @@ void assistant_link_phone_number_with_account(LinphoneAccountCreator *creator, L thiz.waitView.hidden = YES; if (status == LinphoneAccountCreatorOK) { thiz.linkAccountView.hidden = thiz.activateSMSView.userInteractionEnabled = YES; + NSString* phoneNumber = [NSString stringWithUTF8String:linphone_account_creator_get_phone_number(creator)]; + thiz.linkSMSText.text = [NSString stringWithFormat:NSLocalizedString(@"We have sent a SMS with a validation code to %@. To complete your phone number verification, please enter the 4 digit code below:",nil), phoneNumber]; thiz.activateSMSView.hidden = thiz.linkAccountView.userInteractionEnabled = NO; } else { if (strcmp(resp, "Missing required parameters") == 0) { diff --git a/Classes/AssistantView.h b/Classes/AssistantView.h index 0c912a50c..305b26df4 100644 --- a/Classes/AssistantView.h +++ b/Classes/AssistantView.h @@ -60,6 +60,8 @@ @property (weak, nonatomic) IBOutlet UILabel *phoneLabel; @property (weak, nonatomic) IBOutlet UILabel *phoneTitle; @property (weak, nonatomic) IBOutlet UILabel *activationTitle; +@property (weak, nonatomic) IBOutlet UILabel *activationEmailText; +@property (weak, nonatomic) IBOutlet UILabel *activationSMSText; @property (weak, nonatomic) IBOutlet UILabel *accountLabel; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *createAccountNextButtonPositionConstraint; diff --git a/Classes/AssistantView.m b/Classes/AssistantView.m index f6a206316..34616c326 100644 --- a/Classes/AssistantView.m +++ b/Classes/AssistantView.m @@ -271,7 +271,7 @@ static UICompositeViewDescription *compositeDescription = nil; linphone_account_creator_set_transport(account_creator, linphone_transport_parse(type.lowercaseString.UTF8String)); } - + new_config = linphone_account_creator_configure(account_creator); if (new_config) { @@ -860,11 +860,16 @@ static UICompositeViewDescription *compositeDescription = nil; _outgoingView = AssistantLinkView.compositeViewDescription; [self configureProxyConfig]; } else { - [self showErrorPopup:"ERROR_BAD_CREDENTIALS"]; + [self showErrorPopup:resp]; } } else { if (status == LinphoneAccountCreatorAccountExist || status == LinphoneAccountCreatorAccountExistWithAlias) { - linphone_account_creator_is_account_activated(account_creator); + if (linphone_account_creator_get_phone_number(account_creator) != NULL) { + // Offer the possibility to resend a sms confirmation in some cases + linphone_account_creator_is_account_activated(account_creator); + } else { + [self showErrorPopup:resp]; + } } else if (status == LinphoneAccountCreatorAccountNotExist) { NSString * language = [[NSLocale preferredLanguages] objectAtIndex:0]; linphone_account_creator_set_language(account_creator, [[language substringToIndex:2] UTF8String]); @@ -889,8 +894,12 @@ void assistant_create_account(LinphoneAccountCreator *creator, LinphoneAccountCr thiz.waitView.hidden = YES; if (status == LinphoneAccountCreatorAccountCreated) { if (linphone_account_creator_get_phone_number(creator)) { + NSString* phoneNumber = [NSString stringWithUTF8String:linphone_account_creator_get_phone_number(creator)]; + thiz.activationSMSText.text = [NSString stringWithFormat:NSLocalizedString(@"We have sent a SMS with a validation code to %@. To complete your phone number verification, please enter the 4 digit code below:", nil), phoneNumber]; [thiz changeView:thiz.createAccountActivateSMSView back:FALSE animation:TRUE]; } else { + NSString* email = [NSString stringWithUTF8String:linphone_account_creator_get_email(creator)]; + thiz.activationEmailText.text = [NSString stringWithFormat:NSLocalizedString(@" Your account is created. We have sent a confirmation email to %@. Please check your mails to validate your account. Once it is done, come back here and click on the button.", nil), email]; [thiz changeView:thiz.createAccountActivateEmailView back:FALSE animation:TRUE]; } } else { @@ -905,7 +914,11 @@ void assistant_recover_phone_account(LinphoneAccountCreator *creator, LinphoneAc if (status == LinphoneAccountCreatorOK) { [thiz changeView:thiz.createAccountActivateSMSView back:FALSE animation:TRUE]; } else { - [thiz showErrorPopup:resp]; + if(!resp) { + [thiz showErrorPopup:"ERROR_CANNOT_SEND_SMS"]; + } else { + [thiz showErrorPopup:resp]; + } } } @@ -928,8 +941,12 @@ void assistant_is_account_activated(LinphoneAccountCreator *creator, LinphoneAcc AssistantView *thiz = (__bridge AssistantView *)(linphone_account_creator_get_user_data(creator)); thiz.waitView.hidden = YES; if (status == LinphoneAccountCreatorAccountActivated) { - [thiz showErrorPopup:"ERROR_ACCOUNT_ALREADY_IN_USE"]; - [thiz findButton:ViewElement_NextButton].enabled = NO; + if( linphone_account_creator_get_phone_number(creator) == NULL) { + [thiz configureProxyConfig]; + [PhoneMainView.instance changeCurrentView:AssistantLinkView.compositeViewDescription]; + } else { + [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription]; + } } else if (status == LinphoneAccountCreatorAccountNotActivated) { if (!IPAD || linphone_account_creator_get_phone_number(creator) != NULL) { //Re send SMS if the username is the phone number diff --git a/Classes/Base.lproj/AssistantLinkView.xib b/Classes/Base.lproj/AssistantLinkView.xib index 9539580a2..0b7830fd1 100644 --- a/Classes/Base.lproj/AssistantLinkView.xib +++ b/Classes/Base.lproj/AssistantLinkView.xib @@ -15,6 +15,7 @@ + diff --git a/Classes/Base.lproj/AssistantViewScreens.xib b/Classes/Base.lproj/AssistantViewScreens.xib index 843209c21..d520b07cc 100644 --- a/Classes/Base.lproj/AssistantViewScreens.xib +++ b/Classes/Base.lproj/AssistantViewScreens.xib @@ -13,6 +13,8 @@ + + diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index 388c9bcff..1042dff94 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -557,6 +557,10 @@ if (proxyAi) { linphone_core_remove_auth_info(LC, proxyAi); } + if (strcmp(password,"") == 0) { + password = NULL; + } + LinphoneAddress *from = linphone_core_interpret_url(LC, identity); if (from) { const char *userid_str = (userID != nil) ? [userID UTF8String] : NULL; diff --git a/submodules/linphone b/submodules/linphone index 565f83f13..552967108 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 565f83f13d731e5ed90fe1a466c5f21a55eb44ce +Subproject commit 5529671088b6711b90c5abc21d972a3d20e5f124