Updates SourceError.blocked recovery suggestion to list installed/blocked apps

If source is already added, the error message will list all installed apps from the source.

If adding source for first time, the error message will mention exactly which apps have been blocked from the source (if provided).
This commit is contained in:
Riley Testut
2023-05-16 15:39:38 -05:00
committed by Magesh K
parent 177d453491
commit 5a2f32704c
8 changed files with 202 additions and 86 deletions

View File

@@ -369,8 +369,8 @@ extension AppManager
// sure there isn't already a source with this identifier.
let sourceExists = try await fetchedSource.isAdded
// This is just a sanity check, so pass nil for previousSourceName to keep code simple.
guard !sourceExists else { throw SourceError.duplicate(source, previousSourceName: nil) }
// This is just a sanity check, so pass nil for existingSource to keep code simple.
guard !sourceExists else { throw SourceError.duplicate(source, existingSource: nil) }
try await context.performAsync {
try context.save()
@@ -498,7 +498,7 @@ extension AppManager
}
@discardableResult
func updateKnownSources(completionHandler: @escaping (Result<([UpdateKnownSourcesOperation.Source], [UpdateKnownSourcesOperation.Source]), Error>) -> Void) -> UpdateKnownSourcesOperation
func updateKnownSources(completionHandler: @escaping (Result<([KnownSource], [KnownSource]), Error>) -> Void) -> UpdateKnownSourcesOperation
{
let updateKnownSourcesOperation = UpdateKnownSourcesOperation()
updateKnownSourcesOperation.resultHandler = completionHandler