Fix linter warning

This commit is contained in:
Nindi Gill 2023-06-13 18:39:26 +10:00
parent f42acf2e00
commit bcdaccb342
No known key found for this signature in database
GPG key ID: FF9A7FD590D4F4B1

View file

@ -76,8 +76,7 @@ struct ListRowInstaller: View {
) )
HStack(spacing: 1) { HStack(spacing: 1) {
Button { Button {
sheetType = .download pressButton(.download)
if installer.compatible { Task { validate() } } else { showCompatibilityWarning() }
} label: { } label: {
Image(systemName: "arrow.down.circle") Image(systemName: "arrow.down.circle")
.font(.body.bold()) .font(.body.bold())
@ -85,8 +84,7 @@ struct ListRowInstaller: View {
.help("Download and export macOS Installer") .help("Download and export macOS Installer")
.buttonStyle(.mistAction) .buttonStyle(.mistAction)
Button { Button {
sheetType = .volumeSelection pressButton(.volumeSelection)
if installer.compatible { Task { validate() } } else { showCompatibilityWarning() }
} label: { } label: {
Image(systemName: "externaldrive") Image(systemName: "externaldrive")
.font(.body.bold()) .font(.body.bold())
@ -172,6 +170,16 @@ struct ListRowInstaller: View {
} }
} }
private func pressButton(_ type: InstallerSheetType) {
sheetType = type
if installer.compatible {
Task { validate() }
} else {
showCompatibilityWarning()
}
}
private func open() { private func open() {
showOpenPanel = false showOpenPanel = false
openPanel.title = "Download Installer" openPanel.title = "Download Installer"