mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Various improvements
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user