Video avatar fixes

This commit is contained in:
Ilya Laktyushin 2020-07-16 19:19:07 +03:00
parent 4ac6678182
commit 262cddc4d9
3 changed files with 21 additions and 22 deletions

View File

@ -406,6 +406,7 @@
}
TGPhotoEditorController *controller = [[TGPhotoEditorController alloc] initWithContext:_context item:editableItem intent:intent adjustments:nil caption:nil screenImage:thumbnailImage availableTabs:[TGPhotoEditorController defaultTabsForAvatarIntent] selectedTab:TGPhotoEditorCropTab];
controller.stickersContext = self.stickersContext;
controller.editingContext = self.editingContext;
controller.didFinishRenderingFullSizeImage = ^(UIImage *resultImage)
{

View File

@ -186,28 +186,6 @@ const CGFloat TGPhotoEditorToolbarSize = 49.0f;
[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

View File

@ -916,9 +916,13 @@ final class PeerInfoAvatarListContainerNode: ASDisplayNode {
guard case let .image(image) = item else {
return false
}
var items: [PeerInfoAvatarListItem] = []
var entries: [AvatarGalleryEntry] = []
let previousIndex = self.currentIndex
var index = 0
var deletedIndex: Int?
for entry in self.galleryEntries {
switch entry {
case let .topImage(representations, videoRepresentations, _, _, immediateThumbnailData, _):
@ -928,9 +932,25 @@ final class PeerInfoAvatarListContainerNode: ASDisplayNode {
if image.0 != reference {
entries.append(entry)
items.append(.image(reference, representations, videoRepresentations, immediateThumbnailData))
} else {
deletedIndex = index
}
}
index += 1
}
if let peer = self.peer, peer is TelegramGroup || peer is TelegramChannel, deletedIndex == 0 {
self.galleryEntries = []
self.items = []
self.itemsUpdated?([])
self.currentIndex = 0
if let size = self.validLayout {
self.updateItems(size: size, update: true, transition: .immediate, stripTransition: .immediate, synchronous: true)
}
return true
}
self.galleryEntries = normalizeEntries(entries)
self.items = items
self.itemsUpdated?(items)