Skip to content

Commit

Permalink
Merge pull request #628 from XcodesOrg/matt/runtimeDownloadCleanup
Browse files Browse the repository at this point in the history
allow cancelling of runtime downloads, cleanup
  • Loading branch information
MattKiazyk authored Oct 18, 2024
2 parents 283c1a4 + 6050c78 commit dc31fe8
Show file tree
Hide file tree
Showing 2 changed files with 132 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Xcodes/Backend/AppState+Runtimes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ extension AppState {
// not supported
Logger.appState.error("Trying to download a runtime we can't download")
DispatchQueue.main.async {
self.presentedAlert = .generic(title: localizeString("Alert.Install.Error.Title"), message: "Sorry. Apple only supports downloading runtimes iOS 18+, tvOS 18+, watchOS 11+, visionOS 2+ with Xcode 16.1+. Please download and make active.")
self.presentedAlert = .generic(title: localizeString("Alert.Install.Error.Title"), message: localizeString("Alert.Install.Error.Need.Xcode16.1"))
}
return
}
Expand All @@ -76,9 +76,12 @@ extension AppState {
}

func downloadRuntimeViaXcodeBuild(runtime: DownloadableRuntime) {
runtimePublishers[runtime.identifier] = Task {

let downloadRuntimeTask = Current.shell.downloadRuntime(runtime.platform.shortName, runtime.simulatorVersion.buildUpdate)
runtimePublishers[runtime.identifier] = Task { [weak self] in
guard let self = self else { return }
do {
for try await progress in Current.shell.downloadRuntime(runtime.platform.shortName, runtime.simulatorVersion.buildUpdate) {
for try await progress in downloadRuntimeTask {
if progress.isIndeterminate {
DispatchQueue.main.async {
self.setInstallationStep(of: runtime, to: .installing, postNotification: false)
Expand All @@ -91,6 +94,7 @@ extension AppState {

}
Logger.appState.debug("Done downloading runtime - \(runtime.name)")

DispatchQueue.main.async {
guard let index = self.downloadableRuntimes.firstIndex(where: { $0.identifier == runtime.identifier }) else { return }
self.downloadableRuntimes[index].installState = .installed
Expand Down
125 changes: 125 additions & 0 deletions Xcodes/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -1958,6 +1958,131 @@
}
}
},
"Alert.Install.Error.Need.Xcode16.1" : {
"extractionState" : "manual",
"localizations" : {
"ar" : {
"stringUnit" : {
"state" : "translated",
"value" : "Apple only supports downloading runtimes iOS 16.0+, watchOS 9.0+, tvOS 16+, visionOS 1.0+ with Xcode 16.1+. Please download, make active and try again."
}
},
"ca" : {
"stringUnit" : {
"state" : "translated",
"value" : "Apple only supports downloading runtimes iOS 16.0+, watchOS 9.0+, tvOS 16+, visionOS 1.0+ with Xcode 16.1+. Please download, make active and try again."
}
},
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Apple only supports downloading runtimes iOS 16.0+, watchOS 9.0+, tvOS 16+, visionOS 1.0+ with Xcode 16.1+. Please download, make active and try again."
}
},
"el" : {
"stringUnit" : {
"state" : "translated",
"value" : "Apple only supports downloading runtimes iOS 16.0+, watchOS 9.0+, tvOS 16+, visionOS 1.0+ with Xcode 16.1+. Please download, make active and try again."
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Apple only supports downloading runtimes iOS 16.0+, watchOS 9.0+, tvOS 16+, visionOS 1.0+ with Xcode 16.1+. Please download, make active and try again."
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "Apple only supports downloading runtimes iOS 16.0+, watchOS 9.0+, tvOS 16+, visionOS 1.0+ with Xcode 16.1+. Please download, make active and try again."
}
},
"fi" : {
"stringUnit" : {
"state" : "translated",
"value" : "Apple only supports downloading runtimes iOS 16.0+, watchOS 9.0+, tvOS 16+, visionOS 1.0+ with Xcode 16.1+. Please download, make active and try again."
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Apple only supports downloading runtimes iOS 16.0+, watchOS 9.0+, tvOS 16+, visionOS 1.0+ with Xcode 16.1+. Please download, make active and try again."
}
},
"hi" : {
"stringUnit" : {
"state" : "translated",
"value" : "Apple only supports downloading runtimes iOS 16.0+, watchOS 9.0+, tvOS 16+, visionOS 1.0+ with Xcode 16.1+. Please download, make active and try again."
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
"value" : "Apple only supports downloading runtimes iOS 16.0+, watchOS 9.0+, tvOS 16+, visionOS 1.0+ with Xcode 16.1+. Please download, make active and try again."
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "Apple only supports downloading runtimes iOS 16.0+, watchOS 9.0+, tvOS 16+, visionOS 1.0+ with Xcode 16.1+. Please download, make active and try again."
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
"value" : "Apple only supports downloading runtimes iOS 16.0+, watchOS 9.0+, tvOS 16+, visionOS 1.0+ with Xcode 16.1+. Please download, make active and try again."
}
},
"nl" : {
"stringUnit" : {
"state" : "translated",
"value" : "Apple only supports downloading runtimes iOS 16.0+, watchOS 9.0+, tvOS 16+, visionOS 1.0+ with Xcode 16.1+. Please download, make active and try again."
}
},
"pl" : {
"stringUnit" : {
"state" : "translated",
"value" : "Apple only supports downloading runtimes iOS 16.0+, watchOS 9.0+, tvOS 16+, visionOS 1.0+ with Xcode 16.1+. Please download, make active and try again."
}
},
"pt-BR" : {
"stringUnit" : {
"state" : "translated",
"value" : "Apple only supports downloading runtimes iOS 16.0+, watchOS 9.0+, tvOS 16+, visionOS 1.0+ with Xcode 16.1+. Please download, make active and try again."
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
"value" : "Apple only supports downloading runtimes iOS 16.0+, watchOS 9.0+, tvOS 16+, visionOS 1.0+ with Xcode 16.1+. Please download, make active and try again."
}
},
"tr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Apple only supports downloading runtimes iOS 16.0+, watchOS 9.0+, tvOS 16+, visionOS 1.0+ with Xcode 16.1+. Please download, make active and try again."
}
},
"uk" : {
"stringUnit" : {
"state" : "translated",
"value" : "Apple only supports downloading runtimes iOS 16.0+, watchOS 9.0+, tvOS 16+, visionOS 1.0+ with Xcode 16.1+. Please download, make active and try again."
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "Apple only supports downloading runtimes iOS 16.0+, watchOS 9.0+, tvOS 16+, visionOS 1.0+ with Xcode 16.1+. Please download, make active and try again."
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "Apple only supports downloading runtimes iOS 16.0+, watchOS 9.0+, tvOS 16+, visionOS 1.0+ with Xcode 16.1+. Please download, make active and try again."
}
}
}
},
"Alert.Install.Error.Title" : {
"comment" : "Install",
"extractionState" : "manual",
Expand Down

0 comments on commit dc31fe8

Please sign in to comment.