diff --git a/Classes/IncallViewController.h b/Classes/IncallViewController.h index 9635700c1..9f5b6e613 100644 --- a/Classes/IncallViewController.h +++ b/Classes/IncallViewController.h @@ -39,6 +39,7 @@ UISpeakerButton* speaker; UIButton* contacts; UITableView* callTableView; + UIButton* addCall, *mergeCalls; //key pad @@ -64,6 +65,8 @@ NSTimer *durationRefreasher; ABPeoplePickerNavigationController* myPeoplePickerController; + + UITableViewCell* selectedCell; } -(void)displayStatus:(NSString*) message; @@ -84,6 +87,8 @@ @property (nonatomic, retain) IBOutlet UIButton* speaker; @property (nonatomic, retain) IBOutlet UIButton* contacts; @property (nonatomic, retain) IBOutlet UITableView* callTableView; +@property (nonatomic, retain) IBOutlet UIButton* addCall; +@property (nonatomic, retain) IBOutlet UIButton* mergeCalls; @property (nonatomic, retain) IBOutlet UIButton* one; diff --git a/Classes/IncallViewController.m b/Classes/IncallViewController.m index 5af0c2f89..5e46d5aad 100644 --- a/Classes/IncallViewController.m +++ b/Classes/IncallViewController.m @@ -40,6 +40,8 @@ @synthesize speaker; @synthesize contacts; @synthesize callTableView; +@synthesize addCall; +@synthesize mergeCalls; @synthesize one; @synthesize two; @@ -67,6 +69,23 @@ */ +bool isInConference(LinphoneCall* call) { + return linphone_call_get_current_params(call)->in_conference; +} + +int callCount(LinphoneCore* lc) { + int count = 0; + const MSList* calls = linphone_core_get_calls(lc); + + while (calls != 0) { + if (!isInConference((LinphoneCall*)calls->data)) { + count++; + } + calls = calls->next; + } + return count; +} + // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; @@ -91,8 +110,28 @@ [nine initWithNumber:'9']; [star initWithNumber:'*']; [hash initWithNumber:'#']; - - + + [addCall addTarget:self action:@selector(addCallPressed) forControlEvents:UIControlEventTouchDown]; + [mergeCalls addTarget:self action:@selector(mergeCallsPressed) forControlEvents:UIControlEventTouchDown]; + + [mergeCalls setHidden:YES]; +} + +-(void) addCallPressed { + [self dismissModalViewControllerAnimated:true]; +} + +-(void) mergeCallsPressed { + LinphoneCore* lc = [LinphoneManager getLc]; + const MSList* calls = linphone_core_get_calls(lc); + + while (calls != 0) { + LinphoneCall* call = (LinphoneCall*)calls->data; + if (!isInConference(call)) { + linphone_core_add_to_conference(lc, call); + } + calls = calls->next; + } } -(void)updateCallsDurations { @@ -109,6 +148,7 @@ selector:@selector(updateCallsDurations) userInfo:nil repeats:YES]; + selectedCell = nil; } } @@ -116,6 +156,7 @@ if (durationRefreasher != nil) { [durationRefreasher invalidate]; durationRefreasher=nil; + selectedCell = nil; } } @@ -156,9 +197,8 @@ } -(void) displayInCall:(LinphoneCall*) call FromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName { - [callDuration start]; dismissed = false; - [callTableView reloadData]; + [callTableView reloadData]; } -(void) displayDialerFromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName { [callDuration stop]; @@ -170,6 +210,14 @@ [mute reset]; [pause reset]; + if (callCount([LinphoneManager getLc]) > 1) { + [pause setHidden:YES]; + [mergeCalls setHidden:NO]; + } else { + [pause setHidden:NO]; + [mergeCalls setHidden:YES]; + } + [callTableView reloadData]; } @@ -216,23 +264,6 @@ [super dealloc]; } -bool isInConference(LinphoneCall* call) { - return linphone_call_get_current_params(call)->in_conference; -} - -int callCount(LinphoneCore* lc) { - int count = 0; - const MSList* calls = linphone_core_get_calls(lc); - - while (calls != 0) { - if (!isInConference((LinphoneCall*)calls->data)) { - count++; - } - calls = calls->next; - } - return count; -} - -(LinphoneCall*) retrieveCallAtIndex: (NSInteger) index inConference:(bool) conf{ const MSList* calls = linphone_core_get_calls([LinphoneManager getLc]); @@ -284,12 +315,19 @@ int callCount(LinphoneCore* lc) { } [cell.detailTextLabel setText:ms]; + if (linphone_core_get_current_call([LinphoneManager getLc]) == call) - cell.accessoryType = UITableViewCellAccessoryCheckmark; + cell.backgroundColor = [UIColor colorWithRed:0 green:1 blue:0 alpha:0.5]; else if (confActive && isInConference(call)) + cell.backgroundColor = [UIColor colorWithRed:0 green:1 blue:0 alpha:0.5]; + else + cell.backgroundColor = [UIColor colorWithRed:1 green:0.5 blue:0 alpha:0.5]; + + + /*if (cell == selectedCell) cell.accessoryType = UITableViewCellAccessoryCheckmark; else - cell.accessoryType = UITableViewCellAccessoryNone; + cell.accessoryType = UITableViewCellAccessoryNone;*/ } @@ -301,8 +339,6 @@ int callCount(LinphoneCore* lc) { cell.selectionStyle = UITableViewCellSelectionStyleNone; } - ms_message("pouet"); - LinphoneCore* lc = [LinphoneManager getLc]; if (indexPath.section == 0 && linphone_core_get_conference_size(lc) > 0) [self updateCell:cell withCall: [self retrieveCallAtIndex:indexPath.row inConference:true] conferenceActive:linphone_core_is_in_conference(lc)]; @@ -363,5 +399,20 @@ int callCount(LinphoneCore* lc) { return nil; } +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + //selectedCell = [tableView cellForRowAtIndexPath:indexPath]; + + bool inConf = (indexPath.section == 0 && linphone_core_get_conference_size([LinphoneManager getLc]) > 0); + + if (inConf) { + linphone_core_enter_conference([LinphoneManager getLc]); + } else { + LinphoneCall* call = [self retrieveCallAtIndex:indexPath.row inConference:NO]; + linphone_core_resume_call([LinphoneManager getLc], call); + } + + [self updateUIFromLinphoneState: nil]; +} @end diff --git a/Classes/IncallViewController.xib b/Classes/IncallViewController.xib index b1930ec64..56393e2cd 100644 --- a/Classes/IncallViewController.xib +++ b/Classes/IncallViewController.xib @@ -12,9 +12,9 @@ YES - IBUITableView - IBUIViewController IBUIButton + IBUIViewController + IBUITableView IBUIView IBUILabel IBProxyObject @@ -49,6 +49,7 @@ {320, 182} + _NS:418 10 @@ -178,7 +179,7 @@ AAgACAAIAAEAAQABAAE {{239, 63}, {65, 21}} - + NO YES NO @@ -210,6 +211,289 @@ AAgACAAIAAEAAQABAAE + + + 292 + + YES + + + 292 + {{0, 68}, {82, 52}} + + + + NO + NO + IBCocoaTouchFramework + 0 + 0 + 1 + Mute + + 3 + MQA + + + 1 + MC4xOTYwNzg0MzE0IDAuMzA5ODAzOTIxNiAwLjUyMTU2ODYyNzUAA + + + 3 + MC41AA + + + NSImage + mic_active.png + + + + NSImage + mic_muted.png + + + + 2 + 2 + + + Helvetica-Bold + 18 + 16 + + + + + 292 + {{0, 122}, {82, 52}} + + + + NO + NO + IBCocoaTouchFramework + 0 + 0 + 1 + Add call + + + 1 + MC4xOTYwNzg0MzE0IDAuMzA5ODAzOTIxNiAwLjUyMTU2ODYyNzUAA + + + + + NSImage + startcall-green.png + + + + + + + + + 292 + {{94, 133}, {82, 52}} + + + + NO + NO + IBCocoaTouchFramework + 0 + 0 + 1 + Pau. Res. + + + 1 + MC4xOTYwNzg0MzE0IDAuMzA5ODAzOTIxNiAwLjUyMTU2ODYyNzUAA + + + + + NSImage + pausecall.png + + + + + 2 + 10 + + + Helvetica-Bold + 10 + 16 + + + + + 292 + {{90, 122}, {82, 52}} + + + + NO + NO + IBCocoaTouchFramework + 0 + 0 + 1 + Merge + + + 1 + MC4xOTYwNzg0MzE0IDAuMzA5ODAzOTIxNiAwLjUyMTU2ODYyNzUAA + + + + + + + 2 + 17 + + + Helvetica-Bold + 17 + 16 + + + + + 292 + {{6, 261}, {258, 52}} + + + + NO + NO + IBCocoaTouchFramework + 0 + 0 + 1 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + NSImage + stopcall-red.png + + + Helvetica-Bold + Helvetica + 2 + 15 + + + Helvetica-Bold + 15 + 16 + + + + + 292 + {{181, 122}, {82, 52}} + + + + NO + NO + IBCocoaTouchFramework + 0 + 0 + 1 + Cont + + + 1 + MC4xOTYwNzg0MzE0IDAuMzA5ODAzOTIxNiAwLjUyMTU2ODYyNzUAA + + + + NSImage + contact-orange.png + + + + + + + 292 + {{91, 68}, {82, 52}} + + + + NO + NO + IBCocoaTouchFramework + 0 + 0 + 1 + DTMF + + + 1 + MC4xOTYwNzg0MzE0IDAuMzA5ODAzOTIxNiAwLjUyMTU2ODYyNzUAA + + + + NSImage + dialer-orange.png + + + + + + + 292 + {{181, 68}, {82, 52}} + + + + NO + NO + IBCocoaTouchFramework + 0 + 0 + 1 + Spk + + + 1 + MC4xOTYwNzg0MzE0IDAuMzA5ODAzOTIxNiAwLjUyMTU2ODYyNzUAA + + + + NSImage + Speaker-32-off.png + + + + + + {{25, 110}, {270, 317}} + + + + + 3 + MSAwAA + + 2 + + + NO + NO + IBCocoaTouchFramework + -2147483356 @@ -227,33 +511,15 @@ AAgACAAIAAEAAQABAAE IBCocoaTouchFramework 0 0 - - 3 - MQA - + 1 MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - 3 - MC41AA - - - NSImage - stopcall-red.png - - - Helvetica-Bold - Helvetica - 2 - 15 - - - Helvetica-Bold - 15 - 16 - + + + + @@ -261,7 +527,7 @@ AAgACAAIAAEAAQABAAE {{170, 266}, {72, 37}} - + NO NO IBCocoaTouchFramework @@ -276,7 +542,7 @@ AAgACAAIAAEAAQABAAE - + @@ -299,7 +565,7 @@ AAgACAAIAAEAAQABAAE - + @@ -322,7 +588,7 @@ AAgACAAIAAEAAQABAAE - + @@ -345,7 +611,7 @@ AAgACAAIAAEAAQABAAE - + @@ -368,7 +634,7 @@ AAgACAAIAAEAAQABAAE - + @@ -391,7 +657,7 @@ AAgACAAIAAEAAQABAAE - + @@ -414,7 +680,7 @@ AAgACAAIAAEAAQABAAE - + @@ -437,7 +703,7 @@ AAgACAAIAAEAAQABAAE - + @@ -460,7 +726,7 @@ AAgACAAIAAEAAQABAAE - + @@ -483,7 +749,7 @@ AAgACAAIAAEAAQABAAE - + @@ -506,7 +772,7 @@ AAgACAAIAAEAAQABAAE - + @@ -529,7 +795,7 @@ AAgACAAIAAEAAQABAAE - + @@ -552,191 +818,13 @@ AAgACAAIAAEAAQABAAE - + {{25, 110}, {270, 317}} - - 3 - MSAwAA - - 2 - - - NO - NO - IBCocoaTouchFramework - - - - 292 - - YES - - - 292 - {{0, 61}, {82, 52}} - - - - NO - NO - IBCocoaTouchFramework - 0 - 0 - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - mic_active.png - - - - NSImage - mic_muted.png - - - - - - - - 292 - {{0, 121}, {82, 52}} - - - - NO - NO - IBCocoaTouchFramework - 0 - 0 - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - NSImage - pausecall.png - - - - - - - - - 292 - {{6, 261}, {258, 52}} - - - - NO - NO - IBCocoaTouchFramework - 0 - 0 - 1 - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - - - - 292 - {{90, 115}, {82, 52}} - - - - NO - NO - IBCocoaTouchFramework - 0 - 0 - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - contact-orange.png - - - - - - - 292 - {{93, 61}, {82, 52}} - - - - NO - NO - IBCocoaTouchFramework - 0 - 0 - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - dialer-orange.png - - - - - - - 292 - {{181, 61}, {82, 52}} - - - - NO - NO - IBCocoaTouchFramework - 0 - 0 - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - Speaker-32-off.png - - - - - - {{25, 110}, {270, 317}} - - - 3 MSAwAA @@ -750,7 +838,7 @@ AAgACAAIAAEAAQABAAE {{0, 20}, {320, 460}} - + 1 MC44MDAwMDAwMTE5IDAuODAwMDAwMDExOSAwLjgwMDAwMDAxMTkAA @@ -778,158 +866,6 @@ AAgACAAIAAEAAQABAAE 23 - - - controlSubView - - - - 44 - - - - padSubView - - - - 45 - - - - dialer - - - - 49 - - - - close - - - - 51 - - - - one - - - - 54 - - - - zero - - - - 55 - - - - star - - - - 56 - - - - hash - - - - 57 - - - - nine - - - - 58 - - - - two - - - - 59 - - - - three - - - - 60 - - - - four - - - - 67 - - - - five - - - - 69 - - - - six - - - - 71 - - - - seven - - - - 73 - - - - eight - - - - 75 - - - - mute - - - - 80 - - - - speaker - - - - 82 - - - - contacts - - - - 84 - peerName @@ -964,11 +900,43 @@ AAgACAAIAAEAAQABAAE - endPad + callTableView - + - 98 + 109 + + + + contacts + + + + 84 + + + + speaker + + + + 82 + + + + dialer + + + + 49 + + + + mute + + + + 80 @@ -980,19 +948,155 @@ AAgACAAIAAEAAQABAAE - pause + controlSubView - + - 105 + 44 - callTableView + nine - + - 109 + 58 + + + + eight + + + + 75 + + + + seven + + + + 73 + + + + six + + + + 71 + + + + five + + + + 69 + + + + four + + + + 67 + + + + three + + + + 60 + + + + one + + + + 54 + + + + zero + + + + 55 + + + + two + + + + 59 + + + + hash + + + + 57 + + + + star + + + + 56 + + + + close + + + + 51 + + + + endPad + + + + 98 + + + + padSubView + + + + 45 + + + + addCall + + + + 112 + + + + mergeCalls + + + + 114 + + + + pause + + + + 115 @@ -1074,12 +1178,12 @@ AAgACAAIAAEAAQABAAE YES - + @@ -1102,21 +1206,52 @@ AAgACAAIAAEAAQABAAE duration + + 93 + + + status + + + 106 + + + 26 YES - - - + + + + + controls + + 111 + + + addcall + + + 104 + + + merge + + + 15 + + + contacts + 13 @@ -1129,12 +1264,6 @@ AAgACAAIAAEAAQABAAE dialer - - 18 - - - end - 16 @@ -1142,10 +1271,10 @@ AAgACAAIAAEAAQABAAE mute - 15 - + 18 + - contacts + end 27 @@ -1164,36 +1293,12 @@ AAgACAAIAAEAAQABAAE - + pad - - 28 - - - end - - - 29 - - - close - - - 30 - - - 1 - - - 31 - - - star - 32 @@ -1213,10 +1318,10 @@ AAgACAAIAAEAAQABAAE 7 - 35 - + 37 + - 4 + 6 36 @@ -1225,10 +1330,10 @@ AAgACAAIAAEAAQABAAE 5 - 37 - + 35 + - 6 + 4 38 @@ -1236,6 +1341,18 @@ AAgACAAIAAEAAQABAAE 3 + + 30 + + + 1 + + + 41 + + + 0 + 39 @@ -1249,28 +1366,29 @@ AAgACAAIAAEAAQABAAE hash - 41 - + 31 + - 0 + star - 93 - - - status + 29 + + + close - 104 - + 28 + + + end + + + 113 + pauseresume - - 106 - - - @@ -1282,10 +1400,12 @@ AAgACAAIAAEAAQABAAE -2.CustomClassName -2.IBPluginDependency 10.IBPluginDependency - 104.CustomClassName 104.IBPluginDependency 106.IBPluginDependency 11.IBPluginDependency + 111.IBPluginDependency + 113.CustomClassName + 113.IBPluginDependency 12.CustomClassName 12.IBPluginDependency 13.CustomClassName @@ -1336,10 +1456,12 @@ AAgACAAIAAEAAQABAAE UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIPauseResumeButton com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIDuration com.apple.InterfaceBuilder.IBCocoaTouchPlugin UISpeakerButton @@ -1396,7 +1518,7 @@ AAgACAAIAAEAAQABAAE - 109 + 115 @@ -1419,6 +1541,7 @@ AAgACAAIAAEAAQABAAE YES YES + addCall callDuration callTableView close @@ -1431,6 +1554,7 @@ AAgACAAIAAEAAQABAAE five four hash + mergeCalls mute nine one @@ -1449,6 +1573,7 @@ AAgACAAIAAEAAQABAAE YES + UIButton UILabel UITableView UIButton @@ -1464,6 +1589,7 @@ AAgACAAIAAEAAQABAAE UIButton UIButton UIButton + UIButton UIView UIButton UILabel @@ -1482,6 +1608,7 @@ AAgACAAIAAEAAQABAAE YES YES + addCall callDuration callTableView close @@ -1494,6 +1621,7 @@ AAgACAAIAAEAAQABAAE five four hash + mergeCalls mute nine one @@ -1512,6 +1640,10 @@ AAgACAAIAAEAAQABAAE YES + + addCall + UIButton + callDuration UILabel @@ -1560,6 +1692,10 @@ AAgACAAIAAEAAQABAAE hash UIButton + + mergeCalls + UIButton + mute UIButton @@ -1711,6 +1847,7 @@ AAgACAAIAAEAAQABAAE mic_active.png mic_muted.png pausecall.png + startcall-green.png stopcall-red.png @@ -1721,6 +1858,7 @@ AAgACAAIAAEAAQABAAE {20, 20} {20, 20} {25, 23} + {60, 52} {62, 54} diff --git a/Classes/LinphoneUI/UICallButton.m b/Classes/LinphoneUI/UICallButton.m index 1a12e3e0e..a63167009 100644 --- a/Classes/LinphoneUI/UICallButton.m +++ b/Classes/LinphoneUI/UICallButton.m @@ -32,7 +32,7 @@ [error show]; return; } - if (!linphone_core_in_call([LinphoneManager getLc])) { + if (TRUE /*!linphone_core_in_call([LinphoneManager getLc])*/) { LinphoneProxyConfig* proxyCfg; //get default proxy linphone_core_get_default_proxy([LinphoneManager getLc],&proxyCfg); diff --git a/Classes/PhoneViewController.m b/Classes/PhoneViewController.m index f460f34db..4073cc1a1 100644 --- a/Classes/PhoneViewController.m +++ b/Classes/PhoneViewController.m @@ -200,7 +200,7 @@ -(void) displayCall:(LinphoneCall*) call InProgressFromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName { [self displayInCall: call ViewforUser:username withDisplayName:displayName]; - [__call setEnabled:false]; + //[__call setEnabled:false]; [callDuration setText:NSLocalizedString(@"Calling...",nil)]; if ([speaker isOn]) [speaker toggle] ; //preset to off }