Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
dbf45da8
Commit
dbf45da8
authored
Jan 08, 2022
by
vvb2060
Committed by
John Wu
Jan 18, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid constantly check env
parent
6b67902d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
HomeViewModel.kt
...c/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt
+3
-3
No files found.
app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt
View file @
dbf45da8
...
@@ -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
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment