mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 13:37:39 +00:00
Avoid constantly check env
This commit is contained in:
parent
6b67902d53
commit
dbf45da8ab
@ -80,7 +80,7 @@ class HomeViewModel(
|
|||||||
it.bindExtra(BR.viewModel, this)
|
it.bindExtra(BR.viewModel, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var shownDialog = false
|
private var checkedEnv = false
|
||||||
|
|
||||||
override fun refresh() = viewModelScope.launch {
|
override fun refresh() = viewModelScope.launch {
|
||||||
state = State.LOADING
|
state = State.LOADING
|
||||||
@ -136,12 +136,12 @@ class HomeViewModel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun ensureEnv() {
|
private suspend fun ensureEnv() {
|
||||||
if (MagiskState.NOT_INSTALLED == stateMagisk || shownDialog) return
|
if (MagiskState.NOT_INSTALLED == stateMagisk || checkedEnv) return
|
||||||
val cmd = "env_check ${Info.env.versionString} ${Info.env.versionCode}"
|
val cmd = "env_check ${Info.env.versionString} ${Info.env.versionCode}"
|
||||||
if (!Shell.su(cmd).await().isSuccess) {
|
if (!Shell.su(cmd).await().isSuccess) {
|
||||||
shownDialog = true
|
|
||||||
EnvFixDialog(this).publish()
|
EnvFixDialog(this).publish()
|
||||||
}
|
}
|
||||||
|
checkedEnv = true
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user