UI: fix bugs

This commit is contained in:
Gautier Pelloux-Prayer 2015-11-19 12:09:47 +01:00
parent 4cab730c39
commit 7bf0e73cc2
5 changed files with 19 additions and 37 deletions

View file

@ -60,7 +60,7 @@
</imageView>
<button opaque="NO" tag="11" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="26e-Pj-2Oh" userLabel="microButton" customClass="UIMicroButton">
<rect key="frame" x="0.0" y="0.0" width="94" height="63"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<animations/>
<accessibility key="accessibilityConfiguration" label="Accept"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
@ -73,7 +73,7 @@
</button>
<button opaque="NO" tag="11" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="G7m-Av-QlR" userLabel="speakerButton" customClass="UISpeakerButton">
<rect key="frame" x="94" y="0.0" width="94" height="63"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<animations/>
<accessibility key="accessibilityConfiguration" label="Accept"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
@ -86,7 +86,7 @@
</button>
<button opaque="NO" tag="12" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="AaM-cH-pvW" userLabel="declineButton">
<rect key="frame" x="187" y="0.0" width="188" height="63"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" heightSizable="YES"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<animations/>
<accessibility key="accessibilityConfiguration" label="Decline"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>

View file

@ -163,39 +163,18 @@ static UICompositeViewDescription *compositeDescription = nil;
}
- (void)onLoginClick:(id)sender {
NSString *errorMessage = nil;
if ([_usernameField.text length] == 0) {
errorMessage = NSLocalizedString(@"Enter your username", nil);
} else if ([_passwordField.text length] == 0) {
errorMessage = NSLocalizedString(@"Enter your password", nil);
}
if (errorMessage != nil) {
UIAlertView *error = nil;
error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Alert", nil)
message:errorMessage
delegate:nil
cancelButtonTitle:NSLocalizedString(@"Continue", nil)
otherButtonTitles:nil];
[error show];
} else {
linphone_core_clear_all_auth_info([LinphoneManager getLc]);
linphone_core_clear_proxy_config([LinphoneManager getLc]);
LinphoneProxyConfig *proxyCfg = linphone_core_create_proxy_config([LinphoneManager getLc]);
/*default domain is supposed to be preset from linphonerc*/
NSString *identity =
[NSString stringWithFormat:@"sip:%@@%s", _usernameField.text, linphone_proxy_config_get_addr(proxyCfg)];
linphone_proxy_config_set_identity(proxyCfg, [identity UTF8String]);
LinphoneAuthInfo *auth_info = linphone_auth_info_new(
[_usernameField.text UTF8String], [_usernameField.text UTF8String], [_passwordField.text UTF8String], NULL,
NULL, linphone_proxy_config_get_domain(proxyCfg));
linphone_core_add_auth_info([LinphoneManager getLc], auth_info);
linphone_core_add_proxy_config([LinphoneManager getLc], proxyCfg);
linphone_core_set_default_proxy_config([LinphoneManager getLc], proxyCfg);
// reload address book to prepend proxy config domain to contacts' phone number
[[[LinphoneManager instance] fastAddressBook] reload];
[_waitView setHidden:false];
};
_waitView.hidden = NO;
[XMLRPCHelper GetProvisioningURL:_usernameField.text
password:_passwordField.text
domain:_domainField.text
OnSuccess:^(NSString *url) {
if (url) {
linphone_core_set_provisioning_uri([LinphoneManager getLc], url.UTF8String);
[[LinphoneManager instance] resetLinphoneCore];
} else {
_waitView.hidden = YES;
}
}];
}
#pragma mark - UITextFieldDelegate Functions

View file

@ -63,6 +63,7 @@
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<textInputTraits key="textInputTraits" autocorrectionType="no"/>
<connections>
<outlet property="delegate" destination="-1" id="Fml-De-aww"/>
<outlet property="errorLabel" destination="Ym3-AJ-VDD" id="YzJ-Uo-FtX"/>
</connections>
</textField>
@ -92,6 +93,7 @@
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" secureTextEntry="YES"/>
<connections>
<outlet property="delegate" destination="-1" id="e4F-kt-Udb"/>
<outlet property="errorLabel" destination="zTY-fc-a6l" id="uAR-NP-WXe"/>
</connections>
</textField>

View file

@ -52,6 +52,7 @@ INIT_WITH_COMMON {
}
- (void)textFieldDidEndEditing:(UITextField *)textField {
_lastText = textField.text;
_canShowError = YES;
[self checkDisplayError];
}

2
main.m
View file

@ -26,7 +26,7 @@
void uncaughtExceptionHandler(NSException *exception) {
NSLog(@"Crash: %@", exception);
NSLog(@"Stack Trace: %@", [exception callStackSymbols]);
// Internal error reportingstx
// Internal error reporting
};
#endif