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