Files
SideStore/AltStore/LaunchViewController.swift

52 lines
1.5 KiB
Swift
Raw Normal View History

//
// LaunchViewController.swift
// AltStore
//
// Created by Riley Testut on 7/30/19.
// Copyright © 2019 Riley Testut. All rights reserved.
//
import UIKit
import Roxas
class LaunchViewController: RSTLaunchViewController
{
override var launchConditions: [RSTLaunchCondition] {
let isDatabaseStarted = RSTLaunchCondition(condition: { DatabaseManager.shared.isStarted }) { (completionHandler) in
DatabaseManager.shared.start(completionHandler: completionHandler)
}
return [isDatabaseStarted]
}
}
extension LaunchViewController
{
override func handleLaunchError(_ error: Error)
{
do
{
throw error
}
catch let error as NSError
{
let title = error.userInfo[NSLocalizedFailureErrorKey] as? String ?? NSLocalizedString("Unable to Launch AltStore", comment: "")
let alertController = UIAlertController(title: title, message: error.localizedDescription, preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: NSLocalizedString("Retry", comment: ""), style: .default, handler: { (action) in
self.handleLaunchConditions()
}))
self.present(alertController, animated: true, completion: nil)
}
}
override func finishLaunching()
{
super.finishLaunching()
AppManager.shared.update()
self.performSegue(withIdentifier: "finishLaunching", sender: nil)
}
}