Add in-app demo mode toggle, enable alignment assistant in demo data
CAMPER_DEMO=1 only works when Xcode or simctl launches the process, so a build installed locally and opened from the home screen had no way to enable demo mode at all. Demo mode is now also a persisted toggle under Settings > Entwicklung (Debug builds only), checked alongside the environment variable. Takes effect after an app restart since DeviceStore/BluetoothManager only read it at init. Also mark the demo leveling sensor as live-connected - it had a level reading but never a live link state, which left the Ausrichtungs- Assistent button (and Live Activity toggle) disabled in demo mode. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
8d975d2c4d
commit
7fc9442aeb
@@ -3,18 +3,30 @@ import Foundation
|
||||
/// Füllt die App mit erfundenen Messwerten, damit sich die Ansichten ohne
|
||||
/// Fahrzeug und ohne Bluetooth prüfen lassen.
|
||||
///
|
||||
/// Nur in Debug-Builds und nur, wenn beim Start `CAMPER_DEMO=1` gesetzt ist:
|
||||
/// Nur in Debug-Builds, auf zwei Wegen einzuschalten:
|
||||
///
|
||||
/// xcrun simctl launch --terminate-running-process \
|
||||
/// booted de.fritob.CamperMonitor
|
||||
/// # mit: SIMCTL_CHILD_CAMPER_DEMO=1 davor
|
||||
/// * Umgebungsvariable `CAMPER_DEMO=1` beim Start – praktisch im Simulator:
|
||||
///
|
||||
/// xcrun simctl launch --terminate-running-process \
|
||||
/// booted de.fritob.CamperMonitor
|
||||
/// # mit: SIMCTL_CHILD_CAMPER_DEMO=1 davor
|
||||
///
|
||||
/// * Schalter in den Einstellungen (`SettingsView`) – der einzige Weg auf
|
||||
/// einem lokal installierten Build ohne Xcode-Verbindung, da sich dort
|
||||
/// keine Umgebungsvariable setzen lässt. Wirkt erst nach einem Neustart der
|
||||
/// App, weil `DeviceStore` und `BluetoothManager` den Stand nur beim Start
|
||||
/// lesen.
|
||||
///
|
||||
/// Im normalen Betrieb wird hiervon nichts ausgeführt.
|
||||
enum DemoData {
|
||||
|
||||
/// Schlüssel für den Einstellungen-Schalter, siehe `SettingsView`.
|
||||
static let enabledKey = "demoModeEnabled"
|
||||
|
||||
static var isEnabled: Bool {
|
||||
#if DEBUG
|
||||
return ProcessInfo.processInfo.environment["CAMPER_DEMO"] == "1"
|
||||
if ProcessInfo.processInfo.environment["CAMPER_DEMO"] == "1" { return true }
|
||||
return UserDefaults.standard.bool(forKey: enabledKey)
|
||||
#else
|
||||
return false
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user