diff --git a/AltStore/App Detail/AppViewController.swift b/AltStore/App Detail/AppViewController.swift index 4593b84a..89ac59c4 100644 --- a/AltStore/App Detail/AppViewController.swift +++ b/AltStore/App Detail/AppViewController.swift @@ -347,12 +347,10 @@ private extension AppViewController if self.app.installedApp == nil { button.setTitle(NSLocalizedString("FREE", comment: ""), for: .normal) - button.isInverted = false } else { button.setTitle(NSLocalizedString("OPEN", comment: ""), for: .normal) - button.isInverted = true } let progress = AppManager.shared.installationProgress(for: self.app) diff --git a/AltStore/Browse/BrowseViewController.swift b/AltStore/Browse/BrowseViewController.swift index 571e52af..775dd2d2 100644 --- a/AltStore/Browse/BrowseViewController.swift +++ b/AltStore/Browse/BrowseViewController.swift @@ -100,7 +100,6 @@ private extension BrowseViewController let progress = AppManager.shared.installationProgress(for: app) cell.bannerView.button.progress = progress - cell.bannerView.button.isInverted = false if Date() < app.versionDate { @@ -115,7 +114,6 @@ private extension BrowseViewController { cell.bannerView.button.setTitle(NSLocalizedString("OPEN", comment: ""), for: .normal) cell.bannerView.button.progress = nil - cell.bannerView.button.isInverted = true cell.bannerView.button.countdownDate = nil } } diff --git a/AltStore/Components/PillButton.swift b/AltStore/Components/PillButton.swift index e6f464ca..c9483ee8 100644 --- a/AltStore/Components/PillButton.swift +++ b/AltStore/Components/PillButton.swift @@ -11,13 +11,15 @@ import UIKit class PillButton: UIButton { var progress: Progress? { - didSet { + didSet { self.progressView.progress = Float(self.progress?.fractionCompleted ?? 0) self.progressView.observedProgress = self.progress let isUserInteractionEnabled = self.isUserInteractionEnabled self.isIndicatingActivity = (self.progress != nil) self.isUserInteractionEnabled = isUserInteractionEnabled + + self.update() } } @@ -30,12 +32,6 @@ class PillButton: UIButton } } - var isInverted: Bool = false { - didSet { - self.update() - } - } - var countdownDate: Date? { didSet { self.isEnabled = (self.countdownDate == nil) @@ -120,18 +116,18 @@ private extension PillButton { func update() { - if self.isInverted + if self.progress == nil { self.setTitleColor(.white, for: .normal) self.backgroundColor = self.tintColor - self.progressView.progressTintColor = self.tintColor.withAlphaComponent(0.15) } else { self.setTitleColor(self.tintColor, for: .normal) self.backgroundColor = self.tintColor.withAlphaComponent(0.15) - self.progressView.progressTintColor = self.tintColor } + + self.progressView.progressTintColor = self.tintColor } @objc func updateCountdown() diff --git a/AltStore/My Apps/MyAppsViewController.swift b/AltStore/My Apps/MyAppsViewController.swift index b2bc0616..88a92e0c 100644 --- a/AltStore/My Apps/MyAppsViewController.swift +++ b/AltStore/My Apps/MyAppsViewController.swift @@ -268,7 +268,6 @@ private extension MyAppsViewController cell.bannerView.iconImageView.isIndicatingActivity = true cell.bannerView.betaBadgeView.isHidden = !(installedApp.storeApp?.isBeta ?? false) - cell.bannerView.button.isInverted = true cell.bannerView.button.isIndicatingActivity = false cell.bannerView.button.addTarget(self, action: #selector(MyAppsViewController.refreshApp(_:)), for: .primaryActionTriggered) diff --git a/AltStore/My Apps/UpdateCollectionViewCell.swift b/AltStore/My Apps/UpdateCollectionViewCell.swift index 5dbe41c1..d5a7974e 100644 --- a/AltStore/My Apps/UpdateCollectionViewCell.swift +++ b/AltStore/My Apps/UpdateCollectionViewCell.swift @@ -94,7 +94,6 @@ private extension UpdateCollectionViewCell self.versionDescriptionTitleLabel.textColor = self.tintColor self.blurView.backgroundColor = self.tintColor - self.bannerView.button.isInverted = true self.bannerView.button.tintColor = self.tintColor self.bannerView.button.progressTintColor = self.tintColor diff --git a/AltStore/News/NewsViewController.swift b/AltStore/News/NewsViewController.swift index a0712bca..dfa73fcc 100644 --- a/AltStore/News/NewsViewController.swift +++ b/AltStore/News/NewsViewController.swift @@ -344,7 +344,6 @@ extension NewsViewController let progress = AppManager.shared.installationProgress(for: storeApp) footerView.bannerView.button.progress = progress - footerView.bannerView.button.isInverted = false if Date() < storeApp.versionDate { @@ -359,7 +358,6 @@ extension NewsViewController { footerView.bannerView.button.setTitle(NSLocalizedString("OPEN", comment: ""), for: .normal) footerView.bannerView.button.progress = nil - footerView.bannerView.button.isInverted = true footerView.bannerView.button.countdownDate = nil }