Cleanup EH and AZ preferences
This commit is contained in:
parent
f1a6218a4b
commit
9a2ed755b7
@ -142,7 +142,7 @@ class FullBackupManager(context: Context) : AbstractBackupManager(context) {
|
||||
* @return list of [BackupSavedSearch] to be backed up
|
||||
*/
|
||||
private fun backupSavedSearches(): List<BackupSavedSearch> {
|
||||
return preferences.eh_savedSearches().get().map {
|
||||
return preferences.savedSearches().get().map {
|
||||
val sourceId = it.substringBefore(':').toLong()
|
||||
val content = Json.decodeFromString<JsonSavedSearch>(it.substringAfter(':'))
|
||||
BackupSavedSearch(
|
||||
@ -465,7 +465,7 @@ class FullBackupManager(context: Context) : AbstractBackupManager(context) {
|
||||
|
||||
// SY -->
|
||||
internal fun restoreSavedSearches(backupSavedSearches: List<BackupSavedSearch>) {
|
||||
val currentSavedSearches = preferences.eh_savedSearches().get().map {
|
||||
val currentSavedSearches = preferences.savedSearches().get().map {
|
||||
val sourceId = it.substringBefore(':').toLong()
|
||||
val content = Json.decodeFromString<JsonSavedSearch>(it.substringAfter(':'))
|
||||
BackupSavedSearch(
|
||||
@ -476,7 +476,7 @@ class FullBackupManager(context: Context) : AbstractBackupManager(context) {
|
||||
)
|
||||
}
|
||||
|
||||
preferences.eh_savedSearches()
|
||||
preferences.savedSearches()
|
||||
.set(
|
||||
(
|
||||
backupSavedSearches.filter { backupSavedSearch -> currentSavedSearches.none { it.name == backupSavedSearch.name && it.source == backupSavedSearch.source } }
|
||||
@ -488,7 +488,7 @@ class FullBackupManager(context: Context) : AbstractBackupManager(context) {
|
||||
Json.decodeFromString(it.filterList)
|
||||
)
|
||||
)
|
||||
} + preferences.eh_savedSearches().get()
|
||||
} + preferences.savedSearches().get()
|
||||
)
|
||||
.toSet()
|
||||
)
|
||||
|
@ -158,7 +158,7 @@ class LegacyBackupManager(context: Context, version: Int = CURRENT_VERSION) : Ab
|
||||
backupExtensionInfo(extensionEntries, extensions)
|
||||
// SY -->
|
||||
root[SAVEDSEARCHES] =
|
||||
Injekt.get<PreferencesHelper>().eh_savedSearches().get().joinToString(separator = "***")
|
||||
Injekt.get<PreferencesHelper>().savedSearches().get().joinToString(separator = "***")
|
||||
|
||||
backupMergedMangaReferences(mergedMangaReferenceEntries)
|
||||
// SY <--
|
||||
@ -514,7 +514,7 @@ class LegacyBackupManager(context: Context, version: Int = CURRENT_VERSION) : Ab
|
||||
|
||||
val currentSources = newSavedSearches.map { it.first }.toSet()
|
||||
|
||||
newSavedSearches += preferences.eh_savedSearches().get().mapNotNull {
|
||||
newSavedSearches += preferences.savedSearches().get().mapNotNull {
|
||||
try {
|
||||
val id = it.substringBefore(':').toLong()
|
||||
val content = Json.decodeFromString<JsonSavedSearch>(it.substringAfter(':'))
|
||||
@ -527,7 +527,7 @@ class LegacyBackupManager(context: Context, version: Int = CURRENT_VERSION) : Ab
|
||||
}
|
||||
}.toMutableList()
|
||||
|
||||
val otherSerialized = preferences.eh_savedSearches().get().mapNotNull {
|
||||
val otherSerialized = preferences.savedSearches().get().mapNotNull {
|
||||
val sourceId = it.split(":")[0].toLongOrNull() ?: return@mapNotNull null
|
||||
if (sourceId in currentSources) return@mapNotNull null
|
||||
it
|
||||
@ -536,7 +536,7 @@ class LegacyBackupManager(context: Context, version: Int = CURRENT_VERSION) : Ab
|
||||
val newSerialized = newSavedSearches.map {
|
||||
"${it.first}:" + Json.encodeToString(it.second)
|
||||
}
|
||||
preferences.eh_savedSearches().set((otherSerialized + newSerialized).toSet())
|
||||
preferences.savedSearches().set((otherSerialized + newSerialized).toSet())
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -56,10 +56,10 @@ class ChapterCache(private val context: Context) {
|
||||
|
||||
/** Cache class used for cache management. */
|
||||
// --> EH
|
||||
private var diskCache = setupDiskCache(prefs.eh_cacheSize().get().toLong())
|
||||
private var diskCache = setupDiskCache(prefs.cacheSize().get().toLong())
|
||||
|
||||
init {
|
||||
prefs.eh_cacheSize().asFlow()
|
||||
prefs.cacheSize().asFlow()
|
||||
.onEach {
|
||||
// Save old cache for destruction later
|
||||
val oldCache = diskCache
|
||||
|
@ -195,16 +195,6 @@ object PreferenceKeys {
|
||||
|
||||
fun trackToken(syncId: Int) = "track_token_$syncId"
|
||||
|
||||
const val eh_lock_hash = "lock_hash"
|
||||
|
||||
const val eh_lock_salt = "lock_salt"
|
||||
|
||||
const val eh_lock_length = "lock_length"
|
||||
|
||||
const val eh_lock_finger = "lock_finger"
|
||||
|
||||
const val eh_lock_manually = "eh_lock_manually"
|
||||
|
||||
const val eh_showSyncIntro = "eh_show_sync_intro"
|
||||
|
||||
const val eh_readOnlySync = "eh_sync_read_only"
|
||||
@ -225,8 +215,6 @@ object PreferenceKeys {
|
||||
|
||||
const val eh_enableExHentai = "enable_exhentai"
|
||||
|
||||
const val eh_ts_aspNetCookie = "eh_ts_aspNetCookie"
|
||||
|
||||
const val eh_showSettingsUploadWarning = "eh_showSettingsUploadWarning2"
|
||||
|
||||
const val eh_expandFilters = "eh_expand_filters"
|
||||
|
@ -290,7 +290,7 @@ class PreferencesHelper(val context: Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// --> AZ J2K CHERRYPICKING
|
||||
// SY -->
|
||||
|
||||
fun defaultMangaOrder() = flowPrefs.getString("default_manga_order", "")
|
||||
|
||||
@ -302,19 +302,7 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun skipPreMigration() = flowPrefs.getBoolean(Keys.skipPreMigration, false)
|
||||
|
||||
fun upgradeFilters() {
|
||||
val filterDl = flowPrefs.getBoolean(Keys.filterDownloaded, false).get()
|
||||
val filterUn = flowPrefs.getBoolean(Keys.filterUnread, false).get()
|
||||
val filterCm = flowPrefs.getBoolean(Keys.filterCompleted, false).get()
|
||||
filterDownloaded().set(if (filterDl) 1 else 0)
|
||||
filterUnread().set(if (filterUn) 1 else 0)
|
||||
filterCompleted().set(if (filterCm) 1 else 0)
|
||||
}
|
||||
|
||||
// <--
|
||||
|
||||
// --> EH
|
||||
fun eh_isHentaiEnabled() = flowPrefs.getBoolean(Keys.eh_is_hentai_enabled, true)
|
||||
fun isHentaiEnabled() = flowPrefs.getBoolean(Keys.eh_is_hentai_enabled, true)
|
||||
|
||||
fun enableExhentai() = flowPrefs.getBoolean(Keys.eh_enableExHentai, false)
|
||||
|
||||
@ -324,80 +312,72 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun useJapaneseTitle() = flowPrefs.getBoolean("use_jp_title", false)
|
||||
|
||||
fun eh_useOriginalImages() = flowPrefs.getBoolean(Keys.eh_useOrigImages, false)
|
||||
fun exhUseOriginalImages() = flowPrefs.getBoolean(Keys.eh_useOrigImages, false)
|
||||
|
||||
fun ehTagFilterValue() = flowPrefs.getInt(Keys.eh_tag_filtering_value, 0)
|
||||
|
||||
fun ehTagWatchingValue() = flowPrefs.getInt(Keys.eh_tag_watching_value, 0)
|
||||
|
||||
fun ehSearchSize() = flowPrefs.getString("ex_search_size", "rc_0")
|
||||
|
||||
fun thumbnailRows() = flowPrefs.getString("ex_thumb_rows", "tr_2")
|
||||
|
||||
fun hasPerformedURLMigration() = flowPrefs.getBoolean("performed_url_migration", false)
|
||||
|
||||
// EH Cookies
|
||||
fun memberIdVal() = flowPrefs.getString("eh_ipb_member_id", "")
|
||||
|
||||
fun passHashVal() = flowPrefs.getString("eh_ipb_pass_hash", "")
|
||||
fun igneousVal() = flowPrefs.getString("eh_igneous", "")
|
||||
fun eh_ehSettingsProfile() = flowPrefs.getInt(Keys.eh_ehSettingsProfile, -1)
|
||||
fun eh_exhSettingsProfile() = flowPrefs.getInt(Keys.eh_exhSettingsProfile, -1)
|
||||
fun eh_settingsKey() = flowPrefs.getString(Keys.eh_settingsKey, "")
|
||||
fun eh_sessionCookie() = flowPrefs.getString(Keys.eh_sessionCookie, "")
|
||||
fun eh_hathPerksCookies() = flowPrefs.getString(Keys.eh_hathPerksCookie, "")
|
||||
fun ehSettingsProfile() = flowPrefs.getInt(Keys.eh_ehSettingsProfile, -1)
|
||||
fun exhSettingsProfile() = flowPrefs.getInt(Keys.eh_exhSettingsProfile, -1)
|
||||
fun exhSettingsKey() = flowPrefs.getString(Keys.eh_settingsKey, "")
|
||||
fun exhSessionCookie() = flowPrefs.getString(Keys.eh_sessionCookie, "")
|
||||
fun exhHathPerksCookies() = flowPrefs.getString(Keys.eh_hathPerksCookie, "")
|
||||
|
||||
fun eh_showSyncIntro() = flowPrefs.getBoolean(Keys.eh_showSyncIntro, true)
|
||||
fun exhShowSyncIntro() = flowPrefs.getBoolean(Keys.eh_showSyncIntro, true)
|
||||
|
||||
fun eh_readOnlySync() = flowPrefs.getBoolean(Keys.eh_readOnlySync, false)
|
||||
fun exhReadOnlySync() = flowPrefs.getBoolean(Keys.eh_readOnlySync, false)
|
||||
|
||||
fun eh_lenientSync() = flowPrefs.getBoolean(Keys.eh_lenientSync, false)
|
||||
fun exhLenientSync() = flowPrefs.getBoolean(Keys.eh_lenientSync, false)
|
||||
|
||||
fun eh_ts_aspNetCookie() = flowPrefs.getString(Keys.eh_ts_aspNetCookie, "")
|
||||
fun exhShowSettingsUploadWarning() = flowPrefs.getBoolean(Keys.eh_showSettingsUploadWarning, true)
|
||||
|
||||
fun eh_showSettingsUploadWarning() = flowPrefs.getBoolean(Keys.eh_showSettingsUploadWarning, true)
|
||||
fun expandFilters() = flowPrefs.getBoolean(Keys.eh_expandFilters, false)
|
||||
|
||||
fun eh_expandFilters() = flowPrefs.getBoolean(Keys.eh_expandFilters, false)
|
||||
fun readerThreads() = flowPrefs.getInt(Keys.eh_readerThreads, 2)
|
||||
|
||||
fun eh_readerThreads() = flowPrefs.getInt(Keys.eh_readerThreads, 2)
|
||||
fun readerInstantRetry() = flowPrefs.getBoolean(Keys.eh_readerInstantRetry, true)
|
||||
|
||||
fun eh_readerInstantRetry() = flowPrefs.getBoolean(Keys.eh_readerInstantRetry, true)
|
||||
fun autoscrollInterval() = flowPrefs.getFloat(Keys.eh_utilAutoscrollInterval, 3f)
|
||||
|
||||
fun eh_utilAutoscrollInterval() = flowPrefs.getFloat(Keys.eh_utilAutoscrollInterval, 3f)
|
||||
fun cacheSize() = flowPrefs.getString(Keys.eh_cacheSize, "75")
|
||||
|
||||
fun eh_cacheSize() = flowPrefs.getString(Keys.eh_cacheSize, "75")
|
||||
fun preserveReadingPosition() = flowPrefs.getBoolean(Keys.eh_preserveReadingPosition, false)
|
||||
|
||||
fun eh_preserveReadingPosition() = flowPrefs.getBoolean(Keys.eh_preserveReadingPosition, false)
|
||||
fun autoSolveCaptcha() = flowPrefs.getBoolean(Keys.eh_autoSolveCaptchas, false)
|
||||
|
||||
fun eh_autoSolveCaptchas() = flowPrefs.getBoolean(Keys.eh_autoSolveCaptchas, false)
|
||||
fun delegateSources() = flowPrefs.getBoolean(Keys.eh_delegateSources, true)
|
||||
|
||||
fun eh_delegateSources() = flowPrefs.getBoolean(Keys.eh_delegateSources, true)
|
||||
fun ehLastVersionCode() = flowPrefs.getInt("eh_last_version_code", 0)
|
||||
|
||||
fun eh_lastVersionCode() = flowPrefs.getInt("eh_last_version_code", 0)
|
||||
fun savedSearches() = flowPrefs.getStringSet("eh_saved_searches", emptySet())
|
||||
|
||||
fun eh_savedSearches() = flowPrefs.getStringSet("eh_saved_searches", emptySet())
|
||||
fun logLevel() = flowPrefs.getInt(Keys.eh_logLevel, 0)
|
||||
|
||||
fun eh_logLevel() = flowPrefs.getInt(Keys.eh_logLevel, 0)
|
||||
fun enableSourceBlacklist() = flowPrefs.getBoolean(Keys.eh_enableSourceBlacklist, true)
|
||||
|
||||
fun eh_enableSourceBlacklist() = flowPrefs.getBoolean(Keys.eh_enableSourceBlacklist, true)
|
||||
fun exhAutoUpdateFrequency() = flowPrefs.getInt(Keys.eh_autoUpdateFrequency, 1)
|
||||
|
||||
fun eh_autoUpdateFrequency() = flowPrefs.getInt(Keys.eh_autoUpdateFrequency, 1)
|
||||
fun exhAutoUpdateRequirements() = flowPrefs.getStringSet(Keys.eh_autoUpdateRestrictions, emptySet())
|
||||
|
||||
fun eh_autoUpdateRequirements() = prefs.getStringSet(Keys.eh_autoUpdateRestrictions, emptySet())
|
||||
fun exhAutoUpdateStats() = flowPrefs.getString(Keys.eh_autoUpdateStats, "")
|
||||
|
||||
fun eh_autoUpdateStats() = flowPrefs.getString(Keys.eh_autoUpdateStats, "")
|
||||
fun aggressivePageLoading() = flowPrefs.getBoolean(Keys.eh_aggressivePageLoading, false)
|
||||
|
||||
fun eh_aggressivePageLoading() = flowPrefs.getBoolean(Keys.eh_aggressivePageLoading, false)
|
||||
fun preloadSize() = flowPrefs.getInt(Keys.eh_preload_size, 10)
|
||||
|
||||
fun eh_preload_size() = flowPrefs.getInt(Keys.eh_preload_size, 10)
|
||||
fun useAutoWebtoon() = flowPrefs.getBoolean(Keys.eh_use_auto_webtoon, true)
|
||||
|
||||
fun eh_useAutoWebtoon() = flowPrefs.getBoolean(Keys.eh_use_auto_webtoon, true)
|
||||
fun exhWatchedListDefaultState() = flowPrefs.getBoolean(Keys.eh_watched_list_default_state, false)
|
||||
|
||||
fun eh_watchedListDefaultState() = flowPrefs.getBoolean(Keys.eh_watched_list_default_state, false)
|
||||
fun exhSettingsLanguages() = flowPrefs.getString(Keys.eh_settings_languages, "false*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false")
|
||||
|
||||
fun eh_settingsLanguages() = flowPrefs.getString(Keys.eh_settings_languages, "false*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false")
|
||||
|
||||
fun eh_EnabledCategories() = flowPrefs.getString(Keys.eh_enabled_categories, "false,false,false,false,false,false,false,false,false,false")
|
||||
fun exhEnabledCategories() = flowPrefs.getString(Keys.eh_enabled_categories, "false,false,false,false,false,false,false,false,false,false")
|
||||
|
||||
fun latestTabSources() = flowPrefs.getStringSet(Keys.latest_tab_sources, mutableSetOf())
|
||||
|
||||
|
@ -155,7 +155,7 @@ class ExtensionManager(
|
||||
|
||||
// EXH -->
|
||||
fun <T : Extension> Iterable<T>.filterNotBlacklisted(): List<T> {
|
||||
val blacklistEnabled = preferences.eh_enableSourceBlacklist().get()
|
||||
val blacklistEnabled = preferences.enableSourceBlacklist().get()
|
||||
return filter {
|
||||
if (it.isBlacklisted(blacklistEnabled)) {
|
||||
XLog.tag("ExtensionManager").d("Removing blacklisted extension: (name: %s, pkgName: %s)!", it.name, it.pkgName)
|
||||
@ -166,7 +166,7 @@ class ExtensionManager(
|
||||
|
||||
fun Extension.isBlacklisted(
|
||||
blacklistEnabled: Boolean =
|
||||
preferences.eh_enableSourceBlacklist().get()
|
||||
preferences.enableSourceBlacklist().get()
|
||||
): Boolean {
|
||||
return pkgName in BlacklistedSources.BLACKLISTED_EXTENSIONS && blacklistEnabled
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ internal class ExtensionGithubApi {
|
||||
preferences.lastExtCheck().set(Date().time)
|
||||
|
||||
// SY -->
|
||||
val blacklistEnabled = preferences.eh_enableSourceBlacklist().get()
|
||||
val blacklistEnabled = preferences.enableSourceBlacklist().get()
|
||||
// SY <--
|
||||
|
||||
val installedExtensions = ExtensionLoader.loadExtensions(context)
|
||||
@ -86,7 +86,7 @@ internal class ExtensionGithubApi {
|
||||
// SY -->
|
||||
fun Extension.isBlacklisted(
|
||||
blacklistEnabled: Boolean =
|
||||
preferences.eh_enableSourceBlacklist().get()
|
||||
preferences.enableSourceBlacklist().get()
|
||||
): Boolean {
|
||||
return pkgName in BlacklistedSources.BLACKLISTED_EXTENSIONS && blacklistEnabled
|
||||
}
|
||||
|
@ -403,7 +403,7 @@ abstract class HttpSource : CatalogueSource {
|
||||
|
||||
// EXH -->
|
||||
private var delegate: DelegatedHttpSource? = null
|
||||
get() = if (Injekt.get<PreferencesHelper>().eh_delegateSources().get()) {
|
||||
get() = if (Injekt.get<PreferencesHelper>().delegateSources().get()) {
|
||||
field
|
||||
} else {
|
||||
null
|
||||
|
@ -681,9 +681,9 @@ class EHentai(
|
||||
}
|
||||
|
||||
fun spPref() = if (exh) {
|
||||
preferences.eh_exhSettingsProfile()
|
||||
preferences.exhSettingsProfile()
|
||||
} else {
|
||||
preferences.eh_ehSettingsProfile()
|
||||
preferences.ehSettingsProfile()
|
||||
}
|
||||
|
||||
private fun rawCookies(sp: Int): Map<String, String> {
|
||||
@ -694,17 +694,17 @@ class EHentai(
|
||||
cookies[LoginController.IGNEOUS_COOKIE] = preferences.igneousVal().get()
|
||||
cookies["sp"] = sp.toString()
|
||||
|
||||
val sessionKey = preferences.eh_settingsKey().get()
|
||||
val sessionKey = preferences.exhSettingsKey().get()
|
||||
if (sessionKey.isNotBlank()) {
|
||||
cookies["sk"] = sessionKey
|
||||
}
|
||||
|
||||
val sessionCookie = preferences.eh_sessionCookie().get()
|
||||
val sessionCookie = preferences.exhSessionCookie().get()
|
||||
if (sessionCookie.isNotBlank()) {
|
||||
cookies["s"] = sessionCookie
|
||||
}
|
||||
|
||||
val hathPerksCookie = preferences.eh_hathPerksCookies().get()
|
||||
val hathPerksCookie = preferences.exhHathPerksCookies().get()
|
||||
if (hathPerksCookie.isNotBlank()) {
|
||||
cookies["hath_perks"] = hathPerksCookie
|
||||
}
|
||||
@ -752,7 +752,7 @@ class EHentai(
|
||||
EHTags.getNameSpaces().map { "$it:" },
|
||||
excludePrefix
|
||||
),
|
||||
if (preferences.eh_watchedListDefaultState().get()) {
|
||||
if (preferences.exhWatchedListDefaultState().get()) {
|
||||
Watched(isEnabled = true)
|
||||
} else {
|
||||
Watched(isEnabled = false)
|
||||
|
@ -441,7 +441,7 @@ open class BrowseSourcePresenter(
|
||||
|
||||
// EXH -->
|
||||
fun saveSearches(searches: List<EXHSavedSearch>) {
|
||||
val otherSerialized = prefs.eh_savedSearches().get().filter {
|
||||
val otherSerialized = prefs.savedSearches().get().filter {
|
||||
!it.startsWith("${source.id}:")
|
||||
}
|
||||
val newSerialized = searches.map {
|
||||
@ -451,11 +451,11 @@ open class BrowseSourcePresenter(
|
||||
put("filters", filterSerializer.serialize(it.filterList))
|
||||
}.toString()
|
||||
}
|
||||
prefs.eh_savedSearches().set((otherSerialized + newSerialized).toSet())
|
||||
prefs.savedSearches().set((otherSerialized + newSerialized).toSet())
|
||||
}
|
||||
|
||||
fun loadSearches(): List<EXHSavedSearch> {
|
||||
val loaded = prefs.eh_savedSearches().get()
|
||||
val loaded = prefs.savedSearches().get()
|
||||
return loaded.map {
|
||||
try {
|
||||
val id = it.substringBefore(':').toLong()
|
||||
|
@ -20,7 +20,7 @@ class GroupItem(val filter: Filter.Group<*>) : AbstractExpandableHeaderItem<Grou
|
||||
|
||||
init {
|
||||
// --> EH
|
||||
isExpanded = Injekt.get<PreferencesHelper>().eh_expandFilters().get()
|
||||
isExpanded = Injekt.get<PreferencesHelper>().expandFilters().get()
|
||||
// <-- EH
|
||||
}
|
||||
|
||||
|
@ -226,7 +226,7 @@ open class IndexPresenter(
|
||||
private val filterSerializer = FilterSerializer()
|
||||
|
||||
fun loadSearches(): List<EXHSavedSearch> {
|
||||
val loaded = preferences.eh_savedSearches().get()
|
||||
val loaded = preferences.savedSearches().get()
|
||||
return loaded.map {
|
||||
try {
|
||||
val id = it.substringBefore(':').toLong()
|
||||
|
@ -425,7 +425,7 @@ class LibraryController(
|
||||
menu.findItem(R.id.action_filter).icon.mutate()
|
||||
|
||||
// SY -->
|
||||
menu.findItem(R.id.action_sync_favorites).isVisible = preferences.eh_isHentaiEnabled().get()
|
||||
menu.findItem(R.id.action_sync_favorites).isVisible = preferences.isHentaiEnabled().get()
|
||||
// SY <--
|
||||
}
|
||||
|
||||
@ -483,7 +483,7 @@ class LibraryController(
|
||||
router.pushController(MigrationSourcesController().withFadeTransaction())
|
||||
}
|
||||
R.id.action_sync_favorites -> {
|
||||
if (preferences.eh_showSyncIntro().get()) {
|
||||
if (preferences.exhShowSyncIntro().get()) {
|
||||
activity?.let { FavoritesIntroDialog().show(it) }
|
||||
} else {
|
||||
presenter.favoritesSync.runSync()
|
||||
|
@ -201,7 +201,7 @@ class MainActivity : BaseActivity<MainActivityBinding>() {
|
||||
initWhenIdle {
|
||||
// Upload settings
|
||||
if (preferences.enableExhentai().get() &&
|
||||
preferences.eh_showSettingsUploadWarning().get()
|
||||
preferences.exhShowSettingsUploadWarning().get()
|
||||
) {
|
||||
WarnConfigureDialogController.uploadSettings(router)
|
||||
}
|
||||
@ -212,7 +212,7 @@ class MainActivity : BaseActivity<MainActivityBinding>() {
|
||||
// SY <--
|
||||
}
|
||||
// SY -->
|
||||
if (!preferences.eh_isHentaiEnabled().get()) {
|
||||
if (!preferences.isHentaiEnabled().get()) {
|
||||
if (EH_SOURCE_ID !in BlacklistedSources.HIDDEN_SOURCES) {
|
||||
BlacklistedSources.HIDDEN_SOURCES += EH_SOURCE_ID
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ class ChaptersAdapter(
|
||||
val dateFormat: DateFormat = preferences.dateFormat()
|
||||
|
||||
// SY -->
|
||||
val preserveReadingPosition: Boolean = preferences.eh_preserveReadingPosition().get()
|
||||
val preserveReadingPosition: Boolean = preferences.preserveReadingPosition().get()
|
||||
// SY <--
|
||||
|
||||
override fun updateDataSet(items: List<ChapterItem>?) {
|
||||
|
@ -87,7 +87,7 @@ class MoreController :
|
||||
}
|
||||
}
|
||||
// SY -->
|
||||
if (preferences.eh_isHentaiEnabled().get()) {
|
||||
if (preferences.isHentaiEnabled().get()) {
|
||||
preference {
|
||||
titleRes = R.string.eh_batch_add
|
||||
iconRes = R.drawable.ic_playlist_add_black_24dp
|
||||
|
@ -71,7 +71,6 @@ import exh.util.defaultReaderType
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.cancel
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.drop
|
||||
import kotlinx.coroutines.flow.flow
|
||||
@ -430,7 +429,7 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
||||
.launchIn(scope)
|
||||
|
||||
binding.ehAutoscrollFreq.setText(
|
||||
preferences.eh_utilAutoscrollInterval().get().let {
|
||||
preferences.autoscrollInterval().get().let {
|
||||
if (it == -1f) {
|
||||
""
|
||||
} else {
|
||||
@ -443,7 +442,7 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
||||
.onEach {
|
||||
setupAutoscroll(
|
||||
if (it) {
|
||||
preferences.eh_utilAutoscrollInterval().get().toDouble()
|
||||
preferences.autoscrollInterval().get().toDouble()
|
||||
} else {
|
||||
-1.0
|
||||
}
|
||||
@ -457,12 +456,12 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
||||
|
||||
if (parsed == null || parsed <= 0 || parsed > 9999) {
|
||||
binding.ehAutoscrollFreq.error = "Invalid frequency"
|
||||
preferences.eh_utilAutoscrollInterval().set(-1f)
|
||||
preferences.autoscrollInterval().set(-1f)
|
||||
binding.ehAutoscroll.isEnabled = false
|
||||
setupAutoscroll(-1.0)
|
||||
} else {
|
||||
binding.ehAutoscrollFreq.error = null
|
||||
preferences.eh_utilAutoscrollInterval().set(parsed.toFloat())
|
||||
preferences.autoscrollInterval().set(parsed.toFloat())
|
||||
binding.ehAutoscroll.isEnabled = true
|
||||
setupAutoscroll(if (binding.ehAutoscroll.isChecked) parsed else -1.0)
|
||||
}
|
||||
@ -712,7 +711,7 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
||||
|
||||
// SY -->
|
||||
val defaultReaderType = manga.defaultReaderType()
|
||||
if (preferences.eh_useAutoWebtoon().get() && manga.viewer == 0 && defaultReaderType != null && defaultReaderType == WEBTOON) {
|
||||
if (preferences.useAutoWebtoon().get() && manga.viewer == 0 && defaultReaderType != null && defaultReaderType == WEBTOON) {
|
||||
binding.root.snack(resources.getString(R.string.eh_auto_webtoon_snack), Snackbar.LENGTH_LONG)
|
||||
} else if (preferences.showReadingMode()) {
|
||||
// SY <--
|
||||
|
@ -597,7 +597,7 @@ class ReaderPresenter(
|
||||
fun getMangaViewer(): Int {
|
||||
val manga = manga ?: return preferences.defaultViewer()
|
||||
// SY -->
|
||||
return if (manga.viewer == 0 && preferences.eh_useAutoWebtoon().get()) {
|
||||
return if (manga.viewer == 0 && preferences.useAutoWebtoon().get()) {
|
||||
manga.defaultReaderType() ?: if (manga.viewer == 0) preferences.defaultViewer() else manga.viewer
|
||||
} else if (manga.viewer == 0) {
|
||||
preferences.defaultViewer()
|
||||
|
@ -6,7 +6,6 @@ import android.widget.Spinner
|
||||
import androidx.annotation.ArrayRes
|
||||
import androidx.core.view.isInvisible
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.view.plusAssign
|
||||
import androidx.core.widget.NestedScrollView
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||
import com.tfcporciuncula.flow.Preference
|
||||
@ -73,7 +72,7 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : BottomSheetDia
|
||||
binding.alwaysShowChapterTransition.bindToPreference(preferences.alwaysShowChapterTransition())
|
||||
binding.pageTransitions.bindToPreference(preferences.pageTransitions())
|
||||
// SY -->
|
||||
binding.autoWebtoonMode.bindToPreference(preferences.eh_useAutoWebtoon())
|
||||
binding.autoWebtoonMode.bindToPreference(preferences.useAutoWebtoon())
|
||||
// SY <--
|
||||
|
||||
// If the preference is explicitly disabled, that means the setting was configured since there is a cutout
|
||||
|
@ -66,7 +66,7 @@ class ChapterLoader(
|
||||
// If the chapter is partially read, set the starting page to the last the user read
|
||||
// otherwise use the requested page.
|
||||
if (!chapter.chapter.read /* --> EH */ || prefs
|
||||
.eh_preserveReadingPosition()
|
||||
.preserveReadingPosition()
|
||||
.get() /* <-- EH */
|
||||
) {
|
||||
chapter.requestedPage = chapter.chapter.last_page_read
|
||||
|
@ -21,7 +21,6 @@ import rx.subscriptions.CompositeSubscription
|
||||
import timber.log.Timber
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import java.util.concurrent.PriorityBlockingQueue
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
import kotlin.math.min
|
||||
@ -32,11 +31,11 @@ import kotlin.math.min
|
||||
class HttpPageLoader(
|
||||
private val chapter: ReaderChapter,
|
||||
private val source: HttpSource,
|
||||
private val chapterCache: ChapterCache = Injekt.get()
|
||||
private val chapterCache: ChapterCache = Injekt.get(),
|
||||
// SY -->
|
||||
private val preferences: PreferencesHelper = Injekt.get()
|
||||
// SY <--
|
||||
) : PageLoader() {
|
||||
// EXH -->
|
||||
private val prefs: PreferencesHelper by injectLazy()
|
||||
// EXH <--
|
||||
|
||||
/**
|
||||
* A queue used to manage requests one by one while allowing priorities.
|
||||
@ -48,11 +47,11 @@ class HttpPageLoader(
|
||||
*/
|
||||
private val subscriptions = CompositeSubscription()
|
||||
|
||||
private val preloadSize = /* SY --> */ prefs.eh_preload_size().get() /* SY <-- */
|
||||
private val preloadSize = /* SY --> */ preferences.preloadSize().get() /* SY <-- */
|
||||
|
||||
init {
|
||||
// EXH -->
|
||||
repeat(prefs.eh_readerThreads().get()) {
|
||||
repeat(preferences.readerThreads().get()) {
|
||||
// EXH <--
|
||||
subscriptions += Observable.defer { Observable.just(queue.take().page) }
|
||||
.filter { it.status == Page.QUEUE }
|
||||
@ -110,7 +109,7 @@ class HttpPageLoader(
|
||||
// Don't trust sources and use our own indexing
|
||||
ReaderPage(index, page.url, page.imageUrl)
|
||||
}
|
||||
if (prefs.eh_aggressivePageLoading().get()) {
|
||||
if (preferences.aggressivePageLoading().get()) {
|
||||
rp.mapNotNull {
|
||||
if (it.status == Page.QUEUE) {
|
||||
PriorityPage(it, 0)
|
||||
@ -193,7 +192,7 @@ class HttpPageLoader(
|
||||
page.imageUrl = null
|
||||
}
|
||||
|
||||
if (prefs.eh_readerInstantRetry().get()) // EXH <--
|
||||
if (preferences.readerInstantRetry().get()) // EXH <--
|
||||
{
|
||||
boostPage(page)
|
||||
} else {
|
||||
@ -262,16 +261,16 @@ class HttpPageLoader(
|
||||
}
|
||||
.doOnNext {
|
||||
// SY -->
|
||||
val readerTheme = prefs.readerTheme().get()
|
||||
val readerTheme = preferences.readerTheme().get()
|
||||
if (readerTheme >= 3) {
|
||||
val stream = chapterCache.getImageFile(imageUrl).inputStream()
|
||||
val image = BitmapFactory.decodeStream(stream)
|
||||
page.bg = ImageUtil.autoSetBackground(
|
||||
image,
|
||||
readerTheme == 3,
|
||||
prefs.context
|
||||
preferences.context
|
||||
)
|
||||
page.bgType = PagerPageHolder.getBGType(readerTheme, prefs.context)
|
||||
page.bgType = PagerPageHolder.getBGType(readerTheme, preferences.context)
|
||||
stream.close()
|
||||
}
|
||||
// SY <--
|
||||
|
@ -263,7 +263,7 @@ class SettingsAdvancedController : SettingsController() {
|
||||
defaultValue = true
|
||||
|
||||
onChange {
|
||||
if (preferences.eh_isHentaiEnabled().get()) {
|
||||
if (preferences.isHentaiEnabled().get()) {
|
||||
if (EH_SOURCE_ID !in BlacklistedSources.HIDDEN_SOURCES) {
|
||||
BlacklistedSources.HIDDEN_SOURCES += EH_SOURCE_ID
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ class SettingsEhController : SettingsController() {
|
||||
key = PreferenceKeys.eh_useOrigImages
|
||||
defaultValue = false
|
||||
|
||||
onChange { preferences.eh_useOriginalImages().reconfigure() }
|
||||
onChange { preferences.exhUseOriginalImages().reconfigure() }
|
||||
|
||||
preferences.enableExhentai().asImmediateFlow { isVisible = it }
|
||||
.launchIn(scope)
|
||||
@ -297,14 +297,14 @@ class SettingsEhController : SettingsController() {
|
||||
).joinToString("\n")
|
||||
}
|
||||
|
||||
preferences.eh_settingsLanguages().set(languages)
|
||||
preferences.exhSettingsLanguages().set(languages)
|
||||
|
||||
preferences.eh_settingsLanguages().reconfigure()
|
||||
preferences.exhSettingsLanguages().reconfigure()
|
||||
}
|
||||
.show {
|
||||
val customView = this.view.contentLayout.customView!!
|
||||
val binding = EhDialogLanguagesBinding.bind(customView)
|
||||
val settingsLanguages = preferences.eh_settingsLanguages().get().split("\n")
|
||||
val settingsLanguages = preferences.exhSettingsLanguages().get().split("\n")
|
||||
|
||||
val japanese = settingsLanguages[0].split("*").map { it.toBoolean() }
|
||||
val english = settingsLanguages[1].split("*").map { it.toBoolean() }
|
||||
@ -420,7 +420,7 @@ class SettingsEhController : SettingsController() {
|
||||
val binding = EhDialogCategoriesBinding.bind(customView)
|
||||
|
||||
with(binding) {
|
||||
preferences.eh_EnabledCategories().set(
|
||||
preferences.exhEnabledCategories().set(
|
||||
listOf(
|
||||
(!doujinshiCheckbox.isChecked),
|
||||
(!mangaCheckbox.isChecked),
|
||||
@ -436,14 +436,14 @@ class SettingsEhController : SettingsController() {
|
||||
)
|
||||
}
|
||||
|
||||
preferences.eh_EnabledCategories().reconfigure()
|
||||
preferences.exhEnabledCategories().reconfigure()
|
||||
}
|
||||
.show {
|
||||
val customView = this.view.contentLayout.customView!!
|
||||
val binding = EhDialogCategoriesBinding.bind(customView)
|
||||
|
||||
with(binding) {
|
||||
val list = preferences.eh_EnabledCategories().get().split(",").map { !it.toBoolean() }
|
||||
val list = preferences.exhEnabledCategories().get().split(",").map { !it.toBoolean() }
|
||||
doujinshiCheckbox.isChecked = list[0]
|
||||
mangaCheckbox.isChecked = list[1]
|
||||
artistCgCheckbox.isChecked = list[2]
|
||||
@ -584,7 +584,7 @@ class SettingsEhController : SettingsController() {
|
||||
entryValues = arrayOf("0", "1", "2", "3", "6", "12", "24", "48")
|
||||
defaultValue = "0"
|
||||
|
||||
preferences.eh_autoUpdateFrequency().asFlow()
|
||||
preferences.exhAutoUpdateFrequency().asFlow()
|
||||
.onEach { newVal ->
|
||||
summary = if (newVal == 0) {
|
||||
context.getString(R.string.time_between_batches_summary_1, context.getString(R.string.app_name))
|
||||
@ -608,7 +608,7 @@ class SettingsEhController : SettingsController() {
|
||||
entryValues = arrayOf("wifi", "ac")
|
||||
summaryRes = R.string.pref_library_update_restriction_summary
|
||||
|
||||
preferences.eh_autoUpdateFrequency().asFlow()
|
||||
preferences.exhAutoUpdateFrequency().asFlow()
|
||||
.onEach { isVisible = it > 0 }
|
||||
.launchIn(scope)
|
||||
|
||||
@ -633,7 +633,7 @@ class SettingsEhController : SettingsController() {
|
||||
scope.launch(Dispatchers.IO) {
|
||||
val updateInfo = try {
|
||||
val stats =
|
||||
preferences.eh_autoUpdateStats().get().nullIfBlank()?.let {
|
||||
preferences.exhAutoUpdateStats().get().nullIfBlank()?.let {
|
||||
Json.decodeFromString<EHentaiUpdaterStats>(it)
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ class SettingsMainController : SettingsController() {
|
||||
onClick { navigateTo(SettingsSecurityController()) }
|
||||
}
|
||||
// SY -->
|
||||
if (preferences.eh_isHentaiEnabled().get()) {
|
||||
if (preferences.isHentaiEnabled().get()) {
|
||||
preference {
|
||||
iconRes = R.drawable.eh_ic_ehlogo_red_24dp
|
||||
iconTint = tintColor
|
||||
|
@ -51,7 +51,7 @@ object SettingsSearchHelper {
|
||||
if (MdUtil.getEnabledMangaDexs(preferences).isNotEmpty()) {
|
||||
controllers += SettingsMangaDexController::class
|
||||
}
|
||||
if (preferences.eh_isHentaiEnabled().get()) {
|
||||
if (preferences.isHentaiEnabled().get()) {
|
||||
controllers += SettingsEhController::class
|
||||
}
|
||||
controllers
|
||||
|
@ -48,7 +48,7 @@ object EXHMigrations {
|
||||
*/
|
||||
fun upgrade(preferences: PreferencesHelper): Boolean {
|
||||
val context = preferences.context
|
||||
val oldVersion = preferences.eh_lastVersionCode().get()
|
||||
val oldVersion = preferences.ehLastVersionCode().get()
|
||||
try {
|
||||
if (oldVersion < BuildConfig.VERSION_CODE) {
|
||||
// Fresh install
|
||||
@ -259,7 +259,7 @@ object EXHMigrations {
|
||||
|
||||
// TODO BE CAREFUL TO NOT FUCK UP MergedSources IF CHANGING URLs
|
||||
|
||||
preferences.eh_lastVersionCode().set(BuildConfig.VERSION_CODE)
|
||||
preferences.ehLastVersionCode().set(BuildConfig.VERSION_CODE)
|
||||
|
||||
return true
|
||||
}
|
||||
|
@ -38,12 +38,12 @@ object DebugFunctions {
|
||||
val sourceManager: SourceManager by injectLazy()
|
||||
|
||||
fun forceUpgradeMigration() {
|
||||
prefs.eh_lastVersionCode().set(1)
|
||||
prefs.ehLastVersionCode().set(1)
|
||||
EXHMigrations.upgrade(prefs)
|
||||
}
|
||||
|
||||
fun forceSetupJobs() {
|
||||
prefs.eh_lastVersionCode().set(0)
|
||||
prefs.ehLastVersionCode().set(0)
|
||||
EXHMigrations.upgrade(prefs)
|
||||
}
|
||||
|
||||
@ -168,7 +168,7 @@ object DebugFunctions {
|
||||
it.favorite && db.getSearchMetadataForManga(it.id!!).executeAsBlocking() == null
|
||||
}
|
||||
|
||||
fun clearSavedSearches() = prefs.eh_savedSearches().set(emptySet())
|
||||
fun clearSavedSearches() = prefs.savedSearches().set(emptySet())
|
||||
|
||||
fun listAllSources() = sourceManager.getCatalogueSources().joinToString("\n") {
|
||||
"${it.id}: ${it.name} (${it.lang.toUpperCase()})"
|
||||
@ -233,7 +233,7 @@ object DebugFunctions {
|
||||
runBlocking {
|
||||
val source = sourceManager.get(EH_SOURCE_ID) as? CatalogueSource ?: return@runBlocking
|
||||
val newSource = sourceManager.get(EXH_SOURCE_ID) as? CatalogueSource ?: return@runBlocking
|
||||
val savedSearches = prefs.eh_savedSearches().get().mapNotNull {
|
||||
val savedSearches = prefs.savedSearches().get().mapNotNull {
|
||||
try {
|
||||
val id = it.substringBefore(':').toLong()
|
||||
if (id != source.id) return@mapNotNull null
|
||||
@ -245,7 +245,7 @@ object DebugFunctions {
|
||||
null
|
||||
}
|
||||
}.toMutableList()
|
||||
savedSearches += prefs.eh_savedSearches().get().mapNotNull {
|
||||
savedSearches += prefs.savedSearches().get().mapNotNull {
|
||||
try {
|
||||
val id = it.substringBefore(':').toLong()
|
||||
if (id != newSource.id) return@mapNotNull null
|
||||
@ -258,13 +258,13 @@ object DebugFunctions {
|
||||
}
|
||||
}.filterNot { newSavedSearch -> savedSearches.any { it.name == newSavedSearch.name } }
|
||||
|
||||
val otherSerialized = prefs.eh_savedSearches().get().filter {
|
||||
val otherSerialized = prefs.savedSearches().get().filter {
|
||||
!it.startsWith("${newSource.id}:")
|
||||
}
|
||||
val newSerialized = savedSearches.map {
|
||||
"${newSource.id}:" + Json.encodeToString(it)
|
||||
}
|
||||
prefs.eh_savedSearches().set((otherSerialized + newSerialized).toSet())
|
||||
prefs.savedSearches().set((otherSerialized + newSerialized).toSet())
|
||||
}
|
||||
}
|
||||
|
||||
@ -272,7 +272,7 @@ object DebugFunctions {
|
||||
runBlocking {
|
||||
val source = sourceManager.get(EXH_SOURCE_ID) as? CatalogueSource ?: return@runBlocking
|
||||
val newSource = sourceManager.get(EH_SOURCE_ID) as? CatalogueSource ?: return@runBlocking
|
||||
val savedSearches = prefs.eh_savedSearches().get().mapNotNull {
|
||||
val savedSearches = prefs.savedSearches().get().mapNotNull {
|
||||
try {
|
||||
val id = it.substringBefore(':').toLong()
|
||||
if (id != source.id) return@mapNotNull null
|
||||
@ -284,7 +284,7 @@ object DebugFunctions {
|
||||
null
|
||||
}
|
||||
}.toMutableList()
|
||||
savedSearches += prefs.eh_savedSearches().get().mapNotNull {
|
||||
savedSearches += prefs.savedSearches().get().mapNotNull {
|
||||
try {
|
||||
val id = it.substringBefore(':').toLong()
|
||||
if (id != newSource.id) return@mapNotNull null
|
||||
@ -297,13 +297,13 @@ object DebugFunctions {
|
||||
}
|
||||
}.filterNot { newSavedSearch -> savedSearches.any { it.name == newSavedSearch.name } }
|
||||
|
||||
val otherSerialized = prefs.eh_savedSearches().get().filter {
|
||||
val otherSerialized = prefs.savedSearches().get().filter {
|
||||
!it.startsWith("${newSource.id}:")
|
||||
}
|
||||
val newSerialized = savedSearches.map {
|
||||
"${newSource.id}:" + Json.encodeToString(it)
|
||||
}
|
||||
prefs.eh_savedSearches().set((otherSerialized + newSerialized).toSet())
|
||||
prefs.savedSearches().set((otherSerialized + newSerialized).toSet())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ class EHentaiUpdateWorker : JobService(), CoroutineScope {
|
||||
updatedThisIteration++
|
||||
}
|
||||
} finally {
|
||||
prefs.eh_autoUpdateStats().set(
|
||||
prefs.exhAutoUpdateStats().set(
|
||||
Json.encodeToString(
|
||||
EHentaiUpdaterStats(
|
||||
startTime,
|
||||
@ -355,9 +355,9 @@ class EHentaiUpdateWorker : JobService(), CoroutineScope {
|
||||
cancelBackground(context)
|
||||
|
||||
val preferences = Injekt.get<PreferencesHelper>()
|
||||
val duration = prefInterval ?: preferences.eh_autoUpdateFrequency().get()
|
||||
val duration = prefInterval ?: preferences.exhAutoUpdateFrequency().get()
|
||||
if (duration > 0) {
|
||||
val restrictions = preferences.eh_autoUpdateRequirements()!!
|
||||
val restrictions = preferences.exhAutoUpdateRequirements().get()
|
||||
val acRestriction = "ac" in restrictions
|
||||
val wifiRestriction = "wifi" in restrictions
|
||||
|
||||
|
@ -14,7 +14,7 @@ class FavoritesIntroDialog {
|
||||
.title(R.string.favorites_sync_notes)
|
||||
.message(text = HtmlCompat.fromHtml(context.getString(R.string.favorites_sync_notes_message), HtmlCompat.FROM_HTML_MODE_LEGACY))
|
||||
.positiveButton(android.R.string.ok) {
|
||||
prefs.eh_showSyncIntro().set(false)
|
||||
prefs.exhShowSyncIntro().set(false)
|
||||
}
|
||||
.cancelable(false)
|
||||
.show()
|
||||
|
@ -138,7 +138,7 @@ class FavoritesSyncHelper(val context: Context) {
|
||||
db.inTransaction {
|
||||
status.onNext(FavoritesSyncStatus.Processing(context.getString(R.string.favorites_sync_calculating_remote_changes), context = context))
|
||||
val remoteChanges = storage.getChangedRemoteEntries(realm, favorites.first)
|
||||
val localChanges = if (prefs.eh_readOnlySync().get()) {
|
||||
val localChanges = if (prefs.exhReadOnlySync().get()) {
|
||||
null // Do not build local changes if they are not going to be applied
|
||||
} else {
|
||||
status.onNext(FavoritesSyncStatus.Processing(context.getString(R.string.favorites_sync_calculating_local_changes), context = context))
|
||||
@ -255,7 +255,7 @@ class FavoritesSyncHelper(val context: Context) {
|
||||
if (!explicitlyRetryExhRequest(10, request)) {
|
||||
val errorString = "Unable to add gallery to remote server: '${gallery.title}' (GID: ${gallery.gid})!"
|
||||
|
||||
if (prefs.eh_lenientSync().get()) {
|
||||
if (prefs.exhLenientSync().get()) {
|
||||
errorList += errorString
|
||||
} else {
|
||||
status.onNext(FavoritesSyncStatus.Error(errorString))
|
||||
@ -305,7 +305,7 @@ class FavoritesSyncHelper(val context: Context) {
|
||||
if (!explicitlyRetryExhRequest(10, request)) {
|
||||
val errorString = context.getString(R.string.favorites_sync_unable_to_delete)
|
||||
|
||||
if (prefs.eh_lenientSync().get()) {
|
||||
if (prefs.exhLenientSync().get()) {
|
||||
errorList += errorString
|
||||
} else {
|
||||
status.onNext(FavoritesSyncStatus.Error(errorString))
|
||||
@ -397,7 +397,7 @@ class FavoritesSyncHelper(val context: Context) {
|
||||
is GalleryAddEvent.Fail.UnknownType -> context.getString(R.string.favorites_sync_failed_to_add_to_local_unknown_type, it.title, result.galleryUrl)
|
||||
}
|
||||
|
||||
if (prefs.eh_lenientSync().get()) {
|
||||
if (prefs.exhLenientSync().get()) {
|
||||
errorList += errorString
|
||||
} else {
|
||||
status.onNext(FavoritesSyncStatus.Error(errorString))
|
||||
|
@ -59,7 +59,7 @@ class EHDebugModeOverlay(private val context: Context) : OverlayModule<String>(n
|
||||
<b>Version code:</b> ${BuildConfig.VERSION_CODE}<br>
|
||||
<b>Commit SHA:</b> ${BuildConfig.COMMIT_SHA}<br>
|
||||
<b>Log level:</b> ${EHLogLevel.currentLogLevel.name.toLowerCase(Locale.getDefault())}<br>
|
||||
<b>Source blacklist:</b> ${prefs.eh_enableSourceBlacklist().get().asEnabledString()}
|
||||
<b>Source blacklist:</b> ${prefs.enableSourceBlacklist().get().asEnabledString()}
|
||||
""".trimIndent()
|
||||
|
||||
private fun Boolean.asEnabledString() = if (this) "enabled" else "disabled"
|
||||
|
@ -20,7 +20,7 @@ fun OkHttpClient.Builder.injectPatches(sourceIdProducer: () -> Long): OkHttpClie
|
||||
|
||||
fun findAndApplyPatches(sourceId: Long): EHInterceptor {
|
||||
// TODO make it so captcha doesnt auto open in manga eden while applying universal interceptors
|
||||
return if (Injekt.get<PreferencesHelper>().eh_autoSolveCaptchas().get()) ((EH_INTERCEPTORS[sourceId].orEmpty()) + (EH_INTERCEPTORS[EH_UNIVERSAL_INTERCEPTOR].orEmpty())).merge()
|
||||
return if (Injekt.get<PreferencesHelper>().autoSolveCaptcha().get()) ((EH_INTERCEPTORS[sourceId].orEmpty()) + (EH_INTERCEPTORS[EH_UNIVERSAL_INTERCEPTOR].orEmpty())).merge()
|
||||
else (EH_INTERCEPTORS[sourceId].orEmpty()).merge()
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ class EnhancedHttpSource(
|
||||
override fun getFilterList() = source().getFilterList()
|
||||
|
||||
fun source(): HttpSource {
|
||||
return if (prefs.eh_delegateSources().get()) {
|
||||
return if (prefs.delegateSources().get()) {
|
||||
enhancedSource
|
||||
} else {
|
||||
originalSource
|
||||
|
@ -145,13 +145,13 @@ class EHConfigurator(val context: Context) {
|
||||
}?.removePrefix("hath_perks=")?.substringBefore(';')
|
||||
|
||||
if (keyCookie != null) {
|
||||
prefs.eh_settingsKey().set(keyCookie)
|
||||
prefs.exhSettingsKey().set(keyCookie)
|
||||
}
|
||||
if (sessionCookie != null) {
|
||||
prefs.eh_sessionCookie().set(sessionCookie)
|
||||
prefs.exhSessionCookie().set(sessionCookie)
|
||||
}
|
||||
if (hathPerksCookie != null) {
|
||||
prefs.eh_hathPerksCookies().set(hathPerksCookie)
|
||||
prefs.exhHathPerksCookies().set(hathPerksCookie)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ class EhUConfigBuilder {
|
||||
Entry.TitleDisplayLanguage.DEFAULT
|
||||
}
|
||||
|
||||
configItems += if (preferences.eh_useOriginalImages().get()) {
|
||||
configItems += if (preferences.exhUseOriginalImages().get()) {
|
||||
Entry.UseOriginalImages.YES
|
||||
} else {
|
||||
Entry.UseOriginalImages.NO
|
||||
@ -64,9 +64,9 @@ class EhUConfigBuilder {
|
||||
configItems += Entry.TagFilteringThreshold(preferences.ehTagFilterValue().get())
|
||||
configItems += Entry.TagWatchingThreshold(preferences.ehTagWatchingValue().get())
|
||||
|
||||
configItems += Entry.LanguageSystem().getLanguages(preferences.eh_settingsLanguages().get().split("\n"))
|
||||
configItems += Entry.LanguageSystem().getLanguages(preferences.exhSettingsLanguages().get().split("\n"))
|
||||
|
||||
configItems += Entry.Categories().categoryConfigs(preferences.eh_EnabledCategories().get().split(",").map { it.toBoolean() })
|
||||
configItems += Entry.Categories().categoryConfigs(preferences.exhEnabledCategories().get().split(",").map { it.toBoolean() })
|
||||
|
||||
// Actually build form body
|
||||
val formBody = FormBody.Builder()
|
||||
|
@ -18,7 +18,7 @@ class WarnConfigureDialogController : DialogController() {
|
||||
.title(R.string.settings_profile_note)
|
||||
.message(R.string.settings_profile_note_message)
|
||||
.positiveButton(android.R.string.ok) {
|
||||
prefs.eh_showSettingsUploadWarning().set(false)
|
||||
prefs.exhShowSettingsUploadWarning().set(false)
|
||||
ConfiguringDialogController().showDialog(router)
|
||||
}
|
||||
.cancelable(false)
|
||||
@ -26,7 +26,7 @@ class WarnConfigureDialogController : DialogController() {
|
||||
|
||||
companion object {
|
||||
fun uploadSettings(router: Router) {
|
||||
if (Injekt.get<PreferencesHelper>().eh_showSettingsUploadWarning().get()) {
|
||||
if (Injekt.get<PreferencesHelper>().exhShowSettingsUploadWarning().get()) {
|
||||
WarnConfigureDialogController().showDialog(router)
|
||||
} else {
|
||||
ConfiguringDialogController().showDialog(router)
|
||||
|
@ -131,7 +131,7 @@ class BrowserActionActivity : AppCompatActivity() {
|
||||
// Wait for both inner scripts to be loaded
|
||||
if (loadedInners >= 2) {
|
||||
// Attempt to autosolve captcha
|
||||
if (preferencesHelper.eh_autoSolveCaptchas().get()) {
|
||||
if (preferencesHelper.autoSolveCaptcha().get()) {
|
||||
binding.webview.post {
|
||||
// 10 seconds to auto-solve captcha
|
||||
strictValidationStartTime = System.currentTimeMillis() + 1000 * 10
|
||||
@ -150,7 +150,7 @@ class BrowserActionActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
binding.webview.webViewClient = if (actionName == null && preferencesHelper.eh_autoSolveCaptchas().get()) {
|
||||
binding.webview.webViewClient = if (actionName == null && preferencesHelper.autoSolveCaptcha().get()) {
|
||||
// Fetch auto-solve credentials early for speed
|
||||
credentialsObservable = httpClient.newCall(
|
||||
Request.Builder()
|
||||
|
@ -62,14 +62,14 @@ class MangadexLoginDialog(bundle: Bundle? = null) : DialogController(bundle) {
|
||||
binding!!.login.setMode(ActionProcessButton.Mode.ENDLESS)
|
||||
binding!!.login.setOnClickListener { checkLogin() }
|
||||
|
||||
setCredentialsOnView(view)
|
||||
setCredentialsOnView()
|
||||
|
||||
binding!!.twoFactorCheck.setOnCheckedChangeListener { _, isChecked ->
|
||||
binding!!.twoFactorHolder.isVisible = isChecked
|
||||
}
|
||||
}
|
||||
|
||||
private fun setCredentialsOnView(view: View) {
|
||||
private fun setCredentialsOnView() {
|
||||
binding?.username?.setText(service.getUsername())
|
||||
binding?.password?.setText(service.getPassword())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user