Skip to content

Commit

Permalink
toolbar: destructive actions should not be the primary button
Browse files Browse the repository at this point in the history
  • Loading branch information
osy committed Apr 1, 2024
1 parent 0347426 commit 2d46829
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions Platform/Shared/VMConfirmActionModifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,43 +37,43 @@ struct VMConfirmActionModifier: ViewModifier {
switch action {
case .confirmCloneVM:
if vm.isShortcut {
return Alert(title: Text("Do you want to copy this VM and all its data to internal storage?"), primaryButton: .default(Text("Yes")) {
return Alert(title: Text("Do you want to copy this VM and all its data to internal storage?"), primaryButton: .cancel(), secondaryButton: .default(Text("Yes")) {
data.busyWorkAsync {
try await data.clone(vm: vm)
}
onConfirm()
}, secondaryButton: .cancel())
})
} else {
return Alert(title: Text("Do you want to duplicate this VM and all its data?"), primaryButton: .default(Text("Yes")) {
return Alert(title: Text("Do you want to duplicate this VM and all its data?"), primaryButton: .cancel(), secondaryButton: .default(Text("Yes")) {
data.busyWorkAsync {
try await data.clone(vm: vm)
}
onConfirm()
}, secondaryButton: .cancel())
})
}
case .confirmDeleteVM:
return Alert(title: Text("Do you want to delete this VM and all its data?"), primaryButton: .destructive(Text("Delete")) {
return Alert(title: Text("Do you want to delete this VM and all its data?"), primaryButton: .cancel(), secondaryButton: .destructive(Text("Delete")) {
data.busyWorkAsync {
try await data.delete(vm: vm)
}
onConfirm()
}, secondaryButton: .cancel())
})
case .confirmDeleteShortcut:
return Alert(title: Text("Do you want to remove this shortcut? The data will not be deleted."), primaryButton: .destructive(Text("Remove")) {
return Alert(title: Text("Do you want to remove this shortcut? The data will not be deleted."), primaryButton: .cancel(), secondaryButton: .destructive(Text("Remove")) {
data.busyWorkAsync {
await data.listRemove(vm: vm)
}
onConfirm()
}, secondaryButton: .cancel())
})
case .confirmStopVM:
return Alert(title: Text("Do you want to force stop this VM and lose all unsaved data?"), primaryButton: .destructive(Text("Stop")) {
return Alert(title: Text("Do you want to force stop this VM and lose all unsaved data?"), primaryButton: .cancel(), secondaryButton: .destructive(Text("Stop")) {
data.stop(vm: vm)
onConfirm()
}, secondaryButton: .cancel())
})
case .confirmMoveVM:
return Alert(title: Text("Do you want to move this VM to another location? This will copy the data to the new location, delete the data from the original location, and then create a shortcut."), primaryButton: .destructive(Text("Confirm")) {
return Alert(title: Text("Do you want to move this VM to another location? This will copy the data to the new location, delete the data from the original location, and then create a shortcut."), primaryButton: .cancel(), secondaryButton: .destructive(Text("Confirm")) {
onConfirm()
}, secondaryButton: .cancel())
})
}
}
}
Expand Down

0 comments on commit 2d46829

Please sign in to comment.