import/export settings
This commit is contained in:
parent
b559a13bab
commit
49e90a27b8
97 changed files with 1721 additions and 1441 deletions
|
@ -5,9 +5,8 @@ import ani.dantotsu.FileUrl
|
|||
import ani.dantotsu.R
|
||||
import ani.dantotsu.asyncMap
|
||||
import ani.dantotsu.currContext
|
||||
import ani.dantotsu.loadData
|
||||
import ani.dantotsu.others.MalSyncBackup
|
||||
import ani.dantotsu.saveData
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.tryWithSuspend
|
||||
import eu.kanade.tachiyomi.animesource.model.SAnime
|
||||
import eu.kanade.tachiyomi.animesource.model.SEpisode
|
||||
|
@ -182,7 +181,7 @@ abstract class AnimeParser : BaseParser() {
|
|||
override suspend fun loadSavedShowResponse(mediaId: Int): ShowResponse? {
|
||||
checkIfVariablesAreEmpty()
|
||||
val dub = if (isDubAvailableSeparately()) "_${if (selectDub) "dub" else "sub"}" else ""
|
||||
var loaded = loadData<ShowResponse>("${saveName}${dub}_$mediaId")
|
||||
var loaded = PrefManager.getNullableCustomVal<ShowResponse?>("${saveName}${dub}_$mediaId", null)
|
||||
if (loaded == null && malSyncBackupName.isNotEmpty())
|
||||
loaded = MalSyncBackup.get(mediaId, malSyncBackupName, selectDub)
|
||||
?.also { saveShowResponse(mediaId, it, true) }
|
||||
|
@ -200,7 +199,7 @@ abstract class AnimeParser : BaseParser() {
|
|||
} : ${response.name}"
|
||||
)
|
||||
val dub = if (isDubAvailableSeparately()) "_${if (selectDub) "dub" else "sub"}" else ""
|
||||
saveData("${saveName}${dub}_$mediaId", response)
|
||||
PrefManager.setCustomVal("${saveName}${dub}_$mediaId", response)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import android.content.Context
|
|||
import ani.dantotsu.Lazier
|
||||
import ani.dantotsu.lazyList
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.settings.saving.PrefWrapper
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import eu.kanade.tachiyomi.extension.anime.model.AnimeExtension
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.first
|
||||
|
@ -14,7 +14,7 @@ object AnimeSources : WatchSources() {
|
|||
var pinnedAnimeSources: Set<String> = emptySet()
|
||||
|
||||
suspend fun init(fromExtensions: StateFlow<List<AnimeExtension.Installed>>, context: Context) {
|
||||
pinnedAnimeSources = PrefWrapper.getVal(PrefName.PinnedAnimeSources, emptySet())
|
||||
pinnedAnimeSources = PrefManager.getVal(PrefName.PinnedAnimeSources)
|
||||
|
||||
// Initialize with the first value from StateFlow
|
||||
val initialExtensions = fromExtensions.first()
|
||||
|
|
|
@ -3,10 +3,9 @@ package ani.dantotsu.parsers
|
|||
import ani.dantotsu.FileUrl
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.currContext
|
||||
import ani.dantotsu.loadData
|
||||
import ani.dantotsu.logger
|
||||
import ani.dantotsu.media.Media
|
||||
import ani.dantotsu.saveData
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import eu.kanade.tachiyomi.animesource.model.SAnime
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import me.xdrop.fuzzywuzzy.FuzzySearch
|
||||
|
@ -135,7 +134,7 @@ abstract class BaseParser {
|
|||
* **/
|
||||
open suspend fun loadSavedShowResponse(mediaId: Int): ShowResponse? {
|
||||
checkIfVariablesAreEmpty()
|
||||
return loadData("${saveName}_$mediaId")
|
||||
return PrefManager.getNullableCustomVal<ShowResponse?>("${saveName}_$mediaId", null)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -151,7 +150,7 @@ abstract class BaseParser {
|
|||
)
|
||||
} : ${response.name}"
|
||||
)
|
||||
saveData("${saveName}_$mediaId", response)
|
||||
PrefManager.setCustomVal("${saveName}_$mediaId", response)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package ani.dantotsu.parsers
|
||||
|
||||
import android.content.Context
|
||||
import ani.dantotsu.Lazier
|
||||
import ani.dantotsu.lazyList
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.settings.saving.PrefWrapper
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import eu.kanade.tachiyomi.extension.manga.model.MangaExtension
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.first
|
||||
|
@ -14,7 +13,7 @@ object MangaSources : MangaReadSources() {
|
|||
var pinnedMangaSources: Set<String> = emptySet()
|
||||
|
||||
suspend fun init(fromExtensions: StateFlow<List<MangaExtension.Installed>>) {
|
||||
pinnedMangaSources = PrefWrapper.getVal(PrefName.PinnedMangaSources, emptySet())
|
||||
pinnedMangaSources = PrefManager.getVal(PrefName.PinnedMangaSources)
|
||||
|
||||
// Initialize with the first value from StateFlow
|
||||
val initialExtensions = fromExtensions.first()
|
||||
|
|
|
@ -2,10 +2,9 @@ package ani.dantotsu.parsers.novel
|
|||
|
||||
|
||||
import android.content.Context
|
||||
import ani.dantotsu.currContext
|
||||
import ani.dantotsu.logger
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.settings.saving.PrefWrapper
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import eu.kanade.tachiyomi.extension.ExtensionUpdateNotifier
|
||||
import eu.kanade.tachiyomi.extension.anime.model.AnimeExtension
|
||||
import eu.kanade.tachiyomi.extension.anime.model.AnimeLoadResult
|
||||
|
@ -28,7 +27,7 @@ class NovelExtensionGithubApi {
|
|||
private val novelExtensionManager: NovelExtensionManager by injectLazy()
|
||||
private val json: Json by injectLazy()
|
||||
|
||||
private val lastExtCheck: Long = PrefWrapper.getVal(PrefName.NovelLastExtCheck, 0L)
|
||||
private val lastExtCheck: Long = PrefManager.getVal(PrefName.NovelLastExtCheck)
|
||||
|
||||
private var requiresFallbackSource = false
|
||||
|
||||
|
@ -86,7 +85,7 @@ class NovelExtensionGithubApi {
|
|||
novelExtensionManager.availableExtensionsFlow.value
|
||||
} else {
|
||||
findExtensions().also {
|
||||
PrefWrapper.setVal(PrefName.NovelLastExtCheck, Date().time)
|
||||
PrefManager.setVal(PrefName.NovelLastExtCheck, Date().time)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue