diff --git a/iTorrent/Core/SceneDelegate/SceneDelegate+AVPlayer.swift b/iTorrent/Core/SceneDelegate/SceneDelegate+AVPlayer.swift index c819b39c..1dbcf9a6 100644 --- a/iTorrent/Core/SceneDelegate/SceneDelegate+AVPlayer.swift +++ b/iTorrent/Core/SceneDelegate/SceneDelegate+AVPlayer.swift @@ -21,31 +21,19 @@ extension SceneDelegate { extension SceneDelegate { class AVPlayerDelegates: DelegateObject, AVPlayerViewControllerDelegate { func playerViewControllerRestoreUserInterfaceForFullScreenExit(_ playerViewController: AVPlayerViewController) async -> Bool { - await withCheckedContinuation { continuation in - Task { @MainActor in - guard let vc = parent.window?.rootViewController?.topPresented else { - return continuation.resume(returning: false) - } + guard let vc = await parent.window?.rootViewController?.topPresented + else { return false } - vc.present(playerViewController, animated: true) { - continuation.resume(returning: true) - } - } - } + await vc.present(playerViewController, animated: true) + return true } func playerViewControllerRestoreUserInterfaceForPictureInPictureStop(_ playerViewController: AVPlayerViewController) async -> Bool { - await withCheckedContinuation { continuation in - Task { @MainActor in - guard let vc = parent.window?.rootViewController?.topPresented else { - return continuation.resume(returning: false) - } + guard let vc = await parent.window?.rootViewController?.topPresented + else { return false } - vc.present(playerViewController, animated: true) { - continuation.resume(returning: true) - } - } - } + await vc.present(playerViewController, animated: true) + return true } }