Skip to content

Commit

Permalink
Use Control Center for enabling/disabling services on iOS (#380)
Browse files Browse the repository at this point in the history
* toggle wifi on non-notch physical iPhones using control centre

* toggle Wi-Fi

* contracts.proto: add messages and RPCs for airplane mode and bluetooth

* implement enable/disable of airplane mode, cellular, wifi, and bluetooth on iOS. Unstable because of Flutter Driver.
* update feature parity in docs

* implement opening Control Center (aka quick settings) on iOS
  • Loading branch information
bartekpacia authored Sep 29, 2022
1 parent cfb1245 commit 8f016e7
Show file tree
Hide file tree
Showing 19 changed files with 3,356 additions and 641 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,26 @@ class NativeAutomatorServer : NativeAutomatorGrpcKt.NativeAutomatorCoroutineImpl
return empty { }
}

override suspend fun enableAirplaneMode(request: Contracts.AirplaneModeRequest): Empty {
automation.enableAirplaneMode()
return empty {}
}

override suspend fun disableAirplaneMode(request: Contracts.AirplaneModeRequest): Contracts.Empty {
automation.disableAirplaneMode()
return empty {}
}

override suspend fun enableCellular(request: Contracts.CellularRequest): Empty {
automation.enableCellular()
return empty { }
}

override suspend fun disableCellular(request: Contracts.CellularRequest): Empty {
automation.disableCellular()
return empty { }
}

override suspend fun enableWiFi(request: Contracts.WiFiRequest): Empty {
automation.enableWifi()
return empty { }
Expand All @@ -73,13 +93,13 @@ class NativeAutomatorServer : NativeAutomatorGrpcKt.NativeAutomatorCoroutineImpl
return empty { }
}

override suspend fun enableCellular(request: Contracts.CellularRequest): Empty {
automation.enableCellular()
override suspend fun enableBluetooth(request: Contracts.BluetoothRequest): Contracts.Empty {
automation.enableBluetooth()
return empty { }
}

override suspend fun disableCellular(request: Contracts.CellularRequest): Empty {
automation.disableCellular()
override suspend fun disableBluetooth(request: Contracts.BluetoothRequest): Contracts.Empty {
automation.disableBluetooth()
return empty { }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,21 @@ class PatrolAutomator private constructor() {

fun disableDarkMode() = executeShellCommand("cmd uimode night no")

fun disableWifi() = executeShellCommand("svc wifi disable")
fun enableAirplaneMode(): Unit = TODO()

fun enableWifi() = executeShellCommand("svc wifi enable")
fun disableAirplaneMode(): Unit = TODO()

fun disableCellular() = executeShellCommand("svc data disable")

fun enableCellular() = executeShellCommand("svc data enable")

fun enableBluetooth() = executeShellCommand("svc bluetooth enable")
fun disableWifi() = executeShellCommand("svc wifi disable")

fun enableWifi() = executeShellCommand("svc wifi enable")

fun enableBluetooth(): Unit = TODO()

fun disableBluetooth() = executeShellCommand("svc bluetooth disable")
fun disableBluetooth(): Unit = TODO()

fun getNativeWidgets(selector: BySelector): List<Contracts.NativeWidget> {
Logger.d("getNativeWidgets()")
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8f016e7

Please sign in to comment.