Improves maketplace source error messages

This commit is contained in:
Riley Testut
2024-02-15 18:17:51 -06:00
committed by Magesh K
parent 2568f41e20
commit 07ed25ab54
2 changed files with 12 additions and 12 deletions

View File

@@ -25,8 +25,8 @@ extension SourceError
case missingPermissionUsageDescription case missingPermissionUsageDescription
case missingScreenshotSize case missingScreenshotSize
case marketplaceAppsNotSupported = 101 case marketplaceNotSupported = 101
case marketplaceAppsRequired case marketplaceRequired
} }
static func unsupported(_ source: Source) -> SourceError { SourceError(code: .unsupported, source: source) } static func unsupported(_ source: Source) -> SourceError { SourceError(code: .unsupported, source: source) }
@@ -45,12 +45,12 @@ extension SourceError
SourceError(code: .missingScreenshotSize, source: source, app: screenshot.app, screenshotURL: screenshot.imageURL) SourceError(code: .missingScreenshotSize, source: source, app: screenshot.app, screenshotURL: screenshot.imageURL)
} }
static func marketplaceAppsNotSupported(source: Source) -> SourceError { static func marketplaceNotSupported(source: Source) -> SourceError {
return SourceError(code: .marketplaceAppsNotSupported, source: source) return SourceError(code: .marketplaceNotSupported, source: source)
} }
static func marketplaceAppsRequired(source: Source) -> SourceError { static func marketplaceRequired(source: Source) -> SourceError {
return SourceError(code: .marketplaceAppsRequired, source: source) return SourceError(code: .marketplaceRequired, source: source)
} }
} }
@@ -140,12 +140,12 @@ struct SourceError: ALTLocalizedError
let failureReason = baseMessage + ": \(screenshotURL.absoluteString)" let failureReason = baseMessage + ": \(screenshotURL.absoluteString)"
return failureReason return failureReason
case .marketplaceAppsNotSupported: case .marketplaceNotSupported:
let failureReason = String(format: NSLocalizedString("The source “%@” contains notarized apps, which are not supported by this version of AltStore.", comment: ""), self.$source.name) let failureReason = String(format: NSLocalizedString("The source “%@” contains notarized apps, which are not supported by this version of AltStore.", comment: ""), self.$source.name)
return failureReason return failureReason
case .marketplaceAppsRequired: case .marketplaceRequired:
let failureReason = String(format: NSLocalizedString("The source “%@” contains non-marketplace apps, which are not supported by this version of AltStore.", comment: ""), self.$source.name) let failureReason = String(format: NSLocalizedString("One or more apps in source “%@” are missing a marketplaceID. This most likely means they are not notarized, which is not supported by this version of AltStore.", comment: ""), self.$source.name)
return failureReason return failureReason
} }
} }
@@ -185,7 +185,7 @@ struct SourceError: ALTLocalizedError
let recoverySuggestion = NSLocalizedString("Please remove the existing source in order to add this one.", comment: "") let recoverySuggestion = NSLocalizedString("Please remove the existing source in order to add this one.", comment: "")
return recoverySuggestion return recoverySuggestion
case .marketplaceAppsRequired: case .marketplaceRequired:
let failureReason = String(format: NSLocalizedString("AltStore can only install marketplace apps that have been notarized by Apple.", comment: ""), self.$source.name) let failureReason = String(format: NSLocalizedString("AltStore can only install marketplace apps that have been notarized by Apple.", comment: ""), self.$source.name)
return failureReason return failureReason

View File

@@ -228,9 +228,9 @@ private extension FetchSourceOperation
} }
#if MARKETPLACE #if MARKETPLACE
guard app.marketplaceID != nil else { throw SourceError.marketplaceAppsRequired(source: source) } guard app.marketplaceID != nil else { throw SourceError.marketplaceRequired(source: source) }
#else #else
guard app.marketplaceID == nil else { throw SourceError.marketplaceAppsNotSupported(source: source) } guard app.marketplaceID == nil else { throw SourceError.marketplaceNotSupported(source: source) }
#endif #endif
} }