mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-20 20:23:25 +01:00
Supports viewing all NewsItems and StoreApps for a source
This commit is contained in:
@@ -371,6 +371,7 @@
|
|||||||
D58D5F2E26DFE68E00E55E38 /* LaunchAtLogin in Frameworks */ = {isa = PBXBuildFile; productRef = D58D5F2D26DFE68E00E55E38 /* LaunchAtLogin */; };
|
D58D5F2E26DFE68E00E55E38 /* LaunchAtLogin in Frameworks */ = {isa = PBXBuildFile; productRef = D58D5F2D26DFE68E00E55E38 /* LaunchAtLogin */; };
|
||||||
D59162AB29BA60A9005CBF47 /* SourceHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D59162AA29BA60A9005CBF47 /* SourceHeaderView.swift */; };
|
D59162AB29BA60A9005CBF47 /* SourceHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D59162AA29BA60A9005CBF47 /* SourceHeaderView.swift */; };
|
||||||
D59162AD29BA616A005CBF47 /* SourceHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D59162AC29BA616A005CBF47 /* SourceHeaderView.xib */; };
|
D59162AD29BA616A005CBF47 /* SourceHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D59162AC29BA616A005CBF47 /* SourceHeaderView.xib */; };
|
||||||
|
D5927D6629DCC89000D6898E /* UINavigationBarAppearance+TintColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5927D6529DCC89000D6898E /* UINavigationBarAppearance+TintColor.swift */; };
|
||||||
D5935AED29C39DE300C157EF /* SourceDetailsComponents.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5935AEC29C39DE300C157EF /* SourceDetailsComponents.swift */; };
|
D5935AED29C39DE300C157EF /* SourceDetailsComponents.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5935AEC29C39DE300C157EF /* SourceDetailsComponents.swift */; };
|
||||||
D5935AEF29C3B23600C157EF /* Sources.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D5935AEE29C3B23600C157EF /* Sources.storyboard */; };
|
D5935AEF29C3B23600C157EF /* Sources.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D5935AEE29C3B23600C157EF /* Sources.storyboard */; };
|
||||||
D593F1942717749A006E82DE /* PatchAppOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D593F1932717749A006E82DE /* PatchAppOperation.swift */; };
|
D593F1942717749A006E82DE /* PatchAppOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D593F1932717749A006E82DE /* PatchAppOperation.swift */; };
|
||||||
@@ -884,6 +885,7 @@
|
|||||||
D58916FD28C7C55C00E39C8B /* LoggedError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoggedError.swift; sourceTree = "<group>"; };
|
D58916FD28C7C55C00E39C8B /* LoggedError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoggedError.swift; sourceTree = "<group>"; };
|
||||||
D59162AA29BA60A9005CBF47 /* SourceHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SourceHeaderView.swift; sourceTree = "<group>"; };
|
D59162AA29BA60A9005CBF47 /* SourceHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SourceHeaderView.swift; sourceTree = "<group>"; };
|
||||||
D59162AC29BA616A005CBF47 /* SourceHeaderView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SourceHeaderView.xib; sourceTree = "<group>"; };
|
D59162AC29BA616A005CBF47 /* SourceHeaderView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SourceHeaderView.xib; sourceTree = "<group>"; };
|
||||||
|
D5927D6529DCC89000D6898E /* UINavigationBarAppearance+TintColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UINavigationBarAppearance+TintColor.swift"; sourceTree = "<group>"; };
|
||||||
D5935AEC29C39DE300C157EF /* SourceDetailsComponents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SourceDetailsComponents.swift; sourceTree = "<group>"; };
|
D5935AEC29C39DE300C157EF /* SourceDetailsComponents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SourceDetailsComponents.swift; sourceTree = "<group>"; };
|
||||||
D5935AEE29C3B23600C157EF /* Sources.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Sources.storyboard; sourceTree = "<group>"; };
|
D5935AEE29C3B23600C157EF /* Sources.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Sources.storyboard; sourceTree = "<group>"; };
|
||||||
D593F1932717749A006E82DE /* PatchAppOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PatchAppOperation.swift; sourceTree = "<group>"; };
|
D593F1932717749A006E82DE /* PatchAppOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PatchAppOperation.swift; sourceTree = "<group>"; };
|
||||||
@@ -1727,6 +1729,7 @@
|
|||||||
BF8CAE4D248AEABA004D6CCE /* UIDevice+Jailbreak.swift */,
|
BF8CAE4D248AEABA004D6CCE /* UIDevice+Jailbreak.swift */,
|
||||||
BFE00A1F2503097F00EB4D0C /* INInteraction+AltStore.swift */,
|
BFE00A1F2503097F00EB4D0C /* INInteraction+AltStore.swift */,
|
||||||
D57F2C9326E01BC700B9FA39 /* UIDevice+Vibration.swift */,
|
D57F2C9326E01BC700B9FA39 /* UIDevice+Vibration.swift */,
|
||||||
|
D5927D6529DCC89000D6898E /* UINavigationBarAppearance+TintColor.swift */,
|
||||||
);
|
);
|
||||||
path = Extensions;
|
path = Extensions;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -2764,6 +2767,7 @@
|
|||||||
BF44EEFC246B4550002A52F2 /* RemoveAppOperation.swift in Sources */,
|
BF44EEFC246B4550002A52F2 /* RemoveAppOperation.swift in Sources */,
|
||||||
BF3D64B022E8D4B800E9056B /* AppContentViewControllerCells.swift in Sources */,
|
BF3D64B022E8D4B800E9056B /* AppContentViewControllerCells.swift in Sources */,
|
||||||
BFC57A6E2416FC5D00EB891E /* InstalledAppsCollectionHeaderView.swift in Sources */,
|
BFC57A6E2416FC5D00EB891E /* InstalledAppsCollectionHeaderView.swift in Sources */,
|
||||||
|
D5927D6629DCC89000D6898E /* UINavigationBarAppearance+TintColor.swift in Sources */,
|
||||||
BF88F97224F8727D00BB75DF /* AppManagerErrors.swift in Sources */,
|
BF88F97224F8727D00BB75DF /* AppManagerErrors.swift in Sources */,
|
||||||
BF6C8FAE2429597900125131 /* AppBannerCollectionViewCell.swift in Sources */,
|
BF6C8FAE2429597900125131 /* AppBannerCollectionViewCell.swift in Sources */,
|
||||||
BF6F439223644C6E00A0B879 /* RefreshAltStoreViewController.swift in Sources */,
|
BF6F439223644C6E00A0B879 /* RefreshAltStoreViewController.swift in Sources */,
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ import Nuke
|
|||||||
|
|
||||||
class BrowseViewController: UICollectionViewController, PeekPopPreviewing
|
class BrowseViewController: UICollectionViewController, PeekPopPreviewing
|
||||||
{
|
{
|
||||||
|
// Nil == Show apps from all sources.
|
||||||
|
var source: Source?
|
||||||
|
|
||||||
private lazy var dataSource = self.makeDataSource()
|
private lazy var dataSource = self.makeDataSource()
|
||||||
private lazy var placeholderView = RSTPlaceholderView(frame: .zero)
|
private lazy var placeholderView = RSTPlaceholderView(frame: .zero)
|
||||||
|
|
||||||
@@ -26,6 +29,18 @@ class BrowseViewController: UICollectionViewController, PeekPopPreviewing
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
init?(source: Source?, coder: NSCoder)
|
||||||
|
{
|
||||||
|
self.source = source
|
||||||
|
|
||||||
|
super.init(coder: coder)
|
||||||
|
}
|
||||||
|
|
||||||
|
required init?(coder: NSCoder)
|
||||||
|
{
|
||||||
|
super.init(coder: coder)
|
||||||
|
}
|
||||||
|
|
||||||
private var cachedItemSizes = [String: CGSize]()
|
private var cachedItemSizes = [String: CGSize]()
|
||||||
|
|
||||||
@IBOutlet private var sourcesBarButtonItem: UIBarButtonItem!
|
@IBOutlet private var sourcesBarButtonItem: UIBarButtonItem!
|
||||||
@@ -48,6 +63,22 @@ class BrowseViewController: UICollectionViewController, PeekPopPreviewing
|
|||||||
|
|
||||||
(self as PeekPopPreviewing).registerForPreviewing(with: self, sourceView: self.collectionView)
|
(self as PeekPopPreviewing).registerForPreviewing(with: self, sourceView: self.collectionView)
|
||||||
|
|
||||||
|
if let source = self.source
|
||||||
|
{
|
||||||
|
let tintColor = source.effectiveTintColor ?? .altPrimary
|
||||||
|
self.view.tintColor = tintColor
|
||||||
|
|
||||||
|
let appearance = NavigationBarAppearance()
|
||||||
|
appearance.configureWithTintColor(tintColor)
|
||||||
|
appearance.configureWithDefaultBackground()
|
||||||
|
|
||||||
|
let edgeAppearance = appearance.copy()
|
||||||
|
edgeAppearance.configureWithTransparentBackground()
|
||||||
|
|
||||||
|
self.navigationItem.standardAppearance = appearance
|
||||||
|
self.navigationItem.scrollEdgeAppearance = edgeAppearance
|
||||||
|
}
|
||||||
|
|
||||||
self.update()
|
self.update()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,9 +108,20 @@ private extension BrowseViewController
|
|||||||
NSSortDescriptor(keyPath: \StoreApp.name, ascending: true),
|
NSSortDescriptor(keyPath: \StoreApp.name, ascending: true),
|
||||||
NSSortDescriptor(keyPath: \StoreApp.bundleIdentifier, ascending: true)]
|
NSSortDescriptor(keyPath: \StoreApp.bundleIdentifier, ascending: true)]
|
||||||
fetchRequest.returnsObjectsAsFaults = false
|
fetchRequest.returnsObjectsAsFaults = false
|
||||||
fetchRequest.predicate = NSPredicate(format: "%K != %@", #keyPath(StoreApp.bundleIdentifier), StoreApp.altstoreAppID)
|
|
||||||
|
|
||||||
let dataSource = RSTFetchedResultsCollectionViewPrefetchingDataSource<StoreApp, UIImage>(fetchRequest: fetchRequest, managedObjectContext: DatabaseManager.shared.viewContext)
|
let predicate = NSPredicate(format: "%K != %@", #keyPath(StoreApp.bundleIdentifier), StoreApp.altstoreAppID)
|
||||||
|
if let source = self.source
|
||||||
|
{
|
||||||
|
let filterPredicate = NSPredicate(format: "%K == %@", #keyPath(StoreApp._source), source)
|
||||||
|
fetchRequest.predicate = NSCompoundPredicate(andPredicateWithSubpredicates: [filterPredicate, predicate])
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fetchRequest.predicate = predicate
|
||||||
|
}
|
||||||
|
|
||||||
|
let context = self.source?.managedObjectContext ?? DatabaseManager.shared.viewContext
|
||||||
|
let dataSource = RSTFetchedResultsCollectionViewPrefetchingDataSource<StoreApp, UIImage>(fetchRequest: fetchRequest, managedObjectContext: context)
|
||||||
dataSource.cellConfigurationHandler = { (cell, app, indexPath) in
|
dataSource.cellConfigurationHandler = { (cell, app, indexPath) in
|
||||||
let cell = cell as! BrowseCollectionViewCell
|
let cell = cell as! BrowseCollectionViewCell
|
||||||
cell.layoutMargins.left = self.view.layoutMargins.left
|
cell.layoutMargins.left = self.view.layoutMargins.left
|
||||||
|
|||||||
@@ -473,13 +473,7 @@ private extension HeaderContentViewController
|
|||||||
barAppearance.titleTextAttributes = [.foregroundColor: UIColor.clear]
|
barAppearance.titleTextAttributes = [.foregroundColor: UIColor.clear]
|
||||||
|
|
||||||
let tintColor = isHidden ? UIColor.clear : self.tintColor ?? .altPrimary
|
let tintColor = isHidden ? UIColor.clear : self.tintColor ?? .altPrimary
|
||||||
|
barAppearance.configureWithTintColor(tintColor)
|
||||||
let buttonAppearance = UIBarButtonItemAppearance(style: .plain)
|
|
||||||
buttonAppearance.normal.titleTextAttributes = [.foregroundColor: tintColor]
|
|
||||||
barAppearance.buttonAppearance = buttonAppearance
|
|
||||||
|
|
||||||
let backButtonImage = UIImage(systemName: "chevron.backward")?.withTintColor(tintColor, renderingMode: .alwaysOriginal)
|
|
||||||
barAppearance.setBackIndicatorImage(backButtonImage, transitionMaskImage: backButtonImage)
|
|
||||||
|
|
||||||
self.navigationItem.standardAppearance = barAppearance
|
self.navigationItem.standardAppearance = barAppearance
|
||||||
self.navigationItem.scrollEdgeAppearance = barAppearance
|
self.navigationItem.scrollEdgeAppearance = barAppearance
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
//
|
||||||
|
// UINavigationBarAppearance+TintColor.swift
|
||||||
|
// AltStore
|
||||||
|
//
|
||||||
|
// Created by Riley Testut on 4/4/23.
|
||||||
|
// Copyright © 2023 Riley Testut. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
extension UINavigationBarAppearance
|
||||||
|
{
|
||||||
|
func configureWithTintColor(_ tintColor: UIColor)
|
||||||
|
{
|
||||||
|
let buttonAppearance = UIBarButtonItemAppearance(style: .plain)
|
||||||
|
buttonAppearance.normal.titleTextAttributes = [.foregroundColor: tintColor]
|
||||||
|
self.buttonAppearance = buttonAppearance
|
||||||
|
|
||||||
|
let backButtonImage = UIImage(systemName: "chevron.backward")?.withTintColor(tintColor, renderingMode: .alwaysOriginal)
|
||||||
|
self.setBackIndicatorImage(backButtonImage, transitionMaskImage: backButtonImage)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -43,6 +43,9 @@ private class AppBannerFooterView: UICollectionReusableView
|
|||||||
|
|
||||||
class NewsViewController: UICollectionViewController, PeekPopPreviewing
|
class NewsViewController: UICollectionViewController, PeekPopPreviewing
|
||||||
{
|
{
|
||||||
|
// Nil == Show news from all sources.
|
||||||
|
var source: Source?
|
||||||
|
|
||||||
private lazy var dataSource = self.makeDataSource()
|
private lazy var dataSource = self.makeDataSource()
|
||||||
private lazy var placeholderView = RSTPlaceholderView(frame: .zero)
|
private lazy var placeholderView = RSTPlaceholderView(frame: .zero)
|
||||||
|
|
||||||
@@ -57,10 +60,24 @@ class NewsViewController: UICollectionViewController, PeekPopPreviewing
|
|||||||
// Cache
|
// Cache
|
||||||
private var cachedCellSizes = [String: CGSize]()
|
private var cachedCellSizes = [String: CGSize]()
|
||||||
|
|
||||||
|
init?(source: Source?, coder: NSCoder)
|
||||||
|
{
|
||||||
|
self.source = source
|
||||||
|
|
||||||
|
super.init(coder: coder)
|
||||||
|
|
||||||
|
self.initialize()
|
||||||
|
}
|
||||||
|
|
||||||
required init?(coder: NSCoder)
|
required init?(coder: NSCoder)
|
||||||
{
|
{
|
||||||
super.init(coder: coder)
|
super.init(coder: coder)
|
||||||
|
|
||||||
|
self.initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
private func initialize()
|
||||||
|
{
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(NewsViewController.importApp(_:)), name: AppDelegate.importAppDeepLinkNotification, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(NewsViewController.importApp(_:)), name: AppDelegate.importAppDeepLinkNotification, object: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,6 +96,22 @@ class NewsViewController: UICollectionViewController, PeekPopPreviewing
|
|||||||
|
|
||||||
(self as PeekPopPreviewing).registerForPreviewing(with: self, sourceView: self.collectionView)
|
(self as PeekPopPreviewing).registerForPreviewing(with: self, sourceView: self.collectionView)
|
||||||
|
|
||||||
|
if let source = self.source
|
||||||
|
{
|
||||||
|
let tintColor = source.effectiveTintColor ?? .altPrimary
|
||||||
|
self.view.tintColor = tintColor
|
||||||
|
|
||||||
|
let appearance = NavigationBarAppearance()
|
||||||
|
appearance.configureWithTintColor(tintColor)
|
||||||
|
appearance.configureWithDefaultBackground()
|
||||||
|
|
||||||
|
let edgeAppearance = appearance.copy()
|
||||||
|
edgeAppearance.configureWithTransparentBackground()
|
||||||
|
|
||||||
|
self.navigationItem.standardAppearance = appearance
|
||||||
|
self.navigationItem.scrollEdgeAppearance = edgeAppearance
|
||||||
|
}
|
||||||
|
|
||||||
self.update()
|
self.update()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,12 +144,11 @@ private extension NewsViewController
|
|||||||
{
|
{
|
||||||
func makeDataSource() -> RSTFetchedResultsCollectionViewPrefetchingDataSource<NewsItem, UIImage>
|
func makeDataSource() -> RSTFetchedResultsCollectionViewPrefetchingDataSource<NewsItem, UIImage>
|
||||||
{
|
{
|
||||||
let fetchRequest = NewsItem.fetchRequest() as NSFetchRequest<NewsItem>
|
let fetchRequest = NewsItem.sortedFetchRequest(for: self.source)
|
||||||
fetchRequest.sortDescriptors = [NSSortDescriptor(keyPath: \NewsItem.date, ascending: false),
|
let context = self.source?.managedObjectContext ?? DatabaseManager.shared.viewContext
|
||||||
NSSortDescriptor(keyPath: \NewsItem.sortIndex, ascending: true),
|
|
||||||
NSSortDescriptor(keyPath: \NewsItem.sourceIdentifier, ascending: true)]
|
|
||||||
|
|
||||||
let fetchedResultsController = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: DatabaseManager.shared.viewContext, sectionNameKeyPath: #keyPath(NewsItem.objectID), cacheName: nil)
|
// Use fetchedResultsController to split NewsItems up into sections.
|
||||||
|
let fetchedResultsController = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: context, sectionNameKeyPath: #keyPath(NewsItem.objectID), cacheName: nil)
|
||||||
|
|
||||||
let dataSource = RSTFetchedResultsCollectionViewPrefetchingDataSource<NewsItem, UIImage>(fetchedResultsController: fetchedResultsController)
|
let dataSource = RSTFetchedResultsCollectionViewPrefetchingDataSource<NewsItem, UIImage>(fetchedResultsController: fetchedResultsController)
|
||||||
dataSource.proxy = self
|
dataSource.proxy = self
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
import SafariServices
|
||||||
|
|
||||||
import AltStoreCore
|
import AltStoreCore
|
||||||
import Roxas
|
import Roxas
|
||||||
@@ -304,6 +305,33 @@ private extension SourceDetailContentViewController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private extension SourceDetailContentViewController
|
||||||
|
{
|
||||||
|
@objc func viewAllNews()
|
||||||
|
{
|
||||||
|
self.performSegue(withIdentifier: "showAllNews", sender: nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc func viewAllApps()
|
||||||
|
{
|
||||||
|
self.performSegue(withIdentifier: "showAllApps", sender: nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
@IBSegueAction
|
||||||
|
func makeNewsViewController(_ coder: NSCoder) -> UIViewController?
|
||||||
|
{
|
||||||
|
let newsViewController = NewsViewController(source: self.source, coder: coder)
|
||||||
|
return newsViewController
|
||||||
|
}
|
||||||
|
|
||||||
|
@IBSegueAction
|
||||||
|
func makeBrowseViewController(_ coder: NSCoder) -> UIViewController?
|
||||||
|
{
|
||||||
|
let browseViewController = BrowseViewController(source: self.source, coder: coder)
|
||||||
|
return browseViewController
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extension SourceDetailContentViewController
|
extension SourceDetailContentViewController
|
||||||
{
|
{
|
||||||
override func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView
|
override func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView
|
||||||
@@ -318,6 +346,9 @@ extension SourceDetailContentViewController
|
|||||||
let buttonView = supplementaryView as! ButtonCollectionReusableView
|
let buttonView = supplementaryView as! ButtonCollectionReusableView
|
||||||
buttonView.button.setTitle(NSLocalizedString("View All", comment: ""), for: .normal)
|
buttonView.button.setTitle(NSLocalizedString("View All", comment: ""), for: .normal)
|
||||||
|
|
||||||
|
buttonView.button.removeTarget(self, action: nil, for: .primaryActionTriggered)
|
||||||
|
buttonView.button.addTarget(self, action: #selector(SourceDetailContentViewController.viewAllNews), for: .primaryActionTriggered)
|
||||||
|
|
||||||
case (.featuredApps, .title):
|
case (.featuredApps, .title):
|
||||||
let titleView = supplementaryView as! TitleCollectionReusableView
|
let titleView = supplementaryView as! TitleCollectionReusableView
|
||||||
titleView.label.text = NSLocalizedString("Featured Apps", comment: "")
|
titleView.label.text = NSLocalizedString("Featured Apps", comment: "")
|
||||||
@@ -326,6 +357,9 @@ extension SourceDetailContentViewController
|
|||||||
let buttonView = supplementaryView as! ButtonCollectionReusableView
|
let buttonView = supplementaryView as! ButtonCollectionReusableView
|
||||||
buttonView.button.setTitle(NSLocalizedString("View All Apps", comment: ""), for: .normal)
|
buttonView.button.setTitle(NSLocalizedString("View All Apps", comment: ""), for: .normal)
|
||||||
|
|
||||||
|
buttonView.button.removeTarget(self, action: nil, for: .primaryActionTriggered)
|
||||||
|
buttonView.button.addTarget(self, action: #selector(SourceDetailContentViewController.viewAllApps), for: .primaryActionTriggered)
|
||||||
|
|
||||||
case (.about, _):
|
case (.about, _):
|
||||||
let titleView = supplementaryView as! TitleCollectionReusableView
|
let titleView = supplementaryView as! TitleCollectionReusableView
|
||||||
titleView.label.text = NSLocalizedString("About", comment: "")
|
titleView.label.text = NSLocalizedString("About", comment: "")
|
||||||
@@ -333,6 +367,34 @@ extension SourceDetailContentViewController
|
|||||||
|
|
||||||
return supplementaryView
|
return supplementaryView
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath)
|
||||||
|
{
|
||||||
|
let section = Section(rawValue: indexPath.section)!
|
||||||
|
let item = self.dataSource.item(at: indexPath)
|
||||||
|
|
||||||
|
switch (section, item)
|
||||||
|
{
|
||||||
|
case (.news, let newsItem as NewsItem):
|
||||||
|
if let externalURL = newsItem.externalURL
|
||||||
|
{
|
||||||
|
let safariViewController = SFSafariViewController(url: externalURL)
|
||||||
|
safariViewController.preferredControlTintColor = newsItem.tintColor
|
||||||
|
self.present(safariViewController, animated: true, completion: nil)
|
||||||
|
}
|
||||||
|
else if let storeApp = newsItem.storeApp
|
||||||
|
{
|
||||||
|
let appViewController = AppViewController.makeAppViewController(app: storeApp)
|
||||||
|
self.navigationController?.pushViewController(appViewController, animated: true)
|
||||||
|
}
|
||||||
|
|
||||||
|
case (.featuredApps, let storeApp as StoreApp):
|
||||||
|
let appViewController = AppViewController.makeAppViewController(app: storeApp)
|
||||||
|
self.navigationController?.pushViewController(appViewController, animated: true)
|
||||||
|
|
||||||
|
default: break
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension SourceDetailContentViewController: ScrollableContentViewController
|
extension SourceDetailContentViewController: ScrollableContentViewController
|
||||||
|
|||||||
@@ -138,6 +138,32 @@
|
|||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="810" y="-13"/>
|
<point key="canvasLocation" x="810" y="-13"/>
|
||||||
</scene>
|
</scene>
|
||||||
|
<!--All Apps-->
|
||||||
|
<scene sceneID="d8a-U8-CPc">
|
||||||
|
<objects>
|
||||||
|
<placeholder placeholderIdentifier="IBFirstResponder" id="ih5-9R-QX7" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
|
<collectionViewController storyboardIdentifier="browseViewController" id="Nhf-Gw-Ukx" customClass="BrowseViewController" customModule="AltStore" customModuleProvider="target" sceneMemberID="viewController">
|
||||||
|
<collectionView key="view" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" id="oBI-6P-Lm3">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="393" height="783"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
|
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||||
|
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="50" minimumInteritemSpacing="10" id="pSh-Xl-aNg">
|
||||||
|
<size key="itemSize" width="375" height="400"/>
|
||||||
|
<size key="headerReferenceSize" width="0.0" height="0.0"/>
|
||||||
|
<size key="footerReferenceSize" width="0.0" height="0.0"/>
|
||||||
|
<inset key="sectionInset" minX="0.0" minY="8" maxX="0.0" maxY="20"/>
|
||||||
|
</collectionViewFlowLayout>
|
||||||
|
<cells/>
|
||||||
|
<connections>
|
||||||
|
<outlet property="dataSource" destination="Nhf-Gw-Ukx" id="JPE-wa-fZ5"/>
|
||||||
|
<outlet property="delegate" destination="Nhf-Gw-Ukx" id="rW6-a2-seQ"/>
|
||||||
|
</connections>
|
||||||
|
</collectionView>
|
||||||
|
<navigationItem key="navigationItem" title="All Apps" id="rUb-ON-AON"/>
|
||||||
|
</collectionViewController>
|
||||||
|
</objects>
|
||||||
|
<point key="canvasLocation" x="3404" y="-13"/>
|
||||||
|
</scene>
|
||||||
<!--Source Detail View Controller-->
|
<!--Source Detail View Controller-->
|
||||||
<scene sceneID="xbN-Mz-TtU">
|
<scene sceneID="xbN-Mz-TtU">
|
||||||
<objects>
|
<objects>
|
||||||
@@ -192,10 +218,40 @@
|
|||||||
<outlet property="delegate" destination="MSh-hM-32I" id="8SG-5v-iF2"/>
|
<outlet property="delegate" destination="MSh-hM-32I" id="8SG-5v-iF2"/>
|
||||||
</connections>
|
</connections>
|
||||||
</collectionView>
|
</collectionView>
|
||||||
|
<connections>
|
||||||
|
<segue destination="MVH-oB-c8m" kind="show" identifier="showAllNews" destinationCreationSelector="makeNewsViewController:" id="txA-ay-P7p"/>
|
||||||
|
<segue destination="Nhf-Gw-Ukx" kind="show" identifier="showAllApps" destinationCreationSelector="makeBrowseViewController:" id="On0-GP-kaE"/>
|
||||||
|
</connections>
|
||||||
</collectionViewController>
|
</collectionViewController>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="2509" y="-13"/>
|
<point key="canvasLocation" x="2509" y="-13"/>
|
||||||
</scene>
|
</scene>
|
||||||
|
<!--All News-->
|
||||||
|
<scene sceneID="avV-5f-uNE">
|
||||||
|
<objects>
|
||||||
|
<placeholder placeholderIdentifier="IBFirstResponder" id="7f5-vn-JrS" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
|
<collectionViewController storyboardIdentifier="newsViewController" id="MVH-oB-c8m" customClass="NewsViewController" customModule="AltStore" customModuleProvider="target" sceneMemberID="viewController">
|
||||||
|
<collectionView key="view" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" id="p9p-rr-fbF">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="393" height="783"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
|
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||||
|
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="40" minimumInteritemSpacing="40" id="3cD-ax-3h6">
|
||||||
|
<size key="itemSize" width="375" height="300"/>
|
||||||
|
<size key="headerReferenceSize" width="0.0" height="0.0"/>
|
||||||
|
<size key="footerReferenceSize" width="0.0" height="0.0"/>
|
||||||
|
<inset key="sectionInset" minX="0.0" minY="40" maxX="0.0" maxY="13"/>
|
||||||
|
</collectionViewFlowLayout>
|
||||||
|
<cells/>
|
||||||
|
<connections>
|
||||||
|
<outlet property="dataSource" destination="MVH-oB-c8m" id="tji-Ko-dBy"/>
|
||||||
|
<outlet property="delegate" destination="MVH-oB-c8m" id="fcy-SK-PkD"/>
|
||||||
|
</connections>
|
||||||
|
</collectionView>
|
||||||
|
<navigationItem key="navigationItem" title="All News" id="FGB-cd-Vkd"/>
|
||||||
|
</collectionViewController>
|
||||||
|
</objects>
|
||||||
|
<point key="canvasLocation" x="3404" y="-711"/>
|
||||||
|
</scene>
|
||||||
</scenes>
|
</scenes>
|
||||||
<resources>
|
<resources>
|
||||||
<systemColor name="systemBackgroundColor">
|
<systemColor name="systemBackgroundColor">
|
||||||
|
|||||||
Reference in New Issue
Block a user