mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-16 18:23:53 +01:00
refactor: Reduce duplication code with UIApplication.keyWindow and .topController and improve alert function
This commit is contained in:
@@ -187,11 +187,7 @@ final class InstallAppOperation: ResultOperation<InstalledApp>
|
||||
}))
|
||||
|
||||
DispatchQueue.main.async {
|
||||
let keyWindow = UIApplication.shared.windows.filter { $0.isKeyWindow }.first
|
||||
if var topController = keyWindow?.rootViewController {
|
||||
while let presentedViewController = topController.presentedViewController {
|
||||
topController = presentedViewController
|
||||
}
|
||||
if var topController = UIApplication.topController {
|
||||
topController.present(alert, animated: true)
|
||||
} else {
|
||||
print("No key window? Let's just open Safari")
|
||||
|
||||
Reference in New Issue
Block a user