1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-07 03:50:08 +02:00

Mark as busy

This commit is contained in:
2023-03-22 21:49:55 +01:00
parent 5755d608f8
commit 9c8da2aa1c

View File

@ -150,6 +150,7 @@ struct PhpFormulaeView: View {
let command = InstallPhpVersionCommand(formula: formula.name)
do {
PhpEnv.shared.isBusy = true
try await command.execute { progress in
Task { @MainActor in
self.status.title = progress.title
@ -157,11 +158,13 @@ struct PhpFormulaeView: View {
self.status.busy = progress.value != 1
if progress.value == 1 {
PhpEnv.shared.isBusy = false
await self.handler.refreshPhpVersions(loadOutdated: false)
}
}
}
} catch {
PhpEnv.shared.isBusy = false
Task { @MainActor in
self.status.busy = false
}
@ -179,6 +182,7 @@ struct PhpFormulaeView: View {
let command = RemovePhpVersionCommand(formula: formula.name)
do {
PhpEnv.shared.isBusy = true
try await command.execute { progress in
Task { @MainActor in
self.status.title = progress.title
@ -187,10 +191,12 @@ struct PhpFormulaeView: View {
if progress.value == 1 {
await self.handler.refreshPhpVersions(loadOutdated: false)
PhpEnv.shared.isBusy = false
}
}
}
} catch {
PhpEnv.shared.isBusy = false
Task { @MainActor in
self.status.busy = false
}