mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
Makes AppProtocol.url optional
Allows us to create AnyApp values without a valid file URL.
This commit is contained in:
committed by
Joseph Mattello
parent
50841f5e24
commit
93cf9bf6a9
@@ -1223,7 +1223,7 @@ private extension AppManager
|
|||||||
let progress = Progress.discreteProgress(totalUnitCount: 100)
|
let progress = Progress.discreteProgress(totalUnitCount: 100)
|
||||||
|
|
||||||
let context = AppOperationContext(bundleIdentifier: app.bundleIdentifier, authenticatedContext: group.context)
|
let context = AppOperationContext(bundleIdentifier: app.bundleIdentifier, authenticatedContext: group.context)
|
||||||
context.app = ALTApplication(fileURL: app.url)
|
context.app = ALTApplication(fileURL: app.fileURL)
|
||||||
|
|
||||||
/* Fetch Provisioning Profiles */
|
/* Fetch Provisioning Profiles */
|
||||||
let fetchProvisioningProfilesOperation = FetchProvisioningProfilesOperation(context: context)
|
let fetchProvisioningProfilesOperation = FetchProvisioningProfilesOperation(context: context)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class DownloadAppOperation: ResultOperation<ALTApplication>
|
|||||||
let context: AppOperationContext
|
let context: AppOperationContext
|
||||||
|
|
||||||
private let bundleIdentifier: String
|
private let bundleIdentifier: String
|
||||||
private let sourceURL: URL
|
private var sourceURL: URL?
|
||||||
private let destinationURL: URL
|
private let destinationURL: URL
|
||||||
|
|
||||||
private let session = URLSession(configuration: .default)
|
private let session = URLSession(configuration: .default)
|
||||||
@@ -69,7 +69,9 @@ class DownloadAppOperation: ResultOperation<ALTApplication>
|
|||||||
|
|
||||||
print("Downloading App:", self.bundleIdentifier)
|
print("Downloading App:", self.bundleIdentifier)
|
||||||
|
|
||||||
self.downloadApp(from: self.sourceURL) { result in
|
guard let sourceURL = self.sourceURL else { return self.finish(.failure(OperationError.appNotFound)) }
|
||||||
|
|
||||||
|
self.downloadApp(from: sourceURL) { result in
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
let application = try result.get()
|
let application = try result.get()
|
||||||
@@ -165,7 +167,7 @@ private extension DownloadAppOperation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.sourceURL.isFileURL
|
if sourceURL.isFileURL
|
||||||
{
|
{
|
||||||
finishOperation(.success(sourceURL))
|
finishOperation(.success(sourceURL))
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class SendAppOperation: ResultOperation<()>
|
|||||||
guard let resignedApp = self.context.resignedApp else { return self.finish(.failure(OperationError.invalidParameters)) }
|
guard let resignedApp = self.context.resignedApp else { return self.finish(.failure(OperationError.invalidParameters)) }
|
||||||
|
|
||||||
// self.context.resignedApp.fileURL points to the app bundle, but we want the .ipa.
|
// self.context.resignedApp.fileURL points to the app bundle, but we want the .ipa.
|
||||||
let app = AnyApp(name: resignedApp.name, bundleIdentifier: self.context.bundleIdentifier, url: resignedApp.url)
|
let app = AnyApp(name: resignedApp.name, bundleIdentifier: self.context.bundleIdentifier, url: resignedApp.fileURL)
|
||||||
let fileURL = InstalledApp.refreshedIPAURL(for: app)
|
let fileURL = InstalledApp.refreshedIPAURL(for: app)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,16 +13,16 @@ public protocol AppProtocol
|
|||||||
{
|
{
|
||||||
var name: String { get }
|
var name: String { get }
|
||||||
var bundleIdentifier: String { get }
|
var bundleIdentifier: String { get }
|
||||||
var url: URL { get }
|
var url: URL? { get }
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct AnyApp: AppProtocol
|
public struct AnyApp: AppProtocol
|
||||||
{
|
{
|
||||||
public var name: String
|
public var name: String
|
||||||
public var bundleIdentifier: String
|
public var bundleIdentifier: String
|
||||||
public var url: URL
|
public var url: URL?
|
||||||
|
|
||||||
public init(name: String, bundleIdentifier: String, url: URL)
|
public init(name: String, bundleIdentifier: String, url: URL?)
|
||||||
{
|
{
|
||||||
self.name = name
|
self.name = name
|
||||||
self.bundleIdentifier = bundleIdentifier
|
self.bundleIdentifier = bundleIdentifier
|
||||||
@@ -32,21 +32,21 @@ public struct AnyApp: AppProtocol
|
|||||||
|
|
||||||
extension ALTApplication: AppProtocol
|
extension ALTApplication: AppProtocol
|
||||||
{
|
{
|
||||||
public var url: URL {
|
public var url: URL? {
|
||||||
return self.fileURL
|
return self.fileURL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension StoreApp: AppProtocol
|
extension StoreApp: AppProtocol
|
||||||
{
|
{
|
||||||
public var url: URL {
|
public var url: URL? {
|
||||||
return self.downloadURL
|
return self.downloadURL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension InstalledApp: AppProtocol
|
extension InstalledApp: AppProtocol
|
||||||
{
|
{
|
||||||
public var url: URL {
|
public var url: URL? {
|
||||||
return self.fileURL
|
return self.fileURL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user