mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-11 07:43:28 +01:00
Switches from StoreApp.isBeta to isPledged to determine whether app is visible
If StoreApp.isHiddenWithoutPledge == false (default), we’ll still show the app.
This commit is contained in:
@@ -92,7 +92,6 @@ class BrowseViewController: UICollectionViewController, PeekPopPreviewing
|
||||
super.viewWillAppear(animated)
|
||||
|
||||
self.fetchSource()
|
||||
self.updateDataSource()
|
||||
|
||||
self.update()
|
||||
}
|
||||
@@ -109,7 +108,8 @@ private extension BrowseViewController
|
||||
NSSortDescriptor(keyPath: \StoreApp.bundleIdentifier, ascending: true)]
|
||||
fetchRequest.returnsObjectsAsFaults = false
|
||||
|
||||
let predicate = NSPredicate(format: "%K != %@", #keyPath(StoreApp.bundleIdentifier), StoreApp.altstoreAppID)
|
||||
let predicate = StoreApp.visibleAppsPredicate
|
||||
|
||||
if let source = self.source
|
||||
{
|
||||
let filterPredicate = NSPredicate(format: "%K == %@", #keyPath(StoreApp._source), source)
|
||||
@@ -202,18 +202,6 @@ private extension BrowseViewController
|
||||
return dataSource
|
||||
}
|
||||
|
||||
func updateDataSource()
|
||||
{
|
||||
if let patreonAccount = DatabaseManager.shared.patreonAccount(), patreonAccount.isPatron, PatreonAPI.shared.isAuthenticated
|
||||
{
|
||||
self.dataSource.predicate = nil
|
||||
}
|
||||
else
|
||||
{
|
||||
self.dataSource.predicate = NSPredicate(format: "%K == NO", #keyPath(StoreApp.isBeta))
|
||||
}
|
||||
}
|
||||
|
||||
func fetchSource()
|
||||
{
|
||||
self.loadingState = .loading
|
||||
|
||||
@@ -112,11 +112,10 @@ class MyAppsViewController: UICollectionViewController, PeekPopPreviewing
|
||||
(self as PeekPopPreviewing).registerForPreviewing(with: self, sourceView: self.collectionView)
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool)
|
||||
override func viewIsAppearing(_ animated: Bool)
|
||||
{
|
||||
super.viewWillAppear(animated)
|
||||
super.viewIsAppearing(animated)
|
||||
|
||||
self.updateDataSource()
|
||||
self.update()
|
||||
|
||||
self.fetchAppIDs()
|
||||
@@ -475,33 +474,6 @@ private extension MyAppsViewController
|
||||
|
||||
return dataSource
|
||||
}
|
||||
|
||||
func updateDataSource()
|
||||
{
|
||||
do
|
||||
{
|
||||
if self.updatesDataSource.fetchedResultsController.fetchedObjects == nil
|
||||
{
|
||||
try self.updatesDataSource.fetchedResultsController.performFetch()
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
print("[ALTLog] Failed to fetch updates:", error)
|
||||
}
|
||||
|
||||
if let patreonAccount = DatabaseManager.shared.patreonAccount(), patreonAccount.isPatron, PatreonAPI.shared.isAuthenticated
|
||||
{
|
||||
self.dataSource.predicate = nil
|
||||
}
|
||||
else
|
||||
{
|
||||
self.dataSource.predicate = NSPredicate(format: "%K == nil OR %K == NO OR %K == %@",
|
||||
#keyPath(InstalledApp.storeApp),
|
||||
#keyPath(InstalledApp.storeApp.isBeta),
|
||||
#keyPath(InstalledApp.bundleIdentifier), StoreApp.altstoreAppID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private extension MyAppsViewController
|
||||
|
||||
@@ -215,7 +215,7 @@ private extension SourceDetailContentViewController
|
||||
|
||||
let dataSource = RSTArrayCollectionViewPrefetchingDataSource<StoreApp, UIImage>(items: limitedFeaturedApps)
|
||||
dataSource.cellIdentifierHandler = { _ in "AppCell" }
|
||||
dataSource.predicate = NSPredicate(format: "%K == NO", #keyPath(StoreApp.isBeta)) // Never show beta apps (at least until we support betas for other sources).
|
||||
dataSource.predicate = StoreApp.visibleAppsPredicate
|
||||
dataSource.cellConfigurationHandler = { [weak self] (cell, storeApp, indexPath) in
|
||||
let cell = cell as! AppBannerCollectionViewCell
|
||||
cell.tintColor = storeApp.tintColor
|
||||
|
||||
@@ -204,15 +204,7 @@ private extension SourcesViewController
|
||||
cell.bannerView.iconImageView.image = nil
|
||||
cell.bannerView.iconImageView.isIndicatingActivity = true
|
||||
|
||||
let numberOfApps: Int
|
||||
if let patreonAccount = DatabaseManager.shared.patreonAccount(), patreonAccount.isPatron, PatreonAPI.shared.isAuthenticated
|
||||
{
|
||||
numberOfApps = source.apps.count
|
||||
}
|
||||
else
|
||||
{
|
||||
numberOfApps = source.apps.filter { !$0.isBeta }.count
|
||||
}
|
||||
let numberOfApps = source.apps.filter { StoreApp.visibleAppsPredicate.evaluate(with: $0) }.count
|
||||
|
||||
if let error = source.error
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user