mirror of
https://github.com/awizemann/scarf.git
synced 2026-05-10 10:36:35 +00:00
M7 #12: rename Disconnect -> Forget this server + confirmation
Pass-1 found that "Disconnect" was actually a factory reset — wiping both Keychain SSH key and UserDefaults config, forcing full re-onboarding (including re-generating a key and appending it to authorized_keys on the remote). Interim fix ahead of M9 multi-server work: - Relabel button "Forget this server". - Keep destructive role. - Gate tap on a confirmationDialog so users see exactly what gets wiped and can back out. - Add a footer explaining the authorized_keys consequence so the user isn't surprised by a failed reconnect later. Behaviour is unchanged (still wipes both stores). M9 introduces the proper split: soft Disconnect (closes live transport, keeps credentials) vs. hard Forget (this behaviour). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,7 @@ struct DashboardView: View {
|
|||||||
|
|
||||||
@State private var vm: IOSDashboardViewModel
|
@State private var vm: IOSDashboardViewModel
|
||||||
@State private var isDisconnecting = false
|
@State private var isDisconnecting = false
|
||||||
|
@State private var showForgetConfirmation = false
|
||||||
|
|
||||||
/// Stable ID used when building the `ServerContext` — tied to the
|
/// Stable ID used when building the `ServerContext` — tied to the
|
||||||
/// config's host+user tuple so re-launching the app without reset
|
/// config's host+user tuple so re-launching the app without reset
|
||||||
@@ -130,24 +131,39 @@ struct DashboardView: View {
|
|||||||
|
|
||||||
Section {
|
Section {
|
||||||
Button(role: .destructive) {
|
Button(role: .destructive) {
|
||||||
Task {
|
showForgetConfirmation = true
|
||||||
isDisconnecting = true
|
|
||||||
await onDisconnect()
|
|
||||||
}
|
|
||||||
} label: {
|
} label: {
|
||||||
HStack {
|
HStack {
|
||||||
Spacer()
|
Spacer()
|
||||||
if isDisconnecting {
|
if isDisconnecting {
|
||||||
ProgressView()
|
ProgressView()
|
||||||
} else {
|
} else {
|
||||||
Text("Disconnect")
|
Text("Forget this server")
|
||||||
}
|
}
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.disabled(isDisconnecting)
|
.disabled(isDisconnecting)
|
||||||
|
} footer: {
|
||||||
|
Text("Removes this server's SSH key and host info from the device. You'll need to add the public key back to `~/.ssh/authorized_keys` to reconnect.")
|
||||||
|
.font(.caption)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.confirmationDialog(
|
||||||
|
"Forget this server?",
|
||||||
|
isPresented: $showForgetConfirmation,
|
||||||
|
titleVisibility: .visible
|
||||||
|
) {
|
||||||
|
Button("Forget \(config.displayName)", role: .destructive) {
|
||||||
|
Task {
|
||||||
|
isDisconnecting = true
|
||||||
|
await onDisconnect()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Button("Cancel", role: .cancel) {}
|
||||||
|
} message: {
|
||||||
|
Text("Your SSH key and host settings will be removed from this device. This cannot be undone.")
|
||||||
|
}
|
||||||
.navigationTitle(config.displayName)
|
.navigationTitle(config.displayName)
|
||||||
.navigationBarTitleDisplayMode(.large)
|
.navigationBarTitleDisplayMode(.large)
|
||||||
.refreshable {
|
.refreshable {
|
||||||
|
|||||||
Reference in New Issue
Block a user