diff --git a/Mist/Views/List/ListRowInstaller.swift b/Mist/Views/List/ListRowInstaller.swift index b955328..b082881 100644 --- a/Mist/Views/List/ListRowInstaller.swift +++ b/Mist/Views/List/ListRowInstaller.swift @@ -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"