FirstLogin: continue

This commit is contained in:
Gautier Pelloux-Prayer 2015-11-09 14:53:54 +01:00
parent 920760a71c
commit 2d05f938d9
11 changed files with 260 additions and 89 deletions

View file

@ -49,6 +49,8 @@
@property(nonatomic, strong) IBOutlet UIButton *gotoLoginButton;
@property(nonatomic, strong) IBOutlet UIButton *gotoRemoteProvisioningButton;
+ (NSString *)errorForStatus:(LinphoneAccountCreatorStatus)status;
- (void)reset;
- (void)fillDefaultValues;

View file

@ -171,7 +171,7 @@ static UICompositeViewDescription *compositeDescription = nil;
[historyViews removeAllObjects];
}
- (NSString *)errorForStatus:(LinphoneAccountCreatorStatus)status {
+ (NSString *)errorForStatus:(LinphoneAccountCreatorStatus)status {
BOOL usePhoneNumber = [[LinphoneManager instance] lpConfigBoolForKey:@"use_phone_number" forSection:@"assistant"];
switch (status) {
case LinphoneAccountCreatorEmailInvalid:
@ -408,21 +408,21 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)prepareErrorLabels {
UIAssistantTextField *createUsername = [self findTextField:ViewElement_Username];
[createUsername showError:[self errorForStatus:LinphoneAccountCreatorUsernameInvalid]
[createUsername showError:[AssistantView 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 = [AssistantView errorForStatus:s];
return s != LinphoneAccountCreatorOK;
}];
UIAssistantTextField *password = [self findTextField:ViewElement_Password];
[password showError:[self errorForStatus:LinphoneAccountCreatorPasswordTooShort]
[password showError:[AssistantView 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 = [AssistantView errorForStatus:s];
return s != LinphoneAccountCreatorOK;
}];
UIAssistantTextField *password2 = [self findTextField:ViewElement_Password2];
@ -432,21 +432,21 @@ static UICompositeViewDescription *compositeDescription = nil;
}];
UIAssistantTextField *email = [self findTextField:ViewElement_Email];
[email showError:[self errorForStatus:LinphoneAccountCreatorEmailInvalid]
[email showError:[AssistantView 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 = [AssistantView errorForStatus:s];
return s != LinphoneAccountCreatorOK;
}];
UIAssistantTextField *domain = [self findTextField:ViewElement_Domain];
[domain showError:[self errorForStatus:LinphoneAccountCreatorDomainInvalid]
[domain showError:[AssistantView 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 = [AssistantView errorForStatus:s];
return s != LinphoneAccountCreatorOK;
}];
UIAssistantTextField *url = [self findTextField:ViewElement_URL];
@ -616,7 +616,7 @@ void assistant_validation_tested(LinphoneAccountCreator *creator, LinphoneAccoun
UIAssistantTextField *atf = (UIAssistantTextField *)textField;
[atf textField:atf shouldChangeCharactersInRange:range replacementString:string];
if (atf.tag == ViewElement_Username && currentView == _createAccountView) {
textField.text = [textField.text stringByReplacingCharactersInRange:range withString:string.lowercaseString];
atf.text = [atf.text stringByReplacingCharactersInRange:range withString:string.lowercaseString];
[self shouldEnableNextButton];
return NO;
}

View file

@ -20,8 +20,10 @@
#import <UIKit/UIKit.h>
#import "UICompositeView.h"
#import "UIAssistantTextField.h"
@interface FirstLoginView : UIViewController <UITextFieldDelegate, UICompositeViewDelegate> {
LinphoneAccountCreator *account_creator;
}
- (IBAction)onLoginClick:(id)sender;
@ -29,8 +31,9 @@
@property(nonatomic, strong) IBOutlet UIButton *loginButton;
@property(nonatomic, strong) IBOutlet UIButton *siteButton;
@property(nonatomic, strong) IBOutlet UITextField *usernameField;
@property(nonatomic, strong) IBOutlet UITextField *passwordField;
@property(nonatomic, strong) IBOutlet UIAssistantTextField *usernameField;
@property(nonatomic, strong) IBOutlet UIAssistantTextField *passwordField;
@property(nonatomic, strong) IBOutlet UIView *waitView;
@property(weak, nonatomic) IBOutlet UIAssistantTextField *domainField;
@end

View file

@ -66,6 +66,30 @@ static UICompositeViewDescription *compositeDescription = nil;
[self registrationUpdate:linphone_proxy_config_get_state(config)];
}
}
[_usernameField showError:[AssistantView errorForStatus:LinphoneAccountCreatorUsernameInvalid]
when:^BOOL(NSString *inputEntry) {
LinphoneAccountCreatorStatus s =
linphone_account_creator_set_username(account_creator, inputEntry.UTF8String);
_usernameField.errorLabel.text = [AssistantView errorForStatus:s];
return s != LinphoneAccountCreatorOK;
}];
[_passwordField showError:[AssistantView errorForStatus:LinphoneAccountCreatorPasswordTooShort]
when:^BOOL(NSString *inputEntry) {
LinphoneAccountCreatorStatus s =
linphone_account_creator_set_password(account_creator, inputEntry.UTF8String);
_passwordField.errorLabel.text = [AssistantView errorForStatus:s];
return s != LinphoneAccountCreatorOK;
}];
[_domainField showError:[AssistantView errorForStatus:LinphoneAccountCreatorDomainInvalid]
when:^BOOL(NSString *inputEntry) {
LinphoneAccountCreatorStatus s =
linphone_account_creator_set_domain(account_creator, inputEntry.UTF8String);
_domainField.errorLabel.text = [AssistantView errorForStatus:s];
return s != LinphoneAccountCreatorOK;
}];
}
- (void)viewWillDisappear:(BOOL)animated {
@ -83,6 +107,15 @@ static UICompositeViewDescription *compositeDescription = nil;
siteUrl = @"http://www.linphone.org";
}
[_siteButton setTitle:siteUrl forState:UIControlStateNormal];
account_creator = linphone_account_creator_new([LinphoneManager getLc], siteUrl.UTF8String);
}
- (void)shouldEnableNextButton {
BOOL invalidInputs = NO;
for (UIAssistantTextField *field in @[ _usernameField, _passwordField, _domainField ]) {
invalidInputs |= (field.isInvalid || field.lastText.length == 0);
}
_loginButton.enabled = !invalidInputs;
}
#pragma mark - Event Functions
@ -91,8 +124,6 @@ static UICompositeViewDescription *compositeDescription = nil;
[self registrationUpdate:[[notif.userInfo objectForKey:@"state"] intValue]];
}
#pragma mark -
- (void)registrationUpdate:(LinphoneRegistrationState)state {
switch (state) {
case LinphoneRegistrationOk: {
@ -175,4 +206,18 @@ static UICompositeViewDescription *compositeDescription = nil;
return YES;
}
- (void)textFieldDidEndEditing:(UITextField *)textField {
UIAssistantTextField *atf = (UIAssistantTextField *)textField;
[atf textFieldDidEndEditing:atf];
}
- (BOOL)textField:(UITextField *)textField
shouldChangeCharactersInRange:(NSRange)range
replacementString:(NSString *)string {
UIAssistantTextField *atf = (UIAssistantTextField *)textField;
[atf textField:atf shouldChangeCharactersInRange:range replacementString:string];
[self shouldEnableNextButton];
return YES;
}
@end

View file

@ -1,94 +1,184 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4514" systemVersion="13B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment defaultVersion="1072" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3747"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="FirstLoginViewController">
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="FirstLoginView">
<connections>
<outlet property="loginButton" destination="64" id="65"/>
<outlet property="passwordField" destination="8" id="60"/>
<outlet property="siteButton" destination="35" id="58"/>
<outlet property="usernameField" destination="6" id="59"/>
<outlet property="domainField" destination="w8z-ad-o8e" id="QC5-dU-UKn"/>
<outlet property="loginButton" destination="8H9-Gf-7ZL" id="e1g-x6-PCO"/>
<outlet property="passwordField" destination="BBC-uD-FIM" id="JEo-he-9QU"/>
<outlet property="usernameField" destination="vaw-qL-SCR" id="KTu-qn-3am"/>
<outlet property="view" destination="55" id="56"/>
<outlet property="waitView" destination="31" id="57"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="55">
<rect key="frame" x="0.0" y="0.0" width="320" height="460"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="middleTruncation" id="64" userLabel="loginButton">
<rect key="frame" x="33" y="312" width="255" height="50"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Login"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
<state key="normal" title="Login" backgroundImage="button_background_default.png">
<color key="titleColor" red="0.35686274509999999" green="0.39607843139999999" blue="0.43529411759999997" alpha="1" colorSpace="deviceRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted" backgroundImage="button_background_over.png">
<color key="titleColor" red="0.72549019609999998" green="0.76862745099999996" blue="0.79607843140000001" alpha="1" colorSpace="deviceRGB"/>
</state>
<connections>
<action selector="onLoginClick:" destination="-1" eventType="touchUpInside" id="66"/>
</connections>
</button>
<button hidden="YES" opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="35" userLabel="siteButton">
<rect key="frame" x="60" y="420" width="200" height="37"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
<fontDescription key="fontDescription" name="Helvetica-Bold" family="Helvetica" pointSize="15"/>
<state key="normal">
<color key="titleColor" red="0.19607843" green="0.30980393000000001" blue="0.52156866000000002" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="onSiteClick:" destination="-1" eventType="touchUpInside" id="63"/>
</connections>
</button>
<textField opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Username" minimumFontSize="17" background="field_background.png" id="6" userLabel="usernameField">
<rect key="frame" x="60" y="170" width="200" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="logo_secure_phone.png" id="JsZ-cm-gih" userLabel="logoImage">
<rect key="frame" x="20" y="46" width="93" height="93"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
</imageView>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Bienvenue" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="ddC-mF-O2L" userLabel="titleLabel">
<rect key="frame" x="121" y="46" width="254" height="48"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<accessibility key="accessibilityConfiguration" label="Account setup assistant"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="24"/>
<color key="textColor" red="0.2666666667" green="0.2666666667" blue="0.2666666667" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<size key="shadowOffset" width="-1" height="-1"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Saisissez vos identifiants" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" minimumFontSize="10" id="h9m-R1-9c4" userLabel="subtitleLabel">
<rect key="frame" x="121" y="97" width="254" height="42"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<accessibility key="accessibilityConfiguration" label="Account setup assistant"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="1" green="0.36862745099999999" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<size key="shadowOffset" width="-1" height="-1"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" tag="120" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="USERNAME" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="aM8-yf-s5d" userLabel="usernameLabel">
<rect key="frame" x="20" y="186" width="335" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="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="100" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" adjustsFontSizeToFit="NO" minimumFontSize="10" id="vaw-qL-SCR" userLabel="usernameField" customClass="UIAssistantTextField">
<rect key="frame" x="20" y="214" width="335" height="43"/>
<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="Username"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<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"/>
<connections>
<outlet property="delegate" destination="-1" id="39"/>
<outlet property="errorLabel" destination="Ym3-AJ-VDD" id="YzJ-Uo-FtX"/>
</connections>
</textField>
<textField opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" placeholder="Password" clearsOnBeginEditing="YES" minimumFontSize="17" background="field_background.png" id="8" userLabel="passwordField">
<rect key="frame" x="60" y="220" width="200" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<label opaque="NO" userInteractionEnabled="NO" tag="410" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Invalid username" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" id="Ym3-AJ-VDD" userLabel="usernameErrorLabel">
<rect key="frame" x="20" y="259" width="335" height="15"/>
<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="kjU-P0-ji6" userLabel="passwordLabel">
<rect key="frame" x="20" y="288" width="335" 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="101" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" adjustsFontSizeToFit="NO" minimumFontSize="10" id="BBC-uD-FIM" userLabel="passwordField" customClass="UIAssistantTextField">
<rect key="frame" x="20" y="312" width="335" height="43"/>
<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"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<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="17"/>
<outlet property="errorLabel" destination="zTY-fc-a6l" id="uAR-NP-WXe"/>
</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="zTY-fc-a6l" userLabel="passwordErrorLabel">
<rect key="frame" x="20" y="357" width="335" height="15"/>
<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="FdB-x1-lgt" userLabel="domainLabel">
<rect key="frame" x="20" y="386" width="335" 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="104" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" adjustsFontSizeToFit="NO" minimumFontSize="10" id="w8z-ad-o8e" userLabel="domainField" customClass="UIAssistantTextField">
<rect key="frame" x="20" y="408" width="335" height="43"/>
<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="Domain"/>
<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"/>
<connections>
<outlet property="delegate" destination="-1" id="CgQ-c2-2d9"/>
<outlet property="errorLabel" destination="sng-3P-5z8" id="DHj-OF-TIc"/>
</connections>
</textField>
<button opaque="NO" tag="130" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="middleTruncation" id="8H9-Gf-7ZL" userLabel="downloadButton" customClass="UIRoundBorderedButton">
<rect key="frame" x="20" y="498" width="335" height="54"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<accessibility key="accessibilityConfiguration" label="Fetch and apply">
<bool key="isElement" value="YES"/>
</accessibility>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="LOGIN">
<color key="titleColor" red="0.2666666667" green="0.2666666667" blue="0.2666666667" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="disabled">
<color key="titleColor" red="0.76862745099999996" green="0.76862745099999996" blue="0.76862745099999996" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="onLoginClick:" destination="-1" eventType="touchUpInside" id="BX7-xj-kmf"/>
</connections>
</button>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="logo_orange.png" id="7X6-fU-bDd" userLabel="orangeImage">
<rect key="frame" x="271" y="574" width="63" height="63"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<animations/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" tag="410" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Invalid domain" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" id="sng-3P-5z8" userLabel="domainErrorLabel">
<rect key="frame" x="20" y="459" width="335" height="15"/>
<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>
<view hidden="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="31" userLabel="waitView">
<rect key="frame" x="0.0" y="0.0" width="320" height="460"/>
<rect key="frame" x="0.0" y="0.0" width="55" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<activityIndicatorView opaque="NO" clearsContextBeforeDrawing="NO" userInteractionEnabled="NO" contentMode="scaleToFill" animating="YES" style="whiteLarge" id="32" userLabel="activityIndicator">
<rect key="frame" x="142" y="211" width="37" height="37"/>
<rect key="frame" x="9" y="314" width="37" height="37"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<animations/>
</activityIndicatorView>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="0.66000000000000003" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</subviews>
<animations/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<nil key="simulatedStatusBarMetrics"/>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina47"/>
<point key="canvasLocation" x="556.5" y="484.5"/>
</view>
</objects>
<resources>
<image name="button_background_default.png" width="550" height="101"/>
<image name="button_background_over.png" width="550" height="101"/>
<image name="field_background.png" width="542" height="88"/>
<image name="logo_orange.png" width="63" height="63"/>
<image name="logo_secure_phone.png" width="186" height="186"/>
</resources>
</document>
</document>

View file

@ -19,6 +19,6 @@
#import <UIKit/UIKit.h>
@interface UIAddressTextField : UITextField
@interface UIAddressTextField : UITextField <UITextFieldDelegate>
@end

View file

@ -7,9 +7,14 @@
//
#import "UIAssistantTextField.h"
#import "Utils.h"
@implementation UIAssistantTextField
INIT_WITH_COMMON {
self.delegate = self;
}
- (void)showError:(NSString *)msg {
_errorLabel.text = msg;
_lastText = self.text;
@ -32,6 +37,12 @@
self.layer.borderColor = _errorLabel.hidden ? [[UIColor clearColor] CGColor] : [[UIColor redColor] CGColor];
}
- (BOOL)isInvalid {
return _showErrorPredicate && _showErrorPredicate(_lastText);
}
#pragma mark - UITextFieldDelegate Functions
- (BOOL)textField:(UITextField *)textField
shouldChangeCharactersInRange:(NSRange)range
replacementString:(NSString *)string {
@ -45,8 +56,4 @@
[self checkDisplayError];
}
- (BOOL)isInvalid {
return _showErrorPredicate && _showErrorPredicate(_lastText);
}
@end

View file

@ -35,11 +35,11 @@
#import "CallView.h"
#import "CallIncomingView.h"
#import "CallOutgoingView.h"
#import "FirstLoginView.h"
#import "SettingsView.h"
#import "SideMenuView.h"
#import "AssistantView.h"
#import "CallSideMenuView.h"
//#import "ChatConversationCreateView.h"
#import "UIConfirmationDialog.h"
#import "DTAlertView.h"
#import "DTActionSheet.h"

View file

@ -418,7 +418,7 @@ static RootViewManager *rootViewManagerInstance = nil;
if (linphone_core_get_global_state(core) != LinphoneGlobalOn) {
[self changeCurrentView:DialerView.compositeViewDescription];
} else if ([[LinphoneManager instance] lpConfigBoolForKey:@"enable_first_login_view_preference"] == true) {
// TODO: Change to fist login view
[PhoneMainView.instance changeCurrentView:FirstLoginView.compositeViewDescription];
} else {
// always start to dialer when testing
// Change to default view

View file

@ -105,3 +105,23 @@ typedef enum {
+ (UIImage *)decodedImageWithImage:(UIImage *)image;
@end
/* Use that macro when you want to invoke a custom initialisation method on your class,
whatever is using it (xib, source code, etc., tableview cell) */
#define INIT_WITH_COMMON \
-(instancetype)init { \
self = [super init]; \
[self commonInit]; \
return self; \
} \
-(instancetype)initWithCoder : (NSCoder *)aDecoder { \
self = [super initWithCoder:aDecoder]; \
[self commonInit]; \
return self; \
} \
-(instancetype)initWithFrame : (CGRect)frame { \
self = [super initWithFrame:frame]; \
[self commonInit]; \
return self; \
} \
-(void)commonInit

View file

@ -17,6 +17,10 @@ display_filter_auto_rotate=0
#contact_filter_on_default_domain=1
#use_phone_number=0
send_logs_include_linphonerc_and_chathistory=0
enable_first_login_view_preference=1
[assistant]
username_regex=^[a-z0-9_.\-]*$
[in_app_purchase]
enabled=0