mirror of
https://github.com/gkd-kit/gkd.git
synced 2024-11-15 19:22:26 +08:00
This commit is contained in:
parent
9bae29fdc9
commit
3a8b8858c3
|
@ -105,10 +105,10 @@ private fun enableA11yService() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun switchA11yService(): Boolean {
|
fun switchA11yService() = appScope.launchTry(Dispatchers.IO) {
|
||||||
if (!writeSecureSettingsState.updateAndGet()) {
|
if (!writeSecureSettingsState.updateAndGet()) {
|
||||||
toast("请先授予[写入安全设置权限]")
|
toast("请先授予[写入安全设置权限]")
|
||||||
return false
|
return@launchTry
|
||||||
}
|
}
|
||||||
val names = getServiceNames()
|
val names = getServiceNames()
|
||||||
storeFlow.update { it.copy(enableService = !A11yService.isRunning.value) }
|
storeFlow.update { it.copy(enableService = !A11yService.isRunning.value) }
|
||||||
|
@ -121,12 +121,12 @@ fun switchA11yService(): Boolean {
|
||||||
if (names.contains(a11yClsName)) { // 当前无障碍异常, 重启服务
|
if (names.contains(a11yClsName)) { // 当前无障碍异常, 重启服务
|
||||||
names.remove(a11yClsName)
|
names.remove(a11yClsName)
|
||||||
updateServiceNames(names)
|
updateServiceNames(names)
|
||||||
|
delay(500)
|
||||||
}
|
}
|
||||||
names.add(a11yClsName)
|
names.add(a11yClsName)
|
||||||
updateServiceNames(names)
|
updateServiceNames(names)
|
||||||
toast("开启无障碍")
|
toast("开启无障碍")
|
||||||
}
|
}
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun fixRestartService() = appScope.launchTry(Dispatchers.IO) {
|
fun fixRestartService() = appScope.launchTry(Dispatchers.IO) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user