mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 21:17:37 +00:00
Don't assume installed version matches app
This commit is contained in:
parent
bb7a74e4b4
commit
571b8986a4
@ -1,16 +1,19 @@
|
|||||||
package com.topjohnwu.magisk.events.dialog
|
package com.topjohnwu.magisk.events.dialog
|
||||||
|
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import com.topjohnwu.magisk.BuildConfig
|
||||||
import com.topjohnwu.magisk.R
|
import com.topjohnwu.magisk.R
|
||||||
|
import com.topjohnwu.magisk.core.Info
|
||||||
import com.topjohnwu.magisk.core.base.BaseActivity
|
import com.topjohnwu.magisk.core.base.BaseActivity
|
||||||
import com.topjohnwu.magisk.core.tasks.MagiskInstaller
|
import com.topjohnwu.magisk.core.tasks.MagiskInstaller
|
||||||
|
import com.topjohnwu.magisk.ui.home.HomeViewModel
|
||||||
import com.topjohnwu.magisk.view.MagiskDialog
|
import com.topjohnwu.magisk.view.MagiskDialog
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
class EnvFixDialog : DialogEvent() {
|
class EnvFixDialog(private val vm: HomeViewModel) : DialogEvent() {
|
||||||
|
|
||||||
override fun build(dialog: MagiskDialog) = dialog
|
override fun build(dialog: MagiskDialog) {
|
||||||
.applyTitle(R.string.env_fix_title)
|
dialog.applyTitle(R.string.env_fix_title)
|
||||||
.applyMessage(R.string.env_fix_msg)
|
.applyMessage(R.string.env_fix_msg)
|
||||||
.applyButton(MagiskDialog.ButtonType.POSITIVE) {
|
.applyButton(MagiskDialog.ButtonType.POSITIVE) {
|
||||||
titleRes = android.R.string.ok
|
titleRes = android.R.string.ok
|
||||||
@ -30,9 +33,16 @@ class EnvFixDialog : DialogEvent() {
|
|||||||
.applyButton(MagiskDialog.ButtonType.NEGATIVE) {
|
.applyButton(MagiskDialog.ButtonType.NEGATIVE) {
|
||||||
titleRes = android.R.string.cancel
|
titleRes = android.R.string.cancel
|
||||||
}
|
}
|
||||||
.let { }
|
|
||||||
|
|
||||||
companion object {
|
if (Info.env.versionCode != BuildConfig.VERSION_CODE ||
|
||||||
const val DISMISS = "com.topjohnwu.magisk.ENV_DONE"
|
Info.env.versionString != BuildConfig.VERSION_NAME) {
|
||||||
|
dialog.applyButton(MagiskDialog.ButtonType.POSITIVE) {
|
||||||
|
titleRes = android.R.string.ok
|
||||||
|
onClick {
|
||||||
|
vm.onMagiskPressed()
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ class HomeViewModel(
|
|||||||
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
|
shownDialog = true
|
||||||
EnvFixDialog().publish()
|
EnvFixDialog(this).publish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user