← All repositories

crossmate

A collaborative crossword app for iPhone and iPad

git clone https://code.inqk.net/crossmate.git


commit f3901ffa4c4c7ff29ab6b04825a6e8eb2e67c8d9
parent 78ee59483c5ffb11917e3256568fcc9c60e25eb9
Author: Michael Camilleri <[email protected]>
Date:   Fri, 24 Apr 2026 17:01:26 +0900

Add reset database button to Settings

This commit adds a button to reset the database from the debugging menu.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

Diffstat

MCrossmate/Views/SettingsView.swift | 21+++++++++++++++++++--
MCrossmate/Views/SyncDiagnosticsView.swift | 18------------------

2 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/Crossmate/Views/SettingsView.swift b/Crossmate/Views/SettingsView.swift

@@ -3,8 +3,10 @@ import SwiftUI
 struct SettingsView: View {
     @Environment(NYTAuthService.self) private var nytAuth
     @Environment(\.dismiss) private var dismiss
+    @Environment(\.resetDatabase) private var resetDatabase
 
     @State private var showingNYTLogin = false
+    @State private var showResetConfirmation = false
     @State private var fetchResult: String?
     @State private var isFetching = false
 
@@ -19,10 +21,25 @@ struct SettingsView: View {
                     }
                 }
 
-                Section("iCloud Sync") {
-                    NavigationLink("Diagnostics") {
+                Section("Debugging") {
+                    NavigationLink("iCloud Diagnostics") {
                         SyncDiagnosticsView()
                     }
+
+                    Button("Reset Database", role: .destructive) {
+                        showResetConfirmation = true
+                    }
+                    .alert(
+                        "Delete all games?",
+                        isPresented: $showResetConfirmation
+                    ) {
+                        Button("Delete All Games", role: .destructive) {
+                            Task { await resetDatabase?() }
+                        }
+                        Button("Cancel", role: .cancel) {}
+                    } message: {
+                        Text("This removes every game and clears the sync state on this device. Games on other devices and in iCloud are not affected.")
+                    }
                 }
             }
             .navigationTitle("Settings")

diff --git a/Crossmate/Views/SyncDiagnosticsView.swift b/Crossmate/Views/SyncDiagnosticsView.swift

@@ -3,11 +3,9 @@ import SwiftUI
 
 struct SyncDiagnosticsView: View {
     @Environment(\.syncEngine) private var syncEngine
-    @Environment(\.resetDatabase) private var resetDatabase
     @Environment(SyncMonitor.self) private var syncMonitor
 
     @State private var isSyncing = false
-    @State private var showResetConfirmation = false
 
     private static let timestampFormatter: DateFormatter = {
         let formatter = DateFormatter()
@@ -58,22 +56,6 @@ struct SyncDiagnosticsView: View {
                     Task { await resetSyncState() }
                 }
                 .disabled(isSyncing)
-
-                Button("Reset Database", role: .destructive) {
-                    showResetConfirmation = true
-                }
-                .disabled(isSyncing)
-                .confirmationDialog(
-                    "Delete all games?",
-                    isPresented: $showResetConfirmation,
-                    titleVisibility: .visible
-                ) {
-                    Button("Delete All Games", role: .destructive) {
-                        Task { await resetDatabase?() }
-                    }
-                } message: {
-                    Text("This removes every game and clears the sync state on this device. Games on other devices and in iCloud are not affected.")
-                }
             }
 
             Section("Recent Events") {