Fix H@H setting so that its in line with the new version of E-Hentai

This commit is contained in:
Jobobby04 2020-06-05 15:19:08 -04:00
parent c7673f7b4b
commit bf4988ddc3
4 changed files with 29 additions and 11 deletions

View File

@ -252,4 +252,6 @@ object PreferenceKeys {
const val eh_enabled_categories = "eh_enabled_categories"
const val eh_ehentai_quality = "ehentai_quality"
const val eh_enable_hah = "eh_enable_hah"
}

View File

@ -270,7 +270,7 @@ class PreferencesHelper(val context: Context) {
fun imageQuality() = flowPrefs.getString(Keys.eh_ehentai_quality, "auto")
fun useHentaiAtHome() = flowPrefs.getBoolean("enable_hah", true)
fun useHentaiAtHome() = flowPrefs.getInt(Keys.eh_enable_hah, 0)
fun useJapaneseTitle() = flowPrefs.getBoolean("use_jp_title", false)

View File

@ -177,11 +177,26 @@ class SettingsEhController : SettingsController() {
}
}
switchPreference {
intListPreference {
title = "Use Hentai@Home Network"
summary = "Do you wish to load images through the Hentai@Home Network? Disabling this option will reduce the amount of pages you are able to view"
key = "enable_hah"
defaultValue = true
key = PreferenceKeys.eh_enable_hah
if (preferences.eh_hathPerksCookies().get().isBlank()) {
summary = "Do you wish to load images through the Hentai@Home Network, if available? Disabling this option will reduce the amount of pages you are able to view\nOptions:\n - Any client (Recommended)\n - Default port clients only (Can be slower. Enable if behind firewall/proxy that blocks outgoing non-standard ports.)"
entries = arrayOf(
"Any client (Recommended)",
"Default port clients only"
)
entryValues = arrayOf("0", "1")
} else {
summary = "Do you wish to load images through the Hentai@Home Network, if available? Disabling this option will reduce the amount of pages you are able to view\nOptions:\n - Any client (Recommended)\n - Default port clients only (Can be slower. Enable if behind firewall/proxy that blocks outgoing non-standard ports.)\n - No (Donator only. You will not be able to browse as many pages, enable only if having severe problems.)"
entries = arrayOf(
"Any client (Recommended)",
"Default port clients only",
"No(will select Default port clients only if you are not a donator)"
)
entryValues = arrayOf("0", "1", "2")
}
onChange { preferences.useHentaiAtHome().reconfigure() }
}.dependency = PreferenceKeys.eh_enableExHentai

View File

@ -24,10 +24,10 @@ class EhUConfigBuilder {
else -> Entry.ImageSize.AUTO
}
configItems += if (prefs.useHentaiAtHome().get()) {
Entry.UseHentaiAtHome.YES
} else {
Entry.UseHentaiAtHome.NO
configItems += when (prefs.useHentaiAtHome().get()) {
2 -> Entry.UseHentaiAtHome.NO
1 -> Entry.UseHentaiAtHome.DEFAULTONLY
else -> Entry.UseHentaiAtHome.ANY
}
configItems += if (prefs.useJapaneseTitle().get()) {
@ -79,8 +79,9 @@ class EhUConfigBuilder {
object Entry {
enum class UseHentaiAtHome(override val value: String) : ConfigItem {
YES("0"),
NO("1");
ANY("0"),
DEFAULTONLY("1"),
NO("2");
override val key = "uh"
}