only repport registration error due to bad credential

This commit is contained in:
Jehan Monnier 2013-08-26 11:03:03 +02:00
parent dfe1f1ac72
commit 1ef6bf2fc7
4 changed files with 16 additions and 36 deletions

View file

@ -211,42 +211,24 @@ static PhoneMainView* phoneMainViewInstance=nil;
[self updateApplicationBadgeNumber];
}
- (void)registrationUpdate:(NSNotification*)notif {
- (void)registrationUpdate:(NSNotification*)notif {
LinphoneRegistrationState state = [[notif.userInfo objectForKey: @"state"] intValue];
LinphoneProxyConfig *cfg = [[notif.userInfo objectForKey: @"cfg"] pointerValue];
// Show error
if (state == LinphoneRegistrationFailed) {
NSString* lErrorMessage = nil;
LinphoneReason reason = linphone_proxy_config_get_error(cfg);
if (reason == LinphoneReasonBadCredentials) {
lErrorMessage = NSLocalizedString(@"Bad credentials, check your account settings", nil);
} else if (reason == LinphoneReasonNoResponse) {
lErrorMessage = NSLocalizedString(@"SIP server unreachable", nil);
} else {
lErrorMessage = NSLocalizedString(@"Unknown error", nil);
}
if (lErrorMessage != nil && linphone_proxy_config_get_error(cfg) != LinphoneReasonNoResponse) {
//do not report network connection issue on registration
//default behavior if no registration delegates
UIApplicationState s = [UIApplication sharedApplication].applicationState;
// do not stack error message when going to backgroud
if (s != UIApplicationStateBackground) {
UIAlertView* error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Registration failure",nil)
message:lErrorMessage
delegate:nil
cancelButtonTitle:NSLocalizedString(@"Continue",nil)
otherButtonTitles:nil,nil];
[error show];
[error release];
}
}
//Only report bad credential issue
if (state == LinphoneRegistrationFailed
&&[UIApplication sharedApplication].applicationState != UIApplicationStateBackground
&& linphone_proxy_config_get_error(cfg) == LinphoneReasonBadCredentials ) {
UIAlertView* error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Registration failure",nil)
message:NSLocalizedString(@"Bad credentials, check your account settings", nil)
delegate:nil
cancelButtonTitle:NSLocalizedString(@"Continue",nil)
otherButtonTitles:nil,nil];
[error show];
[error release];
}
}
- (void)callUpdate:(NSNotification*)notif {
- (void)callUpdate:(NSNotification*)notif {
LinphoneCall *call = [[notif.userInfo objectForKey: @"call"] pointerValue];
LinphoneCallState state = [[notif.userInfo objectForKey: @"state"] intValue];
NSString *message = [notif.userInfo objectForKey: @"message"];

View file

@ -5789,7 +5789,7 @@
HEADER_SEARCH_PATHS = "";
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
LIBRARY_SEARCH_PATHS = "";
PROVISIONING_PROFILE = "BB7E624F-8CD6-448B-A235-CE8DBB401F92";
PROVISIONING_PROFILE = "0636A6EA-90EB-4D92-B707-19FC32F9A7CF";
SDKROOT = iphoneos;
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic;
TARGETED_DEVICE_FAMILY = "1,2";
@ -5801,7 +5801,6 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CODE_SIGN_ENTITLEMENTS = "";
CODE_SIGN_IDENTITY = "iPhone Distribution: jehan monnier";
COMPRESS_PNG_FILES = NO;
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = "";
@ -5833,7 +5832,6 @@
ORDER_FILE = "";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = linphone;
PROVISIONING_PROFILE = "906D0BA7-CD8F-470C-A060-F0752867FC5D";
SKIP_INSTALL = NO;
TARGETED_DEVICE_FAMILY = "1,2";
};

@ -1 +1 @@
Subproject commit 274ee44882abdda62914a09cc9f2df38892ca336
Subproject commit f10b5b4eb8dd5afc075d006f4cea108d662f5f41

@ -1 +1 @@
Subproject commit 01d35e5b53fca8358e2b9b8dc67d47b4cca4327f
Subproject commit 6d0e4f3525a56577cd3b0d2b48856e81227c7529