Merge pull request #437 from chickdan/install_activity_indicator

Activity Indicator on Install Pressed
This commit is contained in:
Matt Kiazyk 2023-12-12 21:28:11 -06:00 committed by GitHub
commit 0884f85359
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 7 deletions

View file

@ -35,16 +35,21 @@ 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) {
ProgressButton(isInProgress: isLoading) {
install()
} label: {
Text("Install")
.help("Install")
.help("InstallDescription")
}
}
private func install() {
isLoading = true
guard let xcode = xcode else { return }
appState.checkMinVersionAndInstall(id: xcode.id)
}

View file

@ -110,10 +110,9 @@ struct XcodeListViewRow: View {
.buttonStyle(AppStoreButtonStyle(primary: true, highlighted: selected))
.help("OpenDescription")
case .notInstalled:
Button("Install") { appState.checkMinVersionAndInstall(id: xcode.id) }
InstallButton(xcode: xcode)
.textCase(.uppercase)
.buttonStyle(AppStoreButtonStyle(primary: false, highlighted: selected))
.help("InstallDescription")
.buttonStyle(AppStoreButtonStyle(primary: false, highlighted: false))
case let .installing(installationStep):
InstallationStepRowView(
installationStep: installationStep,