mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-11 15:53:30 +01:00
refactor: Reduce duplication code with UIApplication.keyWindow and .topController and improve alert function
This commit is contained in:
@@ -248,7 +248,6 @@ class SideloadingManager {
|
||||
}
|
||||
})
|
||||
|
||||
let rootViewController = UIApplication.shared.keyWindow?.rootViewController
|
||||
rootViewController?.present(alertController, animated: true, completion: nil)
|
||||
UIApplication.topController?.present(alertController, animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,8 +85,7 @@ struct AppPillButton: View {
|
||||
return
|
||||
}
|
||||
|
||||
let _ = AppManager.shared.install(storeApp, presentingViewController: UIApplication.shared.keyWindow?.rootViewController) { result in
|
||||
|
||||
let _ = AppManager.shared.install(storeApp, presentingViewController: UIApplication.topController) { result in
|
||||
switch result {
|
||||
case let .success(installedApp):
|
||||
print("Installed app: \(installedApp.bundleIdentifier)")
|
||||
|
||||
@@ -225,7 +225,6 @@ struct SettingsView: View {
|
||||
Text(L10n.SettingsView.debug)
|
||||
}
|
||||
|
||||
|
||||
Section {} footer: {
|
||||
Text("SideStore \(appVersion)")
|
||||
.multilineTextAlignment(.center)
|
||||
@@ -257,7 +256,7 @@ struct SettingsView: View {
|
||||
// }
|
||||
|
||||
func connectAppleID() {
|
||||
guard let rootViewController = UIApplication.shared.keyWindow?.rootViewController else {
|
||||
guard let rootViewController = UIApplication.topController else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user