Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ControlRoom/Controllers/SimCtl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 14 additions & 1 deletion ControlRoom/Simulator UI/ControlScreens/StatusBarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
}
}

Expand Down Expand Up @@ -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() {
Expand Down