Merge pull request #102 from RobotsAndPencils/downloader-from-userDefaults

When downloading, use the downloader from userdefaults
This commit is contained in:
Matt Kiazyk 2021-02-06 15:59:45 -06:00 committed by GitHub
commit e5065b4a58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -15,7 +15,8 @@ extension AppState {
}
private func install(_ installationType: InstallationType, downloader: Downloader, attemptNumber: Int) -> AnyPublisher<InstalledXcode, Error> {
getXcodeArchive(installationType, downloader: downloader)
Logger.appState.info("Using \(downloader) downloader")
return getXcodeArchive(installationType, downloader: downloader)
.flatMap { xcode, url -> AnyPublisher<InstalledXcode, Swift.Error> in
self.installArchivedXcode(xcode, at: url)
}

View file

@ -49,7 +49,7 @@ class AppState: ObservableObject {
@Published var error: Error?
@Published var authError: Error?
// MARK: - Publisher Cancellables
var cancellables = Set<AnyCancellable>()
@ -299,7 +299,7 @@ class AppState: ObservableObject {
.mapError { $0 as Error }
}
.flatMap { [unowned self] in
self.install(.version(availableXcode), downloader: .aria2)
self.install(.version(availableXcode), downloader: Downloader(rawValue: UserDefaults.standard.string(forKey: "downloader") ?? "aria2") ?? .aria2)
}
.receive(on: DispatchQueue.main)
.sink(