Skip to content

Commit

Permalink
fix: can not turn off a11y
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Dec 4, 2024
1 parent 00dffbe commit 709b6b3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions app/src/main/kotlin/li/songe/gkd/service/GkdTileService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@ fun switchA11yService() = appScope.launchTry(Dispatchers.IO) {
if (A11yService.isRunning.value) {
names.remove(a11yClsName)
updateServiceNames(names)
delay(500)
// https://github.com/orgs/gkd-kit/discussions/799
if (A11yService.isRunning.value) {
toast("关闭无障碍失败")
accessRestrictedSettingsShowFlow.value = true
return@launchTry
}
toast("关闭无障碍")
} else {
enableA11yService()
Expand All @@ -142,6 +149,7 @@ fun switchA11yService() = appScope.launchTry(Dispatchers.IO) {
}

fun fixRestartService() = appScope.launchTry(Dispatchers.IO) {
if (modifyA11yMutex.isLocked) return@launchTry
modifyA11yMutex.withLock {
// 1. 服务没有运行
// 2. 用户配置开启了服务
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/kotlin/li/songe/gkd/ui/AuthA11yPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ fun AuthA11yPage() {
}
Spacer(modifier = Modifier.height(4.dp))
}
if (writeSecureSettings && !a11yRunning) {
if (writeSecureSettings) {
Spacer(modifier = Modifier.height(12.dp))
Card(
modifier = Modifier
Expand All @@ -207,12 +207,12 @@ fun AuthA11yPage() {
Text(
modifier = Modifier.padding(cardHorizontalPadding, 0.dp),
style = MaterialTheme.typography.bodyMedium,
text = "1.某些系统有更严格的无障碍限制\n2.会在 GKD 更新后重新限制开启\n3.重新授权可解决此问题"
text = "1.某些系统有更严格的无障碍限制\n2. GKD 更新后会限制其开关无障碍\n3.重新授权可解决此问题"
)
Spacer(modifier = Modifier.height(12.dp))
Text(
modifier = Modifier.padding(cardHorizontalPadding, 0.dp),
text = "若能正常开启无障碍请忽略此项",
text = "若能正常开关无障碍请忽略此项",
style = MaterialTheme.typography.bodySmall,
)
AuthButtonGroup()
Expand Down

0 comments on commit 709b6b3

Please sign in to comment.