mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-08 22:33:26 +01:00
Throws error if marketplace app is missing buildVersion
This commit is contained in:
@@ -56,7 +56,7 @@ public class AppVersion: NSManagedObject, Decodable, Fetchable
|
||||
super.init(entity: entity, insertInto: context)
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey
|
||||
internal enum CodingKeys: String, CodingKey
|
||||
{
|
||||
case version
|
||||
case buildVersion
|
||||
|
||||
@@ -424,6 +424,33 @@ public class StoreApp: NSManagedObject, Decodable, Fetchable
|
||||
for version in versions
|
||||
{
|
||||
version.appBundleID = self.bundleIdentifier
|
||||
|
||||
if self.marketplaceID != nil
|
||||
{
|
||||
struct IndexCodingKey: CodingKey
|
||||
{
|
||||
var stringValue: String { self.intValue?.description ?? "" }
|
||||
var intValue: Int?
|
||||
|
||||
init?(stringValue: String)
|
||||
{
|
||||
fatalError()
|
||||
}
|
||||
|
||||
init(intValue: Int)
|
||||
{
|
||||
self.intValue = intValue
|
||||
}
|
||||
}
|
||||
|
||||
// Marketplace apps must provide build version.
|
||||
guard version.buildVersion != nil else {
|
||||
let codingPath = container.codingPath + [CodingKeys.versions as CodingKey] + [IndexCodingKey(intValue: index) as CodingKey]
|
||||
let context = DecodingError.Context(codingPath: codingPath, debugDescription: "Notarized apps must provide a build version.")
|
||||
throw DecodingError.keyNotFound(AppVersion.CodingKeys.buildVersion, context)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
try self.setVersions(versions)
|
||||
|
||||
Reference in New Issue
Block a user