Fix ISO compatibility messages

This commit is contained in:
Nindi Gill 2023-06-13 20:26:20 +10:00
parent 6b4aec4e50
commit e5378b599b
No known key found for this signature in database
GPG key ID: FF9A7FD590D4F4B1
3 changed files with 25 additions and 11 deletions

View file

@ -751,6 +751,9 @@ struct Installer: Decodable, Hashable, Identifiable {
"beta": beta
]
}
var mavericksOrNewer: Bool {
bigSurOrNewer || version.range(of: "^10\\.(9|1[0-5])\\.", options: .regularExpression) != nil
}
var sierraOrOlder: Bool {
version.range(of: "^10\\.([7-9]|1[0-2])\\.", options: .regularExpression) != nil
}

View file

@ -23,7 +23,20 @@ struct InstallerExportView: View {
return false
}
return architecture == .intel || (architecture == .appleSilicon && installer.bigSurOrNewer)
return (architecture == .intel && installer.mavericksOrNewer) || (architecture == .appleSilicon && installer.bigSurOrNewer)
}
private var compatibilityMessage: String {
guard let architecture: Architecture = Hardware.architecture else {
return ""
}
switch architecture {
case .appleSilicon:
return "**Note:** ISOs are unavailable for building **macOS Catalina 10.15 and older** on [Apple Silicon Macs](https://support.apple.com/en-us/HT211814)."
case .intel:
return "**Note:** ISOs are unavailable for building **OS X Mountain Lion 10.8 and older** on Intel-based Macs."
}
}
var body: some View {
@ -36,16 +49,15 @@ struct InstallerExportView: View {
.disabled(exports.count == 1 && exportApplication)
InstallerExportViewItem(exportType: .diskImage, selected: $exportDiskImage)
.disabled(exports.count == 1 && exportDiskImage)
if isoCompatible {
InstallerExportViewItem(exportType: .iso, selected: $exportISO)
.disabled(exports.count == 1 && exportISO)
}
InstallerExportViewItem(exportType: .iso, selected: $exportISO)
.disabled(isoCompatible ? exports.count == 1 && exportISO : true)
.opacity(isoCompatible ? 1 : 0.5)
InstallerExportViewItem(exportType: .package, selected: $exportPackage)
.disabled(exports.count == 1 && exportPackage)
Spacer()
}
if !isoCompatible {
Text("**Note:** ISOs are unavailable for building **macOS Catalina 10.15 and older** on [Apple Silicon Macs](https://support.apple.com/en-us/HT211814).")
Text(.init(compatibilityMessage))
.padding(.top)
}
}

View file

@ -78,17 +78,16 @@ struct ListRowInstaller: View {
Button {
pressButton(.download)
} label: {
Image(systemName: "arrow.down.circle")
.font(.body.bold())
Image(systemName: "arrow.down.circle").font(.body.bold())
}
.help("Download and export macOS Installer")
.buttonStyle(.mistAction)
if installer.bigSurOrNewer {
if let architecture: Architecture = Hardware.architecture,
(architecture == .appleSilicon && installer.bigSurOrNewer) || (architecture == .intel && installer.mavericksOrNewer) {
Button {
pressButton(.volumeSelection)
} label: {
Image(systemName: "externaldrive")
.font(.body.bold())
Image(systemName: "externaldrive").font(.body.bold())
.padding(.vertical, 1)
}
.help("Create bootable macOS Installer")