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) {
Button {
sheetType = .download
if installer.compatible { Task { validate() } } else { showCompatibilityWarning() }
pressButton(.download)
} label: {
Image(systemName: "arrow.down.circle")
.font(.body.bold())
@ -85,8 +84,7 @@ struct ListRowInstaller: View {
.help("Download and export macOS Installer")
.buttonStyle(.mistAction)
Button {
sheetType = .volumeSelection
if installer.compatible { Task { validate() } } else { showCompatibilityWarning() }
pressButton(.volumeSelection)
} label: {
Image(systemName: "externaldrive")
.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() {
showOpenPanel = false
openPanel.title = "Download Installer"