mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-25 02:18:24 +01:00
Disallow PackageInstaller extension installer option on MIUI
This commit is contained in:
parent
299e52e877
commit
8c1662cfdb
@ -19,6 +19,7 @@ import eu.kanade.tachiyomi.ui.library.setting.SortModeSetting
|
|||||||
import eu.kanade.tachiyomi.ui.reader.setting.OrientationType
|
import eu.kanade.tachiyomi.ui.reader.setting.OrientationType
|
||||||
import eu.kanade.tachiyomi.util.preference.minusAssign
|
import eu.kanade.tachiyomi.util.preference.minusAssign
|
||||||
import eu.kanade.tachiyomi.util.preference.plusAssign
|
import eu.kanade.tachiyomi.util.preference.plusAssign
|
||||||
|
import eu.kanade.tachiyomi.util.system.DeviceUtil
|
||||||
import eu.kanade.tachiyomi.util.system.toast
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
import eu.kanade.tachiyomi.widget.ExtendedNavigationView
|
import eu.kanade.tachiyomi.widget.ExtendedNavigationView
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
@ -251,6 +252,9 @@ object Migrations {
|
|||||||
if (oldSecureScreen) {
|
if (oldSecureScreen) {
|
||||||
preferences.secureScreen().set(PreferenceValues.SecureScreenMode.ALWAYS)
|
preferences.secureScreen().set(PreferenceValues.SecureScreenMode.ALWAYS)
|
||||||
}
|
}
|
||||||
|
if (DeviceUtil.isMiui && preferences.extensionInstaller().get() == PreferenceValues.ExtensionInstaller.PACKAGEINSTALLER) {
|
||||||
|
preferences.extensionInstaller().set(PreferenceValues.ExtensionInstaller.LEGACY)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
@ -55,22 +55,22 @@ object PreferenceValues {
|
|||||||
LOWEST(47),
|
LOWEST(47),
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class TabletUiMode {
|
enum class TabletUiMode(val titleResId: Int) {
|
||||||
AUTOMATIC,
|
AUTOMATIC(R.string.automatic_background),
|
||||||
ALWAYS,
|
ALWAYS(R.string.lock_always),
|
||||||
LANDSCAPE,
|
LANDSCAPE(R.string.landscape),
|
||||||
NEVER,
|
NEVER(R.string.lock_never),
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class ExtensionInstaller {
|
enum class ExtensionInstaller(val titleResId: Int) {
|
||||||
LEGACY,
|
LEGACY(R.string.ext_installer_legacy),
|
||||||
PACKAGEINSTALLER,
|
PACKAGEINSTALLER(R.string.ext_installer_packageinstaller),
|
||||||
SHIZUKU,
|
SHIZUKU(R.string.ext_installer_shizuku),
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class SecureScreenMode {
|
enum class SecureScreenMode(val titleResId: Int) {
|
||||||
ALWAYS,
|
ALWAYS(R.string.lock_always),
|
||||||
INCOGNITO,
|
INCOGNITO(R.string.pref_incognito_mode),
|
||||||
NEVER,
|
NEVER(R.string.lock_never),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ import eu.kanade.tachiyomi.util.preference.preferenceCategory
|
|||||||
import eu.kanade.tachiyomi.util.preference.summaryRes
|
import eu.kanade.tachiyomi.util.preference.summaryRes
|
||||||
import eu.kanade.tachiyomi.util.preference.switchPreference
|
import eu.kanade.tachiyomi.util.preference.switchPreference
|
||||||
import eu.kanade.tachiyomi.util.preference.titleRes
|
import eu.kanade.tachiyomi.util.preference.titleRes
|
||||||
|
import eu.kanade.tachiyomi.util.system.DeviceUtil
|
||||||
import eu.kanade.tachiyomi.util.system.isPackageInstalled
|
import eu.kanade.tachiyomi.util.system.isPackageInstalled
|
||||||
import eu.kanade.tachiyomi.util.system.powerManager
|
import eu.kanade.tachiyomi.util.system.powerManager
|
||||||
import eu.kanade.tachiyomi.util.system.toast
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
@ -209,12 +210,17 @@ class SettingsAdvancedController : SettingsController() {
|
|||||||
bindTo(preferences.extensionInstaller())
|
bindTo(preferences.extensionInstaller())
|
||||||
titleRes = R.string.ext_installer_pref
|
titleRes = R.string.ext_installer_pref
|
||||||
summary = "%s"
|
summary = "%s"
|
||||||
entriesRes = arrayOf(
|
|
||||||
R.string.ext_installer_legacy,
|
// PackageInstaller doesn't work on MIUI properly for non-allowlisted apps
|
||||||
R.string.ext_installer_packageinstaller,
|
val values = if (DeviceUtil.isMiui) {
|
||||||
R.string.ext_installer_shizuku,
|
PreferenceValues.ExtensionInstaller.values()
|
||||||
)
|
.filter { it != PreferenceValues.ExtensionInstaller.PACKAGEINSTALLER }
|
||||||
entryValues = PreferenceValues.ExtensionInstaller.values().map { it.name }.toTypedArray()
|
} else {
|
||||||
|
PreferenceValues.ExtensionInstaller.values().toList()
|
||||||
|
}
|
||||||
|
|
||||||
|
entriesRes = values.map { it.titleResId }.toTypedArray()
|
||||||
|
entryValues = values.map { it.name }.toTypedArray()
|
||||||
|
|
||||||
onChange {
|
onChange {
|
||||||
if (it == PreferenceValues.ExtensionInstaller.SHIZUKU.name &&
|
if (it == PreferenceValues.ExtensionInstaller.SHIZUKU.name &&
|
||||||
@ -243,7 +249,7 @@ class SettingsAdvancedController : SettingsController() {
|
|||||||
bindTo(preferences.tabletUiMode())
|
bindTo(preferences.tabletUiMode())
|
||||||
titleRes = R.string.pref_tablet_ui_mode
|
titleRes = R.string.pref_tablet_ui_mode
|
||||||
summary = "%s"
|
summary = "%s"
|
||||||
entriesRes = arrayOf(R.string.automatic_background, R.string.lock_always, R.string.landscape, R.string.lock_never)
|
entriesRes = PreferenceValues.TabletUiMode.values().map { it.titleResId }.toTypedArray()
|
||||||
entryValues = PreferenceValues.TabletUiMode.values().map { it.name }.toTypedArray()
|
entryValues = PreferenceValues.TabletUiMode.values().map { it.name }.toTypedArray()
|
||||||
|
|
||||||
onChange {
|
onChange {
|
||||||
|
@ -73,7 +73,7 @@ class SettingsLibraryController : SettingsController() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
preferences.portraitColumns().asFlow().combine(preferences.landscapeColumns().asFlow()) { portraitCols, landscapeCols -> Pair(portraitCols, landscapeCols) }
|
combine(preferences.portraitColumns().asFlow(), preferences.landscapeColumns().asFlow()) { portraitCols, landscapeCols -> Pair(portraitCols, landscapeCols) }
|
||||||
.onEach { (portraitCols, landscapeCols) ->
|
.onEach { (portraitCols, landscapeCols) ->
|
||||||
val portrait = getColumnValue(portraitCols)
|
val portrait = getColumnValue(portraitCols)
|
||||||
val landscape = getColumnValue(landscapeCols)
|
val landscape = getColumnValue(landscapeCols)
|
||||||
|
@ -93,11 +93,7 @@ class SettingsSecurityController : SettingsController() {
|
|||||||
bindTo(preferences.secureScreen())
|
bindTo(preferences.secureScreen())
|
||||||
titleRes = R.string.secure_screen
|
titleRes = R.string.secure_screen
|
||||||
summary = "%s"
|
summary = "%s"
|
||||||
entriesRes = arrayOf(
|
entriesRes = PreferenceValues.SecureScreenMode.values().map { it.titleResId }.toTypedArray()
|
||||||
R.string.lock_always,
|
|
||||||
R.string.pref_incognito_mode,
|
|
||||||
R.string.lock_never,
|
|
||||||
)
|
|
||||||
entryValues = PreferenceValues.SecureScreenMode.values().map { it.name }.toTypedArray()
|
entryValues = PreferenceValues.SecureScreenMode.values().map { it.name }.toTypedArray()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user