mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Various fixes
This commit is contained in:
@@ -391,33 +391,12 @@ public class AttachmentController: ViewController {
|
||||
|
||||
self.container.interactivelyDismissed = { [weak self] velocity in
|
||||
if let strongSelf = self, let layout = strongSelf.validLayout {
|
||||
if let controller = strongSelf.controller, controller.shouldMinimizeOnSwipe?(strongSelf.currentType) == true, let navigationController = controller.navigationController as? NavigationController {
|
||||
|
||||
if let controller = strongSelf.controller, controller.shouldMinimizeOnSwipe?(strongSelf.currentType) == true {
|
||||
let delta = layout.size.height - controller.minimizedTopEdgeOffset
|
||||
let damping: CGFloat = 180
|
||||
let damping: CGFloat = 180.0
|
||||
let initialVelocity: CGFloat = delta > 0.0 ? velocity / delta : 0.0
|
||||
|
||||
navigationController.minimizeViewController(controller, damping: damping, velocity: initialVelocity, setupContainer: { [weak self] current in
|
||||
let minimizedContainer: MinimizedContainerImpl?
|
||||
if let current = current as? MinimizedContainerImpl {
|
||||
minimizedContainer = current
|
||||
} else if let context = self?.controller?.context {
|
||||
minimizedContainer = MinimizedContainerImpl(sharedContext: context.sharedContext)
|
||||
} else {
|
||||
minimizedContainer = nil
|
||||
}
|
||||
return minimizedContainer
|
||||
}, animated: true)
|
||||
|
||||
strongSelf.dim.isHidden = true
|
||||
|
||||
strongSelf.isMinimizing = true
|
||||
strongSelf.container.update(isExpanded: true, force: true, transition: .immediate)
|
||||
strongSelf.isMinimizing = false
|
||||
|
||||
Queue.mainQueue().after(0.45, {
|
||||
strongSelf.dim.isHidden = false
|
||||
})
|
||||
strongSelf.minimize(damping: damping, initialVelocity: initialVelocity)
|
||||
|
||||
return false
|
||||
} else {
|
||||
@@ -588,6 +567,33 @@ public class AttachmentController: ViewController {
|
||||
}
|
||||
}
|
||||
|
||||
private func minimize(damping: CGFloat? = nil, initialVelocity: CGFloat? = nil) {
|
||||
guard let controller = self.controller, let navigationController = controller.navigationController as? NavigationController else {
|
||||
return
|
||||
}
|
||||
navigationController.minimizeViewController(controller, damping: damping, velocity: initialVelocity, setupContainer: { [weak self] current in
|
||||
let minimizedContainer: MinimizedContainerImpl?
|
||||
if let current = current as? MinimizedContainerImpl {
|
||||
minimizedContainer = current
|
||||
} else if let context = self?.controller?.context {
|
||||
minimizedContainer = MinimizedContainerImpl(sharedContext: context.sharedContext)
|
||||
} else {
|
||||
minimizedContainer = nil
|
||||
}
|
||||
return minimizedContainer
|
||||
}, animated: true)
|
||||
|
||||
self.dim.isHidden = true
|
||||
|
||||
self.isMinimizing = true
|
||||
self.container.update(isExpanded: true, force: true, transition: .immediate)
|
||||
self.isMinimizing = false
|
||||
|
||||
Queue.mainQueue().after(0.45, {
|
||||
self.dim.isHidden = false
|
||||
})
|
||||
}
|
||||
|
||||
fileprivate func updateSelectionCount(_ count: Int, animated: Bool = true) {
|
||||
self.selectionCount = count
|
||||
if let layout = self.validLayout {
|
||||
@@ -600,8 +606,12 @@ public class AttachmentController: ViewController {
|
||||
return
|
||||
}
|
||||
if case .ended = recognizer.state {
|
||||
if let controller = self.currentControllers.last {
|
||||
controller.requestDismiss(completion: { [weak self] in
|
||||
if let lastController = self.currentControllers.last {
|
||||
if let controller = self.controller, controller.shouldMinimizeOnSwipe?(self.currentType) == true {
|
||||
self.minimize()
|
||||
return
|
||||
}
|
||||
lastController.requestDismiss(completion: { [weak self] in
|
||||
self?.controller?.dismiss(animated: true)
|
||||
})
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user