Settings&Assistant: rework proxies management to avoid auth popup as much as possible

This commit is contained in:
Gautier Pelloux-Prayer 2015-11-23 15:31:28 +01:00
parent 173891fc62
commit ddaa3cef89
12 changed files with 310 additions and 88 deletions

View file

@ -36,6 +36,7 @@ typedef enum _ViewElement {
ViewElement_Email = 103,
ViewElement_Domain = 104,
ViewElement_URL = 105,
ViewElement_DisplayName = 106,
ViewElement_TextFieldCount = 6,
ViewElement_Transport = 110,
ViewElement_Username_Label = 120,
@ -212,25 +213,28 @@ static UICompositeViewDescription *compositeDescription = nil;
return nil;
}
- (BOOL)addProxyConfig:(LinphoneProxyConfig *)proxy {
- (void)configureProxyConfig {
LinphoneCore *lc = [LinphoneManager getLc];
LinphoneManager *lm = [LinphoneManager instance];
if (new_config != NULL && proxy != new_config) {
// remove previous proxy config, if any
if (new_config != NULL) {
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;
[lm configurePushTokenForProxyConfig:proxy];
linphone_core_set_default_proxy_config(lc, proxy);
// reload address book to prepend proxy config domain to contacts' phone number
// todo: STOP doing that!
[[[LinphoneManager instance] fastAddressBook] reload];
return TRUE;
new_config = linphone_account_creator_configure(account_creator);
if (new_config) {
[lm configurePushTokenForProxyConfig:new_config];
linphone_core_set_default_proxy_config(lc, new_config);
// reload address book to prepend proxy config domain to contacts' phone number
// todo: STOP doing that!
[[[LinphoneManager instance] fastAddressBook] reload];
}
}
#pragma mark - UI update
@ -300,6 +304,15 @@ static UICompositeViewDescription *compositeDescription = nil;
[view setFrame:[_contentView bounds]];
[_contentView setContentSize:[view bounds].size];
// Resize next button to fix text length
UIButton *button = [self findButton:ViewElement_NextButton];
CGSize size = [button.titleLabel.text sizeWithFont:button.titleLabel.font];
size.width += 60;
CGRect frame = button.frame;
frame.origin.x += (button.frame.size.width - size.width) / 2;
frame.size.width = size.width;
[button setFrame:frame];
[self prepareErrorLabels];
}
@ -462,6 +475,15 @@ static UICompositeViewDescription *compositeDescription = nil;
return TRUE;
}];
UIAssistantTextField *displayName = [self findTextField:ViewElement_DisplayName];
[displayName showError:[AssistantView errorForStatus:LinphoneAccountCreatorDisplayNameInvalid]
when:^BOOL(NSString *inputEntry) {
LinphoneAccountCreatorStatus s =
linphone_account_creator_set_display_name(account_creator, inputEntry.UTF8String);
displayName.errorLabel.text = [AssistantView errorForStatus:s];
return s != LinphoneAccountCreatorOK;
}];
[self shouldEnableNextButton];
}
@ -504,7 +526,6 @@ static UICompositeViewDescription *compositeDescription = nil;
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
linphone_core_remove_proxy_config([LinphoneManager getLc], new_config);
break;
}
case LinphoneRegistrationProgress: {
@ -580,7 +601,7 @@ void assistant_validation_tested(LinphoneAccountCreator *creator, LinphoneAccoun
AssistantView *thiz = (__bridge AssistantView *)(linphone_account_creator_get_user_data(creator));
thiz.waitView.hidden = YES;
if (status == LinphoneAccountCreatorAccountValidated) {
[thiz addProxyConfig:linphone_account_creator_configure(creator)];
[thiz configureProxyConfig];
} else if (status == LinphoneAccountCreatorAccountNotValidated) {
DTAlertView *alert = [[DTAlertView alloc]
initWithTitle:NSLocalizedString(@"Account validation failed", nil)
@ -591,7 +612,7 @@ void assistant_validation_tested(LinphoneAccountCreator *creator, LinphoneAccoun
[alert addCancelButtonWithTitle:NSLocalizedString(@"Back", nil) block:nil];
[alert addButtonWithTitle:NSLocalizedString(@"Skip verification", nil)
block:^{
[thiz addProxyConfig:linphone_account_creator_configure(creator)];
[thiz configureProxyConfig];
[PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription];
}];
[alert show];
@ -660,18 +681,18 @@ void assistant_validation_tested(LinphoneAccountCreator *creator, LinphoneAccoun
- (IBAction)onLinphoneLoginClick:(id)sender {
_waitView.hidden = NO;
[self addProxyConfig:linphone_account_creator_configure(account_creator)];
[self configureProxyConfig];
}
- (IBAction)onLoginClick:(id)sender {
_waitView.hidden = NO;
[self addProxyConfig:linphone_account_creator_configure(account_creator)];
[self configureProxyConfig];
}
- (IBAction)onRemoteProvisioningLoginClick:(id)sender {
_waitView.hidden = NO;
[[LinphoneManager instance] lpConfigSetInt:1 forKey:@"transient_provisioning" forSection:@"misc"];
[self addProxyConfig:linphone_account_creator_configure(account_creator)];
[self configureProxyConfig];
}
- (IBAction)onRemoteProvisioningDownloadClick:(id)sender {

View file

@ -46,7 +46,7 @@
<size key="shadowOffset" width="-1" height="-1"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="wordWrap" id="36" userLabel="createAccountButton" customClass="UIRoundBorderedButton">
<rect key="frame" x="40" y="217" width="299" height="71"/>
<rect key="frame" x="40" y="187" width="299" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<accessibility key="accessibilityConfiguration" label="Create account">
@ -61,7 +61,7 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="wordWrap" id="38" userLabel="linphoneLoginButton" customClass="UIRoundBorderedButton">
<rect key="frame" x="40" y="301" width="299" height="71"/>
<rect key="frame" x="40" y="261" width="299" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<accessibility key="accessibilityConfiguration" label="Use Linphone account">
@ -79,7 +79,7 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="wordWrap" id="Kbn-dL-C5h" userLabel="remoteProvisioningButton" customClass="UIRoundBorderedButton">
<rect key="frame" x="40" y="466" width="299" height="71"/>
<rect key="frame" x="40" y="410" width="299" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<accessibility key="accessibilityConfiguration" label="Fetch remote configuration">
@ -97,7 +97,7 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="wordWrap" id="39" userLabel="loginButton" customClass="UIRoundBorderedButton">
<rect key="frame" x="39" y="380" width="299" height="71"/>
<rect key="frame" x="39" y="335" width="299" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<accessibility key="accessibilityConfiguration" label="Use SIP account">
@ -266,7 +266,7 @@
<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"/>
<rect key="frame" x="38" y="485" width="299" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<accessibility key="accessibilityConfiguration" label="Create account">
@ -335,7 +335,7 @@
<size key="shadowOffset" width="-1" height="-1"/>
</label>
<button opaque="NO" tag="130" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="middleTruncation" id="PR0-Gi-vU3" userLabel="checkValidationButton" customClass="UIRoundBorderedButton">
<rect key="frame" x="38" y="448" width="299" height="71"/>
<rect key="frame" x="38" y="485" width="299" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<accessibility key="accessibilityConfiguration" label="Finish configuration">
@ -443,8 +443,38 @@
<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="DISPLAY NAME (OPTIONAL)" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="emA-TJ-wRm" userLabel="displayNameLabel">
<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"/>
<color key="textColor" red="0.50196078430000002" green="0.50196078430000002" blue="0.50196078430000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" tag="106" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" adjustsFontSizeToFit="NO" minimumFontSize="10" id="buh-Vp-YwP" userLabel="displayNameField" customClass="UIAssistantTextField">
<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"/>
<accessibility key="accessibilityConfiguration" label="Password"/>
<color key="textColor" red="0.2666666667" green="0.2666666667" blue="0.2666666667" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" secureTextEntry="YES"/>
<connections>
<outlet property="delegate" destination="-1" id="QcZ-wS-LhT"/>
<outlet property="errorLabel" destination="YzC-qL-tc0" id="SbI-Cd-cxw"/>
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" tag="410" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Invalid display name" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" id="YzC-qL-tc0" userLabel="displayNameErrorLabel">
<rect key="frame" x="38" y="365" width="299" height="10"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="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"/>
<rect key="frame" x="38" y="485" width="299" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<accessibility key="accessibilityConfiguration" label="Login">
@ -469,7 +499,7 @@
<point key="canvasLocation" x="209.5" y="862"/>
</view>
<view contentMode="scaleToFill" id="56" userLabel="loginView">
<rect key="frame" x="0.0" y="0.0" width="375" height="562"/>
<rect key="frame" x="0.0" y="0.0" width="374" height="610"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="CONFIGURE SIP ACCOUNT" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="wen-Vj-Wgv" userLabel="titleLabel">
@ -574,7 +604,7 @@
<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">
<label opaque="NO" userInteractionEnabled="NO" tag="410" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Invalid domain" 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/>
@ -604,8 +634,38 @@
<action selector="onTransportChange:" destination="-1" eventType="valueChanged" id="l9Y-fd-ja8"/>
</connections>
</segmentedControl>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="DISPLAY NAME (OPTIONAL)" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="F0s-Da-L59" userLabel="displayNameLabel">
<rect key="frame" x="38" y="467" 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"/>
<color key="textColor" red="0.50196078430000002" green="0.50196078430000002" blue="0.50196078430000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" tag="106" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" adjustsFontSizeToFit="NO" minimumFontSize="10" id="7Cb-fa-CY5" userLabel="displayNameField" customClass="UIAssistantTextField">
<rect key="frame" x="38" y="489" 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"/>
<accessibility key="accessibilityConfiguration" label="Password"/>
<color key="textColor" red="0.2666666667" green="0.2666666667" blue="0.2666666667" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" secureTextEntry="YES"/>
<connections>
<outlet property="delegate" destination="-1" id="e0Y-gb-t9q"/>
<outlet property="errorLabel" destination="3nU-NE-Lke" id="AlW-17-Y8Q"/>
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" tag="410" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Invalid display name" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" id="3nU-NE-Lke" userLabel="displayNameErrorLabel">
<rect key="frame" x="38" y="519" width="299" height="10"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="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="2Ch-Ji-vjA" userLabel="loginButton" customClass="UIRoundBorderedButton">
<rect key="frame" x="38" y="448" width="299" height="71"/>
<rect key="frame" x="38" y="550" width="299" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<accessibility key="accessibilityConfiguration" label="Login">
@ -627,7 +687,7 @@
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="626.5" y="862"/>
<point key="canvasLocation" x="626" y="886"/>
</view>
<view contentMode="scaleToFill" id="Zuh-Sd-pcd" userLabel="remoteProvisioningView">
<rect key="frame" x="0.0" y="0.0" width="375" height="562"/>
@ -684,7 +744,7 @@
<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"/>
<rect key="frame" x="38" y="485" width="299" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<accessibility key="accessibilityConfiguration" label="Fetch and apply">
@ -796,7 +856,7 @@
</connections>
</textField>
<button opaque="NO" tag="130" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="middleTruncation" id="eKs-or-rqw" userLabel="remoteProvisioningLoginButton" customClass="UIRoundBorderedButton">
<rect key="frame" x="38" y="448" width="299" height="71"/>
<rect key="frame" x="38" y="485" width="299" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<accessibility key="accessibilityConfiguration" label="Login">

View file

@ -21,6 +21,7 @@
#import "FirstLoginView.h"
#import "LinphoneManager.h"
#import "PhoneMainView.h"
#import "Utils/XMLRPCHelper.h"
@implementation FirstLoginView

View file

@ -35,7 +35,7 @@
</label>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleAspectFit" image="launchscreen.png" id="pz0-nR-x0f" userLabel="logoImage">
<rect key="frame" x="0.0" y="187" width="375" height="169"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
</imageView>
</subviews>

View file

@ -166,6 +166,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
[self setCString:tname forKey:@"transport_preference"];
[self setBool:(linphone_proxy_config_get_route(proxy) != NULL) forKey:@"outbound_proxy_preference"];
[self setBool:linphone_proxy_config_avpf_enabled(proxy) forKey:@"avpf_preference"];
[self setBool:(linphone_core_get_default_proxy_config(lc) == proxy) forKey:@"is_default_preference"];
const LinphoneAuthInfo *ai =
linphone_core_find_auth_info(lc, NULL, [self stringForKey:@"username_preference"].UTF8String,
@ -379,7 +380,6 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
LinphoneManager *lm = [LinphoneManager instance];
LinphoneCore *lc = [LinphoneManager getLc];
LinphoneProxyConfig *proxyCfg = NULL;
BOOL isEditing = FALSE;
NSString *error = nil;
int port_preference = [self integerForKey:@"port_preference"];
@ -411,13 +411,15 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
// mandatory parameters
NSString *username = [self stringForKey:@"username_preference"];
NSString *displayName = [self stringForKey:@"display_name_preference"];
NSString *userID = [self stringForKey:@"userid_preference"];
NSString *domain = [self stringForKey:@"domain_preference"];
NSString *transport = [self stringForKey:@"transport_preference"];
NSString *accountHa1 = [self stringForKey:@"ha1_preference"];
NSString *accountPassword = [self stringForKey:@"password_preference"];
bool isOutboundProxy = [self boolForKey:@"outbound_proxy_preference"];
BOOL isOutboundProxy = [self boolForKey:@"outbound_proxy_preference"];
BOOL use_avpf = [self boolForKey:@"avpf_preference"];
BOOL is_default = [self boolForKey:@"is_default_preference"];
if (username && [username length] > 0 && domain && [domain length] > 0) {
int expire = [self integerForKey:@"expire_preference"];
@ -468,7 +470,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
sizeof(normalizedUserName));
linphone_address_set_username(linphoneAddress, normalizedUserName);
linphone_address_set_domain(linphoneAddress, [domain UTF8String]);
linphone_address_set_display_name(linphoneAddress, (displayName.length ? displayName.UTF8String : NULL));
const char *identity = linphone_address_as_string_uri_only(linphoneAddress);
const char *password = [accountPassword UTF8String];
const char *ha1 = [accountHa1 UTF8String];
@ -503,38 +505,30 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
linphone_proxy_config_enable_register(proxyCfg, true);
linphone_proxy_config_enable_avpf(proxyCfg, use_avpf);
linphone_proxy_config_set_expires(proxyCfg, expire);
if (is_default) {
linphone_core_set_default_proxy_config(lc, proxyCfg);
} else if (linphone_core_get_default_proxy_config(lc) == proxyCfg) {
linphone_core_set_default_proxy_config(lc, NULL);
}
LinphoneAuthInfo *proxyAi = (LinphoneAuthInfo *)linphone_proxy_config_find_auth_info(proxyCfg);
// setup new proxycfg
if (isEditing) {
linphone_proxy_config_done(proxyCfg);
} else {
// was a new proxy config, add it
linphone_core_add_proxy_config(lc, proxyCfg);
linphone_core_set_default_proxy_config(lc, proxyCfg);
}
linphone_proxy_config_done(proxyCfg);
// modify auth info only after finishing editting the proxy config, so that
// UNREGISTER succeed
if (proxyAi) {
linphone_auth_info_set_username(proxyAi, username.UTF8String);
if (password) {
linphone_auth_info_set_passwd(proxyAi, password);
linphone_auth_info_set_ha1(proxyAi, NULL);
}
linphone_auth_info_set_domain(proxyAi, linphone_proxy_config_get_domain(proxyCfg));
} else {
LinphoneAddress *from = linphone_address_new(identity);
if (from) {
const char *userid_str = (userID != nil) ? [userID UTF8String] : NULL;
LinphoneAuthInfo *info = linphone_auth_info_new(
linphone_address_get_username(from), userid_str, password ? password : NULL, password ? NULL : ha1,
linphone_proxy_config_get_realm(proxyCfg), linphone_proxy_config_get_domain(proxyCfg));
linphone_address_destroy(from);
linphone_core_add_auth_info(lc, info);
linphone_auth_info_destroy(info);
}
linphone_core_remove_auth_info(lc, proxyAi);
}
LinphoneAddress *from = linphone_address_new(identity);
if (from) {
const char *userid_str = (userID != nil) ? [userID UTF8String] : NULL;
LinphoneAuthInfo *info = linphone_auth_info_new(
linphone_address_get_username(from), userid_str, password ? password : NULL, password ? NULL : ha1,
linphone_proxy_config_get_realm(proxyCfg), linphone_proxy_config_get_domain(proxyCfg));
linphone_address_destroy(from);
linphone_core_add_auth_info(lc, info);
linphone_auth_info_destroy(info);
}
bad_proxy:
@ -545,10 +539,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
// in case of error, show an alert to the user
if (error != nil) {
if (isEditing)
linphone_proxy_config_done(proxyCfg);
else
linphone_proxy_config_destroy(proxyCfg);
linphone_proxy_config_done(proxyCfg);
[[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error", nil)
message:error
@ -580,8 +571,10 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
{
BOOL account_changed =
[self valueChangedForKey:@"username_preference"] || [self valueChangedForKey:@"password_preference"] ||
[self valueChangedForKey:@"domain_preference"] || [self valueChangedForKey:@"expire_preference"] ||
[self valueChangedForKey:@"proxy_preference"] || [self valueChangedForKey:@"outbound_proxy_preference"] ||
[self valueChangedForKey:@"display_name_preference"] ||
[self valueChangedForKey:@"is_default_preference"] || [self valueChangedForKey:@"domain_preference"] ||
[self valueChangedForKey:@"expire_preference"] || [self valueChangedForKey:@"proxy_preference"] ||
[self valueChangedForKey:@"outbound_proxy_preference"] ||
[self valueChangedForKey:@"transport_preference"] || [self valueChangedForKey:@"port_preference"] ||
[self valueChangedForKey:@"random_port_preference"] || [self valueChangedForKey:@"prefix_preference"] ||
[self valueChangedForKey:@"substitute_+_by_00_preference"] || [self valueChangedForKey:@"use_ipv6"] ||

View file

@ -893,24 +893,15 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, const char
[PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
}];
[alertView
addButtonWithTitle:NSLocalizedString(@"Confirm password", nil)
block:^{
NSString *password = [alertView textFieldAtIndex:0].text;
LinphoneAuthInfo *info = (LinphoneAuthInfo *)linphone_core_find_auth_info(
[LinphoneManager getLc], realm.UTF8String, username.UTF8String, domain.UTF8String);
if (info) {
linphone_auth_info_set_passwd(info, password.UTF8String);
linphone_auth_info_set_ha1(info, NULL);
} else {
LOGW(@"Could not find auth info associated with %@@%@, creating it", username, domain);
info = linphone_auth_info_new(username.UTF8String, NULL, password.UTF8String, NULL,
[alertView addButtonWithTitle:NSLocalizedString(@"Confirm password", nil)
block:^{
NSString *password = [alertView textFieldAtIndex:0].text;
LinphoneAuthInfo *info =
linphone_auth_info_new(username.UTF8String, NULL, password.UTF8String, NULL,
realm.UTF8String, domain.UTF8String);
linphone_core_add_auth_info([LinphoneManager getLc], info);
}
linphone_proxy_config_refresh_register(
linphone_core_get_default_proxy_config([LinphoneManager getLc]));
}];
linphone_core_add_auth_info([LinphoneManager getLc], info);
[LinphoneManager.instance refreshRegisters];
}];
[alertView show];
}
}

View file

@ -15,7 +15,7 @@
<outlet property="historyButton" destination="6" id="13"/>
<outlet property="historyNotificationLabel" destination="34" id="35"/>
<outlet property="historyNotificationView" destination="32" id="36"/>
<outlet property="landscapeView" destination="3" id="HaF-0o-7be"/>
<outlet property="landscapeView" destination="ni3-kk-RmM" id="gdj-Ib-y4f"/>
<outlet property="portraitView" destination="3" id="43"/>
<outlet property="selectedButtonImage" destination="eC3-Hw-cqQ" id="PFh-X5-jX7"/>
<outlet property="view" destination="3" id="14"/>
@ -141,7 +141,128 @@
<animations/>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="209" y="259.5"/>
<point key="canvasLocation" x="226" y="-36"/>
</view>
<view contentMode="scaleToFill" id="ni3-kk-RmM">
<rect key="frame" x="0.0" y="0.0" width="90" height="264"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="color_C.png" id="V07-hP-Heu" userLabel="backgroundImage">
<rect key="frame" x="0.0" y="0.0" width="90" height="264"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="hlj-lf-AGD" userLabel="historyButton" customClass="UIIconButton">
<rect key="frame" x="0.0" y="0.0" width="90" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<animations/>
<accessibility key="accessibilityConfiguration" label="History"/>
<state key="normal" image="footer_history_default.png"/>
<state key="disabled" image="footer_history_disabled.png"/>
<state key="highlighted" backgroundImage="color_A.png"/>
<connections>
<action selector="onHistoryClick:" destination="-1" eventType="touchUpInside" id="apg-Ia-q2O"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="ea1-DR-JeN" userLabel="contactsButton" customClass="UIIconButton">
<rect key="frame" x="0.0" y="66" width="90" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<animations/>
<accessibility key="accessibilityConfiguration" label="Contacts"/>
<inset key="titleEdgeInsets" minX="0.0" minY="40" maxX="0.0" maxY="0.0"/>
<state key="normal" image="footer_contacts_default.png"/>
<state key="disabled" image="footer_contacts_disabled.png"/>
<state key="selected">
<color key="titleColor" red="0.81176471709999998" green="0.29803922770000002" blue="0.16078431900000001" alpha="1" colorSpace="deviceRGB"/>
</state>
<state key="highlighted" backgroundImage="color_A.png"/>
<connections>
<action selector="onContactsClick:" destination="-1" eventType="touchUpInside" id="Mha-05-jl6"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="Leo-2i-huu" userLabel="dialerButton" customClass="UIIconButton">
<rect key="frame" x="0.0" y="132" width="90" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<animations/>
<accessibility key="accessibilityConfiguration" label="Dialer"/>
<state key="normal" image="footer_dialer_default.png"/>
<state key="disabled" image="footer_dialer_disabled.png"/>
<state key="highlighted" backgroundImage="color_A.png"/>
<connections>
<action selector="onDialerClick:" destination="-1" eventType="touchUpInside" id="f7N-Mt-lPq"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="TbS-j0-yv4" userLabel="chatButton" customClass="UIIconButton">
<rect key="frame" x="0.0" y="198" width="90" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<animations/>
<accessibility key="accessibilityConfiguration" label="Chat"/>
<inset key="titleEdgeInsets" minX="0.0" minY="40" maxX="0.0" maxY="0.0"/>
<state key="normal" image="footer_chat_default.png"/>
<state key="disabled" image="footer_chat_disabled.png"/>
<state key="highlighted" backgroundImage="color_A.png"/>
<connections>
<action selector="onChatClick:" destination="-1" eventType="touchUpInside" id="B7q-6N-lWO"/>
</connections>
</button>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="color_A.png" id="Dxb-ca-vcU" userLabel="selectedButtonImage">
<rect key="frame" x="0.0" y="66" width="3" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
<animations/>
</imageView>
<view autoresizesSubviews="NO" userInteractionEnabled="NO" contentMode="scaleToFill" id="djA-EL-HUt" userLabel="chatNotificationView">
<rect key="frame" x="68" y="198" width="21" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" image="history_chat_indicator.png" id="EKN-Nr-bdt" userLabel="chatNotificationImage">
<rect key="frame" x="0.0" y="0.0" width="21" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
</imageView>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="99" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="7" id="cWJ-ol-R0k" userLabel="chatNotificationLabel">
<rect key="frame" x="0.0" y="0.0" width="21" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<accessibility key="accessibilityConfiguration" label="Missed message(s)">
<accessibilityTraits key="traits" none="YES"/>
</accessibility>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
<view autoresizesSubviews="NO" userInteractionEnabled="NO" contentMode="scaleToFill" id="Ldd-jk-0kY" userLabel="historyNotificationView">
<rect key="frame" x="68" y="0.0" width="21" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" image="history_chat_indicator.png" id="toi-dz-eTS" userLabel="historyNotificationImage">
<rect key="frame" x="0.0" y="0.0" width="21" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
</imageView>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="99" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="7" id="eU2-w3-nYr" userLabel="historyNotificationLabel">
<rect key="frame" x="0.0" y="0.0" width="21" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<accessibility key="accessibilityConfiguration" label="Missed call(s)">
<accessibilityTraits key="traits" none="YES"/>
</accessibility>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
</subviews>
<animations/>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="91" y="241"/>
</view>
</objects>
<resources>

View file

@ -72,7 +72,7 @@
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
<view autoresizesSubviews="NO" tag="3" contentMode="scaleToFill" id="21" userLabel="tabBar">
<rect key="frame" x="0.0" y="309" width="667" height="66"/>
<rect key="frame" x="0.0" y="0.0" width="66" height="375"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<animations/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>

View file

@ -181,10 +181,15 @@
message = NSLocalizedString(@"Fetching remote configuration", nil);
} else if (config == NULL) {
state = LinphoneRegistrationNone;
if (linphone_core_is_network_reachable([LinphoneManager getLc]))
message = NSLocalizedString(@"No account configured", nil);
else
if (linphone_core_is_network_reachable([LinphoneManager getLc])) {
if (linphone_core_get_proxy_config_list(lc) != NULL) {
message = NSLocalizedString(@"No default account", nil);
} else {
message = NSLocalizedString(@"No account configured", nil);
}
} else {
message = NSLocalizedString(@"Network down", nil);
}
} else {
state = linphone_proxy_config_get_state(config);

View file

@ -434,6 +434,7 @@ static UICompositeViewDescription *compositeDescription = nil;
} else if ([@"advanced_account_preference" compare:notif.object] == NSOrderedSame) {
removeFromHiddenKeys = [[notif.userInfo objectForKey:@"advanced_account_preference"] boolValue];
[keys addObject:@"userid_preference"];
[keys addObject:@"display_name_preference"];
[keys addObject:@"proxy_preference"];
[keys addObject:@"outbound_proxy_preference"];
[keys addObject:@"avpf_preference"];
@ -624,6 +625,7 @@ static UICompositeViewDescription *compositeDescription = nil;
if (![lm lpConfigBoolForKey:@"advanced_account_preference"]) {
[hiddenKeys addObject:@"userid_preference"];
[hiddenKeys addObject:@"display_name_preference"];
[hiddenKeys addObject:@"proxy_preference"];
[hiddenKeys addObject:@"outbound_proxy_preference"];
[hiddenKeys addObject:@"avpf_preference"];

View file

@ -18,7 +18,7 @@
if (default_proxy != NULL) {
const LinphoneAddress *addr = linphone_proxy_config_get_identity_address(default_proxy);
[ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr];
char *as_string = linphone_address_as_string(addr);
char *as_string = linphone_address_as_string_uri_only(addr);
[_addressButton setTitle:[NSString stringWithUTF8String:as_string] forState:UIControlStateNormal];
ms_free(as_string);
[_addressButton setImage:[StatusBarView imageForState:linphone_proxy_config_get_state(default_proxy)]

View file

@ -12,6 +12,16 @@
<key>Type</key>
<string>IASKButtonSpecifier</string>
</dict>
<dict>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
<key>Title</key>
<string>Default account</string>
<key>Key</key>
<string>is_default_preference</string>
<key>DefaultValue</key>
<false/>
</dict>
<dict>
<key>AutocapitalizationType</key>
<string>None</string>
@ -26,7 +36,25 @@
<key>KeyboardType</key>
<string>Alphabet</string>
<key>Title</key>
<string>User name</string>
<string>Username</string>
<key>Type</key>
<string>PSTextFieldSpecifier</string>
</dict>
<dict>
<key>AutocapitalizationType</key>
<string>None</string>
<key>AutocorrectionType</key>
<string>No</string>
<key>DefaultValue</key>
<string></string>
<key>IsSecure</key>
<false/>
<key>Key</key>
<string>display_name_preference</string>
<key>KeyboardType</key>
<string>Alphabet</string>
<key>Title</key>
<string>Display name</string>
<key>Type</key>
<string>PSTextFieldSpecifier</string>
</dict>