mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-26 13:12:59 +00:00
added another way to check if miui optimizations are enabled
This commit is contained in:
parent
597d7a7a4e
commit
537e76499a
5 changed files with 12 additions and 15 deletions
|
@ -206,6 +206,10 @@ class MainActivity : AppCompatActivity() {
|
|||
subscribeToTopic("Music-Update")
|
||||
subscribeToTopic("MicroG-Update")
|
||||
}
|
||||
} else {
|
||||
if (isMiuiOptimizationsEnabled) {
|
||||
DialogContainer.applyAccentMiuiDialog(this)
|
||||
}
|
||||
}
|
||||
|
||||
if (!prefs.getBoolean("statement", true)) {
|
||||
|
|
|
@ -6,7 +6,7 @@ import androidx.preference.PreferenceManager
|
|||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.utils.applyAccent
|
||||
import com.vanced.manager.utils.isMiui
|
||||
import com.vanced.manager.utils.isMiuiOptimizationsEnabled
|
||||
import com.vanced.manager.utils.openUrl
|
||||
|
||||
object DialogContainer {
|
||||
|
@ -19,7 +19,7 @@ object DialogContainer {
|
|||
dialog.cancel()
|
||||
}
|
||||
setOnCancelListener {
|
||||
if (isMiui) {
|
||||
if (context.isMiuiOptimizationsEnabled) {
|
||||
applyAccentMiuiDialog(context)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ object AppUtils: CoroutineScope by CoroutineScope(Dispatchers.IO) {
|
|||
status.contains("Files_Missing_VA") -> context.getString(R.string.files_missing_va)
|
||||
status.contains("Path_Missing") -> context.getString(R.string.path_missing)
|
||||
status.contains("INSTALL_FAILED_INTERNAL_ERROR: Permission Denied") -> {
|
||||
if (isMiui)
|
||||
if (context.isMiuiOptimizationsEnabled)
|
||||
context.getString(R.string.installation_miui)
|
||||
else
|
||||
context.getString(R.string.installation_blocked)
|
||||
|
|
|
@ -1,15 +1,8 @@
|
|||
package com.vanced.manager.utils
|
||||
|
||||
import com.topjohnwu.superuser.Shell
|
||||
import android.content.Context
|
||||
import android.provider.Settings
|
||||
|
||||
private const val MIUI_PROP = "ro.miui.ui.version.name"
|
||||
private const val MIUI_OPTIMIZATION = "miui_optimization"
|
||||
|
||||
val isMiui get() = !getSystemProperty(MIUI_PROP).isNullOrEmpty()
|
||||
|
||||
fun getSystemProperty(propname: String): String? {
|
||||
return try {
|
||||
Shell.sh("getprop $propname").exec().out.joinToString(" ")
|
||||
} catch (e: Exception) {
|
||||
null
|
||||
}
|
||||
}
|
||||
val Context.isMiuiOptimizationsEnabled: Boolean get() = Settings.Secure.getString(contentResolver, MIUI_OPTIMIZATION) == "1"
|
|
@ -81,7 +81,7 @@
|
|||
<string name="guide">Guide</string>
|
||||
<string name="hold_on">Stop!</string>
|
||||
<string name="magisk_vanced">You are using the Magisk/TWRP version of Vanced, which is discontinued and cannot be updated using this app. Please remove it by removing the Magisk module/using TWRP Vanced uninstaller.</string>
|
||||
<string name="miui_one_title">MIUI Detected!</string>
|
||||
<string name="miui_one_title">MIUI Optimizations are enabled!</string>
|
||||
<string name="miui_one">To install Vanced, you MUST disable MIUI Optimizations in the developer settings. (You can ignore this warning if you are using 20.2.20 or later xiaomi.eu based ROM)</string>
|
||||
<string name="error">Error</string>
|
||||
<string name="redownload">Redownload</string>
|
||||
|
|
Loading…
Reference in a new issue