mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-17 02:33:27 +01:00
refs #160 codable feed structs
Signed-off-by: Joseph Mattello <mail@joemattiello.com>
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import CoreData
|
import CoreData
|
||||||
|
import UIKit
|
||||||
|
|
||||||
public extension Source
|
public extension Source
|
||||||
{
|
{
|
||||||
@@ -35,6 +36,146 @@ public extension Source
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public struct AppPermissionFeed: Codable {
|
||||||
|
let type: String // ALTAppPermissionType
|
||||||
|
let usageDescription: String
|
||||||
|
|
||||||
|
enum CodingKeys: String, CodingKey
|
||||||
|
{
|
||||||
|
case type
|
||||||
|
case usageDescription
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct AppVersionFeed: Codable {
|
||||||
|
/* Properties */
|
||||||
|
let version: String
|
||||||
|
let date: Date
|
||||||
|
let localizedDescription: String?
|
||||||
|
|
||||||
|
let downloadURL: URL
|
||||||
|
let size: Int64
|
||||||
|
|
||||||
|
enum CodingKeys: String, CodingKey
|
||||||
|
{
|
||||||
|
case version
|
||||||
|
case date
|
||||||
|
case localizedDescription
|
||||||
|
case downloadURL
|
||||||
|
case size
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct PlatformURLFeed: Codable {
|
||||||
|
/* Properties */
|
||||||
|
let platform: Platform
|
||||||
|
let downloadURL: URL
|
||||||
|
|
||||||
|
|
||||||
|
private enum CodingKeys: String, CodingKey
|
||||||
|
{
|
||||||
|
case platform
|
||||||
|
case downloadURL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public struct StoreAppFeed: Codable {
|
||||||
|
let name: String
|
||||||
|
let bundleIdentifier: String
|
||||||
|
let subtitle: String?
|
||||||
|
|
||||||
|
let developerName: String
|
||||||
|
let localizedDescription: String
|
||||||
|
let size: Int64
|
||||||
|
|
||||||
|
let iconURL: URL
|
||||||
|
let screenshotURLs: [URL]
|
||||||
|
|
||||||
|
let version: String
|
||||||
|
let versionDate: Date
|
||||||
|
let versionDescription: String?
|
||||||
|
let downloadURL: URL
|
||||||
|
let platformURLs: [PlatformURLFeed]?
|
||||||
|
|
||||||
|
let tintColor: String? // UIColor?
|
||||||
|
let isBeta: Bool
|
||||||
|
|
||||||
|
// let source: Source?
|
||||||
|
let appPermission: [AppPermissionFeed]
|
||||||
|
let versions: [AppVersionFeed]
|
||||||
|
|
||||||
|
enum CodingKeys: String, CodingKey
|
||||||
|
{
|
||||||
|
case bundleIdentifier
|
||||||
|
case developerName
|
||||||
|
case downloadURL
|
||||||
|
case iconURL
|
||||||
|
case isBeta = "beta"
|
||||||
|
case localizedDescription
|
||||||
|
case name
|
||||||
|
case appPermission = "permissions"
|
||||||
|
case platformURLs
|
||||||
|
case screenshotURLs
|
||||||
|
case size
|
||||||
|
case subtitle
|
||||||
|
case tintColor
|
||||||
|
case version
|
||||||
|
case versionDate
|
||||||
|
case versionDescription
|
||||||
|
case versions
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct NewsItemFeed: Codable {
|
||||||
|
let identifier: String
|
||||||
|
let date: Date
|
||||||
|
|
||||||
|
let title: String
|
||||||
|
let caption: String
|
||||||
|
let tintColor: String //UIColor
|
||||||
|
let notify: Bool
|
||||||
|
|
||||||
|
let imageURL: URL?
|
||||||
|
let externalURL: URL?
|
||||||
|
|
||||||
|
let appID: String?
|
||||||
|
|
||||||
|
private enum CodingKeys: String, CodingKey
|
||||||
|
{
|
||||||
|
case identifier
|
||||||
|
case date
|
||||||
|
case title
|
||||||
|
case caption
|
||||||
|
case tintColor
|
||||||
|
case imageURL
|
||||||
|
case externalURL = "url"
|
||||||
|
case appID
|
||||||
|
case notify
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public struct SourceJSON: Codable {
|
||||||
|
let name: String
|
||||||
|
let identifier: String
|
||||||
|
let sourceURL: URL
|
||||||
|
let userInfo: [String:String]? //[ALTSourceUserInfoKey:String]?
|
||||||
|
let apps: [StoreAppFeed]
|
||||||
|
let news: [NewsItemFeed]
|
||||||
|
|
||||||
|
enum CodingKeys: String, CodingKey
|
||||||
|
{
|
||||||
|
case name
|
||||||
|
case identifier
|
||||||
|
case sourceURL
|
||||||
|
case userInfo
|
||||||
|
case apps
|
||||||
|
case news
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@objc(Source)
|
@objc(Source)
|
||||||
public class Source: NSManagedObject, Fetchable, Decodable
|
public class Source: NSManagedObject, Fetchable, Decodable
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,14 +26,12 @@ public extension StoreApp
|
|||||||
}
|
}
|
||||||
|
|
||||||
@objc
|
@objc
|
||||||
public enum Platform: UInt {
|
public enum Platform: UInt, Codable {
|
||||||
case ios
|
case ios
|
||||||
case tvos
|
case tvos
|
||||||
case macos
|
case macos
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Platform: Decodable {}
|
|
||||||
|
|
||||||
@objc
|
@objc
|
||||||
public final class PlatformURL: NSManagedObject, Decodable {
|
public final class PlatformURL: NSManagedObject, Decodable {
|
||||||
/* Properties */
|
/* Properties */
|
||||||
|
|||||||
Reference in New Issue
Block a user