2022-09-25 16:07:06 +02:00
|
|
|
package eu.kanade.domain.base
|
|
|
|
|
|
|
|
|
|
import android.content.Context
|
2023-11-18 19:54:56 +01:00
|
|
|
import dev.icerock.moko.resources.StringResource
|
2022-10-22 21:47:09 +02:00
|
|
|
import eu.kanade.tachiyomi.util.system.isPreviewBuildType
|
|
|
|
|
import eu.kanade.tachiyomi.util.system.isReleaseBuildType
|
2023-10-29 17:24:02 +01:00
|
|
|
import tachiyomi.core.preference.Preference
|
2023-01-28 04:31:12 +01:00
|
|
|
import tachiyomi.core.preference.PreferenceStore
|
2023-11-18 19:54:56 +01:00
|
|
|
import tachiyomi.i18n.MR
|
2022-09-25 16:07:06 +02:00
|
|
|
|
|
|
|
|
class BasePreferences(
|
|
|
|
|
val context: Context,
|
|
|
|
|
private val preferenceStore: PreferenceStore,
|
|
|
|
|
) {
|
|
|
|
|
|
2023-10-29 17:24:02 +01:00
|
|
|
fun downloadedOnly() = preferenceStore.getBoolean(
|
|
|
|
|
Preference.appStateKey("pref_downloaded_only"),
|
|
|
|
|
false,
|
|
|
|
|
)
|
2022-09-25 16:07:06 +02:00
|
|
|
|
2023-10-29 17:24:02 +01:00
|
|
|
fun incognitoMode() = preferenceStore.getBoolean(Preference.appStateKey("incognito_mode"), false)
|
2022-09-25 16:07:06 +02:00
|
|
|
|
2023-01-15 16:32:27 +01:00
|
|
|
fun extensionInstaller() = ExtensionInstallerPreference(context, preferenceStore)
|
2022-10-15 17:38:01 +02:00
|
|
|
|
2022-10-22 21:47:09 +02:00
|
|
|
fun acraEnabled() = preferenceStore.getBoolean("acra.enable", isPreviewBuildType || isReleaseBuildType)
|
2023-03-20 03:38:14 +01:00
|
|
|
|
2023-12-09 22:50:02 +01:00
|
|
|
fun shownOnboardingFlow() = preferenceStore.getBoolean(Preference.appStateKey("onboarding_complete"), false)
|
|
|
|
|
|
2023-12-28 21:21:42 +01:00
|
|
|
enum class ExtensionInstaller(val titleRes: StringResource, val requiresSystemPermission: Boolean) {
|
|
|
|
|
LEGACY(MR.strings.ext_installer_legacy, true),
|
|
|
|
|
PACKAGEINSTALLER(MR.strings.ext_installer_packageinstaller, true),
|
|
|
|
|
SHIZUKU(MR.strings.ext_installer_shizuku, false),
|
|
|
|
|
PRIVATE(MR.strings.ext_installer_private, false),
|
2023-03-20 03:38:14 +01:00
|
|
|
}
|
2022-09-25 16:07:06 +02:00
|
|
|
}
|