Files
SideStore/AltStore/My Apps/MyAppsComponents.swift

104 lines
3.7 KiB
Swift
Raw Normal View History

//
// MyAppsComponents.swift
// AltStore
//
// Created by Riley Testut on 7/17/19.
// Copyright © 2019 Riley Testut. All rights reserved.
//
import UIKit
import Roxas
final class InstalledAppCollectionViewCell: UICollectionViewCell
{
private(set) var deactivateBadge: UIView?
2019-10-23 13:32:17 -07:00
@IBOutlet var bannerView: AppBannerView!
override func awakeFromNib()
{
super.awakeFromNib()
self.contentView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
self.contentView.preservesSuperviewLayoutMargins = true
2023-03-02 16:53:36 -06:00
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),
2023-03-02 16:53:36 -06:00
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
2019-10-23 13:32:17 -07:00
}
}
final class InstalledAppsCollectionFooterView: UICollectionReusableView
2020-01-24 14:54:52 -08:00
{
@IBOutlet var textLabel: UILabel!
@IBOutlet var button: UIButton!
}
final class NoUpdatesCollectionViewCell: UICollectionViewCell
2019-10-23 13:32:17 -07:00
{
@IBOutlet var blurView: UIVisualEffectView!
@IBOutlet var textLabel: UILabel!
@IBOutlet var button: UIButton!
2019-10-23 13:32:17 -07:00
override func awakeFromNib()
{
super.awakeFromNib()
self.contentView.preservesSuperviewLayoutMargins = true
2023-03-02 16:53:36 -06:00
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)
2019-10-23 13:32:17 -07:00
}
}
final class UpdatesCollectionHeaderView: UICollectionReusableView
{
let button = PillButton(type: .system)
override init(frame: CGRect)
{
super.init(frame: frame)
self.button.translatesAutoresizingMaskIntoConstraints = false
self.button.setTitle(">", for: .normal)
self.addSubview(self.button)
NSLayoutConstraint.activate([self.button.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: -20),
self.button.topAnchor.constraint(equalTo: self.topAnchor),
self.button.widthAnchor.constraint(equalToConstant: 50),
self.button.heightAnchor.constraint(equalToConstant: 26)])
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}