From c1aad8057828c5f74b1748511ff442c5ff49c55f Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Wed, 1 Apr 2020 11:51:00 -0700 Subject: [PATCH] Adds support for ALPHA builds --- AltStore/Model/Source.swift | 16 ++++++++++++++++ AltStore/Model/StoreApp.swift | 9 ++++++--- .../FetchProvisioningProfilesOperation.swift | 4 ++-- AltStore/Operations/ResignAppOperation.swift | 2 +- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/AltStore/Model/Source.swift b/AltStore/Model/Source.swift index 05cc87e9..34ef5d7e 100644 --- a/AltStore/Model/Source.swift +++ b/AltStore/Model/Source.swift @@ -10,13 +10,29 @@ import CoreData extension Source { + #if ALPHA + static let altStoreIdentifier = "com.rileytestut.AltStore.Alpha" + #else static let altStoreIdentifier = "com.rileytestut.AltStore" + #endif #if STAGING + + #if ALPHA + static let altStoreSourceURL = URL(string: "https://f000.backblazeb2.com/file/altstore-staging/sources/alpha/apps-alpha-staging.json")! + #else static let altStoreSourceURL = URL(string: "https://f000.backblazeb2.com/file/altstore-staging/apps-staging.json")! + #endif + + #else + + #if ALPHA + static let altStoreSourceURL = URL(string: "https://alpha.altstore.io/")! #else static let altStoreSourceURL = URL(string: "https://apps.altstore.io/")! #endif + + #endif } @objc(Source) diff --git a/AltStore/Model/StoreApp.swift b/AltStore/Model/StoreApp.swift index 8efa8a01..ecaa600c 100644 --- a/AltStore/Model/StoreApp.swift +++ b/AltStore/Model/StoreApp.swift @@ -14,12 +14,15 @@ import AltSign extension StoreApp { - #if BETA + #if ALPHA + static let altstoreAppID = "com.rileytestut.AltStore.Alpha" + static let alternativeAltStoreAppIDs: Set = ["com.rileytestut.AltStore", "com.rileytestut.AltStore.Beta"] + #elseif BETA static let altstoreAppID = "com.rileytestut.AltStore.Beta" - static let alternativeAltStoreAppID = "com.rileytestut.AltStore" + static let alternativeAltStoreAppIDs: Set = ["com.rileytestut.AltStore", "com.rileytestut.AltStore.Alpha"] #else static let altstoreAppID = "com.rileytestut.AltStore" - static let alternativeAltStoreAppID = "com.rileytestut.AltStore.Beta" + static let alternativeAltStoreAppIDs: Set = ["com.rileytestut.AltStore.Beta", "com.rileytestut.AltStore.Alpha"] #endif } diff --git a/AltStore/Operations/FetchProvisioningProfilesOperation.swift b/AltStore/Operations/FetchProvisioningProfilesOperation.swift index 98dd8849..6e5c4f64 100644 --- a/AltStore/Operations/FetchProvisioningProfilesOperation.swift +++ b/AltStore/Operations/FetchProvisioningProfilesOperation.swift @@ -129,7 +129,7 @@ extension FetchProvisioningProfilesOperation #if DEBUG - if app.bundleIdentifier == StoreApp.altstoreAppID || app.bundleIdentifier == StoreApp.alternativeAltStoreAppID + if app.bundleIdentifier == StoreApp.altstoreAppID || StoreApp.alternativeAltStoreAppIDs.contains(app.bundleIdentifier) { // Use legacy bundle ID format for AltStore. preferredBundleID = "com.\(team.identifier).\(app.bundleIdentifier)" @@ -174,7 +174,7 @@ extension FetchProvisioningProfilesOperation let parentBundleID = parentApp?.bundleIdentifier ?? app.bundleIdentifier let updatedParentBundleID = parentBundleID + "." + team.identifier // Append just team identifier to make it harder to track. - if app.bundleIdentifier == StoreApp.altstoreAppID || app.bundleIdentifier == StoreApp.alternativeAltStoreAppID + if app.bundleIdentifier == StoreApp.altstoreAppID || StoreApp.alternativeAltStoreAppIDs.contains(app.bundleIdentifier) { // Use legacy bundle ID format for AltStore. bundleID = "com.\(team.identifier).\(app.bundleIdentifier)" diff --git a/AltStore/Operations/ResignAppOperation.swift b/AltStore/Operations/ResignAppOperation.swift index b34557c5..3288d79e 100644 --- a/AltStore/Operations/ResignAppOperation.swift +++ b/AltStore/Operations/ResignAppOperation.swift @@ -158,7 +158,7 @@ private extension ResignAppOperation var additionalValues: [String: Any] = [Bundle.Info.urlTypes: allURLSchemes] - if self.context.bundleIdentifier == StoreApp.altstoreAppID || self.context.bundleIdentifier == StoreApp.alternativeAltStoreAppID + if self.context.bundleIdentifier == StoreApp.altstoreAppID || StoreApp.alternativeAltStoreAppIDs.contains(self.context.bundleIdentifier) { guard let udid = Bundle.main.object(forInfoDictionaryKey: Bundle.Info.deviceID) as? String else { throw OperationError.unknownUDID } additionalValues[Bundle.Info.deviceID] = udid