From cf6df3391957a5299511a497e5ab5a82d3dd4f45 Mon Sep 17 00:00:00 2001 From: Christophe Deschamps Date: Mon, 8 Jun 2015 23:45:35 +0200 Subject: [PATCH] outbound ring count --- Classes/LinphoneUI/Base.lproj/UICallCell.xib | 14 +++++++-- Classes/LinphoneUI/UICallCell.h | 3 ++ Classes/LinphoneUI/UICallCell.m | 33 ++++++++++++++++++++ 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/Classes/LinphoneUI/Base.lproj/UICallCell.xib b/Classes/LinphoneUI/Base.lproj/UICallCell.xib index a4b4f72ce..6b2160ff0 100644 --- a/Classes/LinphoneUI/Base.lproj/UICallCell.xib +++ b/Classes/LinphoneUI/Base.lproj/UICallCell.xib @@ -1,6 +1,7 @@ + @@ -22,6 +23,7 @@ + @@ -43,7 +45,7 @@ - + @@ -411,7 +413,7 @@ - + + @@ -437,6 +446,7 @@ + diff --git a/Classes/LinphoneUI/UICallCell.h b/Classes/LinphoneUI/UICallCell.h index 43f4f13dd..4770f1414 100644 --- a/Classes/LinphoneUI/UICallCell.h +++ b/Classes/LinphoneUI/UICallCell.h @@ -98,6 +98,9 @@ typedef enum _UICallCellOtherView { @property (assign) BOOL firstCell; @property (assign) BOOL conferenceCell; @property (nonatomic, assign) BOOL currentCall; +@property (strong, nonatomic) IBOutlet UILabel *outgoingRingCountLabel; +@property (strong) NSTimer *outgoingRingCountTimer; + - (void)update; diff --git a/Classes/LinphoneUI/UICallCell.m b/Classes/LinphoneUI/UICallCell.m index f24a229c8..46aa149d2 100644 --- a/Classes/LinphoneUI/UICallCell.m +++ b/Classes/LinphoneUI/UICallCell.m @@ -150,6 +150,9 @@ self->currentCall = FALSE; + _outgoingRingCountLabel.hidden = YES; + _outgoingRingCountLabel.text = @"0"; + self->detailsRightSwipeGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(doDetailsSwipe:)]; [detailsRightSwipeGestureRecognizer setDirection:UISwipeGestureRecognizerDirectionLeft]; @@ -311,6 +314,25 @@ [target setAlpha:0.0f]; } +- (void)displayIncrementedOutgoingRingCount { + _outgoingRingCountLabel.hidden = NO; + [UIView transitionWithView:_outgoingRingCountLabel + duration:0.5f + options:UIViewAnimationOptionTransitionCrossDissolve + animations:^{ + _outgoingRingCountLabel.text = [@(_outgoingRingCountLabel.text.intValue + 1) stringValue]; + } + completion:nil]; +} + +- (void)stopOutgoingRingCount { + if (_outgoingRingCountTimer != nil) + [_outgoingRingCountTimer invalidate]; + _outgoingRingCountLabel.hidden = YES; + _outgoingRingCountLabel.text = @"0"; + _outgoingRingCountTimer = nil; +} + #pragma mark - - (void)update { @@ -331,14 +353,25 @@ [stateImage setImage:[UIImage imageNamed:@"call_state_ringing_default.png"]]; [stateImage setHidden:false]; [pauseButton setHidden:true]; + if (_outgoingRingCountTimer == nil) { + _outgoingRingCountTimer = + [NSTimer scheduledTimerWithTimeInterval:2.0f + target:self + selector:@selector(displayIncrementedOutgoingRingCount) + userInfo:nil + repeats:YES]; + [_outgoingRingCountTimer fire]; + } } else if (state == LinphoneCallOutgoingInit || state == LinphoneCallOutgoingProgress) { [stateImage setImage:[UIImage imageNamed:@"call_state_outgoing_default.png"]]; [stateImage setHidden:false]; [pauseButton setHidden:true]; + [self stopOutgoingRingCount]; } else { [stateImage setHidden:true]; [pauseButton setHidden:false]; [pauseButton update]; + [self stopOutgoingRingCount]; } [removeButton setHidden:true]; if (firstCell) {