From e7ff6496c1d68eb5632cd44e6cbde3f2ec904dcc Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Tue, 14 Feb 2023 08:20:16 -0800 Subject: [PATCH] AuthenticationOperation: fix 2FA code not being displayed Bandaid fix, it would be better to have the alert in ConnectAppleIDView --- .../Operations/AuthenticationOperation.swift | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/AltStore/Operations/AuthenticationOperation.swift b/AltStore/Operations/AuthenticationOperation.swift index 1d5a348f..07f30955 100644 --- a/AltStore/Operations/AuthenticationOperation.swift +++ b/AltStore/Operations/AuthenticationOperation.swift @@ -417,14 +417,15 @@ private extension AuthenticationOperation completionHandler(nil) }) -// if self.navigationController.presentingViewController != nil -// { -// self.navigationController.present(alertController, animated: true, completion: nil) -// } -// else -// { -// presentingViewController.present(alertController, animated: true, completion: nil) -// } + let keyWindow = UIApplication.shared.windows.filter { $0.isKeyWindow }.first + + if var topController = keyWindow?.rootViewController { + while let presentedViewController = topController.presentedViewController { + topController = presentedViewController + } + + topController.present(alertController, animated: true, completion: nil) + } } } // }