Various improvements

This commit is contained in:
Ilya Laktyushin
2022-07-09 19:11:24 +02:00
parent dd1d340fdd
commit e27ec389b1
12 changed files with 100 additions and 16 deletions

View File

@@ -83,6 +83,7 @@ public protocol AttachmentContainable: ViewController {
func prepareForReuse()
func requestDismiss(completion: @escaping () -> Void)
func shouldDismissImmediately() -> Bool
}
public extension AttachmentContainable {
@@ -101,6 +102,10 @@ public extension AttachmentContainable {
func requestDismiss(completion: @escaping () -> Void) {
completion()
}
func shouldDismissImmediately() -> Bool {
return true
}
}
public enum AttachmentMediaPickerSendMode {
@@ -312,6 +317,23 @@ public class AttachmentController: ViewController {
}
}
self.container.shouldCancelPanGesture = { [weak self] in
if let strongSelf = self, let currentController = strongSelf.currentControllers.last {
if !currentController.shouldDismissImmediately() {
currentController.requestDismiss { [weak self] in
if let strongSelf = self {
strongSelf.controller?.dismiss(animated: true)
}
}
return true
} else {
return false
}
} else {
return false
}
}
self.panel.selectionChanged = { [weak self] type in
if let strongSelf = self {
return strongSelf.switchToController(type)