diff --git a/AltStore/Managing Apps/AppManager.swift b/AltStore/Managing Apps/AppManager.swift index 00958353..5c4dacc2 100644 --- a/AltStore/Managing Apps/AppManager.swift +++ b/AltStore/Managing Apps/AppManager.swift @@ -1223,7 +1223,7 @@ private extension AppManager let progress = Progress.discreteProgress(totalUnitCount: 100) let context = AppOperationContext(bundleIdentifier: app.bundleIdentifier, authenticatedContext: group.context) - context.app = ALTApplication(fileURL: app.url) + context.app = ALTApplication(fileURL: app.fileURL) /* Fetch Provisioning Profiles */ let fetchProvisioningProfilesOperation = FetchProvisioningProfilesOperation(context: context) diff --git a/AltStore/Operations/DownloadAppOperation.swift b/AltStore/Operations/DownloadAppOperation.swift index ae70ae8f..c386bb35 100644 --- a/AltStore/Operations/DownloadAppOperation.swift +++ b/AltStore/Operations/DownloadAppOperation.swift @@ -36,7 +36,7 @@ class DownloadAppOperation: ResultOperation let context: AppOperationContext private let bundleIdentifier: String - private let sourceURL: URL + private var sourceURL: URL? private let destinationURL: URL private let session = URLSession(configuration: .default) @@ -69,7 +69,9 @@ class DownloadAppOperation: ResultOperation 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 { let application = try result.get() @@ -165,7 +167,7 @@ private extension DownloadAppOperation } } - if self.sourceURL.isFileURL + if sourceURL.isFileURL { finishOperation(.success(sourceURL)) diff --git a/AltStore/Operations/SendAppOperation.swift b/AltStore/Operations/SendAppOperation.swift index 1a46386b..90f6cbee 100644 --- a/AltStore/Operations/SendAppOperation.swift +++ b/AltStore/Operations/SendAppOperation.swift @@ -39,7 +39,7 @@ class SendAppOperation: ResultOperation<()> 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. - 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) diff --git a/AltStoreCore/Protocols/AppProtocol.swift b/AltStoreCore/Protocols/AppProtocol.swift index 94fa6f99..cd76b785 100644 --- a/AltStoreCore/Protocols/AppProtocol.swift +++ b/AltStoreCore/Protocols/AppProtocol.swift @@ -13,16 +13,16 @@ public protocol AppProtocol { var name: String { get } var bundleIdentifier: String { get } - var url: URL { get } + var url: URL? { get } } public struct AnyApp: AppProtocol { public var name: 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.bundleIdentifier = bundleIdentifier @@ -32,21 +32,21 @@ public struct AnyApp: AppProtocol extension ALTApplication: AppProtocol { - public var url: URL { + public var url: URL? { return self.fileURL } } extension StoreApp: AppProtocol { - public var url: URL { + public var url: URL? { return self.downloadURL } } extension InstalledApp: AppProtocol { - public var url: URL { + public var url: URL? { return self.fileURL } }