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
571b8986
Commit
571b8986
authored
Dec 05, 2021
by
vvb2060
Committed by
John Wu
Jan 18, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't assume installed version matches app
parent
bb7a74e4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
24 deletions
+34
-24
EnvFixDialog.kt
...n/java/com/topjohnwu/magisk/events/dialog/EnvFixDialog.kt
+33
-23
HomeViewModel.kt
...c/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt
+1
-1
No files found.
app/src/main/java/com/topjohnwu/magisk/events/dialog/EnvFixDialog.kt
View file @
571b8986
package
com.topjohnwu.magisk.events.dialog
import
androidx.lifecycle.lifecycleScope
import
com.topjohnwu.magisk.BuildConfig
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.core.Info
import
com.topjohnwu.magisk.core.base.BaseActivity
import
com.topjohnwu.magisk.core.tasks.MagiskInstaller
import
com.topjohnwu.magisk.ui.home.HomeViewModel
import
com.topjohnwu.magisk.view.MagiskDialog
import
kotlinx.coroutines.launch
class
EnvFixDialog
:
DialogEvent
()
{
class
EnvFixDialog
(
private
val
vm
:
HomeViewModel
)
:
DialogEvent
()
{
override
fun
build
(
dialog
:
MagiskDialog
)
=
dialog
.
applyTitle
(
R
.
string
.
env_fix_title
)
.
applyMessage
(
R
.
string
.
env_fix_msg
)
.
applyButton
(
MagiskDialog
.
ButtonType
.
POSITIVE
)
{
titleRes
=
android
.
R
.
string
.
ok
preventDismiss
=
true
onClick
{
dialog
.
applyTitle
(
R
.
string
.
setup_title
)
.
applyMessage
(
R
.
string
.
setup_msg
)
.
resetButtons
()
.
cancellable
(
false
)
(
dialog
.
ownerActivity
as
BaseActivity
).
lifecycleScope
.
launch
{
MagiskInstaller
.
FixEnv
{
dialog
.
dismiss
()
}.
exec
()
override
fun
build
(
dialog
:
MagiskDialog
)
{
dialog
.
applyTitle
(
R
.
string
.
env_fix_title
)
.
applyMessage
(
R
.
string
.
env_fix_msg
)
.
applyButton
(
MagiskDialog
.
ButtonType
.
POSITIVE
)
{
titleRes
=
android
.
R
.
string
.
ok
preventDismiss
=
true
onClick
{
dialog
.
applyTitle
(
R
.
string
.
setup_title
)
.
applyMessage
(
R
.
string
.
setup_msg
)
.
resetButtons
()
.
cancellable
(
false
)
(
dialog
.
ownerActivity
as
BaseActivity
).
lifecycleScope
.
launch
{
MagiskInstaller
.
FixEnv
{
dialog
.
dismiss
()
}.
exec
()
}
}
}
}
.
applyButton
(
MagiskDialog
.
ButtonType
.
NEGATIVE
)
{
titleRes
=
android
.
R
.
string
.
cancel
}
.
let
{
}
.
applyButton
(
MagiskDialog
.
ButtonType
.
NEGATIVE
)
{
titleRes
=
android
.
R
.
string
.
cancel
}
companion
object
{
const
val
DISMISS
=
"com.topjohnwu.magisk.ENV_DONE"
if
(
Info
.
env
.
versionCode
!=
BuildConfig
.
VERSION_CODE
||
Info
.
env
.
versionString
!=
BuildConfig
.
VERSION_NAME
)
{
dialog
.
applyButton
(
MagiskDialog
.
ButtonType
.
POSITIVE
)
{
titleRes
=
android
.
R
.
string
.
ok
onClick
{
vm
.
onMagiskPressed
()
dialog
.
dismiss
()
}
}
}
}
}
app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt
View file @
571b8986
...
...
@@ -140,7 +140,7 @@ class HomeViewModel(
val
cmd
=
"env_check ${Info.env.versionString} ${Info.env.versionCode}"
if
(!
Shell
.
su
(
cmd
).
await
().
isSuccess
)
{
shownDialog
=
true
EnvFixDialog
().
publish
()
EnvFixDialog
(
this
).
publish
()
}
}
...
...
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