From fee5e72d30b19a22efc714f8605d19cc163359f7 Mon Sep 17 00:00:00 2001 From: Alan Wizemann Date: Fri, 24 Apr 2026 13:06:59 +0200 Subject: [PATCH] M7 #12: rename Disconnect -> Forget this server + confirmation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- scarf/Scarf iOS/Dashboard/DashboardView.swift | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/scarf/Scarf iOS/Dashboard/DashboardView.swift b/scarf/Scarf iOS/Dashboard/DashboardView.swift index 3f2f064..23202c1 100644 --- a/scarf/Scarf iOS/Dashboard/DashboardView.swift +++ b/scarf/Scarf iOS/Dashboard/DashboardView.swift @@ -13,6 +13,7 @@ struct DashboardView: View { @State private var vm: IOSDashboardViewModel @State private var isDisconnecting = false + @State private var showForgetConfirmation = false /// Stable ID used when building the `ServerContext` — tied to the /// config's host+user tuple so re-launching the app without reset @@ -130,24 +131,39 @@ struct DashboardView: View { Section { Button(role: .destructive) { - Task { - isDisconnecting = true - await onDisconnect() - } + showForgetConfirmation = true } label: { HStack { Spacer() if isDisconnecting { ProgressView() } else { - Text("Disconnect") + Text("Forget this server") } Spacer() } } .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) .navigationBarTitleDisplayMode(.large) .refreshable {