Files
Nearfield_Friends/Proximity/Views/DebugMenu.swift

48 lines
1.7 KiB
Swift
Raw Normal View History

import SwiftUI
/// Developer debug menu, available only in DEBUG builds.
///
/// This is the primary tool for testing the **interaction loop** without any
/// hardware. It drives a `SimulatedAdapter` inside `PresenceEngine`, letting
/// you simulate encounters, waves, and even a crowd exactly as if real
/// users were walking by. In the simulator, you can fully exercise silhouette
/// wave reveal chat with zero physical devices.
///
/// Enabled via the `#if DEBUG` guard so it never ships to production.
struct DebugMenu: View {
@EnvironmentObject private var appState: AppState
var body: some View {
#if DEBUG
NavigationStack {
Form {
Section("Simulation") {
Button("Simulate someone walking by") {
appState.simulateEncounter()
}
Button("Simulate a crowd (20 people)") {
appState.simulateCrowd()
}
Toggle("Auto-broadcast nearby users", isOn: $appState.autoBroadcast)
}
Section("Backend") {
Label("Local server (localhost:8080)", systemImage: "network")
.foregroundColor(.secondary)
Button("Reconnect socket") {
appState.restartRealtime()
}
}
Section("Info") {
Label("Simulator mode — no hardware", systemImage: "iphone.simulator")
.foregroundColor(.secondary)
}
}
.navigationTitle("Debug")
}
#else
EmptyView()
#endif
}
}