Debug: 100 m fence delivery test + test-button trace logging

Settings → Debug → 'Debug fence (delivery test)': registers a 100 m
CLCircularRegion at the current fix that exists solely to prove iOS
delivers region events on this install. Entering it ticks 'Region events
this session', logs 'debug fence entered' in the Alert trace, and fires a
plain notification — zero alert gates. Cleared via button; survives the
station re-registration loop (update() now skips debug-fence regions);
cleared when alerts are disabled.

The Test alert / Plain test buttons now also write to the Alert trace
('test alert scheduled — …'), so the trace reflects every probe, not just
live geofence entries. 83 tests, Release build green.
This commit is contained in:
FuelBoard Contributor
2026-08-15 11:46:00 +01:00
parent 494412ba99
commit 6cbf1dfc8f
3 changed files with 91 additions and 2 deletions
+27
View File
@@ -46,6 +46,12 @@ struct SettingsView: View {
var alertLog: [AlertLogEntry] = []
/// Region events received this session (monitor.regionEventCount).
var regionEventCount: Int = 0
/// Debug fence state (monitor.debugFenceIdentifier) armed vs cleared.
var debugFenceIdentifier: String?
/// Arms a 100 m fence at the current location (monitor.registerDebugFenceAroundMe).
var onDebugFence: () -> Void = {}
/// Clears the armed fence (monitor.clearDebugFence).
var onClearDebugFence: () -> Void = {}
@StateObject private var tipStore = TipStore()
@State private var showTipAlert = false
@@ -234,6 +240,27 @@ struct SettingsView: View {
Text("Geofence monitoring")
}
Section {
if debugFenceIdentifier != nil {
LabeledContent("Debug fence", value: "armed (100 m)")
Text("Step 100 m away from your current position, then walk back in. 'Region events this session' should tick and a plain notification fires — proof iOS delivers region events on this install, with no alert gates involved.")
.font(.caption)
.foregroundStyle(.secondary)
Button("Clear debug fence", role: .destructive) {
onClearDebugFence()
}
} else {
Button("Register 100 m fence at current location") {
onDebugFence()
}
Text("A debug-only circle around your current position that proves geofence delivery end-to-end: step out 100 m and back in, and watch 'Region events this session' tick.")
.font(.caption)
.foregroundStyle(.secondary)
}
} header: {
Text("Debug fence (delivery test)")
}
Section {
LabeledContent("Region events this session", value: "\(regionEventCount)")
if alertLog.isEmpty {