From bcdaccb3425977bde25bdd00aa4882b0e32c771d Mon Sep 17 00:00:00 2001 From: Nindi Gill Date: Tue, 13 Jun 2023 18:39:26 +1000 Subject: [PATCH] Fix linter warning --- Mist/Views/List/ListRowInstaller.swift | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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"