mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-14 04:15:09 +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.util.preference.minusAssign
|
||||
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.widget.ExtendedNavigationView
|
||||
import uy.kohesive.injekt.Injekt
|
||||
@ -251,6 +252,9 @@ object Migrations {
|
||||
if (oldSecureScreen) {
|
||||
preferences.secureScreen().set(PreferenceValues.SecureScreenMode.ALWAYS)
|
||||
}
|
||||
if (DeviceUtil.isMiui && preferences.extensionInstaller().get() == PreferenceValues.ExtensionInstaller.PACKAGEINSTALLER) {
|
||||
preferences.extensionInstaller().set(PreferenceValues.ExtensionInstaller.LEGACY)
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
|
@ -55,22 +55,22 @@ object PreferenceValues {
|
||||
LOWEST(47),
|
||||
}
|
||||
|
||||
enum class TabletUiMode {
|
||||
AUTOMATIC,
|
||||
ALWAYS,
|
||||
LANDSCAPE,
|
||||
NEVER,
|
||||
enum class TabletUiMode(val titleResId: Int) {
|
||||
AUTOMATIC(R.string.automatic_background),
|
||||
ALWAYS(R.string.lock_always),
|
||||
LANDSCAPE(R.string.landscape),
|
||||
NEVER(R.string.lock_never),
|
||||
}
|
||||
|
||||
enum class ExtensionInstaller {
|
||||
LEGACY,
|
||||
PACKAGEINSTALLER,
|
||||
SHIZUKU,
|
||||
enum class ExtensionInstaller(val titleResId: Int) {
|
||||
LEGACY(R.string.ext_installer_legacy),
|
||||
PACKAGEINSTALLER(R.string.ext_installer_packageinstaller),
|
||||
SHIZUKU(R.string.ext_installer_shizuku),
|
||||
}
|
||||
|
||||
enum class SecureScreenMode {
|
||||
ALWAYS,
|
||||
INCOGNITO,
|
||||
NEVER,
|
||||
enum class SecureScreenMode(val titleResId: Int) {
|
||||
ALWAYS(R.string.lock_always),
|
||||
INCOGNITO(R.string.pref_incognito_mode),
|
||||
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.switchPreference
|
||||
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.powerManager
|
||||
import eu.kanade.tachiyomi.util.system.toast
|
||||
@ -209,12 +210,17 @@ class SettingsAdvancedController : SettingsController() {
|
||||
bindTo(preferences.extensionInstaller())
|
||||
titleRes = R.string.ext_installer_pref
|
||||
summary = "%s"
|
||||
entriesRes = arrayOf(
|
||||
R.string.ext_installer_legacy,
|
||||
R.string.ext_installer_packageinstaller,
|
||||
R.string.ext_installer_shizuku,
|
||||
)
|
||||
entryValues = PreferenceValues.ExtensionInstaller.values().map { it.name }.toTypedArray()
|
||||
|
||||
// PackageInstaller doesn't work on MIUI properly for non-allowlisted apps
|
||||
val values = if (DeviceUtil.isMiui) {
|
||||
PreferenceValues.ExtensionInstaller.values()
|
||||
.filter { it != PreferenceValues.ExtensionInstaller.PACKAGEINSTALLER }
|
||||
} else {
|
||||
PreferenceValues.ExtensionInstaller.values().toList()
|
||||
}
|
||||
|
||||
entriesRes = values.map { it.titleResId }.toTypedArray()
|
||||
entryValues = values.map { it.name }.toTypedArray()
|
||||
|
||||
onChange {
|
||||
if (it == PreferenceValues.ExtensionInstaller.SHIZUKU.name &&
|
||||
@ -243,7 +249,7 @@ class SettingsAdvancedController : SettingsController() {
|
||||
bindTo(preferences.tabletUiMode())
|
||||
titleRes = R.string.pref_tablet_ui_mode
|
||||
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()
|
||||
|
||||
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) ->
|
||||
val portrait = getColumnValue(portraitCols)
|
||||
val landscape = getColumnValue(landscapeCols)
|
||||
|
@ -93,11 +93,7 @@ class SettingsSecurityController : SettingsController() {
|
||||
bindTo(preferences.secureScreen())
|
||||
titleRes = R.string.secure_screen
|
||||
summary = "%s"
|
||||
entriesRes = arrayOf(
|
||||
R.string.lock_always,
|
||||
R.string.pref_incognito_mode,
|
||||
R.string.lock_never,
|
||||
)
|
||||
entriesRes = PreferenceValues.SecureScreenMode.values().map { it.titleResId }.toTypedArray()
|
||||
entryValues = PreferenceValues.SecureScreenMode.values().map { it.name }.toTypedArray()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user