Commit dbf45da8 authored by vvb2060's avatar vvb2060 Committed by John Wu

Avoid constantly check env

parent 6b67902d
...@@ -80,7 +80,7 @@ class HomeViewModel( ...@@ -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( ...@@ -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
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment