Fix image preview presentation when order source sheet is open.

Present previews from the top of the presentation chain so tapping lead images inside the sheet no longer conflicts with the already-presented picker.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-07 11:14:57 +08:00
parent 77fec21563
commit 5a2b7b6097
4 changed files with 31 additions and 20 deletions

View File

@ -119,6 +119,30 @@ class BaseViewController: UIViewController {
navigationController?.popViewController(animated: true)
}
/// 沿 presentation Sheet present
func topMostPresentedViewController() -> UIViewController {
var top: UIViewController = self
while let presented = top.presentedViewController {
top = presented
}
return top
}
/// presentation
func presentOnTop(
_ viewController: UIViewController,
animated: Bool = true,
completion: (() -> Void)? = nil
) {
topMostPresentedViewController().present(viewController, animated: animated, completion: completion)
}
///
func presentImagePreview(imageURLs: [String], startIndex: Int) {
guard !imageURLs.isEmpty else { return }
presentOnTop(ImagePreviewViewController(imageURLs: imageURLs, startIndex: startIndex))
}
// MARK: - Notifications
private func registerBaseNotifications() {