[AltStore] Adds redesigned BrowseViewController to browse and install apps

This commit is contained in:
Riley Testut
2019-07-16 14:25:09 -07:00
parent 800ec11ae1
commit 129ae15a54
16 changed files with 689 additions and 22 deletions

View File

@@ -21,6 +21,8 @@
<attribute name="localizedDescription" attributeType="String" syncable="YES"/>
<attribute name="name" attributeType="String" syncable="YES"/>
<attribute name="screenshotNames" attributeType="Transformable" syncable="YES"/>
<attribute name="subtitle" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="tintColor" optional="YES" attributeType="Transformable" syncable="YES"/>
<attribute name="version" attributeType="String" syncable="YES"/>
<attribute name="versionDate" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
<attribute name="versionDescription" optional="YES" attributeType="String" syncable="YES"/>
@@ -57,7 +59,7 @@
</entity>
<elements>
<element name="Account" positionX="-36" positionY="90" width="128" height="135"/>
<element name="App" positionX="-63" positionY="-18" width="128" height="210"/>
<element name="App" positionX="-63" positionY="-18" width="128" height="240"/>
<element name="InstalledApp" positionX="-63" positionY="0" width="128" height="120"/>
<element name="Team" positionX="-45" positionY="81" width="128" height="120"/>
</elements>

View File

@@ -22,6 +22,7 @@ class App: NSManagedObject, Decodable, Fetchable
/* Properties */
@NSManaged private(set) var name: String
@NSManaged private(set) var identifier: String
@NSManaged private(set) var subtitle: String?
@NSManaged private(set) var developerName: String
@NSManaged private(set) var localizedDescription: String
@@ -34,6 +35,7 @@ class App: NSManagedObject, Decodable, Fetchable
@NSManaged private(set) var versionDescription: String?
@NSManaged private(set) var downloadURL: URL
@NSManaged private(set) var tintColor: UIColor?
/* Relationships */
@NSManaged private(set) var installedApp: InstalledApp?
@@ -55,6 +57,8 @@ class App: NSManagedObject, Decodable, Fetchable
case iconName
case screenshotNames
case downloadURL
case tintColor
case subtitle
}
required init(from decoder: Decoder) throws
@@ -69,6 +73,8 @@ class App: NSManagedObject, Decodable, Fetchable
self.developerName = try container.decode(String.self, forKey: .developerName)
self.localizedDescription = try container.decode(String.self, forKey: .localizedDescription)
self.subtitle = try container.decodeIfPresent(String.self, forKey: .subtitle)
self.version = try container.decode(String.self, forKey: .version)
self.versionDate = try container.decode(Date.self, forKey: .versionDate)
self.versionDescription = try container.decodeIfPresent(String.self, forKey: .versionDescription)
@@ -78,6 +84,15 @@ class App: NSManagedObject, Decodable, Fetchable
self.downloadURL = try container.decode(URL.self, forKey: .downloadURL)
if let tintColorHex = try container.decodeIfPresent(String.self, forKey: .tintColor)
{
guard let tintColor = UIColor(hexString: tintColorHex) else {
throw DecodingError.dataCorruptedError(forKey: .tintColor, in: container, debugDescription: "Hex code is invalid.")
}
self.tintColor = tintColor
}
context.insert(self)
}
}