diff --git a/submodules/LegacyComponents/Sources/TGMediaAssetsPickerController.m b/submodules/LegacyComponents/Sources/TGMediaAssetsPickerController.m index f885339c4e..28e2407007 100644 --- a/submodules/LegacyComponents/Sources/TGMediaAssetsPickerController.m +++ b/submodules/LegacyComponents/Sources/TGMediaAssetsPickerController.m @@ -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) { diff --git a/submodules/LegacyComponents/Sources/TGPhotoEditorTabController.m b/submodules/LegacyComponents/Sources/TGPhotoEditorTabController.m index 1f5a122725..842172cf41 100644 --- a/submodules/LegacyComponents/Sources/TGPhotoEditorTabController.m +++ b/submodules/LegacyComponents/Sources/TGPhotoEditorTabController.m @@ -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 diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoHeaderNode.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoHeaderNode.swift index 54a85b9f6a..a7cc1fabaa 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoHeaderNode.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoHeaderNode.swift @@ -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)