Displays accurate expiration date for installed apps

This commit is contained in:
Riley Testut
2019-06-04 18:50:55 -07:00
parent a09d6d3502
commit 13f9f2ea6f
5 changed files with 7 additions and 11 deletions

View File

@@ -146,8 +146,7 @@ extension AppManager
let installedApp = InstalledApp(app: app, let installedApp = InstalledApp(app: app,
bundleIdentifier: profile.appID.bundleIdentifier, bundleIdentifier: profile.appID.bundleIdentifier,
signedDate: Date(), expirationDate: profile.expirationDate,
expirationDate: Date().addingTimeInterval(60 * 60 * 24 * 7),
context: context) context: context)
let signer = ALTSigner(team: team, certificate: certificate) let signer = ALTSigner(team: team, certificate: certificate)

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="14490.99" systemVersion="18D109" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier=""> <model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="14490.99" systemVersion="18F203" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<entity name="App" representedClassName="App" syncable="YES"> <entity name="App" representedClassName="App" syncable="YES">
<attribute name="developerName" attributeType="String" syncable="YES"/> <attribute name="developerName" attributeType="String" syncable="YES"/>
<attribute name="downloadURL" attributeType="URI" syncable="YES"/> <attribute name="downloadURL" attributeType="URI" syncable="YES"/>
@@ -22,12 +22,11 @@
<attribute name="bundleIdentifier" attributeType="String" syncable="YES"/> <attribute name="bundleIdentifier" attributeType="String" syncable="YES"/>
<attribute name="expirationDate" attributeType="Date" usesScalarValueType="NO" syncable="YES"/> <attribute name="expirationDate" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
<attribute name="isBeta" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" 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"/> <attribute name="version" attributeType="String" syncable="YES"/>
<relationship name="app" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="App" inverseName="installedApp" inverseEntity="App" syncable="YES"/> <relationship name="app" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="App" inverseName="installedApp" inverseEntity="App" syncable="YES"/>
</entity> </entity>
<elements> <elements>
<element name="App" positionX="-63" positionY="-18" width="128" height="210"/> <element name="App" positionX="-63" positionY="-18" width="128" height="210"/>
<element name="InstalledApp" positionX="-63" positionY="0" width="128" height="135"/> <element name="InstalledApp" positionX="-63" positionY="0" width="128" height="120"/>
</elements> </elements>
</model> </model>

View File

@@ -16,7 +16,6 @@ class InstalledApp: NSManagedObject
@NSManaged var bundleIdentifier: String @NSManaged var bundleIdentifier: String
@NSManaged var version: String @NSManaged var version: String
@NSManaged var signedDate: Date
@NSManaged var expirationDate: Date @NSManaged var expirationDate: Date
@NSManaged var isBeta: Bool @NSManaged var isBeta: Bool
@@ -29,7 +28,7 @@ class InstalledApp: NSManagedObject
super.init(entity: entity, insertInto: context) super.init(entity: entity, insertInto: context)
} }
init(app: App, bundleIdentifier: String, signedDate: Date, expirationDate: Date, context: NSManagedObjectContext) init(app: App, bundleIdentifier: String, expirationDate: Date, context: NSManagedObjectContext)
{ {
super.init(entity: InstalledApp.entity(), insertInto: context) super.init(entity: InstalledApp.entity(), insertInto: context)
@@ -38,7 +37,6 @@ class InstalledApp: NSManagedObject
self.version = "0.9" self.version = "0.9"
self.bundleIdentifier = bundleIdentifier self.bundleIdentifier = bundleIdentifier
self.signedDate = signedDate
self.expirationDate = expirationDate self.expirationDate = expirationDate
} }
} }

View File

@@ -59,12 +59,12 @@ private extension MyAppsViewController
let detailText = let detailText =
""" """
Signed: \(self.dateFormatter.string(from: installedApp.signedDate))
Expires: \(self.dateFormatter.string(from: installedApp.expirationDate)) Expires: \(self.dateFormatter.string(from: installedApp.expirationDate))
""" """
cell.detailTextLabel?.numberOfLines = 2 cell.detailTextLabel?.numberOfLines = 1
cell.detailTextLabel?.text = detailText cell.detailTextLabel?.text = detailText
cell.detailTextLabel?.textColor = .red
} }
return dataSource return dataSource