Skip to content

Commit

Permalink
Fix ios simulator build
Browse files Browse the repository at this point in the history
  • Loading branch information
pdenert committed Jun 13, 2024
1 parent b3af5c0 commit 18e26c1
Showing 1 changed file with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -362,15 +362,19 @@

// MARK: Volume settings
func pressVolumeUp() throws {
try runVolumeAction("pressing volume up") {
#if targetEnvironment(simulator)
throw PatrolError.internal("pressing volume up on simulator")
#else
self.device.press(XCUIDevice.Button.volumeUp)
}
#endif
}

func pressVolumeDown() throws {
try runVolumeAction("pressing volume down") {
#if targetEnvironment(simulator)
throw PatrolError.internal("pressing volume down on simulator")
#else
self.device.press(XCUIDevice.Button.volumeDown)
}
#endif
}

// MARK: Services
Expand Down Expand Up @@ -999,16 +1003,6 @@
}
}

private func runVolumeAction(_ log: String, block: @escaping () -> Void) throws {
#if targetEnvironment(simulator)
throw PatrolError.internal("Volume buttons are not available on Simulator")
#endif

runAction(log) {
block()
}
}

private func runAction<T>(_ log: String, block: @escaping () throws -> T) rethrows -> T {
return try DispatchQueue.main.sync {
Logger.shared.i("\(log)...")
Expand Down

0 comments on commit 18e26c1

Please sign in to comment.