Fix issues when creating account & assistantUI

This commit is contained in:
REIS Benjamin 2016-10-19 12:30:22 +02:00
parent 4c2f0ecb4a
commit dbee510584
8 changed files with 36 additions and 7 deletions

View file

@ -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;

View file

@ -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) {

View file

@ -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;

View file

@ -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

View file

@ -15,6 +15,7 @@
<outlet property="countryCodeField" destination="DBr-NA-Ibx" id="cRz-xe-r5D"/>
<outlet property="linkAccountButton" destination="D25-6f-qRg" id="aid-PS-8mU"/>
<outlet property="linkAccountView" destination="ImD-Y4-3nC" id="8yc-Dr-cZ8"/>
<outlet property="linkSMSText" destination="Dvq-wa-3k8" id="4Ne-Ud-aA1"/>
<outlet property="phoneField" destination="cEN-WO-5qv" id="Ftl-EA-afz"/>
<outlet property="view" destination="FBm-gC-sIQ" id="Bhr-VA-MJs"/>
<outlet property="waitView" destination="J3A-Fb-Dpg" id="zbb-YB-ace"/>

View file

@ -13,6 +13,8 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="AssistantView">
<connections>
<outlet property="accountLabel" destination="vh7-65-1js" id="IU4-gv-v6m"/>
<outlet property="activationEmailText" destination="mbT-xm-bKk" id="fho-Ip-bTQ"/>
<outlet property="activationSMSText" destination="9AN-gT-I7D" id="GSl-Iw-JjR"/>
<outlet property="activationTitle" destination="Gyl-37-emh" id="rBv-NE-1ON"/>
<outlet property="createAccountActivateEmailView" destination="Zd9-Ms-s7X" id="6Qs-np-oqS"/>
<outlet property="createAccountActivateSMSView" destination="101" id="SAS-8i-4Ao"/>

View file

@ -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;

@ -1 +1 @@
Subproject commit 565f83f13d731e5ed90fe1a466c5f21a55eb44ce
Subproject commit 5529671088b6711b90c5abc21d972a3d20e5f124