diff --git a/ControlRoom/Controllers/SimCtl.swift b/ControlRoom/Controllers/SimCtl.swift index ad7f28b..5ef4ebd 100644 --- a/ControlRoom/Controllers/SimCtl.swift +++ b/ControlRoom/Controllers/SimCtl.swift @@ -113,6 +113,10 @@ enum SimCtl: CommandLineCommandExecuter { ]))) } + static func clearStatusBarOverrides(_ simulator: String) { + execute(.statusBar(deviceId: simulator, operation: .clear)) + } + static func overrideStatusBarTime(_ simulator: String, time: Date) { // Use only time for now since ISO8601 parsing is broken since Xcode 15.3 // https://stackoverflow.com/a/59071895 diff --git a/ControlRoom/Simulator UI/ControlScreens/StatusBarView.swift b/ControlRoom/Simulator UI/ControlScreens/StatusBarView.swift index 4d8015f..29ece9e 100644 --- a/ControlRoom/Simulator UI/ControlScreens/StatusBarView.swift +++ b/ControlRoom/Simulator UI/ControlScreens/StatusBarView.swift @@ -37,7 +37,7 @@ struct StatusBarView: View { /// The current battery state of the device; must be "Charging", "Charged", or "Discharging" /// Note: "Charged" looks the same as "Discharging", so it's not included in this screen. - @State private var batteryState: SimCtl.StatusBar.BatteryState = .charging + @State private var batteryState: SimCtl.StatusBar.BatteryState = .charged var body: some View { ScrollView { @@ -47,6 +47,8 @@ struct StatusBarView: View { DatePicker("Time:", selection: $time) Button("Set", action: setTime) Button("Set to 9:41", action: setAppleTime) + Spacer() + Button("Clear overrides", action: clearOverrides) } } @@ -153,6 +155,17 @@ struct StatusBarView: View { time = appleTime } + private func clearOverrides() { + SimCtl.clearStatusBarOverrides(simulator.udid) + dataNetwork = .wifi + wiFiBar = .three + cellularMode = .active + cellularBar = .four + batteryLevel = 100.0 + batteryState = .charged + carrierName = "Carrier" + } + /// Sends status bar updates all at once; simctl gets unhappy if we send them individually, but /// also for whatever reason prefers cellular data sent separately from WiFi. private func updateWiFiData() {