Assistant: fix various crashes and use cases

This commit is contained in:
Gautier Pelloux-Prayer 2015-11-05 11:42:40 +01:00
parent 359b7a6f0f
commit ec884c9264
10 changed files with 238 additions and 153 deletions

View file

@ -118,6 +118,24 @@ static UICompositeViewDescription *compositeDescription = nil;
#pragma mark - Utils
- (void)resetLiblinphone {
if (account_creator) {
linphone_account_creator_unref(account_creator);
account_creator = NULL;
}
[[LinphoneManager instance] resetLinphoneCore];
account_creator = linphone_account_creator_new(
[LinphoneManager getLc],
[LinphoneManager.instance lpConfigStringForKey:@"xmlrpc_url" forSection:@"assistant" withDefault:@""]
.UTF8String);
linphone_account_creator_set_user_data(account_creator, (__bridge void *)(self));
linphone_account_creator_cbs_set_existence_tested(linphone_account_creator_get_callbacks(account_creator),
assistant_existence_tested);
linphone_account_creator_cbs_set_create_account(linphone_account_creator_get_callbacks(account_creator),
assistant_create_account);
linphone_account_creator_cbs_set_validation_tested(linphone_account_creator_get_callbacks(account_creator),
assistant_validation_tested);
}
- (void)loadAssistantConfig:(NSString *)rcFilename {
NSString *fullPath = [@"file://" stringByAppendingString:[LinphoneManager bundleFile:rcFilename]];
linphone_core_set_provisioning_uri([LinphoneManager getLc], fullPath.UTF8String);
@ -127,23 +145,7 @@ static UICompositeViewDescription *compositeDescription = nil;
// to avoid it, we disable it before and reenable it after core restart.
BOOL hasPreview = linphone_core_video_preview_enabled([LinphoneManager getLc]);
linphone_core_enable_video_preview([LinphoneManager getLc], FALSE);
if (account_creator) {
linphone_account_creator_unref(account_creator);
account_creator = NULL;
}
[[LinphoneManager instance] resetLinphoneCore];
account_creator = linphone_account_creator_new(
[LinphoneManager getLc],
[LinphoneManager.instance lpConfigStringForKey:@"xmlrpc_url" forSection:@"assistant" withDefault:@""]
.UTF8String);
linphone_account_creator_set_user_data(account_creator, (__bridge void *)(self));
linphone_account_creator_cbs_set_existence_tested(linphone_account_creator_get_callbacks(account_creator),
assistant_existence_tested);
linphone_account_creator_cbs_set_create_account(linphone_account_creator_get_callbacks(account_creator),
assistant_create_account);
linphone_account_creator_cbs_set_validation_tested(linphone_account_creator_get_callbacks(account_creator),
assistant_validation_tested);
[self resetLiblinphone];
linphone_core_enable_video_preview([LinphoneManager getLc], hasPreview);
// we will set the new default proxy config in the assistant
linphone_core_set_default_proxy_config([LinphoneManager getLc], NULL);
@ -176,35 +178,43 @@ static UICompositeViewDescription *compositeDescription = nil;
- (NSString *)errorForStatus:(LinphoneAccountCreatorStatus)status {
BOOL usePhoneNumber = [[LinphoneManager instance] lpConfigBoolForKey:@"use_phone_number" forSection:@"assistant"];
NSMutableString *err = [[NSMutableString alloc] init];
if ((status & LinphoneAccountCreatorEmailInvalid) != 0) {
[err appendString:NSLocalizedString(@"Invalid email.", nil)];
switch (status) {
case LinphoneAccountCreatorEmailInvalid:
return NSLocalizedString(@"Invalid email.", nil);
case LinphoneAccountCreatorUsernameInvalid:
return usePhoneNumber
? NSLocalizedString(@"Invalid phone number.", nil)
: NSLocalizedString(@"Invalid username.", nil);
case LinphoneAccountCreatorUsernameTooShort:
return usePhoneNumber
? NSLocalizedString(@"Phone number too short.", nil)
: NSLocalizedString(@"Username too short.", nil);
case LinphoneAccountCreatorUsernameInvalidSize:
return usePhoneNumber
? NSLocalizedString(@"Phone number length invalid.", nil)
: NSLocalizedString(@"Username length invalid.", nil);
case LinphoneAccountCreatorPasswordTooShort:
return NSLocalizedString(@"Password too short.", nil);
case LinphoneAccountCreatorDomainInvalid:
return NSLocalizedString(@"Invalid domain.", nil);
case LinphoneAccountCreatorRouteInvalid:
return NSLocalizedString(@"Invalid route.", nil);
case LinphoneAccountCreatorDisplayNameInvalid:
return NSLocalizedString(@"Invalid display name.", nil);
case LinphoneAccountCreatorReqFailed:
return NSLocalizedString(@"Failed to query the server. Please try again later", nil);
case LinphoneAccountCreatorTransportNotSupported:
return NSLocalizedString(@"Unsupported transport", nil);
case LinphoneAccountCreatorAccountCreated:
case LinphoneAccountCreatorAccountExist:
case LinphoneAccountCreatorAccountNotCreated:
case LinphoneAccountCreatorAccountNotExist:
case LinphoneAccountCreatorAccountNotValidated:
case LinphoneAccountCreatorAccountValidated:
case LinphoneAccountCreatorOK:
break;
}
if ((status & LinphoneAccountCreatorUsernameInvalid) != 0) {
[err appendString:usePhoneNumber ? NSLocalizedString(@"Invalid phone number.", nil)
: NSLocalizedString(@"Invalid username.", nil)];
}
if ((status & LinphoneAccountCreatorUsernameTooShort) != 0) {
[err appendString:usePhoneNumber ? NSLocalizedString(@"Phone number too short.", nil)
: NSLocalizedString(@"Username too short.", nil)];
}
if ((status & LinphoneAccountCreatorUsernameInvalidSize) != 0) {
[err appendString:usePhoneNumber ? NSLocalizedString(@"Phone number length invalid.", nil)
: NSLocalizedString(@"Username length invalid.", nil)];
}
if ((status & LinphoneAccountCreatorPasswordTooShort) != 0) {
[err appendString:NSLocalizedString(@"Password too short.", nil)];
}
if ((status & LinphoneAccountCreatorDomainInvalid) != 0) {
[err appendString:NSLocalizedString(@"Invalid domain.", nil)];
}
if ((status & LinphoneAccountCreatorRouteInvalid) != 0) {
[err appendString:NSLocalizedString(@"Invalid route.", nil)];
}
if ((status & LinphoneAccountCreatorDisplayNameInvalid) != 0) {
[err appendString:NSLocalizedString(@"Invalid display name.", nil)];
}
return err;
return nil;
}
- (BOOL)addProxyConfig:(LinphoneProxyConfig *)proxy {
@ -405,43 +415,57 @@ static UICompositeViewDescription *compositeDescription = nil;
UIAssistantTextField *createUsername = [self findTextField:ViewElement_Username];
[createUsername showError:[self errorForStatus:LinphoneAccountCreatorUsernameInvalid]
when:^BOOL(NSString *inputEntry) {
LinphoneAccountCreatorStatus s =
linphone_account_creator_set_username(account_creator, inputEntry.UTF8String);
createUsername.errorLabel.text = [self errorForStatus:s];
return s != LinphoneAccountCreatorOk;
LinphoneAccountCreatorStatus s =
linphone_account_creator_set_username(account_creator, inputEntry.UTF8String);
createUsername.errorLabel.text = [self errorForStatus:s];
return s != LinphoneAccountCreatorOK;
}];
UIAssistantTextField *password = [self findTextField:ViewElement_Password];
[password showError:[self errorForStatus:LinphoneAccountCreatorPasswordTooShort]
when:^BOOL(NSString *inputEntry) {
LinphoneAccountCreatorStatus s =
linphone_account_creator_set_password(account_creator, inputEntry.UTF8String);
password.errorLabel.text = [self errorForStatus:s];
return s != LinphoneAccountCreatorOk;
LinphoneAccountCreatorStatus s =
linphone_account_creator_set_password(account_creator, inputEntry.UTF8String);
password.errorLabel.text = [self errorForStatus:s];
return s != LinphoneAccountCreatorOK;
}];
UIAssistantTextField *password2 = [self findTextField:ViewElement_Password2];
[password2 showError:NSLocalizedString(@"Passwords do not match.", nil)
when:^BOOL(NSString *inputEntry) {
return ![inputEntry isEqualToString:[self findTextField:ViewElement_Password].text];
return ![inputEntry isEqualToString:[self findTextField:ViewElement_Password].text];
}];
UIAssistantTextField *email = [self findTextField:ViewElement_Email];
[email showError:[self errorForStatus:LinphoneAccountCreatorEmailInvalid]
when:^BOOL(NSString *inputEntry) {
LinphoneAccountCreatorStatus s =
linphone_account_creator_set_email(account_creator, inputEntry.UTF8String);
email.errorLabel.text = [self errorForStatus:s];
return s != LinphoneAccountCreatorOk;
LinphoneAccountCreatorStatus s =
linphone_account_creator_set_email(account_creator, inputEntry.UTF8String);
email.errorLabel.text = [self errorForStatus:s];
return s != LinphoneAccountCreatorOK;
}];
UIAssistantTextField *domain = [self findTextField:ViewElement_Domain];
[domain showError:[self errorForStatus:LinphoneAccountCreatorDomainInvalid]
when:^BOOL(NSString *inputEntry) {
LinphoneAccountCreatorStatus s =
linphone_account_creator_set_domain(account_creator, inputEntry.UTF8String);
domain.errorLabel.text = [self errorForStatus:s];
return s != LinphoneAccountCreatorOk;
LinphoneAccountCreatorStatus s =
linphone_account_creator_set_domain(account_creator, inputEntry.UTF8String);
domain.errorLabel.text = [self errorForStatus:s];
return s != LinphoneAccountCreatorOK;
}];
UIAssistantTextField *url = [self findTextField:ViewElement_URL];
[url showError:NSLocalizedString(@"Invalid remote provisionning URL", nil)
when:^BOOL(NSString *inputEntry) {
NSString *url = [self findTextField:ViewElement_URL].text;
if (url.length > 0) {
// missing prefix will result in http:// being used
if ([url rangeOfString:@"://"].location == NSNotFound) {
url = [NSString stringWithFormat:@"http://%@", url];
}
return (linphone_core_set_provisioning_uri([LinphoneManager getLc], [url UTF8String]) != 0);
}
return TRUE;
}];
[self shouldEnableNextButton];
@ -534,27 +558,26 @@ 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 == LinphoneAccountCreatorFailed) {
if (status == LinphoneAccountCreatorAccountExist) {
[[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];
} else if (status == LinphoneAccountCreatorAccountNotExist) {
linphone_account_creator_create_account(thiz->account_creator);
}
}
void assistant_create_account(LinphoneAccountCreator *creator, LinphoneAccountCreatorStatus status) {
AssistantView *thiz = (__bridge AssistantView *)(linphone_account_creator_get_user_data(creator));
thiz.waitView.hidden = YES;
if (status == LinphoneAccountCreatorOk) {
thiz.waitView.hidden = NO;
linphone_account_creator_test_validation(thiz->account_creator);
if (status == LinphoneAccountCreatorAccountCreated) {
[thiz changeView:thiz.createAccountActivationView back:FALSE animation:TRUE];
} else {
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];
initWithTitle:NSLocalizedString(@"Account creation 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];
}
}
@ -562,11 +585,11 @@ void assistant_create_account(LinphoneAccountCreator *creator, LinphoneAccountCr
void assistant_validation_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 == LinphoneAccountCreatorAccountValidated) {
[thiz addProxyConfig:linphone_account_creator_configure(creator)];
} else {
} else if (status == LinphoneAccountCreatorAccountNotValidated) {
DTAlertView *alert = [[DTAlertView alloc]
initWithTitle:NSLocalizedString(@"Account validation failed.", nil)
initWithTitle:NSLocalizedString(@"Account validation failed", nil)
message:
NSLocalizedString(
@"Your account could not be checked yet. You can skip this validation or try again later.",
@ -638,12 +661,12 @@ void assistant_validation_tested(LinphoneAccountCreator *creator, LinphoneAccoun
- (IBAction)onCreateAccountActivationClick:(id)sender {
_waitView.hidden = NO;
linphone_account_creator_create_account(account_creator);
linphone_account_creator_test_validation(account_creator);
}
- (IBAction)onLinphoneLoginClick:(id)sender {
_waitView.hidden = NO;
linphone_account_creator_test_validation(account_creator);
[self addProxyConfig:linphone_account_creator_configure(account_creator)];
}
- (IBAction)onLoginClick:(id)sender {
@ -653,23 +676,13 @@ void assistant_validation_tested(LinphoneAccountCreator *creator, LinphoneAccoun
- (IBAction)onRemoteProvisionningLoginClick:(id)sender {
_waitView.hidden = NO;
[[LinphoneManager instance] lpConfigSetInt:1 forKey:@"transient_provisioning" forSection:@"misc"];
[self addProxyConfig:linphone_account_creator_configure(account_creator)];
}
- (IBAction)onRemoteProvisionningDownloadClick:(id)sender {
NSString *url = [self findTextField:ViewElement_URL].text;
if ([url length] > 0) {
// missing prefix will result in http:// being used
if ([url rangeOfString:@"://"].location == NSNotFound) {
url = [NSString stringWithFormat:@"http://%@", url];
}
LOGI(@"Should use remote provisioning URL %@", url);
linphone_core_set_provisioning_uri([LinphoneManager getLc], [url UTF8String]);
[_waitView setHidden:false];
[[LinphoneManager instance] resetLinphoneCore];
}
[_waitView setHidden:false];
[self resetLiblinphone];
}
- (IBAction)onTransportChange:(id)sender {

View file

@ -164,10 +164,19 @@
<textInputTraits key="textInputTraits" autocorrectionType="no"/>
<connections>
<outlet property="delegate" destination="-1" id="80"/>
<outlet property="errorLabel" destination="nOO-ch-4RW" id="fVH-OO-tVS"/>
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" tag="410" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Invalid username" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" id="nOO-ch-4RW" userLabel="usernameErrorLabel">
<rect key="frame" x="38" y="217" width="299" height="10"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="9"/>
<color key="textColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="PASSWORD" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="RIQ-aB-k0Y" userLabel="passwordLabel">
<rect key="frame" x="38" y="226" width="299" height="14"/>
<rect key="frame" x="38" y="236" width="299" height="14"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
@ -175,7 +184,7 @@
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" tag="101" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" adjustsFontSizeToFit="NO" minimumFontSize="10" id="75" userLabel="passwordField" customClass="UIAssistantTextField">
<rect key="frame" x="38" y="251" width="299" height="30"/>
<rect key="frame" x="38" y="261" width="299" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<color key="backgroundColor" red="0.88235294119999996" green="0.88235294119999996" blue="0.88235294119999996" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@ -185,10 +194,19 @@
<textInputTraits key="textInputTraits" autocorrectionType="no" secureTextEntry="YES"/>
<connections>
<outlet property="delegate" destination="-1" id="82"/>
<outlet property="errorLabel" destination="qbL-gD-kHo" id="9pp-bs-jQ2"/>
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" tag="410" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Invalid password" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" id="qbL-gD-kHo" userLabel="passwordErrorLabel">
<rect key="frame" x="38" y="291" width="299" height="10"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="9"/>
<color key="textColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="PASSWORD CONFIRMATION" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="yyK-OU-HXT" userLabel="password2Label">
<rect key="frame" x="38" y="293" width="299" height="14"/>
<rect key="frame" x="38" y="313" width="299" height="14"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
@ -196,7 +214,7 @@
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" tag="102" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" adjustsFontSizeToFit="NO" minimumFontSize="10" id="76" userLabel="password2Field" customClass="UIAssistantTextField">
<rect key="frame" x="38" y="315" width="299" height="30"/>
<rect key="frame" x="38" y="335" width="299" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<color key="backgroundColor" red="0.88235294119999996" green="0.88235294119999996" blue="0.88235294119999996" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@ -206,10 +224,19 @@
<textInputTraits key="textInputTraits" autocorrectionType="no" secureTextEntry="YES"/>
<connections>
<outlet property="delegate" destination="-1" id="83"/>
<outlet property="errorLabel" destination="xZk-J2-sOC" id="yEr-ch-Hlx"/>
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" tag="410" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Passwords do not match" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" id="xZk-J2-sOC" userLabel="password2ErrorLabel">
<rect key="frame" x="38" y="365" width="299" height="10"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="9"/>
<color key="textColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="EMAIL" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Syg-X5-YFX" userLabel="emailLabel">
<rect key="frame" x="38" y="358" width="299" height="14"/>
<rect key="frame" x="38" y="388" width="299" height="14"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
@ -217,7 +244,7 @@
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" tag="103" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" adjustsFontSizeToFit="NO" minimumFontSize="10" id="79" userLabel="emailField" customClass="UIAssistantTextField">
<rect key="frame" x="38" y="380" width="299" height="30"/>
<rect key="frame" x="38" y="410" width="299" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<color key="backgroundColor" red="0.88235294119999996" green="0.88235294119999996" blue="0.88235294119999996" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@ -227,8 +254,17 @@
<textInputTraits key="textInputTraits" autocorrectionType="no" keyboardType="emailAddress"/>
<connections>
<outlet property="delegate" destination="-1" id="84"/>
<outlet property="errorLabel" destination="boL-zt-q9f" id="jBP-Jl-eVp"/>
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" tag="410" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Invalid email" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" id="boL-zt-q9f" userLabel="emailErrorLabel">
<rect key="frame" x="38" y="440" width="299" height="10"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="9"/>
<color key="textColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" tag="130" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="middleTruncation" id="K99-0e-fHC" userLabel="createAccountButton" customClass="UIRoundBorderedButton">
<rect key="frame" x="38" y="448" width="299" height="71"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
@ -366,10 +402,19 @@
<textInputTraits key="textInputTraits" autocorrectionType="no"/>
<connections>
<outlet property="delegate" destination="-1" id="vfZ-tB-ybd"/>
<outlet property="errorLabel" destination="CBb-WR-x0g" id="0j0-6V-znD"/>
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" tag="410" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Invalid username" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" id="CBb-WR-x0g" userLabel="usernameErrorLabel">
<rect key="frame" x="38" y="217" width="299" height="10"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="9"/>
<color key="textColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="PASSWORD" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="EXf-qZ-KVL" userLabel="passwordLabel">
<rect key="frame" x="38" y="226" width="299" height="14"/>
<rect key="frame" x="38" y="236" width="299" height="14"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
@ -377,7 +422,7 @@
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" tag="101" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" adjustsFontSizeToFit="NO" minimumFontSize="10" id="ap4-xh-CVK" userLabel="passwordField" customClass="UIAssistantTextField">
<rect key="frame" x="38" y="251" width="299" height="30"/>
<rect key="frame" x="38" y="261" width="299" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<color key="backgroundColor" red="0.88235294119999996" green="0.88235294119999996" blue="0.88235294119999996" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@ -387,8 +432,17 @@
<textInputTraits key="textInputTraits" autocorrectionType="no" secureTextEntry="YES"/>
<connections>
<outlet property="delegate" destination="-1" id="nPx-Tc-Acv"/>
<outlet property="errorLabel" destination="lMz-lo-z4b" id="1Se-fB-fYb"/>
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" tag="410" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Invalid password" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" id="lMz-lo-z4b" userLabel="passwordErrorLabel">
<rect key="frame" x="38" y="291" width="299" height="10"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="9"/>
<color key="textColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" tag="130" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="middleTruncation" id="eIr-bh-JLB" userLabel="linphoneLoginButton" customClass="UIRoundBorderedButton">
<rect key="frame" x="38" y="448" width="299" height="71"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
@ -457,10 +511,19 @@
<textInputTraits key="textInputTraits" autocorrectionType="no"/>
<connections>
<outlet property="delegate" destination="-1" id="2Cf-FZ-uJk"/>
<outlet property="errorLabel" destination="UJ1-kb-e8g" id="XAu-w1-q5R"/>
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" tag="410" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Invalid username" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" id="UJ1-kb-e8g" userLabel="usernameErrorLabel">
<rect key="frame" x="38" y="217" width="299" height="10"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="9"/>
<color key="textColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="PASSWORD" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="XPq-fy-KZS" userLabel="passwordLabel">
<rect key="frame" x="38" y="226" width="299" height="14"/>
<rect key="frame" x="38" y="236" width="299" height="14"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
@ -468,7 +531,7 @@
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" tag="101" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" adjustsFontSizeToFit="NO" minimumFontSize="10" id="zEa-Dj-QiH" userLabel="passwordField" customClass="UIAssistantTextField">
<rect key="frame" x="38" y="251" width="299" height="30"/>
<rect key="frame" x="38" y="261" width="299" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<color key="backgroundColor" red="0.88235294119999996" green="0.88235294119999996" blue="0.88235294119999996" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@ -478,10 +541,19 @@
<textInputTraits key="textInputTraits" autocorrectionType="no" secureTextEntry="YES"/>
<connections>
<outlet property="delegate" destination="-1" id="bYU-bJ-3Ts"/>
<outlet property="errorLabel" destination="Oyr-f0-auK" id="0Cr-il-vwE"/>
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" tag="410" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Invalid password" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" id="Oyr-f0-auK" userLabel="passwordErrorLabel">
<rect key="frame" x="38" y="291" width="299" height="10"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="9"/>
<color key="textColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="DOMAIN" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="MgC-eB-ar3" userLabel="domainLabel">
<rect key="frame" x="38" y="293" width="299" height="14"/>
<rect key="frame" x="38" y="313" width="299" height="14"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
@ -489,7 +561,7 @@
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" tag="104" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" adjustsFontSizeToFit="NO" minimumFontSize="10" id="5kh-Wo-SMY" userLabel="domainField" customClass="UIAssistantTextField">
<rect key="frame" x="38" y="315" width="299" height="30"/>
<rect key="frame" x="38" y="335" width="299" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<color key="backgroundColor" red="0.88235294119999996" green="0.88235294119999996" blue="0.88235294119999996" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@ -499,10 +571,19 @@
<textInputTraits key="textInputTraits" autocorrectionType="no"/>
<connections>
<outlet property="delegate" destination="-1" id="AEK-wy-Dko"/>
<outlet property="errorLabel" destination="ths-8b-FoU" id="mQu-DC-RgF"/>
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" tag="410" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Invalid password" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" id="ths-8b-FoU" userLabel="domainErrorLabel">
<rect key="frame" x="38" y="365" width="299" height="10"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="9"/>
<color key="textColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="TRANSPORT" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Uqz-B6-2gR" userLabel="transportLabel">
<rect key="frame" x="38" y="360" width="299" height="14"/>
<rect key="frame" x="38" y="390" width="299" height="14"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
@ -510,7 +591,7 @@
<nil key="highlightedColor"/>
</label>
<segmentedControl opaque="NO" tag="110" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="bar" selectedSegmentIndex="0" id="Nrv-SM-lMf" userLabel="transportSegment">
<rect key="frame" x="36" y="379" width="299" height="29"/>
<rect key="frame" x="36" y="409" width="299" height="29"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<animations/>
<segments>
@ -591,8 +672,17 @@
<textInputTraits key="textInputTraits" autocorrectionType="no" keyboardType="URL"/>
<connections>
<outlet property="delegate" destination="-1" id="8Fl-mE-8Sb"/>
<outlet property="errorLabel" destination="uEq-Gk-9iy" id="OLx-QW-CcR"/>
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" tag="410" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Invalid username" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" id="uEq-Gk-9iy" userLabel="urlErrorLabel">
<rect key="frame" x="38" y="217" width="299" height="10"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="9"/>
<color key="textColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" tag="130" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="middleTruncation" id="eM0-bn-v3C" userLabel="downloadButton" customClass="UIRoundBorderedButton">
<rect key="frame" x="38" y="448" width="299" height="71"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>

View file

@ -454,17 +454,16 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
proxy = linphone_address_as_string_uri_only(proxy_addr);
}
// possible valid config detected, try to modify current proxy or create new one if none existing
proxyCfg = linphone_core_get_default_proxy_config(lc);
if (proxyCfg == NULL) {
proxyCfg = linphone_core_create_proxy_config(lc);
} else {
isEditing = TRUE;
linphone_proxy_config_edit(proxyCfg);
}
char normalizedUserName[256];
LinphoneAddress *linphoneAddress = linphone_address_new("sip:user@domain.com");
proxyCfg = ms_list_nth_data(linphone_core_get_proxy_config_list(lc),
[self integerForKey:@"current_proxy_config_preference"]);
//if account was deleted, it is not present anymore
if (proxyCfg == NULL) {
goto bad_proxy;
}
linphone_proxy_config_normalize_number(proxyCfg, username.UTF8String, normalizedUserName,
sizeof(normalizedUserName));
linphone_address_set_username(linphoneAddress, normalizedUserName);
@ -827,6 +826,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
if (ai) {
linphone_core_remove_auth_info(lc, ai);
}
[self setInteger:-1 forKey:@"current_proxy_config_preference"];
[self transformLinphoneCoreToKeys];
}
@end

View file

@ -1940,7 +1940,7 @@ static void audioRouteChangeListenerCallback(void *inUserData, // 1
[error show];
} else {
// Finally we can make the call
LinphoneCallParams *lcallParams = linphone_core_create_default_call_parameters(theLinphoneCore);
LinphoneCallParams *lcallParams = linphone_core_create_call_params(theLinphoneCore, NULL);
if ([self lpConfigBoolForKey:@"edge_opt_preference"] && (self.network == network_2g)) {
LOGI(@"Enabling low bandwidth mode");
linphone_call_params_enable_low_bandwidth(lcallParams, YES);

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment identifier="iOS"/>
<development version="6000" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="UICompositeView">
@ -51,7 +51,6 @@
</view>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="simulatedStatusBarMetrics"/>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina47"/>
<point key="canvasLocation" x="-96.5" y="-25.5"/>
@ -93,4 +92,9 @@
</connections>
</swipeGestureRecognizer>
</objects>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>

View file

@ -12,7 +12,7 @@ typedef BOOL (^UIDisplayError)(NSString *inputEntry);
@interface UIAssistantTextField : UITextField <UITextFieldDelegate>
@property(nonatomic) UILabel *errorLabel;
@property(nonatomic, strong) IBOutlet UILabel *errorLabel;
@property(nonatomic, readonly) UIDisplayError showErrorPredicate;
@property(nonatomic, readonly) NSString *lastText;
// we should show error only when user finished editted the field at least once

View file

@ -11,45 +11,24 @@
@implementation UIAssistantTextField
- (void)showError:(NSString *)msg {
if (!_errorLabel) {
[self showError:msg when:nil];
}
_errorLabel.text = msg;
_lastText = self.text;
_errorLabel.hidden = NO;
self.layer.borderWidth = .8;
self.layer.cornerRadius = 4.f;
self.autoresizingMask = YES;
self.layer.borderColor = _errorLabel.hidden ? [[UIColor clearColor] CGColor] : [[UIColor redColor] CGColor];
}
- (void)showError:(NSString *)msg when:(UIDisplayError)apred {
_showErrorPredicate = apred;
self.layer.borderWidth = .8;
self.layer.cornerRadius = 4.f;
self.autoresizingMask = YES;
if (!_errorLabel) {
_errorLabel = [[UILabel alloc] initWithFrame:self.frame];
_errorLabel.font = [UIFont systemFontOfSize:11];
_errorLabel.textColor = [UIColor redColor];
}
_errorLabel.text = msg;
CGSize maximumLabelSize = CGSizeMake(self.frame.size.width, 9999);
CGSize expectedLabelSize =
[msg sizeWithFont:_errorLabel.font constrainedToSize:maximumLabelSize lineBreakMode:_errorLabel.lineBreakMode];
CGRect newFrame = _errorLabel.frame;
newFrame.size.height = expectedLabelSize.height;
newFrame.origin.y = self.frame.origin.y + self.frame.size.height;
_errorLabel.frame = newFrame;
_lastText = self.text;
[self showError:msg];
[self checkDisplayError];
[self.superview addSubview:_errorLabel];
}
- (void)checkDisplayError {
_errorLabel.hidden = ![self isInvalid];
_errorLabel.hidden = !(_canShowError && [self isInvalid]);
self.layer.borderColor = _errorLabel.hidden ? [[UIColor clearColor] CGColor] : [[UIColor redColor] CGColor];
}
@ -67,7 +46,7 @@
}
- (BOOL)isInvalid {
return _canShowError && _showErrorPredicate && _showErrorPredicate(_lastText);
return _showErrorPredicate && _showErrorPredicate(_lastText);
}
@end

View file

@ -64,9 +64,8 @@
[tester waitForViewWithAccessibilityLabel:@"Finish configuration" traits:UIAccessibilityTraitButton];
[tester tapViewWithAccessibilityLabel:@"Finish configuration"];
[tester waitForViewWithAccessibilityLabel:@"Account validation issue"];
[tester tapViewWithAccessibilityLabel:@"Continue"];
[tester tapViewWithAccessibilityLabel:@"Cancel"];
[tester waitForViewWithAccessibilityLabel:@"Account validation failed"];
[tester tapViewWithAccessibilityLabel:@"Skip verification"];
}
- (void)testExternalLoginWithTCP {

View file

@ -427,7 +427,7 @@ def main(argv=None):
info("Tunnel wanted but not found yet, trying to clone it...")
p = Popen("git clone gitosis@git.linphone.org:tunnel.git submodules/tunnel".split(" "))
p.wait()
if p.retcode != 0:
if p.returncode != 0:
error("Could not clone tunnel. Please see http://www.belledonne-communications.com/voiptunnel.html")
return 1
warning("Tunnel enabled, disabling GPL third parties.")

@ -1 +1 @@
Subproject commit bf20c29de6e6e1b7716e984e241a3fdcaf8b2bec
Subproject commit 53dcc192fd1fb9cefb8d083cb488a8b3b8bb5a92