Skip to content

Commit c373068

Browse files
authored
Merge pull request #328 from RobotsAndPencils/matt/xcodeReleasesAppleAuth
Switch Xcode releases back to using Apple Auth :(
2 parents 4049e43 + a0a74ed commit c373068

2 files changed

Lines changed: 12 additions & 11 deletions

File tree

Xcodes/Backend/AppState+Install.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ extension AppState {
4343

4444
Logger.appState.info("Using \(downloader) downloader")
4545

46-
return self.getXcodeArchive(installationType, downloader: downloader)
46+
return validateSession()
47+
.flatMap { _ in
48+
self.getXcodeArchive(installationType, downloader: downloader)
49+
}
4750
.flatMap { xcode, url -> AnyPublisher<InstalledXcode, Swift.Error> in
4851
self.installArchivedXcode(xcode, at: url)
4952
}
@@ -93,15 +96,12 @@ extension AppState {
9396
}
9497

9598
private func downloadXcode(availableXcode: AvailableXcode, downloader: Downloader) -> AnyPublisher<(AvailableXcode, URL), Error> {
96-
return validateADCSession(path: availableXcode.downloadPath)
97-
.flatMap { _ in
98-
return self.downloadOrUseExistingArchive(for: availableXcode, downloader: downloader, progressChanged: { [unowned self] progress in
99-
DispatchQueue.main.async {
100-
self.setInstallationStep(of: availableXcode.version, to: .downloading(progress: progress))
101-
}
102-
})
103-
.map { return (availableXcode, $0) }
104-
}
99+
self.downloadOrUseExistingArchive(for: availableXcode, downloader: downloader, progressChanged: { [unowned self] progress in
100+
DispatchQueue.main.async {
101+
self.setInstallationStep(of: availableXcode.version, to: .downloading(progress: progress))
102+
}
103+
})
104+
.map { return (availableXcode, $0) }
105105
.eraseToAnyPublisher()
106106
}
107107

Xcodes/Backend/AppState.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ class AppState: ObservableObject {
381381
case .apple:
382382
install(id: id)
383383
case .xcodeReleases:
384-
installWithoutLogin(id: id)
384+
install(id: id)
385385
}
386386
}
387387

@@ -454,6 +454,7 @@ class AppState: ObservableObject {
454454
}
455455

456456
/// Skips using the username/password to log in to Apple, and simply gets a Auth Cookie used in downloading
457+
/// As of Nov 2022 this was returning a 403 forbidden
457458
func installWithoutLogin(id: Xcode.ID) {
458459
guard let availableXcode = availableXcodes.first(where: { $0.version == id }) else { return }
459460

0 commit comments

Comments
 (0)