Adds STAGING flag to conditionally use staging endpoint

This commit is contained in:
Riley Testut
2019-11-04 13:38:54 -08:00
parent 991846bd64
commit f10f519eab
2 changed files with 10 additions and 0 deletions

View File

@@ -11,7 +11,12 @@ import CoreData
extension Source extension Source
{ {
static let altStoreIdentifier = "com.rileytestut.AltStore" static let altStoreIdentifier = "com.rileytestut.AltStore"
#if STAGING
static let altStoreSourceURL = URL(string: "https://f000.backblazeb2.com/file/altstore-staging/apps-staging.json")!
#else
static let altStoreSourceURL = URL(string: "https://cdn.altstore.io/file/altstore/apps.json")! static let altStoreSourceURL = URL(string: "https://cdn.altstore.io/file/altstore/apps.json")!
#endif
} }
@objc(Source) @objc(Source)

View File

@@ -67,6 +67,11 @@ class FetchSourceOperation: ResultOperation<Source>
decoder.managedObjectContext = context decoder.managedObjectContext = context
let source = try decoder.decode(Source.self, from: data) let source = try decoder.decode(Source.self, from: data)
#if STAGING
source.sourceURL = self.sourceURL
#endif
self.finish(.success(source)) self.finish(.success(source))
} }
catch catch