mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-14 09:13:25 +01:00
[AltStore] Adds redesigned AppViewController to view/download AltStore apps
This commit is contained in:
@@ -36,6 +36,18 @@ class BrowseViewController: UICollectionViewController
|
||||
let collectionViewLayout = self.collectionViewLayout as! UICollectionViewFlowLayout
|
||||
collectionViewLayout.itemSize.width = self.view.bounds.width
|
||||
}
|
||||
|
||||
override func prepare(for segue: UIStoryboardSegue, sender: Any?)
|
||||
{
|
||||
guard segue.identifier == "showApp" else { return }
|
||||
|
||||
guard let cell = sender as? UICollectionViewCell, let indexPath = self.collectionView.indexPath(for: cell) else { return }
|
||||
|
||||
let app = self.dataSource.item(at: indexPath)
|
||||
|
||||
let appViewController = segue.destination as! AppViewController
|
||||
appViewController.app = app
|
||||
}
|
||||
}
|
||||
|
||||
private extension BrowseViewController
|
||||
|
||||
@@ -18,11 +18,25 @@ class ScreenshotCollectionViewCell: UICollectionViewCell
|
||||
required init?(coder aDecoder: NSCoder)
|
||||
{
|
||||
self.imageView = UIImageView(image: nil)
|
||||
self.imageView.layer.cornerRadius = 8
|
||||
self.imageView.layer.masksToBounds = true
|
||||
|
||||
super.init(coder: aDecoder)
|
||||
|
||||
self.addSubview(self.imageView, pinningEdgesWith: .zero)
|
||||
}
|
||||
|
||||
override func layoutSubviews()
|
||||
{
|
||||
super.layoutSubviews()
|
||||
|
||||
if let image = self.imageView.image, (image.size.height / image.size.width) > ((16.0 / 9.0) + 0.1)
|
||||
{
|
||||
// Image aspect ratio is taller than 16:9, so assume it's an X-style screenshot and set corner radius.
|
||||
self.imageView.layer.cornerRadius = max(self.imageView.bounds.width / 9.8, 8)
|
||||
}
|
||||
else
|
||||
{
|
||||
self.imageView.layer.cornerRadius = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user