mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Fix avatar gallery dismissal
This commit is contained in:
parent
83971542fa
commit
274f4416c3
@ -35,6 +35,8 @@ open class GalleryControllerNode: ASDisplayNode, UIScrollViewDelegate, UIGesture
|
||||
public var areControlsHidden = false
|
||||
public var controlsVisibilityChanged: ((Bool) -> Void)?
|
||||
|
||||
public var animateAlpha = true
|
||||
|
||||
public var updateOrientation: ((UIInterfaceOrientation) -> Void)?
|
||||
|
||||
public var isBackgroundExtendedOverNavigationBar = true {
|
||||
@ -397,7 +399,7 @@ open class GalleryControllerNode: ASDisplayNode, UIScrollViewDelegate, UIGesture
|
||||
contentAnimationCompleted = true
|
||||
intermediateCompletion()
|
||||
})
|
||||
} else {
|
||||
} else if self.animateAlpha {
|
||||
self.scrollView.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.25, removeOnCompletion: false, completion: { _ in
|
||||
contentAnimationCompleted = true
|
||||
intermediateCompletion()
|
||||
|
@ -332,7 +332,7 @@ public func fetchedAvatarGalleryEntries(engine: TelegramEngine, account: Account
|
||||
public class AvatarGalleryController: ViewController, StandalonePresentableController {
|
||||
public enum SourceCorners {
|
||||
case none
|
||||
case round(Bool)
|
||||
case round
|
||||
case roundRect(CGFloat)
|
||||
}
|
||||
|
||||
@ -382,7 +382,7 @@ public class AvatarGalleryController: ViewController, StandalonePresentableContr
|
||||
|
||||
private let editDisposable = MetaDisposable ()
|
||||
|
||||
public init(context: AccountContext, peer: Peer, sourceCorners: SourceCorners = .round(true), remoteEntries: Promise<[AvatarGalleryEntry]>? = nil, skipInitial: Bool = false, centralEntryIndex: Int? = nil, replaceRootController: @escaping (ViewController, Promise<Bool>?) -> Void, synchronousLoad: Bool = false) {
|
||||
public init(context: AccountContext, peer: Peer, sourceCorners: SourceCorners = .round, remoteEntries: Promise<[AvatarGalleryEntry]>? = nil, skipInitial: Bool = false, centralEntryIndex: Int? = nil, replaceRootController: @escaping (ViewController, Promise<Bool>?) -> Void, synchronousLoad: Bool = false) {
|
||||
self.context = context
|
||||
self.peer = peer
|
||||
self.sourceCorners = sourceCorners
|
||||
@ -579,6 +579,7 @@ public class AvatarGalleryController: ViewController, StandalonePresentableContr
|
||||
self.galleryNode.pager.updateOnReplacement = true
|
||||
self.galleryNode.statusBar = self.statusBar
|
||||
self.galleryNode.navigationBar = self.navigationBar
|
||||
self.galleryNode.animateAlpha = false
|
||||
|
||||
self.galleryNode.transitionDataForCentralItem = { [weak self] in
|
||||
if let strongSelf = self {
|
||||
|
@ -439,7 +439,7 @@ final class PeerAvatarImageGalleryItemNode: ZoomableContentGalleryItemNode {
|
||||
self.contentNode.layer.animate(from: NSValue(caTransform3D: transform), to: NSValue(caTransform3D: self.contentNode.layer.transform), keyPath: "transform", timingFunction: kCAMediaTimingFunctionSpring, duration: 0.25)
|
||||
|
||||
self.contentNode.clipsToBounds = true
|
||||
if case .round(true) = self.sourceCorners {
|
||||
if case .round = self.sourceCorners {
|
||||
self.contentNode.layer.animate(from: (self.contentNode.frame.width / 2.0) as NSNumber, to: 0.0 as NSNumber, keyPath: "cornerRadius", timingFunction: CAMediaTimingFunctionName.default.rawValue, duration: 0.18, removeOnCompletion: false, completion: { [weak self] value in
|
||||
if value {
|
||||
self?.contentNode.clipsToBounds = false
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2356,7 +2356,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
|
||||
}
|
||||
|
||||
let entriesPromise = Promise<[AvatarGalleryEntry]>(entries)
|
||||
let galleryController = AvatarGalleryController(context: strongSelf.context, peer: peer, sourceCorners: .round(!strongSelf.headerNode.isAvatarExpanded), remoteEntries: entriesPromise, skipInitial: true, centralEntryIndex: centralEntry.flatMap { entries.firstIndex(of: $0) }, replaceRootController: { controller, ready in
|
||||
let galleryController = AvatarGalleryController(context: strongSelf.context, peer: peer, sourceCorners: .round, remoteEntries: entriesPromise, skipInitial: true, centralEntryIndex: centralEntry.flatMap { entries.firstIndex(of: $0) }, replaceRootController: { controller, ready in
|
||||
})
|
||||
galleryController.openAvatarSetup = { [weak self] completion in
|
||||
self?.openAvatarForEditing(fromGallery: true, completion: completion)
|
||||
|
Loading…
x
Reference in New Issue
Block a user