Various fixes

This commit is contained in:
Ilya Laktyushin
2022-07-10 20:35:05 +02:00
parent fc609c6c70
commit aa46e81a49
5 changed files with 140 additions and 138 deletions

View File

@@ -38,6 +38,7 @@ final class AttachmentContainer: ASDisplayNode, UIGestureRecognizerDelegate {
var controllerRemoved: ((ViewController) -> Void)?
var shouldCancelPanGesture: (() -> Bool)?
var requestDismiss: (() -> Void)?
var updateModalProgress: ((CGFloat, ContainedViewLayoutTransition) -> Void)?
@@ -236,6 +237,7 @@ final class AttachmentContainer: ASDisplayNode, UIGestureRecognizerDelegate {
if !self.isExpanded, translation > 40.0, let shouldCancelPanGesture = self.shouldCancelPanGesture, shouldCancelPanGesture() {
self.cancelPanGesture()
self.requestDismiss?()
return
}
@@ -284,8 +286,13 @@ final class AttachmentContainer: ASDisplayNode, UIGestureRecognizerDelegate {
let offset = currentTopInset + panOffset
let topInset: CGFloat = edgeTopInset
var ignoreDismiss = false
if let shouldCancelPanGesture = self.shouldCancelPanGesture, shouldCancelPanGesture() {
ignoreDismiss = true
}
var dismissing = false
if bounds.minY < -60 || (bounds.minY < 0.0 && velocity.y > 300.0) || (self.isExpanded && bounds.minY.isZero && velocity.y > 1800.0) {
if (bounds.minY < -60 || (bounds.minY < 0.0 && velocity.y > 300.0) || (self.isExpanded && bounds.minY.isZero && velocity.y > 1800.0)) && !ignoreDismiss {
self.interactivelyDismissed?()
dismissing = true
} else if self.isExpanded {