mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
[AltStore] Adds redesigned AppViewController to view/download AltStore apps
This commit is contained in:
@@ -30,10 +30,8 @@ extension UpdateCollectionViewCell
|
||||
@IBOutlet var dateLabel: UILabel!
|
||||
@IBOutlet var updateButton: PillButton!
|
||||
@IBOutlet var versionDescriptionTitleLabel: UILabel!
|
||||
@IBOutlet var versionDescriptionTextView: UITextView!
|
||||
|
||||
@IBOutlet var moreButton: UIButton!
|
||||
|
||||
@IBOutlet var versionDescriptionTextView: CollapsingTextView!
|
||||
|
||||
override func awakeFromNib()
|
||||
{
|
||||
super.awakeFromNib()
|
||||
@@ -41,11 +39,6 @@ extension UpdateCollectionViewCell
|
||||
self.contentView.layer.cornerRadius = 20
|
||||
self.contentView.layer.masksToBounds = true
|
||||
|
||||
self.versionDescriptionTextView.textContainerInset = .zero
|
||||
self.versionDescriptionTextView.textContainer.lineFragmentPadding = 0
|
||||
self.versionDescriptionTextView.textContainer.lineBreakMode = .byTruncatingTail
|
||||
self.versionDescriptionTextView.textContainer.heightTracksTextView = true
|
||||
|
||||
self.update()
|
||||
}
|
||||
|
||||
@@ -56,44 +49,6 @@ extension UpdateCollectionViewCell
|
||||
self.update()
|
||||
}
|
||||
|
||||
override func layoutSubviews()
|
||||
{
|
||||
super.layoutSubviews()
|
||||
|
||||
let textContainer = self.versionDescriptionTextView.textContainer
|
||||
|
||||
switch self.mode
|
||||
{
|
||||
case .collapsed:
|
||||
// Extra wide to make sure it wraps to next line.
|
||||
let frame = CGRect(x: textContainer.size.width - self.moreButton.bounds.width - 8,
|
||||
y: textContainer.size.height - 4,
|
||||
width: textContainer.size.width,
|
||||
height: textContainer.size.height)
|
||||
|
||||
textContainer.maximumNumberOfLines = 2
|
||||
textContainer.exclusionPaths = [UIBezierPath(rect: frame)]
|
||||
|
||||
if let font = self.versionDescriptionTextView.font, self.versionDescriptionTextView.bounds.height > font.lineHeight * 1.5
|
||||
{
|
||||
self.moreButton.isHidden = false
|
||||
}
|
||||
else
|
||||
{
|
||||
// One (or less) lines, so hide more button.
|
||||
self.moreButton.isHidden = true
|
||||
}
|
||||
|
||||
case .expanded:
|
||||
textContainer.maximumNumberOfLines = 10
|
||||
textContainer.exclusionPaths = []
|
||||
|
||||
self.moreButton.isHidden = true
|
||||
}
|
||||
|
||||
self.versionDescriptionTextView.invalidateIntrinsicContentSize()
|
||||
}
|
||||
|
||||
override func apply(_ layoutAttributes: UICollectionViewLayoutAttributes)
|
||||
{
|
||||
// Animates transition to new attributes.
|
||||
@@ -108,6 +63,12 @@ private extension UpdateCollectionViewCell
|
||||
{
|
||||
func update()
|
||||
{
|
||||
switch self.mode
|
||||
{
|
||||
case .collapsed: self.versionDescriptionTextView.isCollapsed = true
|
||||
case .expanded: self.versionDescriptionTextView.isCollapsed = false
|
||||
}
|
||||
|
||||
self.versionDescriptionTitleLabel.textColor = self.tintColor
|
||||
self.contentView.backgroundColor = self.tintColor.withAlphaComponent(0.1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user