This commit is contained in:
Ali
2023-07-25 01:45:44 +04:00
parent a196a1684b
commit 1fa20fa4a4
28 changed files with 635 additions and 181 deletions

View File

@@ -781,9 +781,19 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
}
private weak var currentGalleryController: TGModernGalleryController?
private weak var currentGalleryParentController: ViewController?
fileprivate var currentAssetDownloadDisposable = MetaDisposable()
fileprivate func closeGalleryController() {
if let _ = self.currentGalleryController, let currentGalleryParentController = self.currentGalleryParentController {
self.currentGalleryController = nil
self.currentGalleryParentController = nil
currentGalleryParentController.dismiss(completion: nil)
}
}
fileprivate func cancelAssetDownloads() {
guard let downloadManager = self.controller?.downloadManager else {
return
@@ -868,6 +878,7 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
strongSelf.controller?.interaction?.sendSelected(result, silently, scheduleTime, false, completion)
}
}, presentSchedulePicker: controller.presentSchedulePicker, presentTimerPicker: controller.presentTimerPicker, getCaptionPanelView: controller.getCaptionPanelView, present: { [weak self] c, a in
self?.currentGalleryParentController = c
self?.controller?.present(c, in: .window(.root), with: a)
}, finishedTransitionIn: { [weak self] in
self?.openingMedia = false
@@ -906,6 +917,7 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
strongSelf.controller?.interaction?.sendSelected(result, silently, scheduleTime, false, completion)
}
}, presentSchedulePicker: controller.presentSchedulePicker, presentTimerPicker: controller.presentTimerPicker, getCaptionPanelView: controller.getCaptionPanelView, present: { [weak self] c, a in
self?.currentGalleryParentController = c
self?.controller?.present(c, in: .window(.root), with: a, blockInteraction: true)
}, finishedTransitionIn: { [weak self] in
self?.openingMedia = false
@@ -1686,6 +1698,10 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
super.displayNodeDidLoad()
}
public func closeGalleryController() {
self.controllerNode.closeGalleryController()
}
private weak var undoOverlayController: UndoOverlayController?
private func showSelectionUndo(item: TGMediaSelectableItem) {
let scale = min(2.0, UIScreenScale)