diff --git a/AltStoreCore/Model/AppVersion.swift b/AltStoreCore/Model/AppVersion.swift index dc0ffe80..119d14bc 100644 --- a/AltStoreCore/Model/AppVersion.swift +++ b/AltStoreCore/Model/AppVersion.swift @@ -54,6 +54,8 @@ public class AppVersion: NSManagedObject, Decodable, Fetchable case localizedDescription case downloadURL case size + case minOSVersion + case maxOSVersion } public required init(from decoder: Decoder) throws @@ -72,6 +74,9 @@ public class AppVersion: NSManagedObject, Decodable, Fetchable self.downloadURL = try container.decode(URL.self, forKey: .downloadURL) self.size = try container.decode(Int64.self, forKey: .size) + + self._minOSVersion = try container.decodeIfPresent(String.self, forKey: .minOSVersion) + self._maxOSVersion = try container.decodeIfPresent(String.self, forKey: .maxOSVersion) } catch { @@ -115,6 +120,11 @@ public extension AppVersion } var isSupported: Bool { + if let minOSVersion = self.minOSVersion, !ProcessInfo.processInfo.isOperatingSystemAtLeast(minOSVersion) { + return false + } else if let maxOSVersion = self.maxOSVersion, ProcessInfo.processInfo.operatingSystemVersion > maxOSVersion { + return false + } return true } }