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

@@ -19,9 +19,6 @@
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<viewLayoutGuide key="safeArea" id="sZd-sc-Bvn"/>
</view>
<connections>
<segue destination="49e-Tb-3d3" kind="presentation" identifier="finishLaunching" modalTransitionStyle="crossDissolve" id="6Ov-Kc-Van"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="vOq-mm-rY5" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
@@ -30,7 +27,7 @@
<!--Tab Bar Controller-->
<scene sceneID="yl2-sM-qoP">
<objects>
<tabBarController modalPresentationStyle="fullScreen" id="49e-Tb-3d3" customClass="TabBarController" customModule="AltStore" customModuleProvider="target" sceneMemberID="viewController">
<tabBarController storyboardIdentifier="tabBarController" modalPresentationStyle="fullScreen" id="49e-Tb-3d3" customClass="TabBarController" customModule="AltStore" customModuleProvider="target" sceneMemberID="viewController">
<tabBar key="tabBar" contentMode="scaleToFill" id="W28-zg-YXA">
<rect key="frame" x="0.0" y="975" width="768" height="49"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>

View File

@@ -11,6 +11,8 @@ import Roxas
class AppBannerView: RSTNibView
{
private var originalTintColor: UIColor?
@IBOutlet var titleLabel: UILabel!
@IBOutlet var subtitleLabel: UILabel!
@IBOutlet var iconImageView: AppIconImageView!
@@ -25,6 +27,11 @@ class AppBannerView: RSTNibView
{
super.tintColorDidChange()
if self.tintAdjustmentMode != .dimmed
{
self.originalTintColor = self.tintColor
}
self.update()
}
}
@@ -36,9 +43,7 @@ private extension AppBannerView
self.clipsToBounds = true
self.layer.cornerRadius = 22
self.subtitleLabel.textColor = self.tintColor
self.button.tintColor = self.tintColor
self.backgroundEffectView.backgroundColor = self.tintColor
self.subtitleLabel.textColor = self.originalTintColor ?? self.tintColor
self.backgroundEffectView.backgroundColor = self.originalTintColor ?? self.tintColor
}
}

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
}
}