diff --git a/Xcodes/Backend/AppState+Install.swift b/Xcodes/Backend/AppState+Install.swift index 5e2a0742..e32e9ed5 100644 --- a/Xcodes/Backend/AppState+Install.swift +++ b/Xcodes/Backend/AppState+Install.swift @@ -104,7 +104,7 @@ extension AppState { private func downloadXcode(availableXcode: AvailableXcode, downloader: Downloader) -> AnyPublisher<(AvailableXcode, URL), Error> { self.downloadOrUseExistingArchive(for: availableXcode, downloader: downloader, progressChanged: { [unowned self] progress in DispatchQueue.main.async { - self.setInstallationStep(of: availableXcode.version, to: .downloading(progress: progress)) + self.setInstallationStep(of: availableXcode.xcodeID, to: .downloading(progress: progress)) self.overallProgress.addChild(progress, withPendingUnitCount: AppState.totalProgressUnits - AppState.unxipProgressWeight) } }) @@ -203,9 +203,9 @@ extension AppState { } .flatMap { installedXcode -> AnyPublisher in do { - self.setInstallationStep(of: availableXcode.version, to: .trashingArchive) + self.setInstallationStep(of: availableXcode.xcodeID, to: .trashingArchive) try Current.files.trashItem(at: archiveURL) - self.setInstallationStep(of: availableXcode.version, to: .checkingSecurity) + self.setInstallationStep(of: availableXcode.xcodeID, to: .checkingSecurity) return self.verifySecurityAssessment(of: installedXcode) .combineLatest(self.verifySigningCertificate(of: installedXcode.path.url)) @@ -217,7 +217,7 @@ extension AppState { } } .flatMap { installedXcode -> AnyPublisher in - self.setInstallationStep(of: availableXcode.version, to: .finishing) + self.setInstallationStep(of: availableXcode.xcodeID, to: .finishing) return self.performPostInstallSteps(for: installedXcode) .map { installedXcode } @@ -249,7 +249,7 @@ extension AppState { } func unarchiveAndMoveXIP(availableXcode: AvailableXcode, at source: URL, to destination: URL) -> AnyPublisher { - self.setInstallationStep(of: availableXcode.version, to: .unarchiving) + self.setInstallationStep(of: availableXcode.xcodeID, to: .unarchiving) return unxipOrUnxipExperiment(source) .catch { error -> AnyPublisher in @@ -267,7 +267,7 @@ extension AppState { .eraseToAnyPublisher() } .tryMap { output -> URL in - self.setInstallationStep(of: availableXcode.version, to: .moving(destination: destination.path)) + self.setInstallationStep(of: availableXcode.xcodeID, to: .moving(destination: destination.path)) let xcodeURL = source.deletingLastPathComponent().appendingPathComponent("Xcode.app") let xcodeBetaURL = source.deletingLastPathComponent().appendingPathComponent("Xcode-beta.app") @@ -496,9 +496,9 @@ extension AppState { // MARK: - - func setInstallationStep(of version: Version, to step: XcodeInstallationStep) { + func setInstallationStep(of xcodeID: XcodeID, to step: XcodeInstallationStep) { DispatchQueue.main.async { - guard let index = self.allXcodes.firstIndex(where: { $0.version.isEquivalent(to: version) }) else { return } + guard let index = self.allXcodes.firstIndex(where: { $0.id == xcodeID }) else { return } self.allXcodes[index].installState = .installing(step) let xcode = self.allXcodes[index] diff --git a/Xcodes/Backend/AppState.swift b/Xcodes/Backend/AppState.swift index 1f6419dc..eb2c7c61 100644 --- a/Xcodes/Backend/AppState.swift +++ b/Xcodes/Backend/AppState.swift @@ -557,7 +557,7 @@ class AppState: ObservableObject { installationPublishers[id] = signInIfNeeded() .handleEvents( receiveSubscription: { [unowned self] _ in - self.setInstallationStep(of: availableXcode.version, to: .authenticating) + self.setInstallationStep(of: availableXcode.xcodeID, to: .authenticating) } ) .flatMap { [unowned self] in