From c49b357868d1379cbbdfb55e09bd8b38a8411aa0 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Mon, 13 Jan 2020 13:53:04 -0800 Subject: [PATCH] Fixes Patreon deep link not working on app launch --- AltStore/LaunchViewController.swift | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/AltStore/LaunchViewController.swift b/AltStore/LaunchViewController.swift index 97554963..53d4e7a9 100644 --- a/AltStore/LaunchViewController.swift +++ b/AltStore/LaunchViewController.swift @@ -13,6 +13,8 @@ class LaunchViewController: RSTLaunchViewController { private var didFinishLaunching = false + private var destinationViewController: UIViewController! + override var launchConditions: [RSTLaunchCondition] { let isDatabaseStarted = RSTLaunchCondition(condition: { DatabaseManager.shared.isStarted }) { (completionHandler) in DatabaseManager.shared.start(completionHandler: completionHandler) @@ -28,6 +30,14 @@ class LaunchViewController: RSTLaunchViewController override var childForStatusBarHidden: UIViewController? { return self.children.first } + + override func viewDidLoad() + { + super.viewDidLoad() + + // Create destinationViewController now so view controllers can register for receiving Notifications. + self.destinationViewController = self.storyboard!.instantiateViewController(withIdentifier: "tabBarController") as! TabBarController + } } extension LaunchViewController @@ -61,15 +71,14 @@ extension LaunchViewController // 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) + self.destinationViewController.view.frame = CGRect(x: 0, y: 0, width: self.view.bounds.width, height: self.view.bounds.height) + self.destinationViewController.view.alpha = 0.0 + self.addChild(self.destinationViewController) + self.view.addSubview(self.destinationViewController.view, pinningEdgesWith: .zero) + self.destinationViewController.didMove(toParent: self) UIView.animate(withDuration: 0.2) { - viewController.view.alpha = 1.0 + self.destinationViewController.view.alpha = 1.0 } self.didFinishLaunching = true