Improves error handling when fetching multiple sources

Fetching sources is no longer all or nothing. Now if a source cannot be fetched, it won’t prevent other sources from being updated.
This commit is contained in:
Riley Testut
2020-08-27 16:23:50 -07:00
parent ad33f6e1fb
commit b7564207b3
11 changed files with 262 additions and 116 deletions

View File

@@ -302,13 +302,11 @@ private extension AppDelegate
dispatchGroup.enter()
AppManager.shared.fetchSources() { (result) in
fetchSourcesResult = result
fetchSourcesResult = result.map { $0.0 }.mapError { $0 as Error }
do
{
let sources = try result.get()
guard let context = sources.first?.managedObjectContext else { return }
let (_, context) = try result.get()
let previousUpdatesFetchRequest = InstalledApp.updatesFetchRequest() as! NSFetchRequest<NSFetchRequestResult>
previousUpdatesFetchRequest.includesPendingChanges = false