Merge pull request #328 from RobotsAndPencils/matt/xcodeReleasesAppleAuth

Switch Xcode releases back to using Apple Auth :(
This commit is contained in:
Matt Kiazyk 2022-11-18 08:55:39 -06:00 committed by GitHub
commit c373068f15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 11 deletions

View file

@ -43,7 +43,10 @@ extension AppState {
Logger.appState.info("Using \(downloader) downloader")
return self.getXcodeArchive(installationType, downloader: downloader)
return validateSession()
.flatMap { _ in
self.getXcodeArchive(installationType, downloader: downloader)
}
.flatMap { xcode, url -> AnyPublisher<InstalledXcode, Swift.Error> in
self.installArchivedXcode(xcode, at: url)
}
@ -93,15 +96,12 @@ extension AppState {
}
private func downloadXcode(availableXcode: AvailableXcode, downloader: Downloader) -> AnyPublisher<(AvailableXcode, URL), Error> {
return validateADCSession(path: availableXcode.downloadPath)
.flatMap { _ in
return self.downloadOrUseExistingArchive(for: availableXcode, downloader: downloader, progressChanged: { [unowned self] progress in
DispatchQueue.main.async {
self.setInstallationStep(of: availableXcode.version, to: .downloading(progress: progress))
}
})
.map { return (availableXcode, $0) }
}
self.downloadOrUseExistingArchive(for: availableXcode, downloader: downloader, progressChanged: { [unowned self] progress in
DispatchQueue.main.async {
self.setInstallationStep(of: availableXcode.version, to: .downloading(progress: progress))
}
})
.map { return (availableXcode, $0) }
.eraseToAnyPublisher()
}

View file

@ -381,7 +381,7 @@ class AppState: ObservableObject {
case .apple:
install(id: id)
case .xcodeReleases:
installWithoutLogin(id: id)
install(id: id)
}
}
@ -454,6 +454,7 @@ class AppState: ObservableObject {
}
/// Skips using the username/password to log in to Apple, and simply gets a Auth Cookie used in downloading
/// As of Nov 2022 this was returning a 403 forbidden
func installWithoutLogin(id: Xcode.ID) {
guard let availableXcode = availableXcodes.first(where: { $0.version == id }) else { return }