mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-03-25 08:55:46 +00:00
Merge pull request #328 from RobotsAndPencils/matt/xcodeReleasesAppleAuth
Switch Xcode releases back to using Apple Auth :(
This commit is contained in:
commit
c373068f15
2 changed files with 12 additions and 11 deletions
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 }
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue