Skip to content

Commit

Permalink
ignore calls to select[Fine|Coarse]Location() on iOS < 14 (#1564)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekpacia committed Jul 20, 2023
1 parent b0cdac6 commit ab220c5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/patrol/ios/Classes/AutomatorServer/Automator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,11 @@
}

func selectFineLocation() async throws {
if iOS13orOlder() {
Logger.shared.i("Ignored call to selectFineLocation() (iOS < 14)")
return
}

try await runAction("selecting fine location") {
let alerts = self.springboard.alerts
let button = alerts.buttons["Precise: Off"]
Expand All @@ -496,6 +501,11 @@
}

func selectCoarseLocation() async throws {
if iOS13orOlder() {
Logger.shared.i("Ignored call to selectCoarseLocation() (iOS < 14)")
return
}

try await runAction("selecting coarse location") {
let alerts = self.springboard.alerts
let button = alerts.buttons["Precise: On"]
Expand Down Expand Up @@ -574,6 +584,11 @@
|| model == "iPhone14,6" // iPhone SE 3rd Gen
}

private func iOS13orOlder() -> Bool {
let floatVersion = (UIDevice.current.systemVersion as NSString).floatValue
return floatVersion < 14
}

/// Adapted from https://stackoverflow.com/q/47880395/7009800
@discardableResult
func waitForAnyElement(elements: [XCUIElement], timeout: TimeInterval) -> XCUIElement? {
Expand Down

0 comments on commit ab220c5

Please sign in to comment.