Hides app updates that don’t support device’s OS version

This commit is contained in:
Riley Testut
2022-11-16 14:11:11 -06:00
parent 3574ed2ed9
commit 1cfd83bbb7
5 changed files with 32 additions and 16 deletions

View File

@@ -395,9 +395,9 @@ extension AppManager
{
completionHandler(.success((fetchedSources, managedObjectContext)))
}
NotificationCenter.default.post(name: AppManager.didFetchSourceNotification, object: self)
}
NotificationCenter.default.post(name: AppManager.didFetchSourceNotification, object: self)
}
self.run(operations, context: nil)

View File

@@ -185,7 +185,7 @@ private extension MyAppsViewController
func makeUpdatesDataSource() -> RSTFetchedResultsCollectionViewPrefetchingDataSource<InstalledApp, UIImage>
{
let fetchRequest = InstalledApp.updatesFetchRequest()
let fetchRequest = InstalledApp.supportedUpdatesFetchRequest()
fetchRequest.sortDescriptors = [NSSortDescriptor(keyPath: \InstalledApp.storeApp?.latestSupportedVersion?.date, ascending: false),
NSSortDescriptor(keyPath: \InstalledApp.name, ascending: true)]
fetchRequest.returnsObjectsAsFaults = false
@@ -479,6 +479,15 @@ private extension MyAppsViewController
{
func update()
{
do
{
try self.updatesDataSource.fetchedResultsController.performFetch()
}
catch
{
print("[ALTLog] Failed to fetch updates:", error)
}
if self.updatesDataSource.itemCount > 0
{
self.navigationController?.tabBarItem.badgeValue = String(describing: self.updatesDataSource.itemCount)
@@ -489,13 +498,6 @@ private extension MyAppsViewController
self.navigationController?.tabBarItem.badgeValue = nil
UIApplication.shared.applicationIconBadgeNumber = 0
}
if self.isViewLoaded
{
UIView.performWithoutAnimation {
self.collectionView.reloadSections(IndexSet(integer: Section.updates.rawValue))
}
}
}
func fetchAppIDs()