From 1ce2aced9046e5964d241ada80aef4ebda5d6d20 Mon Sep 17 00:00:00 2001 From: psavarmattas Date: Sat, 15 Aug 2026 01:01:19 +0100 Subject: [PATCH] fix(settings): red Clear Cache button, confirm when it's done MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit role: .destructive alone wasn't rendering red on its own — explicit .buttonStyle(.borderedProminent).tint(.red), matching how other destructive actions in the app (DocumentShareSheet's Revoke) had to be styled explicitly too. Also shows a transient "Cleared" checkmark for 2s after finishing, same timed-reset pattern as the share sheet's copy-link feedback, since the storage count updating alone was easy to miss. --- Outpost/Features/Account/SettingsView.swift | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Outpost/Features/Account/SettingsView.swift b/Outpost/Features/Account/SettingsView.swift index 07fac73..7daffe2 100644 --- a/Outpost/Features/Account/SettingsView.swift +++ b/Outpost/Features/Account/SettingsView.swift @@ -21,6 +21,7 @@ struct SettingsView: View { @State private var pendingOperations: [PendingOperationSummary] = [] @State private var isSyncing = false @State private var isClearingCache = false + @State private var didClearCache = false @State private var lastFullSyncSummary: FullSyncSummary? @State private var lastFlushSummary: SyncFlushSummary? @@ -288,9 +289,14 @@ struct SettingsView: View { .frame(maxWidth: 480) VStack(alignment: .leading, spacing: 6) { - HStack { + HStack(spacing: 10) { Text("Clear All Cache") Spacer() + if didClearCache { + Label("Cleared", systemImage: "checkmark") + .font(.caption) + .foregroundStyle(.secondary) + } Button(role: .destructive) { Task { await clearCache() } } label: { @@ -300,6 +306,8 @@ struct SettingsView: View { Text("Clear") } } + .buttonStyle(.borderedProminent) + .tint(.red) } Text("Deletes every cached collection and document, including anything Full Local Sync built, and anything still waiting to sync. Doesn't touch the server. This is the only place that can — it works even while offline, which is exactly why it's behind this toggle.") .font(.caption2) @@ -410,6 +418,11 @@ struct SettingsView: View { defer { isClearingCache = false } await cachingClient.clearCache() await refreshSyncState() + didClearCache = true + Task { + try? await Task.sleep(for: .seconds(2)) + didClearCache = false + } } } #endif