Skip to content

Commit cb95765

Browse files
Clean up debug commands, about window
1 parent ea9d86c commit cb95765

File tree

2 files changed

+54
-26
lines changed

2 files changed

+54
-26
lines changed

Alidade/Entrypoint.swift

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -110,38 +110,14 @@ struct MCMapsApp: App {
110110
#endif
111111
#if DEBUG
112112
.commands {
113-
CommandMenu("Debug") {
114-
Menu("Tips") {
115-
Button("Show All Tips") {
116-
Tips.showAllTipsForTesting()
117-
}
118-
Button("Hide All Tips") {
119-
Tips.hideAllTipsForTesting()
120-
}
121-
Button("Reset Tip Datastore") {
122-
do {
123-
try Tips.resetDatastore()
124-
} catch {
125-
print("Failed to reset datastore: \(error.localizedDescription)")
126-
}
127-
}
128-
}
129-
}
113+
DebugCommands()
130114
}
131115
#endif
132116

133117
DocumentLaunchScene(proxyMap: $proxyMap)
134118

135119
#if os(macOS)
136-
Window("About \(Self.information.name)", id: "about") {
137-
AboutWindowView()
138-
.containerBackground(.thickMaterial, for: .window)
139-
}
140-
.windowStyle(.hiddenTitleBar)
141-
.windowResizability(.contentSize)
142-
.windowToolbarStyle(.unified)
143-
.windowBackgroundDragBehavior(.enabled)
144-
120+
AboutWindow()
145121
Settings {
146122
AlidadeSettingsView()
147123
.presentedWindowToolbarStyle(.unifiedCompact)
@@ -152,6 +128,22 @@ struct MCMapsApp: App {
152128
}
153129
}
154130

131+
#if os(macOS)
132+
private struct AboutWindow: Scene {
133+
var body: some Scene {
134+
Window("About \(MCMapsApp.information.name)", id: "about") {
135+
AboutWindowView()
136+
.containerBackground(.thickMaterial, for: .window)
137+
}
138+
.windowStyle(.hiddenTitleBar)
139+
.windowResizability(.contentSize)
140+
.windowToolbarStyle(.unified)
141+
.windowBackgroundDragBehavior(.enabled)
142+
143+
}
144+
}
145+
#endif
146+
155147
#if DEBUG
156148
extension MCMapsApp {
157149
var testHooks: TestHooks { TestHooks(target: self) }
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//
2+
// DebugCommands.swift
3+
// Alidade
4+
//
5+
// Created by Marquis Kurt on 18-01-2026.
6+
//
7+
8+
#if DEBUG
9+
import SwiftUI
10+
import TipKit
11+
12+
/// A group of commands useful for debugging Alidade.
13+
///
14+
/// > Note: This command group is only available in debug builds of Alidade.
15+
struct DebugCommands: Commands {
16+
var body: some Commands {
17+
CommandMenu("Debug") {
18+
Menu("Tips") {
19+
Button("Show All Tips") {
20+
Tips.showAllTipsForTesting()
21+
}
22+
Button("Hide All Tips") {
23+
Tips.hideAllTipsForTesting()
24+
}
25+
Button("Reset Tip Datastore") {
26+
do {
27+
try Tips.resetDatastore()
28+
} catch {
29+
print("Failed to reset datastore: \(error.localizedDescription)")
30+
}
31+
}
32+
}
33+
}
34+
}
35+
}
36+
#endif

0 commit comments

Comments
 (0)