From ca9deebb1842c552afd6d3de4941086d82861ad8 Mon Sep 17 00:00:00 2001 From: Francesco <100066266+cranci1@users.noreply.github.com> Date: Sun, 1 Jun 2025 22:30:17 +0200 Subject: [PATCH] test --- Sora/Views/MediaInfoView/MediaInfoView.swift | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/Sora/Views/MediaInfoView/MediaInfoView.swift b/Sora/Views/MediaInfoView/MediaInfoView.swift index 3baf392..ee05097 100644 --- a/Sora/Views/MediaInfoView/MediaInfoView.swift +++ b/Sora/Views/MediaInfoView/MediaInfoView.swift @@ -1299,11 +1299,10 @@ struct MediaInfoView: View { videoPlayerViewController.mediaTitle = title videoPlayerViewController.subtitles = subtitles ?? "" videoPlayerViewController.aniListID = itemID ?? 0 - videoPlayerViewController.modalPresentationStyle = .fullScreen + videoPlayerViewController.modalPresentationStyle = .overFullScreen - if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene, - let rootVC = windowScene.windows.first?.rootViewController { - findTopViewController.findViewController(rootVC).present(videoPlayerViewController, animated: true, completion: nil) + if let currentVC = UIApplication.shared.windows.first?.rootViewController?.presentedViewController ?? UIApplication.shared.windows.first?.rootViewController { + currentVC.present(videoPlayerViewController, animated: true, completion: nil) } return default: @@ -1339,15 +1338,11 @@ struct MediaInfoView: View { episodeImageUrl: selectedEpisodeImage, headers: headers ?? nil ) - customMediaPlayer.modalPresentationStyle = .fullScreen + customMediaPlayer.modalPresentationStyle = .overFullScreen Logger.shared.log("Opening custom media player with url: \(url)") - if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene, - let rootVC = windowScene.windows.first?.rootViewController { - findTopViewController.findViewController(rootVC).present(customMediaPlayer, animated: true, completion: nil) - } else { - Logger.shared.log("Failed to find root view controller", type: "Error") - DropManager.shared.showDrop(title: "Error", subtitle: "Failed to present player", duration: 2.0, icon: UIImage(systemName: "xmark.circle")) + if let currentVC = UIApplication.shared.windows.first?.rootViewController?.presentedViewController ?? UIApplication.shared.windows.first?.rootViewController { + currentVC.present(customMediaPlayer, animated: true) } } }