|
|
|
|
@ -3,7 +3,6 @@ package org.koitharu.kotatsu.core.prefs
|
|
|
|
|
import android.content.Context
|
|
|
|
|
import android.content.SharedPreferences.OnSharedPreferenceChangeListener
|
|
|
|
|
import androidx.core.content.edit
|
|
|
|
|
import okhttp3.internal.isSensitiveHeader
|
|
|
|
|
import org.koitharu.kotatsu.core.util.ext.getEnumValue
|
|
|
|
|
import org.koitharu.kotatsu.core.util.ext.ifNullOrEmpty
|
|
|
|
|
import org.koitharu.kotatsu.core.util.ext.putEnumValue
|
|
|
|
|
@ -12,6 +11,7 @@ import org.koitharu.kotatsu.parsers.config.ConfigKey
|
|
|
|
|
import org.koitharu.kotatsu.parsers.config.MangaSourceConfig
|
|
|
|
|
import org.koitharu.kotatsu.parsers.model.MangaSource
|
|
|
|
|
import org.koitharu.kotatsu.parsers.model.SortOrder
|
|
|
|
|
import org.koitharu.kotatsu.settings.utils.validation.DomainValidator
|
|
|
|
|
|
|
|
|
|
class SourceSettings(context: Context, source: MangaSource) : MangaSourceConfig {
|
|
|
|
|
|
|
|
|
|
@ -31,7 +31,11 @@ class SourceSettings(context: Context, source: MangaSource) : MangaSourceConfig
|
|
|
|
|
.ifNullOrEmpty { key.defaultValue }
|
|
|
|
|
.sanitizeHeaderValue()
|
|
|
|
|
|
|
|
|
|
is ConfigKey.Domain -> prefs.getString(key.key, key.defaultValue).ifNullOrEmpty { key.defaultValue }
|
|
|
|
|
is ConfigKey.Domain -> prefs.getString(key.key, key.defaultValue)
|
|
|
|
|
?.trim()
|
|
|
|
|
?.takeIf { DomainValidator.isValidDomain(it) }
|
|
|
|
|
?: key.defaultValue
|
|
|
|
|
|
|
|
|
|
is ConfigKey.ShowSuspiciousContent -> prefs.getBoolean(key.key, key.defaultValue)
|
|
|
|
|
is ConfigKey.SplitByTranslations -> prefs.getBoolean(key.key, key.defaultValue)
|
|
|
|
|
} as T
|
|
|
|
|
|