settings: add button to reset saved USB devices

This commit is contained in:
osy
2025-08-10 16:51:59 -07:00
parent a5fbc70f4d
commit d6f9ab955b
+10
View File
@@ -162,6 +162,8 @@ struct ApplicationSettingsView: View {
@AppStorage("NoQuitConfirmation") var isNoQuitConfirmation = false
@AppStorage("NoUsbPrompt") var isNoUsbPrompt = false
@State private var isConfirmResetAutoConnect = false
var body: some View {
Form {
Toggle(isOn: $isKeepRunningAfterLastWindowClosed, label: {
@@ -191,6 +193,14 @@ struct ApplicationSettingsView: View {
Toggle(isOn: $isNoUsbPrompt, label: {
Text("Do not show prompt when USB device is plugged in")
})
Button("Reset auto connect devices…") {
isConfirmResetAutoConnect.toggle()
}.help("Clears all saved USB devices.")
.alert(isPresented: $isConfirmResetAutoConnect) {
Alert(title: Text("Do you wish to reset all saved USB devices?"), primaryButton: .cancel(), secondaryButton: .destructive(Text("Reset")) {
UTMUSBManager.shared.usbDevices.removeAll()
})
}
}
}
}