Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Control Center for enabling/disabling services on iOS #380

Merged
merged 9 commits into from
Sep 29, 2022
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