diff --git a/Classes/ConferenceCallDetailView.xib b/Classes/ConferenceCallDetailView.xib index d756d676e..3b80aa096 100644 --- a/Classes/ConferenceCallDetailView.xib +++ b/Classes/ConferenceCallDetailView.xib @@ -36,15 +36,15 @@ 274 - + 274 {320, 328} - + _NS:418 - + 3 MCAwAA @@ -52,25 +52,26 @@ IBCocoaTouchFramework YES 0 + NO YES 44 22 22 - + 292 {{107, 328}, {106, 66}} - + NO NO IBCocoaTouchFramework 0 0 - + 3 MQA @@ -78,7 +79,7 @@ 1 MC4xOTYwNzg0MzE0IDAuMzA5ODAzOTIxNiAwLjUyMTU2ODYyNzUAA - + 3 MC41AA @@ -94,35 +95,35 @@ NSImage micro.png - + 2 2 - + Helvetica-Bold 18 16 - + 292 {{213, 328}, {107, 66}} - - + + NO NO IBCocoaTouchFramework 0 0 - + 1 MC4xOTYwNzg0MzE0IDAuMzA5ODAzOTIxNiAwLjUyMTU2ODYyNzUAA - + NSImage HP_inverse.png @@ -131,10 +132,10 @@ NSImage HP.png - - + + - + 292 {{0, 394}, {320, 66}} @@ -150,12 +151,12 @@ IBCocoaTouchFramework 0 0 - + 1 MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - + NSImage stopcall-red.png @@ -164,47 +165,47 @@ NSImage clavier-01-106px.png - + Helvetica-Bold Helvetica 2 15 - + Helvetica-Bold 15 16 - + 292 {{0, 328}, {107, 66}} - + NO IBCocoaTouchFramework 0 0 - + 1 MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - + NSImage effacer.png - - + + {{0, 20}, {320, 460}} - + 3 MC42NjY2NjY2NjY3AA @@ -219,7 +220,7 @@ back - + 16 @@ -227,7 +228,7 @@ hangup - + 17 @@ -235,7 +236,7 @@ mute - + 18 @@ -243,7 +244,7 @@ speaker - + 19 @@ -259,14 +260,14 @@ table - + 23 dataSource - + 21 @@ -274,7 +275,7 @@ delegate - + 22 @@ -292,11 +293,11 @@ 1 - - - - - + + + + + @@ -313,31 +314,31 @@ 7 - + 10 - + mute 11 - + end 12 - + speaker 14 - + Erase diff --git a/Classes/IncallViewController.h b/Classes/IncallViewController.h index 55fc0d57f..e6ea4e234 100644 --- a/Classes/IncallViewController.h +++ b/Classes/IncallViewController.h @@ -24,7 +24,7 @@ #include "UILinphone.h" @class VideoViewController; -@interface IncallViewController : UIViewController { +@interface IncallViewController : UIViewController { UIView* controlSubView, *callControlSubView, *hangUpView; @@ -74,6 +74,9 @@ BOOL mVideoShown; BOOL mVideoIsPending; BOOL mIncallViewIsReady; + + UIImage* verified, *unverified; + UIActionSheet* zrtpVerificationSheet; } -(void)displayStatus:(NSString*) message; @@ -81,7 +84,7 @@ - (IBAction)doAction:(id)sender; +(LinphoneCall*) retrieveCallAtIndex: (NSInteger) index inConference:(bool) conf; -+ (void) updateCellImageView:(UIImageView*)imageView Label:(UILabel*)label DetailLabel:(UILabel*)detailLabel AndAccessoryView:(UIImageView*)accessoryView withCall:(LinphoneCall*) call; ++ (void) updateCellImageView:(UIImageView*)imageView Label:(UILabel*)label DetailLabel:(UILabel*)detailLabel AndAccessoryView:(UIButton*)accessoryView withCall:(LinphoneCall*) call; @property (nonatomic, retain) IBOutlet UIView* controlSubView; @property (nonatomic, retain) IBOutlet UIView* callControlSubView; diff --git a/Classes/IncallViewController.m b/Classes/IncallViewController.m index 5675b9c13..625621f20 100644 --- a/Classes/IncallViewController.m +++ b/Classes/IncallViewController.m @@ -95,7 +95,9 @@ int callCount(LinphoneCore* lc) { //Controls [mute initWithOnImage:[UIImage imageNamed:@"micro_inverse.png"] offImage:[UIImage imageNamed:@"micro.png"] ]; [speaker initWithOnImage:[UIImage imageNamed:@"HP_inverse.png"] offImage:[UIImage imageNamed:@"HP.png"] ]; - + + verified = [[UIImage imageNamed:@"secured.png"] retain]; + unverified = [[UIImage imageNamed:@"unverified.png"] retain]; //Dialer init [zero initWithNumber:'0']; @@ -218,6 +220,12 @@ int callCount(LinphoneCore* lc) { } } } +-(void) viewWillDisappear:(BOOL)animated { + if (zrtpVerificationSheet != nil) { + [zrtpVerificationSheet dismissWithClickedButtonIndex:2 animated:NO]; + } +} + - (void) viewDidDisappear:(BOOL)animated { if (durationRefreasher != nil) { [durationRefreasher invalidate]; @@ -230,8 +238,8 @@ int callCount(LinphoneCore* lc) { } - (void)viewDidUnload { - - + [verified release]; + [unverified release]; } @@ -473,7 +481,7 @@ int callCount(LinphoneCore* lc) { [self updateActive:(cell == activeCallCell) cell:cell]; } -+ (void) updateCellImageView:(UIImageView*)imageView Label:(UILabel*)label DetailLabel:(UILabel*)detailLabel AndAccessoryView:(UIImageView*)accessoryView withCall:(LinphoneCall*) call { ++ (void) updateCellImageView:(UIImageView*)imageView Label:(UILabel*)label DetailLabel:(UILabel*)detailLabel AndAccessoryView:(UIButton*)accessoryView withCall:(LinphoneCall*) call { if (call == NULL) { ms_warning("UpdateCell called with null call"); [label setText:@""]; @@ -524,13 +532,19 @@ int callCount(LinphoneCore* lc) { } if (accessoryView != nil) { - if (linphone_call_params_get_media_encryption(linphone_call_get_current_params(call)) != - LinphoneMediaEncryptionNone) { - if (accessoryView.image == nil) - accessoryView.image = [UIImage imageNamed:@"secured.png"]; + /* + LinphoneMediaEncryption enc = linphone_call_params_get_media_encryption(linphone_call_get_current_params(call)); + if (enc != LinphoneMediaEncryptionNone) { + if (accessoryView.imageView.image == nil) { + if (enc == LinphoneMediaEncryptionSRTP || linphone_call_get_authentication_token_verified(call)) { + [accessoryView setImage: verified forState:UIControlStateNormal]; + } else { + [accessoryView setImage: unverified forState:UIControlStateNormal]; + } + } } else { - accessoryView.image = nil; - } + [accessoryView setImage: (UIImage*)nil forState:UIControlStateNormal]; + }*/ } } @@ -559,9 +573,7 @@ int callCount(LinphoneCore* lc) { else [ms appendFormat:(isFirst?@"%s":@", %s"), linphone_address_get_username(addr), nil]; - //if (call == selectedCall) - // [self updateActive:YES cell:cell]; - LinphoneCall* selectedCall = linphone_core_get_current_call([LinphoneManager getLc]); + LinphoneCall* selectedCall = linphone_core_get_current_call([LinphoneManager getLc]); if (call == selectedCall) { [callTableView selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone]; cell.selected = YES; @@ -573,11 +585,6 @@ int callCount(LinphoneCore* lc) { } [cell.detailTextLabel setText:ms]; cell.imageView.image = nil; - - /*if (linphone_core_is_in_conference(lc)) - cell.backgroundColor = [UIColor colorWithRed:0 green:1 blue:0 alpha:1]; - else - cell.backgroundColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];*/ } -(void) tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath @@ -597,8 +604,6 @@ int callCount(LinphoneCore* lc) { cell.textLabel.font = [UIFont systemFontOfSize:40]; cell.textLabel.autoresizingMask = UIViewAutoresizingFlexibleHeight; } - if (cell.accessoryView != nil) - ((UIImageView*)cell.accessoryView).image = nil; LinphoneCore* lc = [LinphoneManager getLc]; if (indexPath.row == 0 && linphone_core_get_conference_size(lc) > 0) { @@ -611,27 +616,79 @@ int callCount(LinphoneCore* lc) { else cell.accessoryType = UITableViewCellAccessoryNone; } else { + if (cell.accessoryView == nil) { + UIButton* b = [UIButton buttonWithType:UIButtonTypeCustom]; + [b setFrame:CGRectMake(0, 0, 28, 28)]; + [b setImage:nil forState:UIControlStateNormal]; + b.backgroundColor = [UIColor clearColor]; + b.userInteractionEnabled = YES; + cell.accessoryView = b; + } LinphoneCall* call = [IncallViewController retrieveCallAtIndex:indexPath.row inConference:NO]; - [IncallViewController updateCellImageView:cell.imageView Label:cell.textLabel DetailLabel:cell.detailTextLabel AndAccessoryView:(UIImageView*)cell.accessoryView withCall:call]; + [IncallViewController updateCellImageView:cell.imageView Label:cell.textLabel DetailLabel:cell.detailTextLabel AndAccessoryView:(UIButton*)cell.accessoryView withCall:call]; if (linphone_core_get_current_call(lc) == call) activeCallCell = cell; cell.accessoryType = UITableViewCellAccessoryNone; - if (cell.accessoryView == nil) - cell.accessoryView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 28, 28)]; + + LinphoneMediaEncryption enc = linphone_call_params_get_media_encryption(linphone_call_get_current_params(call)); + + UIButton* accessoryBtn = (UIButton*) cell.accessoryView; + if (enc != LinphoneMediaEncryptionNone) { + if (enc == LinphoneMediaEncryptionSRTP || linphone_call_get_authentication_token_verified(call)) { + [accessoryBtn setImage: verified forState:UIControlStateNormal]; + } else { + [accessoryBtn setImage: unverified forState:UIControlStateNormal]; + } + } else { + [accessoryBtn setImage: (UIImage*)nil forState:UIControlStateNormal]; + } + + if (((UIButton*)cell.accessoryView).imageView.image != nil && linphone_call_params_get_media_encryption(linphone_call_get_current_params(call)) == LinphoneMediaEncryptionZRTP) { + [((UIButton*)cell.accessoryView) addTarget:self action:@selector(secureIconPressed:withEvent:) forControlEvents:UIControlEventTouchUpInside]; + } } cell.userInteractionEnabled = YES; cell.selectionStyle = UITableViewCellSelectionStyleNone; - //cell.selectionStyle = UITableViewCellSelectionStyleBlue; - - - - /*NSString *path = [[NSBundle mainBundle] pathForResource:[item objectForKey:@"imageKey"] ofType:@"png"]; - UIImage *theImage = [UIImage imageWithContentsOfFile:path]; - cell.imageView.image = theImage;*/ return cell; } +-(void) secureIconPressed:(UIControl*) button withEvent: (UIEvent*) evt { + NSSet* touches = [evt allTouches]; + UITouch* touch = [touches anyObject]; + CGPoint currentTouchPos = [touch locationInView:self.callTableView]; + NSIndexPath *path = [self.callTableView indexPathForRowAtPoint:currentTouchPos]; + if (path) { + LinphoneCall* call = [IncallViewController retrieveCallAtIndex:path.row inConference:NO]; + // start action sheet to validate/unvalidate zrtp code + CallDelegate* cd = [[CallDelegate alloc] init]; + cd.delegate = self; + cd.call = call; + + [(UIButton*)[callTableView cellForRowAtIndexPath:path].accessoryView setImage:nil forState:UIControlStateNormal]; + + zrtpVerificationSheet = [[UIActionSheet alloc] initWithTitle:[NSString stringWithFormat:NSLocalizedString(@" Mark auth token '%s' as:",nil),linphone_call_get_authentication_token(call)] + delegate:cd + cancelButtonTitle:NSLocalizedString(@"Unverified",nil) + destructiveButtonTitle:NSLocalizedString(@"Verified",nil) + otherButtonTitles:nil]; + + zrtpVerificationSheet.actionSheetStyle = UIActionSheetStyleDefault; + [zrtpVerificationSheet showInView:self.view]; + [zrtpVerificationSheet release]; + } +} + +-(void) actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex withUserDatas:(void *)datas { + LinphoneCall* call = (LinphoneCall*)datas; + // maybe we could verify call validity + + if (buttonIndex == 0) + linphone_call_set_authentication_token_verified(call, YES); + else if (buttonIndex == 1) + linphone_call_set_authentication_token_verified(call, NO); + zrtpVerificationSheet = nil; +} // UITableViewDataSource (required) - (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section diff --git a/Resources/unverified.png b/Resources/unverified.png new file mode 100644 index 000000000..f824d40c4 Binary files /dev/null and b/Resources/unverified.png differ diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index 18d84e353..3ea4ae020 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -229,6 +229,11 @@ 344ABD78147FCB68007420B6 /* ConferenceCallDetailView.m in Sources */ = {isa = PBXBuildFile; fileRef = 344ABD76147FCB68007420B6 /* ConferenceCallDetailView.m */; }; 344ABD7A147FD32B007420B6 /* ConferenceCallDetailCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 344ABD79147FD32B007420B6 /* ConferenceCallDetailCell.xib */; }; 344ABD7B147FD32B007420B6 /* ConferenceCallDetailCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 344ABD79147FD32B007420B6 /* ConferenceCallDetailCell.xib */; }; + 344ABDE51483E596007420B6 /* unverified.png in Resources */ = {isa = PBXBuildFile; fileRef = 344ABDE41483E596007420B6 /* unverified.png */; }; + 344ABDE61483E596007420B6 /* unverified.png in Resources */ = {isa = PBXBuildFile; fileRef = 344ABDE41483E596007420B6 /* unverified.png */; }; + 344ABDE81484E723007420B6 /* libzrtpcpp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 344ABDE71484E723007420B6 /* libzrtpcpp.a */; }; + 344ABDF114850AE9007420B6 /* libc++.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 344ABDEF14850AE9007420B6 /* libc++.1.dylib */; }; + 344ABDF214850AE9007420B6 /* libstdc++.6.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 344ABDF014850AE9007420B6 /* libstdc++.6.dylib */; }; 34957F3F147D3FBF00DD7A09 /* secured.png in Resources */ = {isa = PBXBuildFile; fileRef = 34957F3E147D3FBF00DD7A09 /* secured.png */; }; 34F2F678147D2E1C00A2D5E3 /* contact_vide.png in Resources */ = {isa = PBXBuildFile; fileRef = 34F2F677147D2E1C00A2D5E3 /* contact_vide.png */; }; 70571E1A13FABCB000CDD3C2 /* rootca.pem in Resources */ = {isa = PBXBuildFile; fileRef = 70571E1913FABCB000CDD3C2 /* rootca.pem */; }; @@ -242,7 +247,7 @@ /* Begin PBXCopyFilesBuildPhase section */ 2247673A129C3B9C002B94B4 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; + buildActionMask = 12; dstPath = ""; dstSubfolderSpec = 11; files = ( @@ -585,6 +590,10 @@ 344ABD75147FCB68007420B6 /* ConferenceCallDetailView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConferenceCallDetailView.h; sourceTree = ""; }; 344ABD76147FCB68007420B6 /* ConferenceCallDetailView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ConferenceCallDetailView.m; sourceTree = ""; }; 344ABD79147FD32B007420B6 /* ConferenceCallDetailCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ConferenceCallDetailCell.xib; sourceTree = ""; }; + 344ABDE41483E596007420B6 /* unverified.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = unverified.png; path = Resources/unverified.png; sourceTree = ""; }; + 344ABDE71484E723007420B6 /* libzrtpcpp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libzrtpcpp.a; path = "liblinphone-sdk/apple-darwin/lib/libzrtpcpp.a"; sourceTree = ""; }; + 344ABDEF14850AE9007420B6 /* libc++.1.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libc++.1.dylib"; path = "usr/lib/libc++.1.dylib"; sourceTree = SDKROOT; }; + 344ABDF014850AE9007420B6 /* libstdc++.6.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libstdc++.6.dylib"; path = "usr/lib/libstdc++.6.dylib"; sourceTree = SDKROOT; }; 34957F3E147D3FBF00DD7A09 /* secured.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = secured.png; path = Resources/secured.png; sourceTree = ""; }; 34F2F677147D2E1C00A2D5E3 /* contact_vide.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = contact_vide.png; path = Resources/contact_vide.png; sourceTree = ""; }; 70571E1913FABCB000CDD3C2 /* rootca.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = rootca.pem; path = Resources/rootca.pem; sourceTree = ""; }; @@ -599,6 +608,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 344ABDF114850AE9007420B6 /* libc++.1.dylib in Frameworks */, + 344ABDF214850AE9007420B6 /* libstdc++.6.dylib in Frameworks */, + 344ABDE81484E723007420B6 /* libzrtpcpp.a in Frameworks */, F476004C147AAF4600FFF19B /* libmediastreamer.a in Frameworks */, F476004B147AAF2800FFF19B /* liblinphone.a in Frameworks */, 7066FC0C13E830E400EFC6DC /* libvpx.a in Frameworks */, @@ -1052,6 +1064,9 @@ 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { isa = PBXGroup; children = ( + 344ABDEF14850AE9007420B6 /* libc++.1.dylib */, + 344ABDF014850AE9007420B6 /* libstdc++.6.dylib */, + 344ABDE71484E723007420B6 /* libzrtpcpp.a */, 2211DB9614764F6B00DEE054 /* nogpl-thirdparties */, 2211DB911475562600DEE054 /* liblinphone.a */, 2211DB8F147555C800DEE054 /* libmediastreamer.a */, @@ -1121,6 +1136,7 @@ 29B97317FDCFA39411CA2CEA /* Resources */ = { isa = PBXGroup; children = ( + 344ABDE41483E596007420B6 /* unverified.png */, 34957F3E147D3FBF00DD7A09 /* secured.png */, 34F2F677147D2E1C00A2D5E3 /* contact_vide.png */, 2211DBCA1476BE7300DEE054 /* ajouter.png */, @@ -1294,6 +1310,7 @@ 34957F3F147D3FBF00DD7A09 /* secured.png in Resources */, 344ABD72147FC438007420B6 /* ConferenceCallDetailView.xib in Resources */, 344ABD7A147FD32B007420B6 /* ConferenceCallDetailCell.xib in Resources */, + 344ABDE51483E596007420B6 /* unverified.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1350,6 +1367,7 @@ 2211DBEA1476BE7300DEE054 /* pause.png in Resources */, 344ABD73147FC438007420B6 /* ConferenceCallDetailView.xib in Resources */, 344ABD7B147FD32B007420B6 /* ConferenceCallDetailCell.xib in Resources */, + 344ABDE61483E596007420B6 /* unverified.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; };