Adds basic UpdatesViewController implementation

This commit is contained in:
Riley Testut
2019-05-20 22:24:16 +02:00
parent 0c79db4482
commit 001a2d9365
8 changed files with 192 additions and 6 deletions

View File

@@ -7,6 +7,9 @@
<attribute name="localizedDescription" attributeType="String" syncable="YES"/>
<attribute name="name" attributeType="String" syncable="YES"/>
<attribute name="screenshotNames" 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"/>
<relationship name="installedApp" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="InstalledApp" inverseName="app" inverseEntity="InstalledApp" syncable="YES"/>
<uniquenessConstraints>
<uniquenessConstraint>
@@ -19,10 +22,11 @@
<attribute name="expirationDate" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
<attribute name="isBeta" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
<attribute name="signedDate" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
<attribute name="version" attributeType="String" syncable="YES"/>
<relationship name="app" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="App" inverseName="installedApp" inverseEntity="App" syncable="YES"/>
</entity>
<elements>
<element name="App" positionX="-63" positionY="-18" width="128" height="150"/>
<element name="InstalledApp" positionX="-63" positionY="0" width="128" height="120"/>
<element name="App" positionX="-63" positionY="-18" width="128" height="195"/>
<element name="InstalledApp" positionX="-63" positionY="0" width="128" height="135"/>
</elements>
</model>

View File

@@ -22,6 +22,10 @@ class App: NSManagedObject, Decodable
@NSManaged private(set) var iconName: String
@NSManaged private(set) var screenshotNames: [String]
@NSManaged private(set) var version: String
@NSManaged private(set) var versionDate: Date
@NSManaged private(set) var versionDescription: String?
/* Relationships */
@NSManaged private(set) var installedApp: InstalledApp?
@@ -36,6 +40,9 @@ class App: NSManagedObject, Decodable
case identifier
case developerName
case localizedDescription
case version
case versionDescription
case versionDate
case iconName
case screenshotNames
}
@@ -52,6 +59,10 @@ class App: NSManagedObject, Decodable
self.developerName = try container.decode(String.self, forKey: .developerName)
self.localizedDescription = try container.decode(String.self, forKey: .localizedDescription)
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)
self.iconName = try container.decode(String.self, forKey: .iconName)
self.screenshotNames = try container.decodeIfPresent([String].self, forKey: .screenshotNames) ?? []
@@ -59,8 +70,6 @@ class App: NSManagedObject, Decodable
}
}
extension App
{
@nonobjc class func fetchRequest() -> NSFetchRequest<App>

View File

@@ -14,6 +14,7 @@ class InstalledApp: NSManagedObject
{
/* Properties */
@NSManaged var bundleIdentifier: String
@NSManaged var version: String
@NSManaged var signedDate: Date
@NSManaged var expirationDate: Date
@@ -34,6 +35,7 @@ class InstalledApp: NSManagedObject
let app = context.object(with: app.objectID) as! App
self.app = app
self.version = "0.9"
self.bundleIdentifier = bundleIdentifier
self.signedDate = signedDate