mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-20 12:13:26 +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:
@@ -93,7 +93,6 @@ class BrowseViewController: UICollectionViewController, PeekPopPreviewing
|
|||||||
super.viewWillAppear(animated)
|
super.viewWillAppear(animated)
|
||||||
|
|
||||||
self.fetchSource()
|
self.fetchSource()
|
||||||
self.updateDataSource()
|
|
||||||
|
|
||||||
self.update()
|
self.update()
|
||||||
}
|
}
|
||||||
@@ -110,7 +109,8 @@ private extension BrowseViewController
|
|||||||
NSSortDescriptor(keyPath: \StoreApp.bundleIdentifier, ascending: true)]
|
NSSortDescriptor(keyPath: \StoreApp.bundleIdentifier, ascending: true)]
|
||||||
fetchRequest.returnsObjectsAsFaults = false
|
fetchRequest.returnsObjectsAsFaults = false
|
||||||
|
|
||||||
let predicate = NSPredicate(format: "%K != %@", #keyPath(StoreApp.bundleIdentifier), StoreApp.altstoreAppID)
|
let predicate = StoreApp.visibleAppsPredicate
|
||||||
|
|
||||||
if let source = self.source
|
if let source = self.source
|
||||||
{
|
{
|
||||||
let filterPredicate = NSPredicate(format: "%K == %@", #keyPath(StoreApp._source), source)
|
let filterPredicate = NSPredicate(format: "%K == %@", #keyPath(StoreApp._source), source)
|
||||||
|
|||||||
@@ -113,11 +113,10 @@ class MyAppsViewController: UICollectionViewController, PeekPopPreviewing
|
|||||||
(self as PeekPopPreviewing).registerForPreviewing(with: self, sourceView: self.collectionView)
|
(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.update()
|
||||||
|
|
||||||
self.fetchAppIDs()
|
self.fetchAppIDs()
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ private extension SourceDetailContentViewController
|
|||||||
|
|
||||||
let dataSource = RSTArrayCollectionViewPrefetchingDataSource<StoreApp, UIImage>(items: limitedFeaturedApps)
|
let dataSource = RSTArrayCollectionViewPrefetchingDataSource<StoreApp, UIImage>(items: limitedFeaturedApps)
|
||||||
dataSource.cellIdentifierHandler = { _ in "AppCell" }
|
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
|
dataSource.cellConfigurationHandler = { [weak self] (cell, storeApp, indexPath) in
|
||||||
let cell = cell as! AppBannerCollectionViewCell
|
let cell = cell as! AppBannerCollectionViewCell
|
||||||
cell.tintColor = storeApp.tintColor
|
cell.tintColor = storeApp.tintColor
|
||||||
|
|||||||
@@ -231,15 +231,7 @@ private extension SourcesViewController
|
|||||||
cell.bannerView.iconImageView.image = nil
|
cell.bannerView.iconImageView.image = nil
|
||||||
cell.bannerView.iconImageView.isIndicatingActivity = true
|
cell.bannerView.iconImageView.isIndicatingActivity = true
|
||||||
|
|
||||||
let numberOfApps: Int
|
let numberOfApps = source.apps.filter { StoreApp.visibleAppsPredicate.evaluate(with: $0) }.count
|
||||||
if let patreonAccount = DatabaseManager.shared.patreonAccount(), patreonAccount.isPatron, PatreonAPI.shared.isAuthenticated
|
|
||||||
{
|
|
||||||
numberOfApps = source.apps.count
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
numberOfApps = source.apps.filter { !$0.isBeta }.count
|
|
||||||
}
|
|
||||||
|
|
||||||
if let error = source.error
|
if let error = source.error
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -212,13 +212,19 @@ public extension InstalledApp
|
|||||||
// We have to also check !(latestSupportedVersion.buildVersion == '' && installedApp.storeBuildVersion == nil)
|
// We have to also check !(latestSupportedVersion.buildVersion == '' && installedApp.storeBuildVersion == nil)
|
||||||
// because latestSupportedVersion.buildVersion stores an empty string for nil, while installedApp.storeBuildVersion uses NULL.
|
// because latestSupportedVersion.buildVersion stores an empty string for nil, while installedApp.storeBuildVersion uses NULL.
|
||||||
"(%K != %K OR (%K != %K AND NOT (%K == '' AND %K == nil)))",
|
"(%K != %K OR (%K != %K AND NOT (%K == '' AND %K == nil)))",
|
||||||
|
|
||||||
|
"AND",
|
||||||
|
|
||||||
|
// !isPledgeRequired || isPledged
|
||||||
|
"(%K == NO OR %K == YES)"
|
||||||
].joined(separator: " ")
|
].joined(separator: " ")
|
||||||
|
|
||||||
fetchRequest.predicate = NSPredicate(format: predicateFormat,
|
fetchRequest.predicate = NSPredicate(format: predicateFormat,
|
||||||
#keyPath(InstalledApp.isActive), #keyPath(InstalledApp.storeApp), #keyPath(InstalledApp.storeApp.latestSupportedVersion),
|
#keyPath(InstalledApp.isActive), #keyPath(InstalledApp.storeApp), #keyPath(InstalledApp.storeApp.latestSupportedVersion),
|
||||||
#keyPath(InstalledApp.storeApp.latestSupportedVersion.version), #keyPath(InstalledApp.version),
|
#keyPath(InstalledApp.storeApp.latestSupportedVersion.version), #keyPath(InstalledApp.version),
|
||||||
#keyPath(InstalledApp.storeApp.latestSupportedVersion._buildVersion), #keyPath(InstalledApp.storeBuildVersion),
|
#keyPath(InstalledApp.storeApp.latestSupportedVersion._buildVersion), #keyPath(InstalledApp.storeBuildVersion),
|
||||||
#keyPath(InstalledApp.storeApp.latestSupportedVersion._buildVersion), #keyPath(InstalledApp.storeBuildVersion))
|
#keyPath(InstalledApp.storeApp.latestSupportedVersion._buildVersion), #keyPath(InstalledApp.storeBuildVersion),
|
||||||
|
#keyPath(InstalledApp.storeApp.isPledgeRequired), #keyPath(InstalledApp.storeApp.isPledged))
|
||||||
return fetchRequest
|
return fetchRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -569,6 +569,18 @@ public extension StoreApp
|
|||||||
let globallyUniqueID = self.bundleIdentifier + "|" + sourceIdentifier
|
let globallyUniqueID = self.bundleIdentifier + "|" + sourceIdentifier
|
||||||
return globallyUniqueID
|
return globallyUniqueID
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public extension StoreApp
|
||||||
|
{
|
||||||
|
class var visibleAppsPredicate: NSPredicate {
|
||||||
|
let predicate = NSPredicate(format: "(%K != %@) AND ((%K == NO) OR (%K == NO) OR (%K == YES))",
|
||||||
|
#keyPath(StoreApp.bundleIdentifier), StoreApp.altstoreAppID,
|
||||||
|
#keyPath(StoreApp.isPledgeRequired),
|
||||||
|
#keyPath(StoreApp.isHiddenWithoutPledge),
|
||||||
|
#keyPath(StoreApp.isPledged))
|
||||||
|
return predicate
|
||||||
|
}
|
||||||
|
|
||||||
@nonobjc class func fetchRequest() -> NSFetchRequest<StoreApp>
|
@nonobjc class func fetchRequest() -> NSFetchRequest<StoreApp>
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user