mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-19 19:53:25 +01:00
Updates PillButton appearance
This commit is contained in:
@@ -347,12 +347,10 @@ private extension AppViewController
|
|||||||
if self.app.installedApp == nil
|
if self.app.installedApp == nil
|
||||||
{
|
{
|
||||||
button.setTitle(NSLocalizedString("FREE", comment: ""), for: .normal)
|
button.setTitle(NSLocalizedString("FREE", comment: ""), for: .normal)
|
||||||
button.isInverted = false
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
button.setTitle(NSLocalizedString("OPEN", comment: ""), for: .normal)
|
button.setTitle(NSLocalizedString("OPEN", comment: ""), for: .normal)
|
||||||
button.isInverted = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let progress = AppManager.shared.installationProgress(for: self.app)
|
let progress = AppManager.shared.installationProgress(for: self.app)
|
||||||
|
|||||||
@@ -100,7 +100,6 @@ private extension BrowseViewController
|
|||||||
|
|
||||||
let progress = AppManager.shared.installationProgress(for: app)
|
let progress = AppManager.shared.installationProgress(for: app)
|
||||||
cell.bannerView.button.progress = progress
|
cell.bannerView.button.progress = progress
|
||||||
cell.bannerView.button.isInverted = false
|
|
||||||
|
|
||||||
if Date() < app.versionDate
|
if Date() < app.versionDate
|
||||||
{
|
{
|
||||||
@@ -115,7 +114,6 @@ private extension BrowseViewController
|
|||||||
{
|
{
|
||||||
cell.bannerView.button.setTitle(NSLocalizedString("OPEN", comment: ""), for: .normal)
|
cell.bannerView.button.setTitle(NSLocalizedString("OPEN", comment: ""), for: .normal)
|
||||||
cell.bannerView.button.progress = nil
|
cell.bannerView.button.progress = nil
|
||||||
cell.bannerView.button.isInverted = true
|
|
||||||
cell.bannerView.button.countdownDate = nil
|
cell.bannerView.button.countdownDate = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,13 +11,15 @@ import UIKit
|
|||||||
class PillButton: UIButton
|
class PillButton: UIButton
|
||||||
{
|
{
|
||||||
var progress: Progress? {
|
var progress: Progress? {
|
||||||
didSet {
|
didSet {
|
||||||
self.progressView.progress = Float(self.progress?.fractionCompleted ?? 0)
|
self.progressView.progress = Float(self.progress?.fractionCompleted ?? 0)
|
||||||
self.progressView.observedProgress = self.progress
|
self.progressView.observedProgress = self.progress
|
||||||
|
|
||||||
let isUserInteractionEnabled = self.isUserInteractionEnabled
|
let isUserInteractionEnabled = self.isUserInteractionEnabled
|
||||||
self.isIndicatingActivity = (self.progress != nil)
|
self.isIndicatingActivity = (self.progress != nil)
|
||||||
self.isUserInteractionEnabled = isUserInteractionEnabled
|
self.isUserInteractionEnabled = isUserInteractionEnabled
|
||||||
|
|
||||||
|
self.update()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,12 +32,6 @@ class PillButton: UIButton
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var isInverted: Bool = false {
|
|
||||||
didSet {
|
|
||||||
self.update()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var countdownDate: Date? {
|
var countdownDate: Date? {
|
||||||
didSet {
|
didSet {
|
||||||
self.isEnabled = (self.countdownDate == nil)
|
self.isEnabled = (self.countdownDate == nil)
|
||||||
@@ -120,18 +116,18 @@ private extension PillButton
|
|||||||
{
|
{
|
||||||
func update()
|
func update()
|
||||||
{
|
{
|
||||||
if self.isInverted
|
if self.progress == nil
|
||||||
{
|
{
|
||||||
self.setTitleColor(.white, for: .normal)
|
self.setTitleColor(.white, for: .normal)
|
||||||
self.backgroundColor = self.tintColor
|
self.backgroundColor = self.tintColor
|
||||||
self.progressView.progressTintColor = self.tintColor.withAlphaComponent(0.15)
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
self.setTitleColor(self.tintColor, for: .normal)
|
self.setTitleColor(self.tintColor, for: .normal)
|
||||||
self.backgroundColor = self.tintColor.withAlphaComponent(0.15)
|
self.backgroundColor = self.tintColor.withAlphaComponent(0.15)
|
||||||
self.progressView.progressTintColor = self.tintColor
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.progressView.progressTintColor = self.tintColor
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func updateCountdown()
|
@objc func updateCountdown()
|
||||||
|
|||||||
@@ -268,7 +268,6 @@ private extension MyAppsViewController
|
|||||||
cell.bannerView.iconImageView.isIndicatingActivity = true
|
cell.bannerView.iconImageView.isIndicatingActivity = true
|
||||||
cell.bannerView.betaBadgeView.isHidden = !(installedApp.storeApp?.isBeta ?? false)
|
cell.bannerView.betaBadgeView.isHidden = !(installedApp.storeApp?.isBeta ?? false)
|
||||||
|
|
||||||
cell.bannerView.button.isInverted = true
|
|
||||||
cell.bannerView.button.isIndicatingActivity = false
|
cell.bannerView.button.isIndicatingActivity = false
|
||||||
cell.bannerView.button.addTarget(self, action: #selector(MyAppsViewController.refreshApp(_:)), for: .primaryActionTriggered)
|
cell.bannerView.button.addTarget(self, action: #selector(MyAppsViewController.refreshApp(_:)), for: .primaryActionTriggered)
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,6 @@ private extension UpdateCollectionViewCell
|
|||||||
self.versionDescriptionTitleLabel.textColor = self.tintColor
|
self.versionDescriptionTitleLabel.textColor = self.tintColor
|
||||||
self.blurView.backgroundColor = self.tintColor
|
self.blurView.backgroundColor = self.tintColor
|
||||||
|
|
||||||
self.bannerView.button.isInverted = true
|
|
||||||
self.bannerView.button.tintColor = self.tintColor
|
self.bannerView.button.tintColor = self.tintColor
|
||||||
self.bannerView.button.progressTintColor = self.tintColor
|
self.bannerView.button.progressTintColor = self.tintColor
|
||||||
|
|
||||||
|
|||||||
@@ -344,7 +344,6 @@ extension NewsViewController
|
|||||||
|
|
||||||
let progress = AppManager.shared.installationProgress(for: storeApp)
|
let progress = AppManager.shared.installationProgress(for: storeApp)
|
||||||
footerView.bannerView.button.progress = progress
|
footerView.bannerView.button.progress = progress
|
||||||
footerView.bannerView.button.isInverted = false
|
|
||||||
|
|
||||||
if Date() < storeApp.versionDate
|
if Date() < storeApp.versionDate
|
||||||
{
|
{
|
||||||
@@ -359,7 +358,6 @@ extension NewsViewController
|
|||||||
{
|
{
|
||||||
footerView.bannerView.button.setTitle(NSLocalizedString("OPEN", comment: ""), for: .normal)
|
footerView.bannerView.button.setTitle(NSLocalizedString("OPEN", comment: ""), for: .normal)
|
||||||
footerView.bannerView.button.progress = nil
|
footerView.bannerView.button.progress = nil
|
||||||
footerView.bannerView.button.isInverted = true
|
|
||||||
footerView.bannerView.button.countdownDate = nil
|
footerView.bannerView.button.countdownDate = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user