Fixes tint colors not dimming when presenting alerts

This commit is contained in:
Riley Testut
2019-11-04 12:32:36 -08:00
parent 7485472095
commit 991846bd64
3 changed files with 36 additions and 9 deletions

View File

@@ -11,6 +11,8 @@ import Roxas
class LaunchViewController: RSTLaunchViewController
{
private var didFinishLaunching = false
override var launchConditions: [RSTLaunchCondition] {
let isDatabaseStarted = RSTLaunchCondition(condition: { DatabaseManager.shared.isStarted }) { (completionHandler) in
DatabaseManager.shared.start(completionHandler: completionHandler)
@@ -18,6 +20,14 @@ class LaunchViewController: RSTLaunchViewController
return [isDatabaseStarted]
}
override var childForStatusBarStyle: UIViewController? {
return self.children.first
}
override var childForStatusBarHidden: UIViewController? {
return self.children.first
}
}
extension LaunchViewController
@@ -44,9 +54,24 @@ extension LaunchViewController
{
super.finishLaunching()
guard !self.didFinishLaunching else { return }
AppManager.shared.update()
PatreonAPI.shared.refreshPatreonAccount()
self.performSegue(withIdentifier: "finishLaunching", sender: nil)
// Add view controller as child (rather than presenting modally)
// so tint adjustment + card presentations works correctly.
let viewController = self.storyboard!.instantiateViewController(withIdentifier: "tabBarController") as! TabBarController
viewController.view.frame = CGRect(x: 0, y: 0, width: self.view.bounds.width, height: self.view.bounds.height)
viewController.view.alpha = 0.0
self.addChild(viewController)
self.view.addSubview(viewController.view, pinningEdgesWith: .zero)
viewController.didMove(toParent: self)
UIView.animate(withDuration: 0.2) {
viewController.view.alpha = 1.0
}
self.didFinishLaunching = true
}
}