Video avatar fixes

This commit is contained in:
Ilya Laktyushin
2020-07-01 04:43:39 +03:00
parent a2b82285db
commit cccb11a5d6
40 changed files with 4022 additions and 3922 deletions

View File

@@ -147,7 +147,8 @@ const CGFloat TGPhotoEditorToolbarSize = 49.0f;
}
else
{
_transitionView = [referenceView snapshotViewAfterScreenUpdates:false];
if (![referenceView isKindOfClass:[TGPhotoEditorPreviewView class]])
_transitionView = [referenceView snapshotViewAfterScreenUpdates:false];
if (_transitionView == nil) {
_transitionView = referenceView;
}
@@ -168,27 +169,45 @@ const CGFloat TGPhotoEditorToolbarSize = 49.0f;
_transitionInProgress = true;
POPSpringAnimation *animation = [TGPhotoEditorAnimation prepareTransitionAnimationForPropertyNamed:kPOPViewFrame];
if (self.transitionSpeed > FLT_EPSILON)
animation.springSpeed = self.transitionSpeed;
animation.fromValue = [NSValue valueWithCGRect:_transitionView.frame];
animation.toValue = [NSValue valueWithCGRect:_transitionTargetFrame];
animation.completionBlock = ^(__unused POPAnimation *animation, __unused BOOL finished)
[UIView animateWithDuration:0.3f delay:0.0f options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionLayoutSubviews animations:^
{
_transitionView.frame = _transitionTargetFrame;
} completion:^(BOOL finished) {
_transitionInProgress = false;
UIView *transitionView = _transitionView;
_transitionView = nil;
if (self.finishedTransitionIn != nil)
{
self.finishedTransitionIn();
self.finishedTransitionIn = nil;
}
[self _finishedTransitionInWithView:transitionView];
};
[_transitionView pop_addAnimation:animation forKey:@"frame"];
UIView *transitionView = _transitionView;
_transitionView = nil;
if (self.finishedTransitionIn != nil)
{
self.finishedTransitionIn();
self.finishedTransitionIn = nil;
}
[self _finishedTransitionInWithView:transitionView];
}];
// POPSpringAnimation *animation = [TGPhotoEditorAnimation prepareTransitionAnimationForPropertyNamed:kPOPViewFrame];
// if (self.transitionSpeed > FLT_EPSILON)
// animation.springSpeed = self.transitionSpeed;
// animation.fromValue = [NSValue valueWithCGRect:_transitionView.frame];
// animation.toValue = [NSValue valueWithCGRect:_transitionTargetFrame];
// animation.completionBlock = ^(__unused POPAnimation *animation, __unused BOOL finished)
// {
// _transitionInProgress = false;
//
// UIView *transitionView = _transitionView;
// _transitionView = nil;
//
// if (self.finishedTransitionIn != nil)
// {
// self.finishedTransitionIn();
// self.finishedTransitionIn = nil;
// }
//
// [self _finishedTransitionInWithView:transitionView];
// };
// [_transitionView pop_addAnimation:animation forKey:@"frame"];
}
- (void)prepareForCustomTransitionOut