Cherry pick fixes

This commit is contained in:
Jobobby04 2022-11-16 14:17:26 -05:00
parent 3b55bc25dd
commit c8de918e46
4 changed files with 3 additions and 44 deletions

View File

@ -34,7 +34,7 @@ fun List<Chapter>.applyFilters(manga: Manga, downloadManager: DownloadManager):
}
}
.filter { chapter ->
val downloaded = downloadManager.isChapterDownloaded(chapter.name, chapter.scanlator,/* SY --> */ manga.ogTitle /* SY <-- */, manga.source)
val downloaded = downloadManager.isChapterDownloaded(chapter.name, chapter.scanlator, /* SY --> */ manga.ogTitle /* SY <-- */, manga.source)
val downloadState = when {
downloaded -> Download.State.DOWNLOADED
else -> Download.State.NOT_DOWNLOADED

View File

@ -328,8 +328,8 @@ class DownloadManager(
if (removeRead) {
val readChapters = allChapters.filter { it.read }
val readChapterDirs = provider.findChapterDirs(readChapters, manga, source)
readChapterDirs.forEach { it.delete() }
cleaned += readChapterDirs.size
readChapterDirs.second.forEach { it.delete() }
cleaned += readChapterDirs.second.size
cache.removeChapters(readChapters, manga)
}

View File

@ -184,44 +184,4 @@ class DownloadPendingDeleter(
val title: String,
val source: Long,
)
/**
* Returns a manga entry from a manga model.
*/
private fun Manga.toEntry(): MangaEntry {
return MangaEntry(id!!, url, /* SY --> */ ogTitle /* SY <-- */, source)
}
/**
* Returns a chapter entry from a chapter model.
*/
private fun Chapter.toEntry(): ChapterEntry {
return ChapterEntry(id!!, url, name, scanlator)
}
/**
* Returns a manga model from a manga entry.
*/
private fun MangaEntry.toModel(): Manga {
return Manga.create().copy(
url = url,
// SY -->
ogTitle = title,
// SY <--
source = source,
id = id,
)
}
/**
* Returns a chapter model from a chapter entry.
*/
private fun ChapterEntry.toModel(): Chapter {
return Chapter.create().copy(
id = id,
url = url,
name = name,
scanlator = scanlator,
)
}
}

View File

@ -138,7 +138,6 @@ class MangaInfoScreenModel(
private val downloadCache: DownloadCache = Injekt.get(),
private val getMangaAndChapters: GetMangaWithChapters = Injekt.get(),
// SY -->
private val uiPreferences: UiPreferences = Injekt.get(),
private val readerPreferences: ReaderPreferences = Injekt.get(),
private val getManga: GetManga = Injekt.get(),
private val setMangaFilteredScanlators: SetMangaFilteredScanlators = Injekt.get(),