mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-17 02:33:27 +01:00
Removes unnecessary #available checks
This commit is contained in:
@@ -22,36 +22,33 @@ class InstalledAppCollectionViewCell: UICollectionViewCell
|
||||
self.contentView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
||||
self.contentView.preservesSuperviewLayoutMargins = true
|
||||
|
||||
if #available(iOS 13.0, *)
|
||||
{
|
||||
let deactivateBadge = UIView()
|
||||
deactivateBadge.translatesAutoresizingMaskIntoConstraints = false
|
||||
deactivateBadge.isHidden = true
|
||||
self.addSubview(deactivateBadge)
|
||||
let deactivateBadge = UIView()
|
||||
deactivateBadge.translatesAutoresizingMaskIntoConstraints = false
|
||||
deactivateBadge.isHidden = true
|
||||
self.addSubview(deactivateBadge)
|
||||
|
||||
// Solid background to make the X opaque white.
|
||||
let backgroundView = UIView()
|
||||
backgroundView.translatesAutoresizingMaskIntoConstraints = false
|
||||
backgroundView.backgroundColor = .white
|
||||
deactivateBadge.addSubview(backgroundView)
|
||||
|
||||
let badgeView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
||||
badgeView.preferredSymbolConfiguration = UIImage.SymbolConfiguration(scale: .large)
|
||||
badgeView.tintColor = .systemRed
|
||||
deactivateBadge.addSubview(badgeView, pinningEdgesWith: .zero)
|
||||
|
||||
NSLayoutConstraint.activate([
|
||||
deactivateBadge.centerXAnchor.constraint(equalTo: self.bannerView.iconImageView.trailingAnchor),
|
||||
deactivateBadge.centerYAnchor.constraint(equalTo: self.bannerView.iconImageView.topAnchor),
|
||||
|
||||
// Solid background to make the X opaque white.
|
||||
let backgroundView = UIView()
|
||||
backgroundView.translatesAutoresizingMaskIntoConstraints = false
|
||||
backgroundView.backgroundColor = .white
|
||||
deactivateBadge.addSubview(backgroundView)
|
||||
|
||||
let badgeView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
||||
badgeView.preferredSymbolConfiguration = UIImage.SymbolConfiguration(scale: .large)
|
||||
badgeView.tintColor = .systemRed
|
||||
deactivateBadge.addSubview(badgeView, pinningEdgesWith: .zero)
|
||||
|
||||
NSLayoutConstraint.activate([
|
||||
deactivateBadge.centerXAnchor.constraint(equalTo: self.bannerView.iconImageView.trailingAnchor),
|
||||
deactivateBadge.centerYAnchor.constraint(equalTo: self.bannerView.iconImageView.topAnchor),
|
||||
|
||||
backgroundView.centerXAnchor.constraint(equalTo: badgeView.centerXAnchor),
|
||||
backgroundView.centerYAnchor.constraint(equalTo: badgeView.centerYAnchor),
|
||||
backgroundView.widthAnchor.constraint(equalTo: badgeView.widthAnchor, multiplier: 0.5),
|
||||
backgroundView.heightAnchor.constraint(equalTo: badgeView.heightAnchor, multiplier: 0.5)
|
||||
])
|
||||
|
||||
self.deactivateBadge = deactivateBadge
|
||||
}
|
||||
backgroundView.centerXAnchor.constraint(equalTo: badgeView.centerXAnchor),
|
||||
backgroundView.centerYAnchor.constraint(equalTo: badgeView.centerYAnchor),
|
||||
backgroundView.widthAnchor.constraint(equalTo: badgeView.widthAnchor, multiplier: 0.5),
|
||||
backgroundView.heightAnchor.constraint(equalTo: badgeView.heightAnchor, multiplier: 0.5)
|
||||
])
|
||||
|
||||
self.deactivateBadge = deactivateBadge
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,18 +70,9 @@ class NoUpdatesCollectionViewCell: UICollectionViewCell
|
||||
|
||||
self.contentView.preservesSuperviewLayoutMargins = true
|
||||
|
||||
let image: UIImage?
|
||||
if #available(iOS 13, *)
|
||||
{
|
||||
let font = self.textLabel.font ?? UIFont.systemFont(ofSize: 17)
|
||||
let configuration = UIImage.SymbolConfiguration(font: font)
|
||||
|
||||
image = UIImage(systemName: "ellipsis.circle", withConfiguration: configuration)
|
||||
}
|
||||
else
|
||||
{
|
||||
image = UIImage(named: "ellipsis.circle")
|
||||
}
|
||||
let font = self.textLabel.font ?? UIFont.systemFont(ofSize: 17)
|
||||
let configuration = UIImage.SymbolConfiguration(font: font)
|
||||
let image = UIImage(systemName: "ellipsis.circle", withConfiguration: configuration)
|
||||
|
||||
self.button.setTitle("", for: .normal)
|
||||
self.button.setImage(image, for: .normal)
|
||||
|
||||
@@ -704,13 +704,10 @@ private extension MyAppsViewController
|
||||
}
|
||||
}
|
||||
|
||||
if #available(iOS 14, *)
|
||||
{
|
||||
let interaction = INInteraction.refreshAllApps()
|
||||
interaction.donate { (error) in
|
||||
guard let error = error else { return }
|
||||
print("Failed to donate intent \(interaction.intent).", error)
|
||||
}
|
||||
let interaction = INInteraction.refreshAllApps()
|
||||
interaction.donate { (error) in
|
||||
guard let error = error else { return }
|
||||
print("Failed to donate intent \(interaction.intent).", error)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1166,10 +1163,8 @@ private extension MyAppsViewController
|
||||
}
|
||||
}
|
||||
|
||||
if UserDefaults.standard.activeAppsLimit != nil, #available(iOS 13, *)
|
||||
if UserDefaults.standard.activeAppsLimit != nil
|
||||
{
|
||||
// UserDefaults.standard.activeAppsLimit is only non-nil on iOS 13.3.1 or later, so the #available check is just so we can use Combine.
|
||||
|
||||
guard let app = ALTApplication(fileURL: installedApp.fileURL) else { return finish(.failure(OperationError.invalidApp)) }
|
||||
|
||||
var cancellable: AnyCancellable?
|
||||
@@ -1609,12 +1604,7 @@ extension MyAppsViewController
|
||||
|
||||
headerView.textLabel.text = NSLocalizedString("Inactive", comment: "")
|
||||
headerView.button.setTitle(nil, for: .normal)
|
||||
|
||||
if #available(iOS 13.0, *)
|
||||
{
|
||||
headerView.button.setImage(UIImage(systemName: "questionmark.circle"), for: .normal)
|
||||
}
|
||||
|
||||
headerView.button.setImage(UIImage(systemName: "questionmark.circle"), for: .normal)
|
||||
headerView.button.addTarget(self, action: #selector(MyAppsViewController.presentInactiveAppsAlert), for: .primaryActionTriggered)
|
||||
}
|
||||
|
||||
@@ -1695,7 +1685,6 @@ extension MyAppsViewController
|
||||
}
|
||||
|
||||
let jitAction = UIAction(title: NSLocalizedString("Enable JIT", comment: ""), image: UIImage(systemName: "bolt")) { (action) in
|
||||
guard #available(iOS 14, *) else { return }
|
||||
self.enableJIT(for: installedApp)
|
||||
}
|
||||
|
||||
@@ -1745,7 +1734,7 @@ extension MyAppsViewController
|
||||
actions.append(activateAction)
|
||||
}
|
||||
|
||||
if installedApp.isActive, #available(iOS 14, *)
|
||||
if installedApp.isActive
|
||||
{
|
||||
actions.append(jitAction)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user