Skip to content
Snippets Groups Projects
Commit 22d615bd authored by Alexandre Lision's avatar Alexandre Lision Committed by Edric Milaret
Browse files

call: fix progress animation

El Capitan handles animations differently and optimizes out
animations on off screen views. Progress animation was started when
Ring was launched, and the CurrentCall view is hidden at first,
therefore progress animation was never started.

This patch also simplifies layer handling.

Change-Id: I33f1b42ca3e813d780868a81f4e391138e4751a2
Tuleap: #269
parent e7a604c1
Branches
Tags
No related merge requests found
...@@ -89,9 +89,7 @@ ...@@ -89,9 +89,7 @@
// Video // Video
@property (unsafe_unretained) IBOutlet CallView *videoView; @property (unsafe_unretained) IBOutlet CallView *videoView;
@property CALayer* videoLayer;
@property (unsafe_unretained) IBOutlet NSView *previewView; @property (unsafe_unretained) IBOutlet NSView *previewView;
@property CALayer* previewLayer;
@property RendererConnectionsHolder* previewHolder; @property RendererConnectionsHolder* previewHolder;
@property RendererConnectionsHolder* videoHolder; @property RendererConnectionsHolder* videoHolder;
...@@ -106,7 +104,7 @@ ...@@ -106,7 +104,7 @@
@synthesize personLabel, actionHash, stateLabel, holdOnOffButton, hangUpButton, @synthesize personLabel, actionHash, stateLabel, holdOnOffButton, hangUpButton,
recordOnOffButton, pickUpButton, chatButton, transferButton, addParticipantButton, timeSpentLabel, recordOnOffButton, pickUpButton, chatButton, transferButton, addParticipantButton, timeSpentLabel,
muteVideoButton, muteAudioButton, controlsPanel, headerContainer, videoView, muteVideoButton, muteAudioButton, controlsPanel, headerContainer, videoView,
videoLayer, previewLayer, previewView, splitView, loadingIndicator; previewView, splitView, loadingIndicator;
@synthesize previewHolder; @synthesize previewHolder;
@synthesize videoHolder; @synthesize videoHolder;
...@@ -149,20 +147,17 @@ ...@@ -149,20 +147,17 @@
// Default values for this views // Default values for this views
[loadingIndicator setHidden:YES]; [loadingIndicator setHidden:YES];
[videoView setShouldAcceptInteractions:NO]; [videoView setShouldAcceptInteractions:NO];
[self.controlsPanel setHidden:current->hasParentCall()]; [self.controlsPanel setHidden:current->hasParentCall()];
[self.joinPanel setHidden:!current->hasParentCall()]; [self.joinPanel setHidden:!current->hasParentCall()];
switch (state) { switch (state) {
case Call::State::DIALING:
[loadingIndicator setHidden:NO];
break;
case Call::State::NEW: case Call::State::NEW:
break; break;
case Call::State::DIALING:
case Call::State::INITIALIZATION: case Call::State::INITIALIZATION:
[loadingIndicator setHidden:NO];
break;
case Call::State::CONNECTED: case Call::State::CONNECTED:
[loadingIndicator setHidden:NO]; [loadingIndicator setHidden:NO];
break; break;
...@@ -197,7 +192,6 @@ ...@@ -197,7 +192,6 @@
{ {
NSLog(@"INIT CurrentCall VC"); NSLog(@"INIT CurrentCall VC");
[self.view setWantsLayer:YES]; [self.view setWantsLayer:YES];
[self.view setLayer:[CALayer layer]];
actionHash[ (int)UserActionModel::Action::ACCEPT] = pickUpButton; actionHash[ (int)UserActionModel::Action::ACCEPT] = pickUpButton;
actionHash[ (int)UserActionModel::Action::HOLD ] = holdOnOffButton; actionHash[ (int)UserActionModel::Action::HOLD ] = holdOnOffButton;
...@@ -206,22 +200,17 @@ ...@@ -206,22 +200,17 @@
actionHash[ (int)UserActionModel::Action::MUTE_AUDIO] = muteAudioButton; actionHash[ (int)UserActionModel::Action::MUTE_AUDIO] = muteAudioButton;
actionHash[ (int)UserActionModel::Action::MUTE_VIDEO] = muteVideoButton; actionHash[ (int)UserActionModel::Action::MUTE_VIDEO] = muteVideoButton;
videoLayer = [CALayer layer];
[videoView setWantsLayer:YES]; [videoView setWantsLayer:YES];
[videoView setLayer:videoLayer];
[videoView.layer setBackgroundColor:[NSColor blackColor].CGColor]; [videoView.layer setBackgroundColor:[NSColor blackColor].CGColor];
[videoView.layer setFrame:videoView.frame]; [videoView.layer setFrame:videoView.frame];
[videoView.layer setContentsGravity:kCAGravityResizeAspect]; [videoView.layer setContentsGravity:kCAGravityResizeAspect];
previewLayer = [CALayer layer];
[previewView setWantsLayer:YES]; [previewView setWantsLayer:YES];
[previewView setLayer:previewLayer]; [previewView.layer setBackgroundColor:[NSColor blackColor].CGColor];
[previewLayer setBackgroundColor:[NSColor blackColor].CGColor]; [previewView.layer setContentsGravity:kCAGravityResizeAspectFill];
[previewLayer setContentsGravity:kCAGravityResizeAspectFill]; [previewView.layer setFrame:previewView.frame];
[previewLayer setFrame:previewView.frame];
[controlsPanel setWantsLayer:YES]; [controlsPanel setWantsLayer:YES];
[controlsPanel setLayer:[CALayer layer]];
[controlsPanel.layer setBackgroundColor:[NSColor clearColor].CGColor]; [controlsPanel.layer setBackgroundColor:[NSColor clearColor].CGColor];
[controlsPanel.layer setFrame:controlsPanel.frame]; [controlsPanel.layer setFrame:controlsPanel.frame];
...@@ -451,7 +440,7 @@ ...@@ -451,7 +440,7 @@
[animation setFromValue:[NSValue valueWithPoint:frame.origin]]; [animation setFromValue:[NSValue valueWithPoint:frame.origin]];
[animation setToValue:[NSValue valueWithPoint:self.view.superview.bounds.origin]]; [animation setToValue:[NSValue valueWithPoint:self.view.superview.bounds.origin]];
[animation setDuration:0.2f]; [animation setDuration:0.2f];
[animation setTimingFunction:[CAMediaTimingFunction functionWithControlPoints:.7 :0.9 :1 :1]]; [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]];
[CATransaction setCompletionBlock:^{ [CATransaction setCompletionBlock:^{
// when call comes in we want to show the controls/header // when call comes in we want to show the controls/header
...@@ -462,6 +451,7 @@ ...@@ -462,6 +451,7 @@
if(!CallModel::instance().selectedCall()) if(!CallModel::instance().selectedCall())
return; return;
[loadingIndicator setAnimates:YES];
[self updateCall]; [self updateCall];
if (CallModel::instance().selectedCall()->hasMedia(Media::Media::Type::TEXT, Media::Media::Direction::IN)) { if (CallModel::instance().selectedCall()->hasMedia(Media::Media::Type::TEXT, Media::Media::Direction::IN)) {
...@@ -516,9 +506,7 @@ ...@@ -516,9 +506,7 @@
-(void) animateOut -(void) animateOut
{ {
NSLog(@"animateOut");
if(self.view.frame.origin.x < 0) { if(self.view.frame.origin.x < 0) {
NSLog(@"Already hidden");
return; return;
} }
...@@ -528,7 +516,7 @@ ...@@ -528,7 +516,7 @@
[animation setFromValue:[NSValue valueWithPoint:self.view.frame.origin]]; [animation setFromValue:[NSValue valueWithPoint:self.view.frame.origin]];
[animation setToValue:[NSValue valueWithPoint:frame.origin]]; [animation setToValue:[NSValue valueWithPoint:frame.origin]];
[animation setDuration:0.2f]; [animation setDuration:0.2f];
[animation setTimingFunction:[CAMediaTimingFunction functionWithControlPoints:.7 :0.9 :1 :1]]; [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]];
[CATransaction setCompletionBlock:^{ [CATransaction setCompletionBlock:^{
[self.view setHidden:YES]; [self.view setHidden:YES];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment