mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-08 22:33:26 +01:00
[AltStoreCore] Adds StoreApp.category + StoreCategory enum
This commit is contained in:
@@ -239,6 +239,7 @@
|
||||
</entity>
|
||||
<entity name="StoreApp" representedClassName="StoreApp" syncable="YES">
|
||||
<attribute name="bundleIdentifier" attributeType="String"/>
|
||||
<attribute name="category" optional="YES" attributeType="String"/>
|
||||
<attribute name="developerName" attributeType="String"/>
|
||||
<attribute name="downloadURL" attributeType="URI"/>
|
||||
<attribute name="iconURL" attributeType="URI"/>
|
||||
|
||||
@@ -115,6 +115,14 @@ public class StoreApp: NSManagedObject, Decodable, Fetchable
|
||||
@NSManaged public private(set) var localizedDescription: String
|
||||
@NSManaged @objc(size) internal var _size: Int32
|
||||
|
||||
@nonobjc public var category: StoreCategory? {
|
||||
guard let _category else { return nil }
|
||||
|
||||
let category = StoreCategory(rawValue: _category)
|
||||
return category
|
||||
}
|
||||
@NSManaged @objc(category) public private(set) var _category: String?
|
||||
|
||||
@NSManaged public private(set) var iconURL: URL
|
||||
@NSManaged public private(set) var screenshotURLs: [URL]
|
||||
|
||||
@@ -259,6 +267,7 @@ public class StoreApp: NSManagedObject, Decodable, Fetchable
|
||||
case isBeta = "beta"
|
||||
case versions
|
||||
case patreon
|
||||
case category
|
||||
|
||||
// Legacy
|
||||
case version
|
||||
@@ -282,10 +291,10 @@ public class StoreApp: NSManagedObject, Decodable, Fetchable
|
||||
self.bundleIdentifier = try container.decode(String.self, forKey: .bundleIdentifier)
|
||||
self.developerName = try container.decode(String.self, forKey: .developerName)
|
||||
self.localizedDescription = try container.decode(String.self, forKey: .localizedDescription)
|
||||
self.iconURL = try container.decode(URL.self, forKey: .iconURL)
|
||||
|
||||
self.subtitle = try container.decodeIfPresent(String.self, forKey: .subtitle)
|
||||
|
||||
self.iconURL = try container.decode(URL.self, forKey: .iconURL)
|
||||
self.isBeta = try container.decodeIfPresent(Bool.self, forKey: .isBeta) ?? false
|
||||
|
||||
var downloadURL = try container.decodeIfPresent(URL.self, forKey: .downloadURL)
|
||||
let platformURLs = try container.decodeIfPresent(PlatformURLs.self.self, forKey: .platformURLs)
|
||||
@@ -329,7 +338,10 @@ public class StoreApp: NSManagedObject, Decodable, Fetchable
|
||||
self.tintColor = tintColor
|
||||
}
|
||||
|
||||
self.isBeta = try container.decodeIfPresent(Bool.self, forKey: .isBeta) ?? false
|
||||
if let rawCategory = try container.decodeIfPresent(String.self, forKey: .category)
|
||||
{
|
||||
self._category = rawCategory.lowercased() // Store raw (lowercased) category value.
|
||||
}
|
||||
|
||||
let appScreenshots: [AppScreenshot]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user