fix runtime not appearing when multiple runtimes exist for same build

This commit is contained in:
Matt Kiazyk 2024-03-08 12:16:20 -06:00
parent 91f75843da
commit 8534e2850b
4 changed files with 6 additions and 6 deletions

View file

@ -15,10 +15,10 @@ extension AppState {
var updatedRuntime = runtime
// This loops through and matches up the simulatorVersion to the mappings
let simulatorBuildUpdate = downloadableRuntimes.sdkToSimulatorMappings.first { SDKToSimulatorMapping in
let simulatorBuildUpdate = downloadableRuntimes.sdkToSimulatorMappings.filter { SDKToSimulatorMapping in
SDKToSimulatorMapping.simulatorBuildUpdate == runtime.simulatorVersion.buildUpdate
}
updatedRuntime.sdkBuildUpdate = simulatorBuildUpdate?.sdkBuildUpdate
updatedRuntime.sdkBuildUpdate = simulatorBuildUpdate.map { $0.sdkBuildUpdate }
return updatedRuntime
}

View file

@ -146,12 +146,12 @@ var xcodeDict: [XcodePreviewName: Xcode] = [
var downloadableRuntimes: [DownloadableRuntime] = {
var runtimes = try! JSONDecoder().decode([DownloadableRuntime].self, from: Current.files.contents(atPath: Path.runtimeCacheFile.string)!)
// set iOS to installed
let iOSIndex = runtimes.firstIndex { $0.sdkBuildUpdate == "19E239" }!
let iOSIndex = 0//runtimes.firstIndex { $0.sdkBuildUpdate.contains == "19E239" }!
var iOSRuntime = runtimes[iOSIndex]
iOSRuntime.installState = .installed
runtimes[iOSIndex] = iOSRuntime
let watchOSIndex = runtimes.firstIndex { $0.sdkBuildUpdate == "20R362" }!
let watchOSIndex = 0//runtimes.firstIndex { $0.sdkBuildUpdate.first == "20R362" }!
var runtime = runtimes[watchOSIndex]
runtime.installState = .installing(
RuntimeInstallationStep.downloading(

View file

@ -19,7 +19,7 @@ struct PlatformsView: View {
let builds = xcode.sdks?.allBuilds()
let runtimes = builds?.flatMap { sdkBuild in
appState.downloadableRuntimes.filter {
$0.sdkBuildUpdate == sdkBuild
$0.sdkBuildUpdate?.contains(sdkBuild) ?? false
}
}

View file

@ -30,7 +30,7 @@ public struct DownloadableRuntime: Codable, Identifiable, Hashable {
// dynamically updated - not decoded
public var installState: RuntimeInstallState = .notInstalled
public var sdkBuildUpdate: String?
public var sdkBuildUpdate: [String]?
enum CodingKeys: CodingKey {
case category