diff --git a/AltStore/Operations/DownloadAppOperation.swift b/AltStore/Operations/DownloadAppOperation.swift index 024e3520..3bd5f832 100644 --- a/AltStore/Operations/DownloadAppOperation.swift +++ b/AltStore/Operations/DownloadAppOperation.swift @@ -80,8 +80,6 @@ class DownloadAppOperation: ResultOperation guard let application = ALTApplication(fileURL: appBundleURL) else { throw OperationError.invalidApp } - guard ProcessInfo.processInfo.isOperatingSystemAtLeast(application.minimumiOSVersion) else { throw OperationError.iOSVersionNotSupported(application) } - try FileManager.default.copyItem(at: appBundleURL, to: self.destinationURL, shouldReplace: true) if self.context.bundleIdentifier == StoreApp.dolphinAppID, self.context.bundleIdentifier != application.bundleIdentifier diff --git a/AltStore/Operations/OperationError.swift b/AltStore/Operations/OperationError.swift index 82ed2a51..497129d5 100644 --- a/AltStore/Operations/OperationError.swift +++ b/AltStore/Operations/OperationError.swift @@ -24,7 +24,6 @@ enum OperationError: LocalizedError case invalidApp case invalidParameters - case iOSVersionNotSupported(ALTApplication) case maximumAppIDLimitReached(application: ALTApplication, requiredAppIDs: Int, availableAppIDs: Int, nextExpirationDate: Date) case noSources @@ -46,18 +45,6 @@ enum OperationError: LocalizedError case .noSources: return NSLocalizedString("There are no AltStore sources.", comment: "") case .openAppFailed(let name): return String(format: NSLocalizedString("AltStore was denied permission to launch %@.", comment: ""), name) case .missingAppGroup: return NSLocalizedString("AltStore's shared app group could not be found.", comment: "") - case .iOSVersionNotSupported(let app): - let name = app.name - - var version = "iOS \(app.minimumiOSVersion.majorVersion).\(app.minimumiOSVersion.minorVersion)" - if app.minimumiOSVersion.patchVersion > 0 - { - version += ".\(app.minimumiOSVersion.patchVersion)" - } - - let localizedDescription = String(format: NSLocalizedString("%@ requires %@.", comment: ""), name, version) - return localizedDescription - case .maximumAppIDLimitReached: return NSLocalizedString("Cannot register more than 10 App IDs.", comment: "") } } diff --git a/AltStore/Operations/VerifyAppOperation.swift b/AltStore/Operations/VerifyAppOperation.swift index f451db2d..1daa92b0 100644 --- a/AltStore/Operations/VerifyAppOperation.swift +++ b/AltStore/Operations/VerifyAppOperation.swift @@ -15,12 +15,14 @@ enum VerificationError: ALTLocalizedError { case privateEntitlements(ALTApplication, entitlements: [String: Any]) case mismatchedBundleIdentifiers(ALTApplication, sourceBundleID: String) + case iOSVersionNotSupported(ALTApplication) var app: ALTApplication { switch self { case .privateEntitlements(let app, _): return app case .mismatchedBundleIdentifiers(let app, _): return app + case .iOSVersionNotSupported(let app): return app } } @@ -36,6 +38,18 @@ enum VerificationError: ALTLocalizedError case .mismatchedBundleIdentifiers(let app, let sourceBundleID): return String(format: NSLocalizedString("The bundle ID “%@” does not match the one specified by the source (“%@”).", comment: ""), app.bundleIdentifier, sourceBundleID) + + case .iOSVersionNotSupported(let app): + let name = app.name + + var version = "iOS \(app.minimumiOSVersion.majorVersion).\(app.minimumiOSVersion.minorVersion)" + if app.minimumiOSVersion.patchVersion > 0 + { + version += ".\(app.minimumiOSVersion.patchVersion)" + } + + let localizedDescription = String(format: NSLocalizedString("%@ requires %@.", comment: ""), name, version) + return localizedDescription } } } @@ -69,7 +83,11 @@ class VerifyAppOperation: ResultOperation guard app.bundleIdentifier == self.context.bundleIdentifier else { throw VerificationError.mismatchedBundleIdentifiers(app, sourceBundleID: self.context.bundleIdentifier) } - + + guard ProcessInfo.processInfo.isOperatingSystemAtLeast(app.minimumiOSVersion) else { + throw VerificationError.iOSVersionNotSupported(app) + } + if #available(iOS 13.5, *) { // No psychic paper, so we can ignore private entitlements @@ -149,6 +167,7 @@ private extension VerifyAppOperation presentingViewController.present(alertController, animated: true, completion: nil) case .mismatchedBundleIdentifiers: return completion(.failure(error)) + case .iOSVersionNotSupported: return completion(.failure(error)) } } }