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
parent 6053a075f4
commit fe412a07b6
8 changed files with 202 additions and 86 deletions

View File

@@ -100,40 +100,3 @@ public extension UserDefaults
}
}
}
public extension UserDefaults
{
// Cache trustedSourceIDs just in case we need to check whether source is trusted or not.
@nonobjc var trustedSourceIDs: Set<String>? {
get {
guard let sourceIDs = _trustedSourceIDs else { return nil }
return Set(sourceIDs)
}
set {
_trustedSourceIDs = newValue?.map { $0 }
}
}
@NSManaged @objc(trustedSourceIDs) private var _trustedSourceIDs: [String]?
@nonobjc var blockedSourceIDs: Set<String>? {
get {
guard let sourceIDs = _blockedSourceIDs else { return nil }
return Set(sourceIDs)
}
set {
_blockedSourceIDs = newValue?.map { $0 }
}
}
@NSManaged @objc(blockedSourceIDs) private var _blockedSourceIDs: [String]?
@nonobjc var blockedSourceURLs: Set<URL>? {
get {
guard let sourceURLs = _blockedSourceURLs?.compactMap({ URL(string: $0) }) else { return nil }
return Set(sourceURLs)
}
set {
_blockedSourceURLs = newValue?.map { $0.absoluteString }
}
}
@NSManaged @objc(blockedSourceURLs) private var _blockedSourceURLs: [String]?
}