diff --git a/submodules/MediaPickerUI/Sources/MediaPickerScreen.swift b/submodules/MediaPickerUI/Sources/MediaPickerScreen.swift index aab42c5a27..8f4b11f282 100644 --- a/submodules/MediaPickerUI/Sources/MediaPickerScreen.swift +++ b/submodules/MediaPickerUI/Sources/MediaPickerScreen.swift @@ -1259,7 +1259,11 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable { if let undoOverlayController = strongSelf.undoOverlayController { undoOverlayController.content = .image(image: image ?? UIImage(), text: text) } else { - let undoOverlayController = UndoOverlayController(presentationData: presentationData, content: .image(image: image ?? UIImage(), text: text), elevatedLayout: false, action: { [weak self] action in + var elevatedLayout = true + if let layout = strongSelf.validLayout, case .regular = layout.metrics.widthClass { + elevatedLayout = false + } + let undoOverlayController = UndoOverlayController(presentationData: presentationData, content: .image(image: image ?? UIImage(), text: text), elevatedLayout: elevatedLayout, action: { [weak self] action in guard let strongSelf = self else { return true } @@ -1271,7 +1275,11 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable { } return true }) - strongSelf.present(undoOverlayController, in: .current) + if let layout = strongSelf.validLayout, case .regular = layout.metrics.widthClass { + strongSelf.present(undoOverlayController, in: .current) + } else { + strongSelf.present(undoOverlayController, in: .window(.root)) + } strongSelf.undoOverlayController = undoOverlayController } })