mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 14:53:25 +01:00
Refactors SourcesViewController from Main.storyboard to new Sources.storyboard
Also refactors BannerCollectionViewCell to AppBannerCollectionViewCell to support initializing from code.
This commit is contained in:
@@ -70,6 +70,16 @@ final class SourcesViewController: UICollectionViewController
|
||||
{
|
||||
super.viewDidLoad()
|
||||
|
||||
self.view.tintColor = .altPrimary
|
||||
self.navigationController?.view.tintColor = .altPrimary
|
||||
|
||||
if let navigationBar = self.navigationController?.navigationBar as? NavigationBar
|
||||
{
|
||||
// Don't automatically adjust item positions when being presented non-full screen,
|
||||
// or else the navigation bar content won't be vertically centered.
|
||||
navigationBar.automaticallyAdjustsItemPositions = false
|
||||
}
|
||||
|
||||
self.collectionView.dataSource = self.dataSource
|
||||
|
||||
#if !BETA
|
||||
@@ -113,7 +123,7 @@ private extension SourcesViewController
|
||||
dataSource.cellConfigurationHandler = { (cell, source, indexPath) in
|
||||
let tintColor = UIColor.altPrimary
|
||||
|
||||
let cell = cell as! BannerCollectionViewCell
|
||||
let cell = cell as! AppBannerCollectionViewCell
|
||||
cell.layoutMargins.left = self.view.layoutMargins.left
|
||||
cell.layoutMargins.right = self.view.layoutMargins.right
|
||||
cell.tintColor = tintColor
|
||||
@@ -622,7 +632,7 @@ extension SourcesViewController
|
||||
}
|
||||
|
||||
case .trusted:
|
||||
if let cell = collectionView.cellForItem(at: indexPath) as? BannerCollectionViewCell, !cell.bannerView.button.isHidden
|
||||
if let cell = collectionView.cellForItem(at: indexPath) as? AppBannerCollectionViewCell, !cell.bannerView.button.isHidden
|
||||
{
|
||||
actions.append(addAction)
|
||||
}
|
||||
@@ -638,7 +648,7 @@ extension SourcesViewController
|
||||
override func collectionView(_ collectionView: UICollectionView, previewForHighlightingContextMenuWithConfiguration configuration: UIContextMenuConfiguration) -> UITargetedPreview?
|
||||
{
|
||||
guard let indexPath = configuration.identifier as? NSIndexPath else { return nil }
|
||||
guard let cell = collectionView.cellForItem(at: indexPath as IndexPath) as? BannerCollectionViewCell else { return nil }
|
||||
guard let cell = collectionView.cellForItem(at: indexPath as IndexPath) as? AppBannerCollectionViewCell else { return nil }
|
||||
|
||||
let parameters = UIPreviewParameters()
|
||||
parameters.backgroundColor = .clear
|
||||
|
||||
Reference in New Issue
Block a user