mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
- Store: Reverted localized version for Store and version to be independent
This commit is contained in:
11
.github/workflows/reusable-build-workflow.yml
vendored
11
.github/workflows/reusable-build-workflow.yml
vendored
@@ -100,11 +100,15 @@ jobs:
|
|||||||
echo "cat Build.xcconfig"
|
echo "cat Build.xcconfig"
|
||||||
cat Build.xcconfig
|
cat Build.xcconfig
|
||||||
|
|
||||||
|
- name: Set Release Channel info for build number bumper
|
||||||
|
run: |
|
||||||
|
echo "RELEASE_CHANNEL=${{ inputs.release_tag }}" >> $GITHUB_OUTPUT
|
||||||
|
echo "RELEASE_CHANNEL=${RELEASE_CHANNEL}"
|
||||||
|
|
||||||
|
|
||||||
- name: Increase build number for beta builds
|
- name: Increase build number for beta builds
|
||||||
if: ${{ inputs.is_beta }}
|
if: ${{ inputs.is_beta }}
|
||||||
run: |
|
run: |
|
||||||
echo "RELEASE_CHANNEL=${{ inputs.release_tag }}" >> $GITHUB_OUTPUT
|
|
||||||
bash .github/workflows/increase-beta-build-num.sh
|
bash .github/workflows/increase-beta-build-num.sh
|
||||||
|
|
||||||
- name: Extract MARKETING_VERSION from Build.xcconfig
|
- name: Extract MARKETING_VERSION from Build.xcconfig
|
||||||
@@ -218,10 +222,13 @@ jobs:
|
|||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
|
||||||
|
- name: Set BundleID Suffix for Sidestore build
|
||||||
|
run: |
|
||||||
|
echo "BUNDLE_ID_SUFFIX=${{ inputs.bundle_id_suffix }}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Build SideStore
|
- name: Build SideStore
|
||||||
# using 'tee' to intercept stdout and log for detailed build-log
|
# using 'tee' to intercept stdout and log for detailed build-log
|
||||||
run: |
|
run: |
|
||||||
echo "BUNDLE_ID_SUFFIX=${{ inputs.bundle_id_suffix }}" >> $GITHUB_ENV
|
|
||||||
NSUnbufferedIO=YES make build 2>&1 | tee build.log | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
|
NSUnbufferedIO=YES make build 2>&1 | tee build.log | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
|
||||||
|
|
||||||
- name: Fakesign app
|
- name: Fakesign app
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ extension AppContentViewController
|
|||||||
switch Row.allCases[indexPath.row]
|
switch Row.allCases[indexPath.row]
|
||||||
{
|
{
|
||||||
case .screenshots:
|
case .screenshots:
|
||||||
guard !self.app.screenshots.isEmpty else { return 0.0 }
|
guard !self.app.allScreenshots.isEmpty else { return 0.0 }
|
||||||
return UITableView.automaticDimension
|
return UITableView.automaticDimension
|
||||||
|
|
||||||
case .permissions:
|
case .permissions:
|
||||||
|
|||||||
@@ -27,9 +27,9 @@
|
|||||||
</uniquenessConstraints>
|
</uniquenessConstraints>
|
||||||
</entity>
|
</entity>
|
||||||
<entity name="AppPermission" representedClassName="AppPermission" syncable="YES">
|
<entity name="AppPermission" representedClassName="AppPermission" syncable="YES">
|
||||||
<attribute name="appBundleID" optional="YES" attributeType="String" defaultValueString=""/>
|
<attribute name="appBundleID" attributeType="String"/>
|
||||||
<attribute name="permission" optional="YES" attributeType="String" defaultValueString=""/>
|
<attribute name="permission" attributeType="String"/>
|
||||||
<attribute name="sourceID" optional="YES" attributeType="String"/>
|
<attribute name="sourceID" attributeType="String"/>
|
||||||
<attribute name="type" attributeType="String"/>
|
<attribute name="type" attributeType="String"/>
|
||||||
<attribute name="usageDescription" attributeType="String"/>
|
<attribute name="usageDescription" attributeType="String"/>
|
||||||
<relationship name="app" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="StoreApp" inverseName="permissions" inverseEntity="StoreApp"/>
|
<relationship name="app" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="StoreApp" inverseName="permissions" inverseEntity="StoreApp"/>
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
<attribute name="certificateSerialNumber" optional="YES" attributeType="String"/>
|
<attribute name="certificateSerialNumber" optional="YES" attributeType="String"/>
|
||||||
<attribute name="expirationDate" attributeType="Date" usesScalarValueType="NO"/>
|
<attribute name="expirationDate" attributeType="Date" usesScalarValueType="NO"/>
|
||||||
<attribute name="hasAlternateIcon" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
|
<attribute name="hasAlternateIcon" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
|
||||||
<attribute name="hasUpdate" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
|
<attribute name="hasUpdate" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
|
||||||
<attribute name="installedDate" attributeType="Date" usesScalarValueType="NO"/>
|
<attribute name="installedDate" attributeType="Date" usesScalarValueType="NO"/>
|
||||||
<attribute name="isActive" attributeType="Boolean" defaultValueString="YES" usesScalarValueType="YES"/>
|
<attribute name="isActive" attributeType="Boolean" defaultValueString="YES" usesScalarValueType="YES"/>
|
||||||
<attribute name="isRefreshing" transient="YES" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
|
<attribute name="isRefreshing" transient="YES" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
|
||||||
@@ -229,7 +229,7 @@
|
|||||||
<attribute name="sourceURL" attributeType="URI"/>
|
<attribute name="sourceURL" attributeType="URI"/>
|
||||||
<attribute name="subtitle" optional="YES" attributeType="String"/>
|
<attribute name="subtitle" optional="YES" attributeType="String"/>
|
||||||
<attribute name="tintColor" optional="YES" attributeType="Transformable" valueTransformerName="ALTSecureValueTransformer"/>
|
<attribute name="tintColor" optional="YES" attributeType="Transformable" valueTransformerName="ALTSecureValueTransformer"/>
|
||||||
<attribute name="version" optional="YES" attributeType="Integer 64" defaultValueString="1" usesScalarValueType="NO"/>
|
<attribute name="version" attributeType="Integer 64" defaultValueString="1" usesScalarValueType="YES"/>
|
||||||
<attribute name="websiteURL" optional="YES" attributeType="URI"/>
|
<attribute name="websiteURL" optional="YES" attributeType="URI"/>
|
||||||
<relationship name="apps" toMany="YES" deletionRule="Cascade" ordered="YES" destinationEntity="StoreApp" inverseName="source" inverseEntity="StoreApp"/>
|
<relationship name="apps" toMany="YES" deletionRule="Cascade" ordered="YES" destinationEntity="StoreApp" inverseName="source" inverseEntity="StoreApp"/>
|
||||||
<relationship name="featuredApps" optional="YES" toMany="YES" deletionRule="Nullify" ordered="YES" destinationEntity="StoreApp" inverseName="featuringSource" inverseEntity="StoreApp"/>
|
<relationship name="featuredApps" optional="YES" toMany="YES" deletionRule="Nullify" ordered="YES" destinationEntity="StoreApp" inverseName="featuringSource" inverseEntity="StoreApp"/>
|
||||||
@@ -251,15 +251,14 @@
|
|||||||
<attribute name="isHiddenWithoutPledge" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
|
<attribute name="isHiddenWithoutPledge" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
|
||||||
<attribute name="isPledged" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
|
<attribute name="isPledged" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
|
||||||
<attribute name="isPledgeRequired" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
|
<attribute name="isPledgeRequired" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
|
||||||
<attribute name="localizedDescription" optional="YES" attributeType="String"/>
|
<attribute name="localizedDescription" attributeType="String"/>
|
||||||
<attribute name="marketplaceID" optional="YES" attributeType="String"/>
|
<attribute name="marketplaceID" optional="YES" attributeType="String"/>
|
||||||
<attribute name="name" attributeType="String"/>
|
<attribute name="name" attributeType="String"/>
|
||||||
<attribute name="pledgeAmount" optional="YES" attributeType="Decimal"/>
|
<attribute name="pledgeAmount" optional="YES" attributeType="Decimal"/>
|
||||||
<attribute name="pledgeCurrency" optional="YES" attributeType="String"/>
|
<attribute name="pledgeCurrency" optional="YES" attributeType="String"/>
|
||||||
<attribute name="prefersCustomPledge" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
|
<attribute name="prefersCustomPledge" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
|
||||||
<attribute name="screenshotURLs" attributeType="Transformable" valueTransformerName="ALTSecureValueTransformer"/>
|
<attribute name="screenshotURLs" attributeType="Transformable" valueTransformerName="ALTSecureValueTransformer"/>
|
||||||
<attribute name="sha256" optional="YES" attributeType="String"/>
|
<attribute name="size" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||||
<attribute name="size" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
|
|
||||||
<attribute name="sortIndex" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
<attribute name="sortIndex" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||||
<attribute name="sourceIdentifier" optional="YES" attributeType="String"/>
|
<attribute name="sourceIdentifier" optional="YES" attributeType="String"/>
|
||||||
<attribute name="subtitle" optional="YES" attributeType="String"/>
|
<attribute name="subtitle" optional="YES" attributeType="String"/>
|
||||||
|
|||||||
@@ -23,15 +23,10 @@ public class AppVersion: BaseEntity, Decodable
|
|||||||
@NSManaged @objc(buildVersion) public private(set) var _buildVersion: String
|
@NSManaged @objc(buildVersion) public private(set) var _buildVersion: String
|
||||||
|
|
||||||
@NSManaged public private(set) var date: Date
|
@NSManaged public private(set) var date: Date
|
||||||
@NSManaged @objc(localizedDescription) private(set) var _localizedDescription: String?
|
@NSManaged public private(set) var localizedDescription: String?
|
||||||
@NSManaged public private(set) var downloadURL: URL
|
@NSManaged public private(set) var downloadURL: URL
|
||||||
@NSManaged public private(set) var size: Int64
|
@NSManaged public private(set) var size: Int64
|
||||||
@NSManaged public private(set) var sha256: String?
|
@NSManaged public private(set) var sha256: String?
|
||||||
|
|
||||||
@nonobjc public var localizedDescription: String {
|
|
||||||
return self._localizedDescription ?? app?.localizedDescription ??
|
|
||||||
"localizedDescription not set, contact the source owner to fix this"
|
|
||||||
}
|
|
||||||
|
|
||||||
@nonobjc public var minOSVersion: OperatingSystemVersion? {
|
@nonobjc public var minOSVersion: OperatingSystemVersion? {
|
||||||
guard let osVersionString = self._minOSVersion else { return nil }
|
guard let osVersionString = self._minOSVersion else { return nil }
|
||||||
@@ -88,7 +83,7 @@ public class AppVersion: BaseEntity, Decodable
|
|||||||
self.buildVersion = try container.decodeIfPresent(String.self, forKey: .buildVersion)
|
self.buildVersion = try container.decodeIfPresent(String.self, forKey: .buildVersion)
|
||||||
|
|
||||||
self.date = try container.decode(Date.self, forKey: .date)
|
self.date = try container.decode(Date.self, forKey: .date)
|
||||||
self._localizedDescription = try container.decodeIfPresent(String.self, forKey: .localizedDescription)
|
self.localizedDescription = try container.decodeIfPresent(String.self, forKey: .localizedDescription)
|
||||||
|
|
||||||
self.downloadURL = try container.decode(URL.self, forKey: .downloadURL)
|
self.downloadURL = try container.decode(URL.self, forKey: .downloadURL)
|
||||||
self.size = try container.decode(Int64.self, forKey: .size)
|
self.size = try container.decode(Int64.self, forKey: .size)
|
||||||
@@ -154,7 +149,7 @@ public extension AppVersion
|
|||||||
appVersion.version = version
|
appVersion.version = version
|
||||||
appVersion.buildVersion = buildVersion
|
appVersion.buildVersion = buildVersion
|
||||||
appVersion.date = date
|
appVersion.date = date
|
||||||
appVersion._localizedDescription = localizedDescription
|
appVersion.localizedDescription = localizedDescription
|
||||||
appVersion.downloadURL = downloadURL
|
appVersion.downloadURL = downloadURL
|
||||||
appVersion.size = size
|
appVersion.size = size
|
||||||
appVersion.sha256 = sha256
|
appVersion.sha256 = sha256
|
||||||
|
|||||||
@@ -392,11 +392,11 @@ extension MergePolicy{
|
|||||||
// Screenshots
|
// Screenshots
|
||||||
if let sortedScreenshotIDs = sortedScreenshotIDsByGlobalAppID[globallyUniqueID],
|
if let sortedScreenshotIDs = sortedScreenshotIDsByGlobalAppID[globallyUniqueID],
|
||||||
let sortedScreenshotIDsArray = sortedScreenshotIDs.array as? [String],
|
let sortedScreenshotIDsArray = sortedScreenshotIDs.array as? [String],
|
||||||
case let databaseScreenshotIDs = databaseObject.screenshots.map({ $0.screenshotID }),
|
case let databaseScreenshotIDs = databaseObject.allScreenshots.map({ $0.screenshotID }),
|
||||||
databaseScreenshotIDs != sortedScreenshotIDsArray
|
databaseScreenshotIDs != sortedScreenshotIDsArray
|
||||||
{
|
{
|
||||||
// Screenshot order is incorrect, so attempt to fix by re-sorting.
|
// Screenshot order is incorrect, so attempt to fix by re-sorting.
|
||||||
let fixedScreenshots = databaseObject.screenshots.sorted { (screenshotA, screenshotB) in
|
let fixedScreenshots = databaseObject.allScreenshots.sorted { (screenshotA, screenshotB) in
|
||||||
let indexA = sortedScreenshotIDs.index(of: screenshotA.screenshotID)
|
let indexA = sortedScreenshotIDs.index(of: screenshotA.screenshotID)
|
||||||
let indexB = sortedScreenshotIDs.index(of: screenshotB.screenshotID)
|
let indexB = sortedScreenshotIDs.index(of: screenshotB.screenshotID)
|
||||||
return indexA < indexB
|
return indexA < indexB
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ fileprivate extension NSManagedObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
var storeAppSize: NSNumber? {
|
var storeAppSize: NSNumber? {
|
||||||
let size = self.value(forKey: #keyPath(StoreApp.size)) as? NSNumber
|
let size = self.value(forKey: #keyPath(StoreApp._size)) as? NSNumber
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ fileprivate extension NSManagedObject
|
|||||||
let appVersion = NSEntityDescription.insertNewObject(forEntityName: AppVersion.entity().name!, into: context)
|
let appVersion = NSEntityDescription.insertNewObject(forEntityName: AppVersion.entity().name!, into: context)
|
||||||
appVersion.setValue(version, forKey: #keyPath(AppVersion.version))
|
appVersion.setValue(version, forKey: #keyPath(AppVersion.version))
|
||||||
appVersion.setValue(date, forKey: #keyPath(AppVersion.date))
|
appVersion.setValue(date, forKey: #keyPath(AppVersion.date))
|
||||||
appVersion.setValue(localizedDescription, forKey: #keyPath(AppVersion._localizedDescription))
|
appVersion.setValue(localizedDescription, forKey: #keyPath(AppVersion.localizedDescription))
|
||||||
appVersion.setValue(downloadURL, forKey: #keyPath(AppVersion.downloadURL))
|
appVersion.setValue(downloadURL, forKey: #keyPath(AppVersion.downloadURL))
|
||||||
appVersion.setValue(size, forKey: #keyPath(AppVersion.size))
|
appVersion.setValue(size, forKey: #keyPath(AppVersion.size))
|
||||||
appVersion.setValue(appBundleID, forKey: #keyPath(AppVersion.appBundleID))
|
appVersion.setValue(appBundleID, forKey: #keyPath(AppVersion.appBundleID))
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public extension StoreApp
|
|||||||
#else
|
#else
|
||||||
static let altstoreAppID = Bundle.Info.appbundleIdentifier
|
static let altstoreAppID = Bundle.Info.appbundleIdentifier
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static let dolphinAppID = "me.oatmealdome.dolphinios-njb"
|
static let dolphinAppID = "me.oatmealdome.dolphinios-njb"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,22 +37,22 @@ public final class PlatformURL: NSManagedObject, Decodable {
|
|||||||
/* Properties */
|
/* Properties */
|
||||||
@NSManaged public private(set) var platform: Platform
|
@NSManaged public private(set) var platform: Platform
|
||||||
@NSManaged public private(set) var downloadURL: URL
|
@NSManaged public private(set) var downloadURL: URL
|
||||||
|
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey
|
private enum CodingKeys: String, CodingKey
|
||||||
{
|
{
|
||||||
case platform
|
case platform
|
||||||
case downloadURL
|
case downloadURL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public init(from decoder: Decoder) throws
|
public init(from decoder: Decoder) throws
|
||||||
{
|
{
|
||||||
guard let context = decoder.managedObjectContext else { preconditionFailure("Decoder must have non-nil NSManagedObjectContext.") }
|
guard let context = decoder.managedObjectContext else { preconditionFailure("Decoder must have non-nil NSManagedObjectContext.") }
|
||||||
|
|
||||||
// Must initialize with context in order for child context saves to work correctly.
|
// Must initialize with context in order for child context saves to work correctly.
|
||||||
super.init(entity: PlatformURL.entity(), insertInto: context)
|
super.init(entity: PlatformURL.entity(), insertInto: context)
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
@@ -65,7 +65,7 @@ public final class PlatformURL: NSManagedObject, Decodable {
|
|||||||
{
|
{
|
||||||
context.delete(self)
|
context.delete(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -75,15 +75,15 @@ extension PlatformURL: Comparable {
|
|||||||
public static func < (lhs: PlatformURL, rhs: PlatformURL) -> Bool {
|
public static func < (lhs: PlatformURL, rhs: PlatformURL) -> Bool {
|
||||||
return lhs.platform.rawValue < rhs.platform.rawValue
|
return lhs.platform.rawValue < rhs.platform.rawValue
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func > (lhs: PlatformURL, rhs: PlatformURL) -> Bool {
|
public static func > (lhs: PlatformURL, rhs: PlatformURL) -> Bool {
|
||||||
return lhs.platform.rawValue > rhs.platform.rawValue
|
return lhs.platform.rawValue > rhs.platform.rawValue
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func <= (lhs: PlatformURL, rhs: PlatformURL) -> Bool {
|
public static func <= (lhs: PlatformURL, rhs: PlatformURL) -> Bool {
|
||||||
return lhs.platform.rawValue <= rhs.platform.rawValue
|
return lhs.platform.rawValue <= rhs.platform.rawValue
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func >= (lhs: PlatformURL, rhs: PlatformURL) -> Bool {
|
public static func >= (lhs: PlatformURL, rhs: PlatformURL) -> Bool {
|
||||||
return lhs.platform.rawValue >= rhs.platform.rawValue
|
return lhs.platform.rawValue >= rhs.platform.rawValue
|
||||||
}
|
}
|
||||||
@@ -97,11 +97,11 @@ private struct PatreonParameters: Decodable
|
|||||||
{
|
{
|
||||||
var amount: Decimal
|
var amount: Decimal
|
||||||
var isCustom: Bool
|
var isCustom: Bool
|
||||||
|
|
||||||
init(from decoder: Decoder) throws
|
init(from decoder: Decoder) throws
|
||||||
{
|
{
|
||||||
let container = try decoder.singleValueContainer()
|
let container = try decoder.singleValueContainer()
|
||||||
|
|
||||||
if let stringValue = try? container.decode(String.self), stringValue == "custom"
|
if let stringValue = try? container.decode(String.self), stringValue == "custom"
|
||||||
{
|
{
|
||||||
self.amount = 0 // Use 0 as amount internally to simplify logic.
|
self.amount = 0 // Use 0 as amount internally to simplify logic.
|
||||||
@@ -115,7 +115,7 @@ private struct PatreonParameters: Decodable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var pledge: Pledge?
|
var pledge: Pledge?
|
||||||
var currency: String?
|
var currency: String?
|
||||||
var tiers: Set<String>?
|
var tiers: Set<String>?
|
||||||
@@ -123,12 +123,6 @@ private struct PatreonParameters: Decodable
|
|||||||
var hidden: Bool?
|
var hidden: Bool?
|
||||||
}
|
}
|
||||||
|
|
||||||
// added for v0.6.0
|
|
||||||
extension StoreApp {
|
|
||||||
//MARK: - properties
|
|
||||||
@NSManaged public private(set) var sha256: String?
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@objc(StoreApp)
|
@objc(StoreApp)
|
||||||
public class StoreApp: BaseEntity, Decodable
|
public class StoreApp: BaseEntity, Decodable
|
||||||
@@ -137,30 +131,28 @@ public class StoreApp: BaseEntity, Decodable
|
|||||||
@NSManaged public private(set) var name: String
|
@NSManaged public private(set) var name: String
|
||||||
@NSManaged public private(set) var bundleIdentifier: String
|
@NSManaged public private(set) var bundleIdentifier: String
|
||||||
@NSManaged public private(set) var subtitle: String?
|
@NSManaged public private(set) var subtitle: String?
|
||||||
|
|
||||||
@NSManaged public private(set) var developerName: String
|
@NSManaged public private(set) var developerName: String
|
||||||
@NSManaged public private(set) var localizedDescription: String?
|
@NSManaged public private(set) var localizedDescription: String
|
||||||
@NSManaged public private(set) var size: Int64
|
@NSManaged @objc(size) internal var _size: Int32
|
||||||
|
|
||||||
@nonobjc public var category: StoreCategory? {
|
@nonobjc public var category: StoreCategory? {
|
||||||
guard let _category else { return nil }
|
guard let _category else { return nil }
|
||||||
|
|
||||||
let category = StoreCategory(rawValue: _category)
|
let category = StoreCategory(rawValue: _category)
|
||||||
return category
|
return category
|
||||||
}
|
}
|
||||||
@NSManaged @objc(category) public private(set) var _category: String?
|
@NSManaged @objc(category) public private(set) var _category: String?
|
||||||
|
|
||||||
@NSManaged public private(set) var iconURL: URL
|
@NSManaged public private(set) var iconURL: URL
|
||||||
@NSManaged public private(set) var screenshotURLs: [URL]
|
@NSManaged public private(set) var screenshotURLs: [URL]
|
||||||
|
|
||||||
@NSManaged public private(set) var downloadURL: URL?
|
@NSManaged public private(set) var downloadURL: URL?
|
||||||
@NSManaged public private(set) var platformURLs: PlatformURLs?
|
@NSManaged public private(set) var platformURLs: PlatformURLs?
|
||||||
|
|
||||||
@NSManaged public private(set) var tintColor: UIColor?
|
@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 isBeta: Bool
|
||||||
|
|
||||||
// Required for Marketplace apps.
|
// Required for Marketplace apps.
|
||||||
@NSManaged public private(set) var marketplaceID: String?
|
@NSManaged public private(set) var marketplaceID: String?
|
||||||
|
|
||||||
@@ -169,18 +161,18 @@ public class StoreApp: BaseEntity, Decodable
|
|||||||
@NSManaged public private(set) var isHiddenWithoutPledge: Bool
|
@NSManaged public private(set) var isHiddenWithoutPledge: Bool
|
||||||
@NSManaged public private(set) var pledgeCurrency: String?
|
@NSManaged public private(set) var pledgeCurrency: String?
|
||||||
@NSManaged public private(set) var prefersCustomPledge: Bool
|
@NSManaged public private(set) var prefersCustomPledge: Bool
|
||||||
|
|
||||||
@nonobjc public var pledgeAmount: Decimal? { _pledgeAmount as? Decimal }
|
@nonobjc public var pledgeAmount: Decimal? { _pledgeAmount as? Decimal }
|
||||||
@NSManaged @objc(pledgeAmount) private var _pledgeAmount: NSDecimalNumber?
|
@NSManaged @objc(pledgeAmount) private var _pledgeAmount: NSDecimalNumber?
|
||||||
|
|
||||||
@NSManaged public var sortIndex: Int32
|
@NSManaged public var sortIndex: Int32
|
||||||
@NSManaged public var featuredSortID: String?
|
@NSManaged public var featuredSortID: String?
|
||||||
|
|
||||||
@objc public internal(set) var sourceIdentifier: String? {
|
@objc public internal(set) var sourceIdentifier: String? {
|
||||||
get {
|
get {
|
||||||
self.willAccessValue(forKey: #keyPath(sourceIdentifier))
|
self.willAccessValue(forKey: #keyPath(sourceIdentifier))
|
||||||
defer { self.didAccessValue(forKey: #keyPath(sourceIdentifier)) }
|
defer { self.didAccessValue(forKey: #keyPath(sourceIdentifier)) }
|
||||||
|
|
||||||
let sourceIdentifier = self.primitiveSourceIdentifier
|
let sourceIdentifier = self.primitiveSourceIdentifier
|
||||||
return sourceIdentifier
|
return sourceIdentifier
|
||||||
}
|
}
|
||||||
@@ -188,48 +180,48 @@ public class StoreApp: BaseEntity, Decodable
|
|||||||
self.willChangeValue(forKey: #keyPath(sourceIdentifier))
|
self.willChangeValue(forKey: #keyPath(sourceIdentifier))
|
||||||
self.primitiveSourceIdentifier = newValue
|
self.primitiveSourceIdentifier = newValue
|
||||||
self.didChangeValue(forKey: #keyPath(sourceIdentifier))
|
self.didChangeValue(forKey: #keyPath(sourceIdentifier))
|
||||||
|
|
||||||
for version in self.versions
|
for version in self.versions
|
||||||
{
|
{
|
||||||
version.sourceID = newValue
|
version.sourceID = newValue
|
||||||
}
|
}
|
||||||
|
|
||||||
for permission in self.permissions
|
for permission in self.permissions
|
||||||
{
|
{
|
||||||
permission.sourceID = self.sourceIdentifier ?? ""
|
permission.sourceID = self.sourceIdentifier ?? ""
|
||||||
}
|
}
|
||||||
|
|
||||||
for screenshot in self.screenshots
|
for screenshot in self.allScreenshots
|
||||||
{
|
{
|
||||||
screenshot.sourceID = self.sourceIdentifier ?? ""
|
screenshot.sourceID = self.sourceIdentifier ?? ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@NSManaged private var primitiveSourceIdentifier: String?
|
@NSManaged private var primitiveSourceIdentifier: String?
|
||||||
|
|
||||||
// Legacy (kept for backwards compatibility)
|
// Legacy (kept for backwards compatibility)
|
||||||
@NSManaged public private(set) var version: String?
|
@NSManaged public private(set) var version: String?
|
||||||
@NSManaged public private(set) var versionDate: Date?
|
@NSManaged public private(set) var versionDate: Date?
|
||||||
@NSManaged public private(set) var versionDescription: String?
|
@NSManaged public private(set) var versionDescription: String?
|
||||||
|
|
||||||
/* Relationships */
|
/* Relationships */
|
||||||
@NSManaged public var installedApp: InstalledApp?
|
@NSManaged public var installedApp: InstalledApp?
|
||||||
@NSManaged public var newsItems: Set<NewsItem>
|
@NSManaged public var newsItems: Set<NewsItem>
|
||||||
|
|
||||||
@NSManaged @objc(source) public var _source: Source?
|
@NSManaged @objc(source) public var _source: Source?
|
||||||
@NSManaged public internal(set) var featuringSource: Source?
|
@NSManaged public internal(set) var featuringSource: Source?
|
||||||
|
|
||||||
@NSManaged @objc(latestVersion) public private(set) var latestSupportedVersion: AppVersion?
|
@NSManaged @objc(latestVersion) public private(set) var latestSupportedVersion: AppVersion?
|
||||||
@NSManaged @objc(versions) public private(set) var _versions: NSOrderedSet
|
@NSManaged @objc(versions) public private(set) var _versions: NSOrderedSet
|
||||||
|
|
||||||
@NSManaged public private(set) var loggedErrors: NSSet /* Set<LoggedError> */ // Use NSSet to avoid eagerly fetching values.
|
@NSManaged public private(set) var loggedErrors: NSSet /* Set<LoggedError> */ // Use NSSet to avoid eagerly fetching values.
|
||||||
|
|
||||||
/* Non-Core Data Properties */
|
/* Non-Core Data Properties */
|
||||||
|
|
||||||
// Used to set isPledged after fetching source.
|
// Used to set isPledged after fetching source.
|
||||||
public var _tierIDs: Set<String>?
|
public var _tierIDs: Set<String>?
|
||||||
public var _rewardID: String?
|
public var _rewardID: String?
|
||||||
|
|
||||||
@nonobjc public var source: Source? {
|
@nonobjc public var source: Source? {
|
||||||
set {
|
set {
|
||||||
self._source = newValue
|
self._source = newValue
|
||||||
@@ -239,26 +231,26 @@ public class StoreApp: BaseEntity, Decodable
|
|||||||
return self._source
|
return self._source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@nonobjc public var permissions: Set<AppPermission> {
|
@nonobjc public var permissions: Set<AppPermission> {
|
||||||
return self._permissions as! Set<AppPermission>
|
return self._permissions as! Set<AppPermission>
|
||||||
}
|
}
|
||||||
@NSManaged @objc(permissions) internal private(set) var _permissions: NSSet // Use NSSet to avoid eagerly fetching values.
|
@NSManaged @objc(permissions) internal private(set) var _permissions: NSSet // Use NSSet to avoid eagerly fetching values.
|
||||||
|
|
||||||
@nonobjc public var versions: [AppVersion] {
|
@nonobjc public var versions: [AppVersion] {
|
||||||
return self._versions.array as! [AppVersion]
|
return self._versions.array as! [AppVersion]
|
||||||
}
|
}
|
||||||
|
|
||||||
@nonobjc public var screenshots: [AppScreenshot] {
|
@nonobjc public var allScreenshots: [AppScreenshot] {
|
||||||
return self._screenshots.array as! [AppScreenshot]
|
return self._screenshots.array as! [AppScreenshot]
|
||||||
}
|
}
|
||||||
@NSManaged @objc(screenshots) private(set) var _screenshots: NSOrderedSet
|
@NSManaged @objc(screenshots) private(set) var _screenshots: NSOrderedSet
|
||||||
|
|
||||||
private override init(entity: NSEntityDescription, insertInto context: NSManagedObjectContext?)
|
private override init(entity: NSEntityDescription, insertInto context: NSManagedObjectContext?)
|
||||||
{
|
{
|
||||||
super.init(entity: entity, insertInto: context)
|
super.init(entity: entity, insertInto: context)
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey
|
private enum CodingKeys: String, CodingKey
|
||||||
{
|
{
|
||||||
case name
|
case name
|
||||||
@@ -277,56 +269,53 @@ public class StoreApp: BaseEntity, Decodable
|
|||||||
case versions
|
case versions
|
||||||
case patreon
|
case patreon
|
||||||
case category
|
case category
|
||||||
|
|
||||||
// Legacy
|
// Legacy
|
||||||
case version
|
case version
|
||||||
case versionDescription
|
case versionDescription
|
||||||
case versionDate
|
case versionDate
|
||||||
case downloadURL
|
case downloadURL
|
||||||
case screenshotURLs
|
case screenshotURLs
|
||||||
|
|
||||||
// new for v0.6.0
|
|
||||||
case sha256
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public required init(from decoder: Decoder) throws
|
public required init(from decoder: Decoder) throws
|
||||||
{
|
{
|
||||||
guard let context = decoder.managedObjectContext else { preconditionFailure("Decoder must have non-nil NSManagedObjectContext.") }
|
guard let context = decoder.managedObjectContext else { preconditionFailure("Decoder must have non-nil NSManagedObjectContext.") }
|
||||||
|
|
||||||
// Must initialize with context in order for child context saves to work correctly.
|
// Must initialize with context in order for child context saves to work correctly.
|
||||||
super.init(entity: StoreApp.entity(), insertInto: context)
|
super.init(entity: StoreApp.entity(), insertInto: context)
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
|
||||||
self.sha256 = try container.decodeIfPresent(String.self, forKey: .sha256)
|
|
||||||
|
|
||||||
self.name = try container.decode(String.self, forKey: .name)
|
self.name = try container.decode(String.self, forKey: .name)
|
||||||
self.bundleIdentifier = try container.decode(String.self, forKey: .bundleIdentifier)
|
self.bundleIdentifier = try container.decode(String.self, forKey: .bundleIdentifier)
|
||||||
self.developerName = try container.decode(String.self, forKey: .developerName)
|
self.developerName = try container.decode(String.self, forKey: .developerName)
|
||||||
self.localizedDescription = try container.decodeIfPresent(String.self, forKey: .localizedDescription)
|
self.localizedDescription = try container.decode(String.self, forKey: .localizedDescription)
|
||||||
self.iconURL = try container.decode(URL.self, forKey: .iconURL)
|
self.iconURL = try container.decode(URL.self, forKey: .iconURL)
|
||||||
|
|
||||||
self.subtitle = try container.decodeIfPresent(String.self, forKey: .subtitle)
|
self.subtitle = try container.decodeIfPresent(String.self, forKey: .subtitle)
|
||||||
self.isBeta = try container.decodeIfPresent(Bool.self, forKey: .isBeta) ?? false
|
self.isBeta = try container.decodeIfPresent(Bool.self, forKey: .isBeta) ?? false
|
||||||
|
|
||||||
|
// Required for Marketplace apps, but we'll verify later.
|
||||||
|
self.marketplaceID = try container.decodeIfPresent(String.self, forKey: .marketplaceID)
|
||||||
|
|
||||||
if let tintColorHex = try container.decodeIfPresent(String.self, forKey: .tintColor)
|
if let tintColorHex = try container.decodeIfPresent(String.self, forKey: .tintColor)
|
||||||
{
|
{
|
||||||
guard let tintColor = UIColor(hexString: tintColorHex) else {
|
guard let tintColor = UIColor(hexString: tintColorHex) else {
|
||||||
throw DecodingError.dataCorruptedError(forKey: .tintColor, in: container, debugDescription: "Hex code is invalid.")
|
throw DecodingError.dataCorruptedError(forKey: .tintColor, in: container, debugDescription: "Hex code is invalid.")
|
||||||
}
|
}
|
||||||
|
|
||||||
self.tintColor = tintColor
|
self.tintColor = tintColor
|
||||||
}
|
}
|
||||||
|
|
||||||
if let rawCategory = try container.decodeIfPresent(String.self, forKey: .category)
|
if let rawCategory = try container.decodeIfPresent(String.self, forKey: .category)
|
||||||
{
|
{
|
||||||
self._category = rawCategory.lowercased() // Store raw (lowercased) category value.
|
self._category = rawCategory.lowercased() // Store raw (lowercased) category value.
|
||||||
}
|
}
|
||||||
|
|
||||||
let appScreenshots: [AppScreenshot]
|
let appScreenshots: [AppScreenshot]
|
||||||
|
|
||||||
if let screenshots = try container.decodeIfPresent(AppScreenshots.self, forKey: .screenshots)
|
if let screenshots = try container.decodeIfPresent(AppScreenshots.self, forKey: .screenshots)
|
||||||
{
|
{
|
||||||
appScreenshots = screenshots.screenshots
|
appScreenshots = screenshots.screenshots
|
||||||
@@ -335,7 +324,7 @@ public class StoreApp: BaseEntity, Decodable
|
|||||||
{
|
{
|
||||||
// Assume 9:16 iPhone 8 screen dimensions for legacy screenshotURLs.
|
// Assume 9:16 iPhone 8 screen dimensions for legacy screenshotURLs.
|
||||||
let legacyAspectRatio = CGSize(width: 750, height: 1334)
|
let legacyAspectRatio = CGSize(width: 750, height: 1334)
|
||||||
|
|
||||||
appScreenshots = screenshotURLs.map { imageURL in
|
appScreenshots = screenshotURLs.map { imageURL in
|
||||||
let screenshot = AppScreenshot(imageURL: imageURL, size: legacyAspectRatio, deviceType: .iphone, context: context)
|
let screenshot = AppScreenshot(imageURL: imageURL, size: legacyAspectRatio, deviceType: .iphone, context: context)
|
||||||
return screenshot
|
return screenshot
|
||||||
@@ -343,7 +332,7 @@ public class StoreApp: BaseEntity, Decodable
|
|||||||
|
|
||||||
// // Update to iPhone 13 screen size
|
// // Update to iPhone 13 screen size
|
||||||
// let modernAspectRatio = CGSize(width: 1170, height: 2532)
|
// let modernAspectRatio = CGSize(width: 1170, height: 2532)
|
||||||
|
|
||||||
// appScreenshots = screenshotURLs.map { imageURL in
|
// appScreenshots = screenshotURLs.map { imageURL in
|
||||||
// let screenshot = AppScreenshot(imageURL: imageURL, size: modernAspectRatio, deviceType: .iphone, context: context)
|
// let screenshot = AppScreenshot(imageURL: imageURL, size: modernAspectRatio, deviceType: .iphone, context: context)
|
||||||
// return screenshot
|
// return screenshot
|
||||||
@@ -353,14 +342,14 @@ public class StoreApp: BaseEntity, Decodable
|
|||||||
{
|
{
|
||||||
appScreenshots = []
|
appScreenshots = []
|
||||||
}
|
}
|
||||||
|
|
||||||
for screenshot in appScreenshots
|
for screenshot in appScreenshots
|
||||||
{
|
{
|
||||||
screenshot.appBundleID = self.bundleIdentifier
|
screenshot.appBundleID = self.bundleIdentifier
|
||||||
}
|
}
|
||||||
|
|
||||||
self.setScreenshots(appScreenshots)
|
self.setScreenshots(appScreenshots)
|
||||||
|
|
||||||
if let appPermissions = try container.decodeIfPresent(AppPermissions.self, forKey: .permissions)
|
if let appPermissions = try container.decodeIfPresent(AppPermissions.self, forKey: .permissions)
|
||||||
{
|
{
|
||||||
let allPermissions = appPermissions.entitlements + appPermissions.privacy
|
let allPermissions = appPermissions.entitlements + appPermissions.privacy
|
||||||
@@ -368,20 +357,16 @@ public class StoreApp: BaseEntity, Decodable
|
|||||||
{
|
{
|
||||||
permission.appBundleID = self.bundleIdentifier
|
permission.appBundleID = self.bundleIdentifier
|
||||||
}
|
}
|
||||||
|
|
||||||
self._permissions = NSSet(array: allPermissions)
|
self._permissions = NSSet(array: allPermissions)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
self._permissions = NSSet()
|
self._permissions = NSSet()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Required for Marketplace apps, but we'll verify later.
|
|
||||||
self.marketplaceID = try container.decodeIfPresent(String.self, forKey: .marketplaceID)
|
|
||||||
|
|
||||||
if let versions = try container.decodeIfPresent([AppVersion].self, forKey: .versions)
|
if let versions = try container.decodeIfPresent([AppVersion].self, forKey: .versions)
|
||||||
{
|
{
|
||||||
//TODO: Throw error if there isn't at least one version.
|
|
||||||
if (versions.count == 0){
|
if (versions.count == 0){
|
||||||
throw DecodingError.dataCorruptedError(forKey: .versions, in: container, debugDescription: "At least one version is required in key: versions")
|
throw DecodingError.dataCorruptedError(forKey: .versions, in: container, debugDescription: "At least one version is required in key: versions")
|
||||||
}
|
}
|
||||||
@@ -417,7 +402,7 @@ public class StoreApp: BaseEntity, Decodable
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try self.setVersions(versions)
|
try self.setVersions(versions)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -425,10 +410,10 @@ public class StoreApp: BaseEntity, Decodable
|
|||||||
let version = try container.decode(String.self, forKey: .version)
|
let version = try container.decode(String.self, forKey: .version)
|
||||||
let versionDate = try container.decode(Date.self, forKey: .versionDate)
|
let versionDate = try container.decode(Date.self, forKey: .versionDate)
|
||||||
let versionDescription = try container.decodeIfPresent(String.self, forKey: .versionDescription)
|
let versionDescription = try container.decodeIfPresent(String.self, forKey: .versionDescription)
|
||||||
|
|
||||||
let downloadURL = try container.decode(URL.self, forKey: .downloadURL)
|
let downloadURL = try container.decode(URL.self, forKey: .downloadURL)
|
||||||
let size = try container.decode(Int32.self, forKey: .size)
|
let size = try container.decode(Int32.self, forKey: .size)
|
||||||
|
|
||||||
let appVersion = AppVersion.makeAppVersion(version: version,
|
let appVersion = AppVersion.makeAppVersion(version: version,
|
||||||
buildVersion: nil,
|
buildVersion: nil,
|
||||||
date: versionDate,
|
date: versionDate,
|
||||||
@@ -439,7 +424,7 @@ public class StoreApp: BaseEntity, Decodable
|
|||||||
in: context)
|
in: context)
|
||||||
try self.setVersions([appVersion])
|
try self.setVersions([appVersion])
|
||||||
}
|
}
|
||||||
|
|
||||||
// latestSupportedVersion is set by this point if one was available
|
// latestSupportedVersion is set by this point if one was available
|
||||||
let platformURLs = try container.decodeIfPresent(PlatformURLs.self.self, forKey: .platformURLs)
|
let platformURLs = try container.decodeIfPresent(PlatformURLs.self.self, forKey: .platformURLs)
|
||||||
if let platformURLs = platformURLs {
|
if let platformURLs = platformURLs {
|
||||||
@@ -461,16 +446,16 @@ public class StoreApp: BaseEntity, Decodable
|
|||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Must _explicitly_ set to false to ensure it updates cached database value.
|
// Must _explicitly_ set to false to ensure it updates cached database value.
|
||||||
self.isPledged = false
|
self.isPledged = false
|
||||||
self.prefersCustomPledge = false
|
self.prefersCustomPledge = false
|
||||||
|
|
||||||
if let patreon = try container.decodeIfPresent(PatreonParameters.self, forKey: .patreon)
|
if let patreon = try container.decodeIfPresent(PatreonParameters.self, forKey: .patreon)
|
||||||
{
|
{
|
||||||
self.isPledgeRequired = true
|
self.isPledgeRequired = true
|
||||||
self.isHiddenWithoutPledge = patreon.hidden ?? false // Default to showing Patreon apps
|
self.isHiddenWithoutPledge = patreon.hidden ?? false // Default to showing Patreon apps
|
||||||
|
|
||||||
if let pledge = patreon.pledge
|
if let pledge = patreon.pledge
|
||||||
{
|
{
|
||||||
self._pledgeAmount = pledge.amount as NSDecimalNumber
|
self._pledgeAmount = pledge.amount as NSDecimalNumber
|
||||||
@@ -482,7 +467,7 @@ public class StoreApp: BaseEntity, Decodable
|
|||||||
// No conditions, so default to pledgeAmount of 0 to simplify logic.
|
// No conditions, so default to pledgeAmount of 0 to simplify logic.
|
||||||
self._pledgeAmount = 0 as NSDecimalNumber
|
self._pledgeAmount = 0 as NSDecimalNumber
|
||||||
}
|
}
|
||||||
|
|
||||||
self._tierIDs = patreon.tiers
|
self._tierIDs = patreon.tiers
|
||||||
self._rewardID = patreon.benefit
|
self._rewardID = patreon.benefit
|
||||||
}
|
}
|
||||||
@@ -492,7 +477,7 @@ public class StoreApp: BaseEntity, Decodable
|
|||||||
self.isHiddenWithoutPledge = false
|
self.isHiddenWithoutPledge = false
|
||||||
self._pledgeAmount = nil
|
self._pledgeAmount = nil
|
||||||
self.pledgeCurrency = nil
|
self.pledgeCurrency = nil
|
||||||
|
|
||||||
self._tierIDs = nil
|
self._tierIDs = nil
|
||||||
self._rewardID = nil
|
self._rewardID = nil
|
||||||
}
|
}
|
||||||
@@ -503,15 +488,15 @@ public class StoreApp: BaseEntity, Decodable
|
|||||||
{
|
{
|
||||||
context.delete(self)
|
context.delete(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func awakeFromInsert()
|
public override func awakeFromInsert()
|
||||||
{
|
{
|
||||||
super.awakeFromInsert()
|
super.awakeFromInsert()
|
||||||
|
|
||||||
self.featuredSortID = UUID().uuidString
|
self.featuredSortID = UUID().uuidString
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -525,10 +510,10 @@ internal extension StoreApp
|
|||||||
}
|
}
|
||||||
|
|
||||||
self._versions = NSOrderedSet(array: versions)
|
self._versions = NSOrderedSet(array: versions)
|
||||||
|
|
||||||
let latestSupportedVersion = versions.first(where: { $0.isSupported })
|
let latestSupportedVersion = versions.first(where: { $0.isSupported })
|
||||||
self.latestSupportedVersion = latestSupportedVersion
|
self.latestSupportedVersion = latestSupportedVersion
|
||||||
|
|
||||||
for case let version as AppVersion in self._versions
|
for case let version as AppVersion in self._versions
|
||||||
{
|
{
|
||||||
if version == latestSupportedVersion
|
if version == latestSupportedVersion
|
||||||
@@ -541,17 +526,15 @@ internal extension StoreApp
|
|||||||
version.latestSupportedVersionApp = nil
|
version.latestSupportedVersionApp = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Preserve backwards compatibility by assigning legacy property values.
|
// Preserve backwards compatibility by assigning legacy property values.
|
||||||
self.version = latestVersion.version
|
self.version = latestVersion.version
|
||||||
self.versionDate = latestVersion.date
|
self.versionDate = latestVersion.date
|
||||||
self.versionDescription = latestVersion.localizedDescription
|
self.versionDescription = latestVersion.localizedDescription
|
||||||
self.downloadURL = latestVersion.downloadURL
|
self.downloadURL = latestVersion.downloadURL
|
||||||
self.size = latestVersion.size
|
self._size = Int32(latestVersion.size)
|
||||||
self.localizedDescription = latestVersion.localizedDescription
|
|
||||||
self.sha256 = latestVersion.sha256
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func setPermissions(_ permissions: Set<AppPermission>)
|
func setPermissions(_ permissions: Set<AppPermission>)
|
||||||
{
|
{
|
||||||
for case let permission as AppPermission in self._permissions
|
for case let permission as AppPermission in self._permissions
|
||||||
@@ -565,10 +548,10 @@ internal extension StoreApp
|
|||||||
permission.app = nil
|
permission.app = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self._permissions = permissions as NSSet
|
self._permissions = permissions as NSSet
|
||||||
}
|
}
|
||||||
|
|
||||||
func setScreenshots(_ screenshots: [AppScreenshot])
|
func setScreenshots(_ screenshots: [AppScreenshot])
|
||||||
{
|
{
|
||||||
for case let screenshot as AppScreenshot in self._screenshots
|
for case let screenshot as AppScreenshot in self._screenshots
|
||||||
@@ -582,9 +565,9 @@ internal extension StoreApp
|
|||||||
screenshot.app = nil
|
screenshot.app = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self._screenshots = NSOrderedSet(array: screenshots)
|
self._screenshots = NSOrderedSet(array: screenshots)
|
||||||
|
|
||||||
// Backwards compatibility
|
// Backwards compatibility
|
||||||
self.screenshotURLs = screenshots.map { $0.imageURL }
|
self.screenshotURLs = screenshots.map { $0.imageURL }
|
||||||
}
|
}
|
||||||
@@ -595,14 +578,14 @@ public extension StoreApp
|
|||||||
func screenshots(for deviceType: ALTDeviceType) -> [AppScreenshot]
|
func screenshots(for deviceType: ALTDeviceType) -> [AppScreenshot]
|
||||||
{
|
{
|
||||||
//TODO: Support multiple device types
|
//TODO: Support multiple device types
|
||||||
let filteredScreenshots = self.screenshots.filter { $0.deviceType == deviceType }
|
let filteredScreenshots = self.allScreenshots.filter { $0.deviceType == deviceType }
|
||||||
return filteredScreenshots
|
return filteredScreenshots
|
||||||
}
|
}
|
||||||
|
|
||||||
func preferredScreenshots() -> [AppScreenshot]
|
func preferredScreenshots() -> [AppScreenshot]
|
||||||
{
|
{
|
||||||
let deviceType: ALTDeviceType
|
let deviceType: ALTDeviceType
|
||||||
|
|
||||||
if UIDevice.current.model.contains("iPad")
|
if UIDevice.current.model.contains("iPad")
|
||||||
{
|
{
|
||||||
deviceType = .ipad
|
deviceType = .ipad
|
||||||
@@ -611,13 +594,13 @@ public extension StoreApp
|
|||||||
{
|
{
|
||||||
deviceType = .iphone
|
deviceType = .iphone
|
||||||
}
|
}
|
||||||
|
|
||||||
let preferredScreenshots = self.screenshots(for: deviceType)
|
let preferredScreenshots = self.screenshots(for: deviceType)
|
||||||
guard !preferredScreenshots.isEmpty else {
|
guard !preferredScreenshots.isEmpty else {
|
||||||
// There are no screenshots for deviceType, so return _all_ screenshots instead.
|
// There are no screenshots for deviceType, so return _all_ screenshots instead.
|
||||||
return self.screenshots
|
return self.allScreenshots
|
||||||
}
|
}
|
||||||
|
|
||||||
return preferredScreenshots
|
return preferredScreenshots
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -627,10 +610,10 @@ public extension StoreApp
|
|||||||
var latestAvailableVersion: AppVersion? {
|
var latestAvailableVersion: AppVersion? {
|
||||||
return self._versions.firstObject as? AppVersion
|
return self._versions.firstObject as? AppVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
var globallyUniqueID: String? {
|
var globallyUniqueID: String? {
|
||||||
guard let sourceIdentifier = self.sourceIdentifier else { return nil }
|
guard let sourceIdentifier = self.sourceIdentifier else { return nil }
|
||||||
|
|
||||||
let globallyUniqueID = self.bundleIdentifier + "|" + sourceIdentifier
|
let globallyUniqueID = self.bundleIdentifier + "|" + sourceIdentifier
|
||||||
return globallyUniqueID
|
return globallyUniqueID
|
||||||
}
|
}
|
||||||
@@ -646,60 +629,41 @@ public extension StoreApp
|
|||||||
#keyPath(StoreApp.isPledged))
|
#keyPath(StoreApp.isPledged))
|
||||||
return predicate
|
return predicate
|
||||||
}
|
}
|
||||||
|
|
||||||
class var otherCategoryPredicate: NSPredicate {
|
class var otherCategoryPredicate: NSPredicate {
|
||||||
let knownCategories = StoreCategory.allCases.lazy.filter { $0 != .other }.map { $0.rawValue }
|
let knownCategories = StoreCategory.allCases.lazy.filter { $0 != .other }.map { $0.rawValue }
|
||||||
|
|
||||||
let predicate = NSPredicate(format: "%K == nil OR NOT (%K IN %@)", #keyPath(StoreApp._category), #keyPath(StoreApp._category), Array(knownCategories))
|
let predicate = NSPredicate(format: "%K == nil OR NOT (%K IN %@)", #keyPath(StoreApp._category), #keyPath(StoreApp._category), Array(knownCategories))
|
||||||
return predicate
|
return predicate
|
||||||
}
|
}
|
||||||
|
|
||||||
@nonobjc class func fetchRequest() -> NSFetchRequest<StoreApp>
|
@nonobjc class func fetchRequest() -> NSFetchRequest<StoreApp>
|
||||||
{
|
{
|
||||||
return NSFetchRequest<StoreApp>(entityName: "StoreApp")
|
return NSFetchRequest<StoreApp>(entityName: "StoreApp")
|
||||||
}
|
}
|
||||||
|
|
||||||
//MARK: - override in subclasses if required
|
|
||||||
@objc func placeholderAppVersion(appVersion: AppVersion, in context: NSManagedObjectContext) -> AppVersion{
|
|
||||||
return appVersion
|
|
||||||
}
|
|
||||||
//MARK: - override in subclasses if required
|
|
||||||
@objc class func createStoreApp(in context: NSManagedObjectContext) -> StoreApp{
|
|
||||||
return StoreApp(context: context)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class func isPlaceHolderVersion(_ version: AppVersion) -> Bool{
|
|
||||||
return version.version == "0.0.0" && version.date == Date.distantPast && version.appBundleID == StoreApp.altstoreAppID
|
|
||||||
}
|
|
||||||
|
|
||||||
class func isPlaceHolderStoreApp(_ app: StoreApp) -> Bool{
|
|
||||||
return app.version == "0.0.0" && app.versionDate == Date.distantPast && app.bundleIdentifier == StoreApp.altstoreAppID
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static var sideStoreAppIconURL: URL {
|
private static var sideStoreAppIconURL: URL {
|
||||||
let iconNames = [
|
let iconNames = [
|
||||||
"AppIcon76x76@2x~ipad",
|
"AppIcon76x76@2x~ipad",
|
||||||
"AppIcon60x60@2x",
|
"AppIcon60x60@2x",
|
||||||
"AppIcon"
|
"AppIcon"
|
||||||
]
|
]
|
||||||
|
|
||||||
for iconName in iconNames {
|
for iconName in iconNames {
|
||||||
if let path = Bundle.main.path(forResource: iconName, ofType: "png") {
|
if let path = Bundle.main.path(forResource: iconName, ofType: "png") {
|
||||||
return URL(fileURLWithPath: path)
|
return URL(fileURLWithPath: path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return URL(string: "https://sidestore.io/apps-v2.json/apps/sidestore/icon.png")!
|
return URL(string: "https://sidestore.io/apps-v2.json/apps/sidestore/icon.png")!
|
||||||
}
|
}
|
||||||
|
|
||||||
class func makeAltStoreApp(version: String, buildVersion: String?, in context: NSManagedObjectContext) -> StoreApp
|
class func makeAltStoreApp(version: String, buildVersion: String?, in context: NSManagedObjectContext) -> StoreApp
|
||||||
{
|
{
|
||||||
let placeholderAppID = StoreApp.altstoreAppID
|
let placeholderAppID = StoreApp.altstoreAppID
|
||||||
let placeholderDownloadURL = URL(string: "https://sidestore.io")!
|
let placeholderDownloadURL = URL(string: "https://sidestore.io")!
|
||||||
let placeholderSourceID = Source.altStoreIdentifier
|
let placeholderSourceID = Source.altStoreIdentifier
|
||||||
|
|
||||||
let app = StoreApp(context: context)
|
let app = StoreApp(context: context)
|
||||||
app.name = "SideStore"
|
app.name = "SideStore"
|
||||||
app.bundleIdentifier = placeholderAppID
|
app.bundleIdentifier = placeholderAppID
|
||||||
@@ -708,7 +672,7 @@ public extension StoreApp
|
|||||||
app.iconURL = Self.sideStoreAppIconURL
|
app.iconURL = Self.sideStoreAppIconURL
|
||||||
app.screenshotURLs = []
|
app.screenshotURLs = []
|
||||||
app.sourceIdentifier = placeholderSourceID
|
app.sourceIdentifier = placeholderSourceID
|
||||||
|
|
||||||
let appVersion = AppVersion.makeAppVersion(version: version,
|
let appVersion = AppVersion.makeAppVersion(version: version,
|
||||||
buildVersion: buildVersion,
|
buildVersion: buildVersion,
|
||||||
date: Date(),
|
date: Date(),
|
||||||
@@ -718,9 +682,7 @@ public extension StoreApp
|
|||||||
sourceID: app.sourceIdentifier,
|
sourceID: app.sourceIdentifier,
|
||||||
in: context)
|
in: context)
|
||||||
try? app.setVersions([appVersion])
|
try? app.setVersions([appVersion])
|
||||||
|
|
||||||
print("makeAltStoreApp StoreApp: \(String(describing: app))")
|
|
||||||
|
|
||||||
#if BETA
|
#if BETA
|
||||||
app.isBeta = true
|
app.isBeta = true
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
3
Makefile
3
Makefile
@@ -168,6 +168,7 @@ test:
|
|||||||
# Overrides (will inherit from env if set already)
|
# Overrides (will inherit from env if set already)
|
||||||
BUILD_CONFIG ?= Release
|
BUILD_CONFIG ?= Release
|
||||||
MARKETING_VERSION ?=
|
MARKETING_VERSION ?=
|
||||||
|
BUNDLE_ID_SUFFIX ?=
|
||||||
build:
|
build:
|
||||||
@echo ">>>>>>>>> BUILD_CONFIG is set to '$(BUILD_CONFIG)', Building for $(BUILD_CONFIG) mode! <<<<<<<<<<"
|
@echo ">>>>>>>>> BUILD_CONFIG is set to '$(BUILD_CONFIG)', Building for $(BUILD_CONFIG) mode! <<<<<<<<<<"
|
||||||
@echo ""
|
@echo ""
|
||||||
@@ -182,7 +183,7 @@ build:
|
|||||||
DEVELOPMENT_TEAM=XYZ0123456 \
|
DEVELOPMENT_TEAM=XYZ0123456 \
|
||||||
ORG_IDENTIFIER=com.SideStore \
|
ORG_IDENTIFIER=com.SideStore \
|
||||||
MARKETING_VERSION=$(MARKETING_VERSION) \
|
MARKETING_VERSION=$(MARKETING_VERSION) \
|
||||||
BUNDLE_ID_SUFFIX=
|
BUNDLE_ID_SUFFIX=$(BUNDLE_ID_SUFFIX)
|
||||||
# DWARF_DSYM_FOLDER_PATH="."
|
# DWARF_DSYM_FOLDER_PATH="."
|
||||||
|
|
||||||
fakesign-apps:
|
fakesign-apps:
|
||||||
|
|||||||
Reference in New Issue
Block a user