Presents confirmation alert before refreshing AltStore

This commit is contained in:
Riley Testut
2019-06-25 14:35:00 -07:00
parent 84f564452b
commit 5d59407eeb

View File

@@ -129,6 +129,8 @@ private extension MyAppsViewController
} }
func refresh(_ installedApps: [InstalledApp], completionHandler: @escaping (Result<[String : Result<InstalledApp, Error>], Error>) -> Void) func refresh(_ installedApps: [InstalledApp], completionHandler: @escaping (Result<[String : Result<InstalledApp, Error>], Error>) -> Void)
{
func refresh()
{ {
if self.refreshGroup == nil if self.refreshGroup == nil
{ {
@@ -193,6 +195,21 @@ private extension MyAppsViewController
self.refreshGroup = group self.refreshGroup = group
} }
if installedApps.contains(where: { $0.app.identifier == App.altstoreAppID })
{
let alertController = UIAlertController(title: NSLocalizedString("Refresh AltStore?", comment: ""), message: NSLocalizedString("AltStore will quit when it is finished refreshing.", comment: ""), preferredStyle: .alert)
alertController.addAction(.cancel)
alertController.addAction(UIAlertAction(title: NSLocalizedString("Refresh", comment: ""), style: .default) { (action) in
refresh()
})
self.present(alertController, animated: true, completion: nil)
}
else
{
refresh()
}
}
} }
extension MyAppsViewController extension MyAppsViewController