From 13715930af765c58cecb80fe240fcb1d621f403f Mon Sep 17 00:00:00 2001 From: Daniel Chick Date: Tue, 17 Oct 2023 18:14:51 -0500 Subject: [PATCH] Update InstallButton with progress view and styling from list row --- Xcodes/Backend/XcodeCommands.swift | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Xcodes/Backend/XcodeCommands.swift b/Xcodes/Backend/XcodeCommands.swift index 76e9924..9967abb 100644 --- a/Xcodes/Backend/XcodeCommands.swift +++ b/Xcodes/Backend/XcodeCommands.swift @@ -34,16 +34,26 @@ struct XcodeCommands: Commands { struct InstallButton: View { @EnvironmentObject var appState: AppState + @State private var isLoading = false + let xcode: Xcode? - + var body: some View { Button(action: install) { - Text("Install") - .help("Install") - } + if isLoading { + ProgressView() + .colorInvert() + .controlSize(.small) + } else { + Text("Install") + .textCase(.uppercase) + .help("InstallDescription") + } + }.buttonStyle(AppStoreButtonStyle(primary: false, highlighted: false)) } - + private func install() { + isLoading = true guard let xcode = xcode else { return } appState.checkMinVersionAndInstall(id: xcode.id) }