- Store: Reverted localized version for Store and version to be independent

This commit is contained in:
Magesh K
2025-02-08 13:11:27 +05:30
parent 61086a681a
commit 77833c6ffc
8 changed files with 128 additions and 164 deletions

View File

@@ -100,11 +100,15 @@ jobs:
echo "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
if: ${{ inputs.is_beta }}
run: |
echo "RELEASE_CHANNEL=${{ inputs.release_tag }}" >> $GITHUB_OUTPUT
bash .github/workflows/increase-beta-build-num.sh
- name: Extract MARKETING_VERSION from Build.xcconfig
@@ -218,10 +222,13 @@ jobs:
echo ""
- name: Set BundleID Suffix for Sidestore build
run: |
echo "BUNDLE_ID_SUFFIX=${{ inputs.bundle_id_suffix }}" >> $GITHUB_ENV
- name: Build SideStore
# using 'tee' to intercept stdout and log for detailed build-log
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]}
- name: Fakesign app

View File

@@ -186,7 +186,7 @@ extension AppContentViewController
switch Row.allCases[indexPath.row]
{
case .screenshots:
guard !self.app.screenshots.isEmpty else { return 0.0 }
guard !self.app.allScreenshots.isEmpty else { return 0.0 }
return UITableView.automaticDimension
case .permissions:

View File

@@ -27,9 +27,9 @@
</uniquenessConstraints>
</entity>
<entity name="AppPermission" representedClassName="AppPermission" syncable="YES">
<attribute name="appBundleID" optional="YES" attributeType="String" defaultValueString=""/>
<attribute name="permission" optional="YES" attributeType="String" defaultValueString=""/>
<attribute name="sourceID" optional="YES" attributeType="String"/>
<attribute name="appBundleID" attributeType="String"/>
<attribute name="permission" attributeType="String"/>
<attribute name="sourceID" attributeType="String"/>
<attribute name="type" attributeType="String"/>
<attribute name="usageDescription" attributeType="String"/>
<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="expirationDate" attributeType="Date" usesScalarValueType="NO"/>
<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="isActive" attributeType="Boolean" defaultValueString="YES" usesScalarValueType="YES"/>
<attribute name="isRefreshing" transient="YES" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
@@ -229,7 +229,7 @@
<attribute name="sourceURL" attributeType="URI"/>
<attribute name="subtitle" optional="YES" attributeType="String"/>
<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"/>
<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"/>
@@ -251,15 +251,14 @@
<attribute name="isHiddenWithoutPledge" 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="localizedDescription" optional="YES" attributeType="String"/>
<attribute name="localizedDescription" attributeType="String"/>
<attribute name="marketplaceID" optional="YES" attributeType="String"/>
<attribute name="name" attributeType="String"/>
<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="screenshotURLs" attributeType="Transformable" valueTransformerName="ALTSecureValueTransformer"/>
<attribute name="sha256" optional="YES" attributeType="String"/>
<attribute name="size" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="size" 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="subtitle" optional="YES" attributeType="String"/>

View File

@@ -23,15 +23,10 @@ public class AppVersion: BaseEntity, Decodable
@NSManaged @objc(buildVersion) public private(set) var _buildVersion: String
@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 size: Int64
@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? {
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.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.size = try container.decode(Int64.self, forKey: .size)
@@ -154,7 +149,7 @@ public extension AppVersion
appVersion.version = version
appVersion.buildVersion = buildVersion
appVersion.date = date
appVersion._localizedDescription = localizedDescription
appVersion.localizedDescription = localizedDescription
appVersion.downloadURL = downloadURL
appVersion.size = size
appVersion.sha256 = sha256

View File

@@ -392,11 +392,11 @@ extension MergePolicy{
// Screenshots
if let sortedScreenshotIDs = sortedScreenshotIDsByGlobalAppID[globallyUniqueID],
let sortedScreenshotIDsArray = sortedScreenshotIDs.array as? [String],
case let databaseScreenshotIDs = databaseObject.screenshots.map({ $0.screenshotID }),
case let databaseScreenshotIDs = databaseObject.allScreenshots.map({ $0.screenshotID }),
databaseScreenshotIDs != sortedScreenshotIDsArray
{
// 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 indexB = sortedScreenshotIDs.index(of: screenshotB.screenshotID)
return indexA < indexB

View File

@@ -37,7 +37,7 @@ fileprivate extension NSManagedObject
}
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
}
@@ -66,7 +66,7 @@ fileprivate extension NSManagedObject
let appVersion = NSEntityDescription.insertNewObject(forEntityName: AppVersion.entity().name!, into: context)
appVersion.setValue(version, forKey: #keyPath(AppVersion.version))
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(size, forKey: #keyPath(AppVersion.size))
appVersion.setValue(appBundleID, forKey: #keyPath(AppVersion.appBundleID))

View File

@@ -21,7 +21,7 @@ public extension StoreApp
#else
static let altstoreAppID = Bundle.Info.appbundleIdentifier
#endif
static let dolphinAppID = "me.oatmealdome.dolphinios-njb"
}
@@ -37,22 +37,22 @@ public final class PlatformURL: NSManagedObject, Decodable {
/* Properties */
@NSManaged public private(set) var platform: Platform
@NSManaged public private(set) var downloadURL: URL
private enum CodingKeys: String, CodingKey
{
case platform
case downloadURL
}
public init(from decoder: Decoder) throws
{
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.
super.init(entity: PlatformURL.entity(), insertInto: context)
do
{
let container = try decoder.container(keyedBy: CodingKeys.self)
@@ -65,7 +65,7 @@ public final class PlatformURL: NSManagedObject, Decodable {
{
context.delete(self)
}
throw error
}
}
@@ -75,15 +75,15 @@ extension PlatformURL: Comparable {
public static func < (lhs: PlatformURL, rhs: PlatformURL) -> Bool {
return lhs.platform.rawValue < rhs.platform.rawValue
}
public static func > (lhs: PlatformURL, rhs: PlatformURL) -> Bool {
return lhs.platform.rawValue > rhs.platform.rawValue
}
public static func <= (lhs: PlatformURL, rhs: PlatformURL) -> Bool {
return lhs.platform.rawValue <= rhs.platform.rawValue
}
public static func >= (lhs: PlatformURL, rhs: PlatformURL) -> Bool {
return lhs.platform.rawValue >= rhs.platform.rawValue
}
@@ -97,11 +97,11 @@ private struct PatreonParameters: Decodable
{
var amount: Decimal
var isCustom: Bool
init(from decoder: Decoder) throws
{
let container = try decoder.singleValueContainer()
if let stringValue = try? container.decode(String.self), stringValue == "custom"
{
self.amount = 0 // Use 0 as amount internally to simplify logic.
@@ -115,7 +115,7 @@ private struct PatreonParameters: Decodable
}
}
}
var pledge: Pledge?
var currency: String?
var tiers: Set<String>?
@@ -123,12 +123,6 @@ private struct PatreonParameters: Decodable
var hidden: Bool?
}
// added for v0.6.0
extension StoreApp {
//MARK: - properties
@NSManaged public private(set) var sha256: String?
}
@objc(StoreApp)
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 bundleIdentifier: String
@NSManaged public private(set) var subtitle: String?
@NSManaged public private(set) var developerName: String
@NSManaged public private(set) var localizedDescription: String?
@NSManaged public private(set) var size: Int64
@NSManaged public private(set) var localizedDescription: String
@NSManaged @objc(size) internal var _size: Int32
@nonobjc public var category: StoreCategory? {
guard let _category else { return nil }
let category = StoreCategory(rawValue: _category)
return category
}
@NSManaged @objc(category) public private(set) var _category: String?
@NSManaged public private(set) var iconURL: URL
@NSManaged public private(set) var screenshotURLs: [URL]
@NSManaged public private(set) var downloadURL: URL?
@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
// Required for Marketplace apps.
@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 pledgeCurrency: String?
@NSManaged public private(set) var prefersCustomPledge: Bool
@nonobjc public var pledgeAmount: Decimal? { _pledgeAmount as? Decimal }
@NSManaged @objc(pledgeAmount) private var _pledgeAmount: NSDecimalNumber?
@NSManaged public var sortIndex: Int32
@NSManaged public var featuredSortID: String?
@objc public internal(set) var sourceIdentifier: String? {
get {
self.willAccessValue(forKey: #keyPath(sourceIdentifier))
defer { self.didAccessValue(forKey: #keyPath(sourceIdentifier)) }
let sourceIdentifier = self.primitiveSourceIdentifier
return sourceIdentifier
}
@@ -188,48 +180,48 @@ public class StoreApp: BaseEntity, Decodable
self.willChangeValue(forKey: #keyPath(sourceIdentifier))
self.primitiveSourceIdentifier = newValue
self.didChangeValue(forKey: #keyPath(sourceIdentifier))
for version in self.versions
{
version.sourceID = newValue
}
for permission in self.permissions
{
permission.sourceID = self.sourceIdentifier ?? ""
}
for screenshot in self.screenshots
for screenshot in self.allScreenshots
{
screenshot.sourceID = self.sourceIdentifier ?? ""
}
}
}
@NSManaged private var primitiveSourceIdentifier: String?
// Legacy (kept for backwards compatibility)
@NSManaged public private(set) var version: String?
@NSManaged public private(set) var versionDate: Date?
@NSManaged public private(set) var versionDescription: String?
/* Relationships */
@NSManaged public var installedApp: InstalledApp?
@NSManaged public var newsItems: Set<NewsItem>
@NSManaged @objc(source) public var _source: Source?
@NSManaged public internal(set) var featuringSource: Source?
@NSManaged @objc(latestVersion) public private(set) var latestSupportedVersion: AppVersion?
@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.
/* Non-Core Data Properties */
// Used to set isPledged after fetching source.
public var _tierIDs: Set<String>?
public var _rewardID: String?
@nonobjc public var source: Source? {
set {
self._source = newValue
@@ -239,26 +231,26 @@ public class StoreApp: BaseEntity, Decodable
return self._source
}
}
@nonobjc public var permissions: Set<AppPermission> {
return self._permissions as! Set<AppPermission>
}
@NSManaged @objc(permissions) internal private(set) var _permissions: NSSet // Use NSSet to avoid eagerly fetching values.
@nonobjc public var versions: [AppVersion] {
return self._versions.array as! [AppVersion]
}
@nonobjc public var screenshots: [AppScreenshot] {
@nonobjc public var allScreenshots: [AppScreenshot] {
return self._screenshots.array as! [AppScreenshot]
}
@NSManaged @objc(screenshots) private(set) var _screenshots: NSOrderedSet
private override init(entity: NSEntityDescription, insertInto context: NSManagedObjectContext?)
{
super.init(entity: entity, insertInto: context)
}
private enum CodingKeys: String, CodingKey
{
case name
@@ -277,56 +269,53 @@ public class StoreApp: BaseEntity, Decodable
case versions
case patreon
case category
// Legacy
case version
case versionDescription
case versionDate
case downloadURL
case screenshotURLs
// new for v0.6.0
case sha256
}
public required init(from decoder: Decoder) throws
{
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.
super.init(entity: StoreApp.entity(), insertInto: context)
do
{
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.bundleIdentifier = try container.decode(String.self, forKey: .bundleIdentifier)
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.subtitle = try container.decodeIfPresent(String.self, forKey: .subtitle)
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)
{
guard let tintColor = UIColor(hexString: tintColorHex) else {
throw DecodingError.dataCorruptedError(forKey: .tintColor, in: container, debugDescription: "Hex code is invalid.")
}
self.tintColor = tintColor
}
if let rawCategory = try container.decodeIfPresent(String.self, forKey: .category)
{
self._category = rawCategory.lowercased() // Store raw (lowercased) category value.
}
let appScreenshots: [AppScreenshot]
if let screenshots = try container.decodeIfPresent(AppScreenshots.self, forKey: .screenshots)
{
appScreenshots = screenshots.screenshots
@@ -335,7 +324,7 @@ public class StoreApp: BaseEntity, Decodable
{
// Assume 9:16 iPhone 8 screen dimensions for legacy screenshotURLs.
let legacyAspectRatio = CGSize(width: 750, height: 1334)
appScreenshots = screenshotURLs.map { imageURL in
let screenshot = AppScreenshot(imageURL: imageURL, size: legacyAspectRatio, deviceType: .iphone, context: context)
return screenshot
@@ -343,7 +332,7 @@ public class StoreApp: BaseEntity, Decodable
// // Update to iPhone 13 screen size
// let modernAspectRatio = CGSize(width: 1170, height: 2532)
// appScreenshots = screenshotURLs.map { imageURL in
// let screenshot = AppScreenshot(imageURL: imageURL, size: modernAspectRatio, deviceType: .iphone, context: context)
// return screenshot
@@ -353,14 +342,14 @@ public class StoreApp: BaseEntity, Decodable
{
appScreenshots = []
}
for screenshot in appScreenshots
{
screenshot.appBundleID = self.bundleIdentifier
}
self.setScreenshots(appScreenshots)
if let appPermissions = try container.decodeIfPresent(AppPermissions.self, forKey: .permissions)
{
let allPermissions = appPermissions.entitlements + appPermissions.privacy
@@ -368,20 +357,16 @@ public class StoreApp: BaseEntity, Decodable
{
permission.appBundleID = self.bundleIdentifier
}
self._permissions = NSSet(array: allPermissions)
}
else
{
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)
{
//TODO: Throw error if there isn't at least one version.
if (versions.count == 0){
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)
}
else
@@ -425,10 +410,10 @@ public class StoreApp: BaseEntity, Decodable
let version = try container.decode(String.self, forKey: .version)
let versionDate = try container.decode(Date.self, forKey: .versionDate)
let versionDescription = try container.decodeIfPresent(String.self, forKey: .versionDescription)
let downloadURL = try container.decode(URL.self, forKey: .downloadURL)
let size = try container.decode(Int32.self, forKey: .size)
let appVersion = AppVersion.makeAppVersion(version: version,
buildVersion: nil,
date: versionDate,
@@ -439,7 +424,7 @@ public class StoreApp: BaseEntity, Decodable
in: context)
try self.setVersions([appVersion])
}
// latestSupportedVersion is set by this point if one was available
let platformURLs = try container.decodeIfPresent(PlatformURLs.self.self, forKey: .platformURLs)
if let platformURLs = platformURLs {
@@ -461,16 +446,16 @@ public class StoreApp: BaseEntity, Decodable
throw error
}
}
// Must _explicitly_ set to false to ensure it updates cached database value.
self.isPledged = false
self.prefersCustomPledge = false
if let patreon = try container.decodeIfPresent(PatreonParameters.self, forKey: .patreon)
{
self.isPledgeRequired = true
self.isHiddenWithoutPledge = patreon.hidden ?? false // Default to showing Patreon apps
if let pledge = patreon.pledge
{
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.
self._pledgeAmount = 0 as NSDecimalNumber
}
self._tierIDs = patreon.tiers
self._rewardID = patreon.benefit
}
@@ -492,7 +477,7 @@ public class StoreApp: BaseEntity, Decodable
self.isHiddenWithoutPledge = false
self._pledgeAmount = nil
self.pledgeCurrency = nil
self._tierIDs = nil
self._rewardID = nil
}
@@ -503,15 +488,15 @@ public class StoreApp: BaseEntity, Decodable
{
context.delete(self)
}
throw error
}
}
public override func awakeFromInsert()
{
super.awakeFromInsert()
self.featuredSortID = UUID().uuidString
}
}
@@ -525,10 +510,10 @@ internal extension StoreApp
}
self._versions = NSOrderedSet(array: versions)
let latestSupportedVersion = versions.first(where: { $0.isSupported })
self.latestSupportedVersion = latestSupportedVersion
for case let version as AppVersion in self._versions
{
if version == latestSupportedVersion
@@ -541,17 +526,15 @@ internal extension StoreApp
version.latestSupportedVersionApp = nil
}
}
// Preserve backwards compatibility by assigning legacy property values.
self.version = latestVersion.version
self.versionDate = latestVersion.date
self.versionDescription = latestVersion.localizedDescription
self.downloadURL = latestVersion.downloadURL
self.size = latestVersion.size
self.localizedDescription = latestVersion.localizedDescription
self.sha256 = latestVersion.sha256
self._size = Int32(latestVersion.size)
}
func setPermissions(_ permissions: Set<AppPermission>)
{
for case let permission as AppPermission in self._permissions
@@ -565,10 +548,10 @@ internal extension StoreApp
permission.app = nil
}
}
self._permissions = permissions as NSSet
}
func setScreenshots(_ screenshots: [AppScreenshot])
{
for case let screenshot as AppScreenshot in self._screenshots
@@ -582,9 +565,9 @@ internal extension StoreApp
screenshot.app = nil
}
}
self._screenshots = NSOrderedSet(array: screenshots)
// Backwards compatibility
self.screenshotURLs = screenshots.map { $0.imageURL }
}
@@ -595,14 +578,14 @@ public extension StoreApp
func screenshots(for deviceType: ALTDeviceType) -> [AppScreenshot]
{
//TODO: Support multiple device types
let filteredScreenshots = self.screenshots.filter { $0.deviceType == deviceType }
let filteredScreenshots = self.allScreenshots.filter { $0.deviceType == deviceType }
return filteredScreenshots
}
func preferredScreenshots() -> [AppScreenshot]
{
let deviceType: ALTDeviceType
if UIDevice.current.model.contains("iPad")
{
deviceType = .ipad
@@ -611,13 +594,13 @@ public extension StoreApp
{
deviceType = .iphone
}
let preferredScreenshots = self.screenshots(for: deviceType)
guard !preferredScreenshots.isEmpty else {
// There are no screenshots for deviceType, so return _all_ screenshots instead.
return self.screenshots
return self.allScreenshots
}
return preferredScreenshots
}
}
@@ -627,10 +610,10 @@ public extension StoreApp
var latestAvailableVersion: AppVersion? {
return self._versions.firstObject as? AppVersion
}
var globallyUniqueID: String? {
guard let sourceIdentifier = self.sourceIdentifier else { return nil }
let globallyUniqueID = self.bundleIdentifier + "|" + sourceIdentifier
return globallyUniqueID
}
@@ -646,60 +629,41 @@ public extension StoreApp
#keyPath(StoreApp.isPledged))
return predicate
}
class var otherCategoryPredicate: NSPredicate {
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))
return predicate
}
@nonobjc class func fetchRequest() -> NSFetchRequest<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 {
let iconNames = [
"AppIcon76x76@2x~ipad",
"AppIcon60x60@2x",
"AppIcon"
]
for iconName in iconNames {
if let path = Bundle.main.path(forResource: iconName, ofType: "png") {
return URL(fileURLWithPath: path)
}
}
return URL(string: "https://sidestore.io/apps-v2.json/apps/sidestore/icon.png")!
}
class func makeAltStoreApp(version: String, buildVersion: String?, in context: NSManagedObjectContext) -> StoreApp
{
let placeholderAppID = StoreApp.altstoreAppID
let placeholderDownloadURL = URL(string: "https://sidestore.io")!
let placeholderSourceID = Source.altStoreIdentifier
let app = StoreApp(context: context)
app.name = "SideStore"
app.bundleIdentifier = placeholderAppID
@@ -708,7 +672,7 @@ public extension StoreApp
app.iconURL = Self.sideStoreAppIconURL
app.screenshotURLs = []
app.sourceIdentifier = placeholderSourceID
let appVersion = AppVersion.makeAppVersion(version: version,
buildVersion: buildVersion,
date: Date(),
@@ -718,9 +682,7 @@ public extension StoreApp
sourceID: app.sourceIdentifier,
in: context)
try? app.setVersions([appVersion])
print("makeAltStoreApp StoreApp: \(String(describing: app))")
#if BETA
app.isBeta = true
#endif

View File

@@ -168,6 +168,7 @@ test:
# Overrides (will inherit from env if set already)
BUILD_CONFIG ?= Release
MARKETING_VERSION ?=
BUNDLE_ID_SUFFIX ?=
build:
@echo ">>>>>>>>> BUILD_CONFIG is set to '$(BUILD_CONFIG)', Building for $(BUILD_CONFIG) mode! <<<<<<<<<<"
@echo ""
@@ -182,7 +183,7 @@ build:
DEVELOPMENT_TEAM=XYZ0123456 \
ORG_IDENTIFIER=com.SideStore \
MARKETING_VERSION=$(MARKETING_VERSION) \
BUNDLE_ID_SUFFIX=
BUNDLE_ID_SUFFIX=$(BUNDLE_ID_SUFFIX)
# DWARF_DSYM_FOLDER_PATH="."
fakesign-apps: