chore: code refactor
This commit is contained in:
parent
8d7b86a667
commit
a2e44da99d
334 changed files with 3550 additions and 3092 deletions
|
@ -181,7 +181,11 @@ abstract class AnimeParser : BaseParser() {
|
|||
override suspend fun loadSavedShowResponse(mediaId: Int): ShowResponse? {
|
||||
checkIfVariablesAreEmpty()
|
||||
val dub = if (isDubAvailableSeparately()) "_${if (selectDub) "dub" else "sub"}" else ""
|
||||
var loaded = PrefManager.getNullableCustomVal("${saveName}${dub}_$mediaId", null, ShowResponse::class.java)
|
||||
var loaded = PrefManager.getNullableCustomVal(
|
||||
"${saveName}${dub}_$mediaId",
|
||||
null,
|
||||
ShowResponse::class.java
|
||||
)
|
||||
if (loaded == null && malSyncBackupName.isNotEmpty())
|
||||
loaded = MalSyncBackup.get(mediaId, malSyncBackupName, selectDub)
|
||||
?.also { saveShowResponse(mediaId, it, true) }
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ani.dantotsu.parsers
|
||||
|
||||
import android.content.Context
|
||||
import ani.dantotsu.Lazier
|
||||
import ani.dantotsu.lazyList
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
|
@ -14,8 +13,9 @@ object AnimeSources : WatchSources() {
|
|||
var pinnedAnimeSources: List<String> = emptyList()
|
||||
|
||||
suspend fun init(fromExtensions: StateFlow<List<AnimeExtension.Installed>>) {
|
||||
pinnedAnimeSources = PrefManager.getNullableVal<List<String>>(PrefName.AnimeSourcesOrder, null)
|
||||
?: emptyList()
|
||||
pinnedAnimeSources =
|
||||
PrefManager.getNullableVal<List<String>>(PrefName.AnimeSourcesOrder, null)
|
||||
?: emptyList()
|
||||
|
||||
// Initialize with the first value from StateFlow
|
||||
val initialExtensions = fromExtensions.first()
|
||||
|
|
|
@ -134,7 +134,11 @@ abstract class BaseParser {
|
|||
* **/
|
||||
open suspend fun loadSavedShowResponse(mediaId: Int): ShowResponse? {
|
||||
checkIfVariablesAreEmpty()
|
||||
return PrefManager.getNullableCustomVal("${saveName}_$mediaId", null, ShowResponse::class.java)
|
||||
return PrefManager.getNullableCustomVal(
|
||||
"${saveName}_$mediaId",
|
||||
null,
|
||||
ShowResponse::class.java
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,8 +2,8 @@ package ani.dantotsu.parsers
|
|||
|
||||
import ani.dantotsu.Lazier
|
||||
import ani.dantotsu.lazyList
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import eu.kanade.tachiyomi.extension.manga.model.MangaExtension
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.first
|
||||
|
@ -13,8 +13,9 @@ object MangaSources : MangaReadSources() {
|
|||
var pinnedMangaSources: List<String> = emptyList()
|
||||
|
||||
suspend fun init(fromExtensions: StateFlow<List<MangaExtension.Installed>>) {
|
||||
pinnedMangaSources = PrefManager.getNullableVal<List<String>>(PrefName.MangaSourcesOrder, null)
|
||||
?: emptyList()
|
||||
pinnedMangaSources =
|
||||
PrefManager.getNullableVal<List<String>>(PrefName.MangaSourcesOrder, null)
|
||||
?: emptyList()
|
||||
|
||||
// Initialize with the first value from StateFlow
|
||||
val initialExtensions = fromExtensions.first()
|
||||
|
|
|
@ -14,8 +14,9 @@ object NovelSources : NovelReadSources() {
|
|||
var pinnedNovelSources: List<String> = emptyList()
|
||||
|
||||
suspend fun init(fromExtensions: StateFlow<List<NovelExtension.Installed>>) {
|
||||
pinnedNovelSources = PrefManager.getNullableVal<List<String>>(PrefName.NovelSourcesOrder, null)
|
||||
?: emptyList()
|
||||
pinnedNovelSources =
|
||||
PrefManager.getNullableVal<List<String>>(PrefName.NovelSourcesOrder, null)
|
||||
?: emptyList()
|
||||
|
||||
// Initialize with the first value from StateFlow
|
||||
val initialExtensions = fromExtensions.first()
|
||||
|
|
|
@ -3,8 +3,8 @@ package ani.dantotsu.parsers.novel
|
|||
|
||||
import android.content.Context
|
||||
import ani.dantotsu.logger
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import eu.kanade.tachiyomi.extension.ExtensionUpdateNotifier
|
||||
import eu.kanade.tachiyomi.extension.anime.model.AnimeExtension
|
||||
import eu.kanade.tachiyomi.extension.anime.model.AnimeLoadResult
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue