From 009db98d8ef9aed865f2e88ddde958e3003be376 Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Thu, 2 Feb 2017 14:50:57 +0100 Subject: [PATCH] clearer message to validate ZRTP SAS --- Classes/LinphoneAppDelegate.m | 20 ++++++++++++++++---- Classes/LinphoneUI/StatusBarView.m | 18 ++++++++++++++++-- Resources/en.lproj/Localizable.strings | Bin 62602 -> 62778 bytes 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 95e00897c..a43af202f 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -800,10 +800,22 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response userInfo:sheet repeats:NO]; } else if ([response.notification.request.content.categoryIdentifier isEqual:@"zrtp_request"]) { - [UIConfirmationDialog - ShowWithMessage:[NSString stringWithFormat:NSLocalizedString( - @"Confirm the following SAS with peer:\n%s", nil), - linphone_call_get_authentication_token(call)] + NSString *code = [NSString stringWithUTF8String:linphone_call_get_authentication_token(call)]; + NSString *myCode; + NSString *correspondantCode; + if (linphone_call_get_dir(call) == LinphoneCallIncoming) { + myCode = [code substringToIndex:2]; + correspondantCode = [code substringFromIndex:2]; + } else { + correspondantCode = [code substringToIndex:2]; + myCode = [code substringFromIndex:2]; + } + NSString *message = [NSString stringWithFormat:NSLocalizedString(@"Confirm the following SAS with peer:\n" + @"Say : %@\n" + @"Your correspondant should say : %@", + nil), + myCode, correspondantCode]; + [UIConfirmationDialog ShowWithMessage:message cancelMessage:NSLocalizedString(@"DENY", nil) confirmMessage:NSLocalizedString(@"ACCEPT", nil) onCancelClick:^() { diff --git a/Classes/LinphoneUI/StatusBarView.m b/Classes/LinphoneUI/StatusBarView.m index e0e2c785e..43db8ee5e 100644 --- a/Classes/LinphoneUI/StatusBarView.m +++ b/Classes/LinphoneUI/StatusBarView.m @@ -318,9 +318,23 @@ LinphoneMediaEncryption enc = linphone_call_params_get_media_encryption(linphone_call_get_current_params(call)); if (enc == LinphoneMediaEncryptionZRTP) { + NSString *code = [NSString stringWithUTF8String:linphone_call_get_authentication_token(call)]; + NSString *myCode; + NSString *correspondantCode; + if (linphone_call_get_dir(call) == LinphoneCallIncoming) { + myCode = [code substringToIndex:2]; + correspondantCode = [code substringFromIndex:2]; + } else { + correspondantCode = [code substringToIndex:2]; + myCode = [code substringFromIndex:2]; + } NSString *message = - [NSString stringWithFormat:NSLocalizedString(@"Confirm the following SAS with peer:\n%s", nil), - linphone_call_get_authentication_token(call)]; + [NSString stringWithFormat:NSLocalizedString(@"Confirm the following SAS with peer:\n" + @"Say : %@\n" + @"Your correspondant should say : %@", + nil), + myCode, correspondantCode]; + if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground && floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_9_x_Max) { UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init]; diff --git a/Resources/en.lproj/Localizable.strings b/Resources/en.lproj/Localizable.strings index deac1601852cd7c6f93bd241156c9ce8cd3d679e..ac03ac828d094b1dd2f7885b240b5bcd61411142 100644 GIT binary patch delta 138 zcmeBr$-L_o^M(T&qQMM_43!KD3|2s_%HY5d!;r@iIobP$s%$Ys217nWDMJoJ3Q(>X oRo&!|>e7?%Y1l}j>NjLiK{i7as~M9k*-|I}&=lC*rpa;|01)mWeEin;40^M(T&%&H8