mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-29 17:49:03 +03:00
Small Changes on Anime side (#451)
* Remove redundant History mapping in Anime Database * Fix Anime Sources (Pinned, Last Used and Disabled) * Fix Extension Updates (+ naming consistency)
This commit is contained in:
parent
493fb155e1
commit
093208921b
10 changed files with 14 additions and 15 deletions
|
@ -9,14 +9,12 @@ import eu.kanade.tachiyomi.data.database.mappers.AnimeTrackTypeMapping
|
|||
import eu.kanade.tachiyomi.data.database.mappers.AnimeTypeMapping
|
||||
import eu.kanade.tachiyomi.data.database.mappers.CategoryTypeMapping
|
||||
import eu.kanade.tachiyomi.data.database.mappers.EpisodeTypeMapping
|
||||
import eu.kanade.tachiyomi.data.database.mappers.HistoryTypeMapping
|
||||
import eu.kanade.tachiyomi.data.database.models.Anime
|
||||
import eu.kanade.tachiyomi.data.database.models.AnimeCategory
|
||||
import eu.kanade.tachiyomi.data.database.models.AnimeHistory
|
||||
import eu.kanade.tachiyomi.data.database.models.AnimeTrack
|
||||
import eu.kanade.tachiyomi.data.database.models.Category
|
||||
import eu.kanade.tachiyomi.data.database.models.Episode
|
||||
import eu.kanade.tachiyomi.data.database.models.History
|
||||
import eu.kanade.tachiyomi.data.database.queries.AnimeCategoryQueries
|
||||
import eu.kanade.tachiyomi.data.database.queries.AnimeHistoryQueries
|
||||
import eu.kanade.tachiyomi.data.database.queries.AnimeQueries
|
||||
|
@ -43,7 +41,6 @@ open class AnimeDatabaseHelper(context: Context) :
|
|||
.addTypeMapping(AnimeTrack::class.java, AnimeTrackTypeMapping())
|
||||
.addTypeMapping(Category::class.java, CategoryTypeMapping())
|
||||
.addTypeMapping(AnimeCategory::class.java, AnimeCategoryTypeMapping())
|
||||
.addTypeMapping(History::class.java, HistoryTypeMapping())
|
||||
.addTypeMapping(AnimeHistory::class.java, AnimeHistoryTypeMapping())
|
||||
.build()
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ class AnimeDownloadCache(
|
|||
val animeDir = sourceDir.files[provider.getAnimeDirName(anime)]
|
||||
if (animeDir != null) {
|
||||
return animeDir.files
|
||||
.filter { !it.endsWith(Downloader.TMP_DIR_SUFFIX) }
|
||||
.filter { !it.endsWith(AnimeDownloader.TMP_DIR_SUFFIX) }
|
||||
.size
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,10 +109,10 @@ class AnimeDownloadManager(
|
|||
queue.add(0, download)
|
||||
reorderQueue(queue)
|
||||
if (isPaused()) {
|
||||
if (DownloadService.isRunning(context)) {
|
||||
if (AnimeDownloadService.isRunning(context)) {
|
||||
downloader.start()
|
||||
} else {
|
||||
DownloadService.start(context)
|
||||
AnimeDownloadService.start(context)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ internal class AnimeExtensionGithubApi {
|
|||
|
||||
suspend fun checkForUpdates(context: Context): List<AnimeExtension.Installed> {
|
||||
// Limit checks to once a day at most
|
||||
if (Date().time < preferences.lastExtCheck().get() + TimeUnit.DAYS.toMillis(1)) {
|
||||
if (Date().time < preferences.lastAnimeExtCheck().get() + TimeUnit.DAYS.toMillis(1)) {
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ class AnimeExtensionInstallActivity : Activity() {
|
|||
}
|
||||
|
||||
private fun checkInstallationResult(resultCode: Int) {
|
||||
val downloadId = intent.extras!!.getLong(ExtensionInstaller.EXTRA_DOWNLOAD_ID)
|
||||
val downloadId = intent.extras!!.getLong(AnimeExtensionInstaller.EXTRA_DOWNLOAD_ID)
|
||||
val extensionManager = Injekt.get<AnimeExtensionManager>()
|
||||
val newStep = when (resultCode) {
|
||||
RESULT_OK -> InstallStep.Installed
|
||||
|
|
|
@ -152,7 +152,7 @@ class AnimeExtensionDetailsController(bundle: Bundle? = null) :
|
|||
}
|
||||
|
||||
// React to enable/disable all changes
|
||||
preferences.disabledSources().asFlow()
|
||||
preferences.disabledAnimeSources().asFlow()
|
||||
.onEach {
|
||||
val enabled = source.isEnabled()
|
||||
isChecked = enabled
|
||||
|
|
|
@ -151,7 +151,7 @@ class AnimeSourceController :
|
|||
}
|
||||
|
||||
private fun toggleSourcePin(source: AnimeSource) {
|
||||
val isPinned = source.id.toString() in preferences.pinnedSources().get()
|
||||
val isPinned = source.id.toString() in preferences.pinnedAnimeSources().get()
|
||||
if (isPinned) {
|
||||
preferences.pinnedAnimeSources() -= source.id.toString()
|
||||
} else {
|
||||
|
|
|
@ -52,7 +52,7 @@ class AnimeSourcePresenter(
|
|||
sourceSubscription?.unsubscribe()
|
||||
|
||||
val pinnedSources = mutableListOf<AnimeSourceItem>()
|
||||
val pinnedSourceIds = preferences.pinnedSources().get()
|
||||
val pinnedSourceIds = preferences.pinnedAnimeSources().get()
|
||||
|
||||
val map = TreeMap<String, MutableList<AnimeCatalogueSource>> { d1, d2 ->
|
||||
// Catalogues without a lang defined will be placed at the end
|
||||
|
@ -85,10 +85,10 @@ class AnimeSourcePresenter(
|
|||
|
||||
private fun loadLastUsedSource() {
|
||||
// Immediate initial load
|
||||
preferences.lastUsedSource().get().let { updateLastUsedSource(it) }
|
||||
preferences.lastUsedAnimeSource().get().let { updateLastUsedSource(it) }
|
||||
|
||||
// Subsequent updates
|
||||
preferences.lastUsedSource().asFlow()
|
||||
preferences.lastUsedAnimeSource().asFlow()
|
||||
.drop(1)
|
||||
.onStart { delay(500) }
|
||||
.distinctUntilChanged()
|
||||
|
@ -98,7 +98,7 @@ class AnimeSourcePresenter(
|
|||
|
||||
private fun updateLastUsedSource(sourceId: Long) {
|
||||
val source = (sourceManager.get(sourceId) as? AnimeCatalogueSource)?.let {
|
||||
val isPinned = it.id.toString() in preferences.pinnedSources().get()
|
||||
val isPinned = it.id.toString() in preferences.pinnedAnimeSources().get()
|
||||
AnimeSourceItem(it, null, isPinned)
|
||||
}
|
||||
source?.let { view?.setLastUsedSource(it) }
|
||||
|
|
|
@ -210,7 +210,7 @@ open class GlobalAnimeSearchController(
|
|||
*/
|
||||
override fun onTitleClick(source: AnimeCatalogueSource) {
|
||||
if (!preferences.incognitoMode().get()) {
|
||||
preferences.lastUsedSource().set(source.id)
|
||||
preferences.lastUsedAnimeSource().set(source.id)
|
||||
}
|
||||
router.pushController(BrowseAnimeSourceController(source, presenter.query).withFadeTransaction())
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.ui.setting
|
|||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.preference.PreferenceScreen
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.extension.AnimeExtensionUpdateJob
|
||||
import eu.kanade.tachiyomi.extension.ExtensionUpdateJob
|
||||
import eu.kanade.tachiyomi.util.preference.bindTo
|
||||
import eu.kanade.tachiyomi.util.preference.defaultValue
|
||||
|
@ -31,6 +32,7 @@ class SettingsBrowseController : SettingsController() {
|
|||
onChange { newValue ->
|
||||
val checked = newValue as Boolean
|
||||
ExtensionUpdateJob.setupTask(activity!!, checked)
|
||||
AnimeExtensionUpdateJob.setupTask(activity!!, checked)
|
||||
true
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue