mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
[cleanup]: renamed new field for build revision from commitID to revision
This commit is contained in:
@@ -62,12 +62,12 @@
|
||||
<entity name="AppVersion" representedClassName="AppVersion" syncable="YES">
|
||||
<attribute name="appBundleID" attributeType="String"/>
|
||||
<attribute name="buildVersion" optional="YES" attributeType="String"/>
|
||||
<attribute name="commitID" optional="YES" attributeType="String"/>
|
||||
<attribute name="date" attributeType="Date" usesScalarValueType="NO"/>
|
||||
<attribute name="downloadURL" attributeType="URI"/>
|
||||
<attribute name="localizedDescription" optional="YES" attributeType="String"/>
|
||||
<attribute name="maxOSVersion" optional="YES" attributeType="String"/>
|
||||
<attribute name="minOSVersion" optional="YES" attributeType="String"/>
|
||||
<attribute name="revision" optional="YES" attributeType="String"/>
|
||||
<attribute name="sha256" optional="YES" attributeType="String"/>
|
||||
<attribute name="size" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="sourceID" optional="YES" attributeType="String"/>
|
||||
@@ -243,7 +243,6 @@
|
||||
<entity name="StoreApp" representedClassName="StoreApp" syncable="YES">
|
||||
<attribute name="bundleIdentifier" attributeType="String"/>
|
||||
<attribute name="category" optional="YES" attributeType="String"/>
|
||||
<attribute name="commitID" optional="YES" attributeType="String"/>
|
||||
<attribute name="developerName" attributeType="String"/>
|
||||
<attribute name="downloadURL" attributeType="URI"/>
|
||||
<attribute name="featuredSortID" optional="YES" attributeType="String"/>
|
||||
@@ -258,6 +257,7 @@
|
||||
<attribute name="pledgeAmount" optional="YES" attributeType="Decimal"/>
|
||||
<attribute name="pledgeCurrency" optional="YES" attributeType="String"/>
|
||||
<attribute name="prefersCustomPledge" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
|
||||
<attribute name="revision" optional="YES" attributeType="String"/>
|
||||
<attribute name="screenshotURLs" attributeType="Transformable" valueTransformerName="ALTSecureValueTransformer"/>
|
||||
<attribute name="size" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="sortIndex" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
|
||||
@@ -46,8 +46,10 @@ public class AppVersion: NSManagedObject, Decodable, Fetchable
|
||||
|
||||
@NSManaged public var appBundleID: String
|
||||
@NSManaged public var sourceID: String?
|
||||
|
||||
// TODO: @mahee96: retire isBeta and use a string type to decode and store values as enum
|
||||
@NSManaged public var isBeta: Bool
|
||||
@NSManaged public var commitID: String?
|
||||
@NSManaged public var revision: String?
|
||||
|
||||
/* Relationships */
|
||||
@NSManaged public private(set) var app: StoreApp?
|
||||
@@ -70,7 +72,7 @@ public class AppVersion: NSManagedObject, Decodable, Fetchable
|
||||
case minOSVersion
|
||||
case maxOSVersion
|
||||
case isBeta
|
||||
case commitID
|
||||
case revision = "commitID"
|
||||
}
|
||||
|
||||
public required init(from decoder: Decoder) throws
|
||||
@@ -97,7 +99,7 @@ public class AppVersion: NSManagedObject, Decodable, Fetchable
|
||||
self._maxOSVersion = try container.decodeIfPresent(String.self, forKey: .maxOSVersion)
|
||||
|
||||
// self.isBeta = try container.decodeIfPresent(Bool.self, forKey: .isBeta) ?? false
|
||||
// self.commitID = try container.decodeIfPresent(String.self, forKey: .commitID)
|
||||
// self.revision = try container.decodeIfPresent(String.self, forKey: .revision)
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -102,15 +102,15 @@ public class InstalledApp: NSManagedObject, InstalledAppProtocol
|
||||
// so it doesn't matter if semantic version was bumped, because commit ID won't be same
|
||||
// and we will accept this update
|
||||
|
||||
// storeApp.commitID is set in sources.json deployed at apps.json for the respective source
|
||||
let commitID = storeApp.commitID ?? ""
|
||||
if(isBeta && !commitID.isEmpty){
|
||||
// storeApp.revision is set in sources.json deployed at apps.json for the respective source
|
||||
let revision = storeApp.revision ?? ""
|
||||
if(isBeta && !revision.isEmpty){
|
||||
let SHORT_COMMIT_LEN = 7
|
||||
let isCommitIDValid = (commitID.count == SHORT_COMMIT_LEN)
|
||||
let installedAppCommitID = Bundle.main.object(forInfoDictionaryKey: "BuildRevision") as? String ?? ""
|
||||
// when installing beta build over stable build installedAppCommitID will be empty!
|
||||
let isBetaUpdateAvailable = (installedAppCommitID != commitID)
|
||||
return isCommitIDValid && isBetaUpdateAvailable
|
||||
let isRevisionValid = (revision.count == SHORT_COMMIT_LEN)
|
||||
let installedAppRevision = Bundle.main.object(forInfoDictionaryKey: "BuildRevision") as? String ?? ""
|
||||
// when installing beta build over stable build installedAppRevision will be empty!
|
||||
let isBetaUpdateAvailable = (installedAppRevision != revision)
|
||||
return isRevisionValid && isBetaUpdateAvailable
|
||||
}
|
||||
}
|
||||
return false
|
||||
|
||||
@@ -150,8 +150,10 @@ public class StoreApp: NSManagedObject, Decodable, Fetchable
|
||||
@NSManaged public private(set) var platformURLs: PlatformURLs?
|
||||
|
||||
@NSManaged public private(set) var tintColor: UIColor?
|
||||
|
||||
// TODO: @mahee96: retire isBeta and use a string type to decode and store values as enum
|
||||
@NSManaged public private(set) var isBeta: Bool
|
||||
@NSManaged public private(set) var commitID: String?
|
||||
@NSManaged public private(set) var revision: String?
|
||||
|
||||
// Required for Marketplace apps.
|
||||
@NSManaged public private(set) var marketplaceID: String?
|
||||
@@ -290,7 +292,7 @@ public class StoreApp: NSManagedObject, Decodable, Fetchable
|
||||
case permissions = "appPermissions"
|
||||
case size
|
||||
case isBeta = "beta"
|
||||
case commitID
|
||||
case revision = "commitID"
|
||||
case versions
|
||||
case patreon
|
||||
case category
|
||||
@@ -322,7 +324,7 @@ public class StoreApp: NSManagedObject, Decodable, Fetchable
|
||||
|
||||
self.subtitle = try container.decodeIfPresent(String.self, forKey: .subtitle)
|
||||
self.isBeta = try container.decodeIfPresent(Bool.self, forKey: .isBeta) ?? false
|
||||
self.commitID = try container.decodeIfPresent(String.self, forKey: .commitID)
|
||||
self.revision = try container.decodeIfPresent(String.self, forKey: .revision)
|
||||
|
||||
var downloadURL = try container.decodeIfPresent(URL.self, forKey: .downloadURL)
|
||||
let platformURLs = try container.decodeIfPresent(PlatformURLs.self.self, forKey: .platformURLs)
|
||||
|
||||
Reference in New Issue
Block a user