Skip to content

Commit 6050c78

Browse files
committed
allow cancelling of runtime downloads, cleanup
1 parent cf85e2f commit 6050c78

2 files changed

Lines changed: 132 additions & 3 deletions

File tree

Xcodes/Backend/AppState+Runtimes.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ extension AppState {
6666
// not supported
6767
Logger.appState.error("Trying to download a runtime we can't download")
6868
DispatchQueue.main.async {
69-
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.")
69+
self.presentedAlert = .generic(title: localizeString("Alert.Install.Error.Title"), message: localizeString("Alert.Install.Error.Need.Xcode16.1"))
7070
}
7171
return
7272
}
@@ -76,9 +76,12 @@ extension AppState {
7676
}
7777

7878
func downloadRuntimeViaXcodeBuild(runtime: DownloadableRuntime) {
79-
runtimePublishers[runtime.identifier] = Task {
79+
80+
let downloadRuntimeTask = Current.shell.downloadRuntime(runtime.platform.shortName, runtime.simulatorVersion.buildUpdate)
81+
runtimePublishers[runtime.identifier] = Task { [weak self] in
82+
guard let self = self else { return }
8083
do {
81-
for try await progress in Current.shell.downloadRuntime(runtime.platform.shortName, runtime.simulatorVersion.buildUpdate) {
84+
for try await progress in downloadRuntimeTask {
8285
if progress.isIndeterminate {
8386
DispatchQueue.main.async {
8487
self.setInstallationStep(of: runtime, to: .installing, postNotification: false)
@@ -91,6 +94,7 @@ extension AppState {
9194

9295
}
9396
Logger.appState.debug("Done downloading runtime - \(runtime.name)")
97+
9498
DispatchQueue.main.async {
9599
guard let index = self.downloadableRuntimes.firstIndex(where: { $0.identifier == runtime.identifier }) else { return }
96100
self.downloadableRuntimes[index].installState = .installed

Xcodes/Resources/Localizable.xcstrings

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,6 +1958,131 @@
19581958
}
19591959
}
19601960
},
1961+
"Alert.Install.Error.Need.Xcode16.1" : {
1962+
"extractionState" : "manual",
1963+
"localizations" : {
1964+
"ar" : {
1965+
"stringUnit" : {
1966+
"state" : "translated",
1967+
"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."
1968+
}
1969+
},
1970+
"ca" : {
1971+
"stringUnit" : {
1972+
"state" : "translated",
1973+
"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."
1974+
}
1975+
},
1976+
"de" : {
1977+
"stringUnit" : {
1978+
"state" : "translated",
1979+
"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."
1980+
}
1981+
},
1982+
"el" : {
1983+
"stringUnit" : {
1984+
"state" : "translated",
1985+
"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."
1986+
}
1987+
},
1988+
"en" : {
1989+
"stringUnit" : {
1990+
"state" : "translated",
1991+
"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."
1992+
}
1993+
},
1994+
"es" : {
1995+
"stringUnit" : {
1996+
"state" : "translated",
1997+
"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."
1998+
}
1999+
},
2000+
"fi" : {
2001+
"stringUnit" : {
2002+
"state" : "translated",
2003+
"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."
2004+
}
2005+
},
2006+
"fr" : {
2007+
"stringUnit" : {
2008+
"state" : "translated",
2009+
"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."
2010+
}
2011+
},
2012+
"hi" : {
2013+
"stringUnit" : {
2014+
"state" : "translated",
2015+
"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."
2016+
}
2017+
},
2018+
"it" : {
2019+
"stringUnit" : {
2020+
"state" : "translated",
2021+
"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."
2022+
}
2023+
},
2024+
"ja" : {
2025+
"stringUnit" : {
2026+
"state" : "translated",
2027+
"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."
2028+
}
2029+
},
2030+
"ko" : {
2031+
"stringUnit" : {
2032+
"state" : "translated",
2033+
"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."
2034+
}
2035+
},
2036+
"nl" : {
2037+
"stringUnit" : {
2038+
"state" : "translated",
2039+
"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."
2040+
}
2041+
},
2042+
"pl" : {
2043+
"stringUnit" : {
2044+
"state" : "translated",
2045+
"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."
2046+
}
2047+
},
2048+
"pt-BR" : {
2049+
"stringUnit" : {
2050+
"state" : "translated",
2051+
"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."
2052+
}
2053+
},
2054+
"ru" : {
2055+
"stringUnit" : {
2056+
"state" : "translated",
2057+
"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."
2058+
}
2059+
},
2060+
"tr" : {
2061+
"stringUnit" : {
2062+
"state" : "translated",
2063+
"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."
2064+
}
2065+
},
2066+
"uk" : {
2067+
"stringUnit" : {
2068+
"state" : "translated",
2069+
"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."
2070+
}
2071+
},
2072+
"zh-Hans" : {
2073+
"stringUnit" : {
2074+
"state" : "translated",
2075+
"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."
2076+
}
2077+
},
2078+
"zh-Hant" : {
2079+
"stringUnit" : {
2080+
"state" : "translated",
2081+
"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."
2082+
}
2083+
}
2084+
}
2085+
},
19612086
"Alert.Install.Error.Title" : {
19622087
"comment" : "Install",
19632088
"extractionState" : "manual",

0 commit comments

Comments
 (0)