assistant: password is not mandatory anymore on external sip domains

This commit is contained in:
Gautier Pelloux-Prayer 2016-01-07 14:37:35 +01:00
parent 1c5dc413e8
commit 8f3980b582
7 changed files with 20 additions and 21 deletions

View file

@ -22,7 +22,7 @@
#import "UICompositeView.h"
#import "TPKeyboardAvoidingScrollView.h"
@interface AssistantView : TPMultiLayoutViewController <UITextFieldDelegate, UICompositeViewDelegate> {
@interface AssistantView : UIViewController <UITextFieldDelegate, UICompositeViewDelegate> {
@private
LinphoneAccountCreator *account_creator;
UIView *currentView;

View file

@ -37,7 +37,7 @@ typedef enum _ViewElement {
ViewElement_Domain = 104,
ViewElement_URL = 105,
ViewElement_DisplayName = 106,
ViewElement_TextFieldCount = 6,
ViewElement_TextFieldCount = 7,
ViewElement_Transport = 110,
ViewElement_Username_Label = 120,
ViewElement_NextButton = 130,
@ -399,7 +399,7 @@ static UICompositeViewDescription *compositeDescription = nil;
for (int i = 0; i < ViewElement_TextFieldCount; i++) {
UIAssistantTextField *field = [self findTextField:100 + i];
if (field) {
invalidInputs |= (field.isInvalid || field.lastText.length == 0);
invalidInputs |= field.isInvalid;
}
}
[self findButton:ViewElement_NextButton].enabled = !invalidInputs;
@ -639,6 +639,7 @@ void assistant_validation_tested(LinphoneAccountCreator *creator, LinphoneAccoun
- (void)textFieldDidEndEditing:(UITextField *)textField {
UIAssistantTextField *atf = (UIAssistantTextField *)textField;
[atf textFieldDidEndEditing:atf];
[self shouldEnableNextButton];
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
@ -664,14 +665,18 @@ void assistant_validation_tested(LinphoneAccountCreator *creator, LinphoneAccoun
shouldChangeCharactersInRange:(NSRange)range
replacementString:(NSString *)string {
UIAssistantTextField *atf = (UIAssistantTextField *)textField;
BOOL replace = YES;
// if we are hitting backspace, invalid range is given (length=1 instead of text size, new string="")
if ([string isEqual:@""]) {
range = NSMakeRange(0, atf.text.length);
}
[atf textField:atf shouldChangeCharactersInRange:range replacementString:string];
if (atf.tag == ViewElement_Username && currentView == _createAccountView) {
atf.text = [atf.text stringByReplacingCharactersInRange:range withString:string.lowercaseString];
[self shouldEnableNextButton];
return NO;
replace = NO;
}
[self shouldEnableNextButton];
return YES;
return replace;
}
#pragma mark - Action Functions

View file

@ -1,16 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9051"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="AssistantView">
<connections>
<outlet property="backButton" destination="edC-CG-eZr" id="aXO-xT-kQ1"/>
<outlet property="contentView" destination="98" id="99"/>
<outlet property="landscapeView" destination="12" id="bDn-lQ-GfK"/>
<outlet property="portraitView" destination="12" id="117"/>
<outlet property="view" destination="12" id="20"/>
<outlet property="waitView" destination="91" id="96"/>
</connections>
@ -31,12 +29,10 @@
<imageView userInteractionEnabled="NO" tag="3" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="color_F.png" id="vhv-dn-tHv" userLabel="backgroundColor">
<rect key="frame" x="0.0" y="0.0" width="375" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<animations/>
</imageView>
<button opaque="NO" tag="4" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="TFl-cN-1Vb" userLabel="dialerBackButton" customClass="UIIconButton">
<rect key="frame" x="300" y="0.0" width="75" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<animations/>
<accessibility key="accessibilityConfiguration" label="Dialer"/>
<inset key="titleEdgeInsets" minX="0.0" minY="18" maxX="0.0" maxY="0.0"/>
<state key="normal" image="dialer_back_default.png">
@ -51,7 +47,6 @@
<label opaque="NO" userInteractionEnabled="NO" tag="5" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ASSISTANT" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="1EG-3g-3uU" userLabel="titleLabel">
<rect key="frame" x="83" y="0.0" width="209" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<animations/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="27"/>
<color key="textColor" red="1" green="0.36862745099999999" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
@ -59,7 +54,6 @@
<button opaque="NO" tag="6" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="edC-CG-eZr" userLabel="backButton" customClass="UIIconButton">
<rect key="frame" x="0.0" y="0.0" width="75" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<animations/>
<accessibility key="accessibilityConfiguration" label="Back"/>
<inset key="titleEdgeInsets" minX="0.0" minY="18" maxX="0.0" maxY="0.0"/>
<state key="normal" image="back_default.png">
@ -72,12 +66,10 @@
</connections>
</button>
</subviews>
<animations/>
</view>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" tag="7" contentMode="scaleToFill" bounces="NO" showsHorizontalScrollIndicator="NO" id="98" userLabel="contentView" customClass="TPKeyboardAvoidingScrollView">
<rect key="frame" x="0.0" y="66" width="375" height="559"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</scrollView>
<view hidden="YES" tag="8" contentMode="scaleToFill" id="91" userLabel="waitView">
@ -87,19 +79,15 @@
<activityIndicatorView opaque="NO" tag="9" contentMode="scaleToFill" animating="YES" style="gray" id="90" userLabel="activityIndicatorView">
<rect key="frame" x="179" y="302" width="20" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<animations/>
</activityIndicatorView>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="0.5" colorSpace="calibratedWhite"/>
<gestureRecognizers/>
</view>
</subviews>
<animations/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
</subviews>
<animations/>
<color key="backgroundColor" red="1" green="1" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina47"/>
<point key="canvasLocation" x="40.5" y="263.5"/>

View file

@ -505,7 +505,7 @@
<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">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="PASSWORD (OPTIONAL)" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="XPq-fy-KZS" userLabel="passwordLabel">
<rect key="frame" x="38" y="236" width="299" height="14"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>

View file

@ -12,6 +12,8 @@
</section>
<section name="assistant">
<entry name="username_min_length" overwrite="true">1</entry>
<entry name="password_min_length" overwrite="true">0</entry>
<entry name="xmlrpc_url" overwrite="true"></entry>
</section>
</config>

View file

@ -16,6 +16,8 @@
<section name="assistant">
<entry name="domain" overwrite="true">sip.linphone.org</entry>
<entry name="username_regex" overwrite="true">^[a-z0-9_.\-]*$</entry>
<entry name="username_min_length" overwrite="true">1</entry>
<entry name="password_min_length" overwrite="true">1</entry>
<entry name="xmlrpc_url" overwrite="true">https://www.linphone.org/assistant.php</entry>
</section>
</config>

View file

@ -16,6 +16,8 @@
<section name="assistant">
<entry name="domain" overwrite="true">sip.linphone.org</entry>
<entry name="username_regex" overwrite="true">^[a-z0-9_.\-]*$</entry>
<entry name="username_min_length" overwrite="true">1</entry>
<entry name="password_min_length" overwrite="true">1</entry>
<entry name="xmlrpc_url" overwrite="true">https://www.linphone.org/assistant.php</entry>
</section>
</config>