commit 9b3fe37d4979df43263d5e83771ff159c039f0b0
parent 4e176831a30049237940c874fda3ac503951c506
Author: Michael Camilleri <[email protected]>
Date: Sun, 24 May 2026 03:13:19 +0900
Use 'Diagnostics Log' for name of log view
Diffstat:
3 files changed, 3 insertions(+), 87 deletions(-)
diff --git a/Crossmate/Views/DiagnosticsView.swift b/Crossmate/Views/DiagnosticsView.swift
@@ -106,7 +106,7 @@ struct DiagnosticsView: View {
}
}
}
- .navigationTitle("Diagnostics")
+ .navigationTitle("Diagnostics Log")
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .topBarTrailing) {
@@ -213,84 +213,3 @@ struct DiagnosticsView: View {
}
}
-struct ShareDiagnosticsView: View {
- @Environment(SyncMonitor.self) private var syncMonitor
- @Environment(EventLog.self) private var eventLog
-
- private var shareEntries: [EventLogEntry] {
- eventLog.entries.filter {
- $0.message.localizedCaseInsensitiveContains("share")
- }
- }
-
- var body: some View {
- List {
- Section("Last Share Error") {
- row("Phase", syncMonitor.lastErrorPhase ?? "None")
- row("Domain", syncMonitor.lastErrorDomain ?? "None")
- row("Code", syncMonitor.lastErrorCode.map(String.init) ?? "None")
- row("Description", syncMonitor.lastErrorDescription ?? "None")
- }
-
- Section("Share Events") {
- if shareEntries.isEmpty {
- Text("No share events captured yet.")
- .foregroundStyle(.secondary)
- } else {
- ForEach(shareEntries.reversed()) { entry in
- VStack(alignment: .leading, spacing: 4) {
- Text(
- "\(TimestampFormatter.string(from: entry.timestamp, in: .local)) [\(entry.level.uppercased())]"
- )
- .font(.caption.monospaced())
- .foregroundStyle(.secondary)
-
- Text(entry.message)
- .font(.caption.monospaced())
- .textSelection(.enabled)
- }
- .padding(.vertical, 2)
- }
- }
- }
- }
- .navigationTitle("Share Diagnostics")
- .navigationBarTitleDisplayMode(.inline)
- .toolbar {
- ToolbarItem(placement: .topBarTrailing) {
- Button("Copy") {
- UIPasteboard.general.string = diagnosticDump
- }
- }
- }
- }
-
- @ViewBuilder
- private func row(_ title: String, _ value: String) -> some View {
- VStack(alignment: .leading, spacing: 4) {
- Text(title)
- .font(.caption)
- .foregroundStyle(.secondary)
- Text(value)
- .font(.body.monospaced())
- .textSelection(.enabled)
- }
- .padding(.vertical, 2)
- }
-
- private var diagnosticDump: String {
- var lines: [String] = []
- lines.append("Last Share Error Phase: \(syncMonitor.lastErrorPhase ?? "None")")
- lines.append("Last Share Error Domain: \(syncMonitor.lastErrorDomain ?? "None")")
- lines.append("Last Share Error Code: \(syncMonitor.lastErrorCode.map(String.init) ?? "None")")
- lines.append("Last Share Error Description: \(syncMonitor.lastErrorDescription ?? "None")")
- lines.append("")
- lines.append("Share Events (UTC):")
- for entry in shareEntries {
- lines.append(
- "\(TimestampFormatter.string(from: entry.timestamp, in: .utc)) [\(entry.level.uppercased())] \(entry.message)"
- )
- }
- return lines.joined(separator: "\n")
- }
-}
diff --git a/Crossmate/Views/PuzzleView.swift b/Crossmate/Views/PuzzleView.swift
@@ -787,7 +787,7 @@ private struct PuzzleToolbarModifier: ViewModifier {
NavigationLink {
DiagnosticsView()
} label: {
- Text("iCloud Diagnostics")
+ Text("Diagnostics Log")
}
}
}
diff --git a/Crossmate/Views/SettingsView.swift b/Crossmate/Views/SettingsView.swift
@@ -41,12 +41,9 @@ struct SettingsView: View {
Section("Debugging") {
Toggle("Enable iCloud Sync", isOn: $preferences.isICloudSyncEnabled)
- NavigationLink("iCloud Diagnostics") {
+ NavigationLink("Diagnostics Log") {
DiagnosticsView()
}
- NavigationLink("Share Diagnostics") {
- ShareDiagnosticsView()
- }
NavigationLink("Record Editor") {
RecordEditorView()
}