Inline the foreach functions

This commit is contained in:
Jobobby04 2020-07-24 22:37:54 -04:00
parent 135f0bdd95
commit 646aeb66c5

View File

@ -191,8 +191,7 @@ class DownloadCache(
fun removeChapter(chapter: Chapter, manga: Manga) { fun removeChapter(chapter: Chapter, manga: Manga) {
val sourceDir = rootDir.files[manga.source] ?: return val sourceDir = rootDir.files[manga.source] ?: return
val mangaDir = sourceDir.files[provider.getMangaDirName(manga)] ?: return val mangaDir = sourceDir.files[provider.getMangaDirName(manga)] ?: return
val chapterDirName = provider.getValidChapterDirNames(chapter) provider.getValidChapterDirNames(chapter).forEach {
chapterDirName.forEach {
if (it in mangaDir.files) { if (it in mangaDir.files) {
mangaDir.files -= it mangaDir.files -= it
} }
@ -210,8 +209,7 @@ class DownloadCache(
val sourceDir = rootDir.files[manga.source] ?: return val sourceDir = rootDir.files[manga.source] ?: return
val mangaDir = sourceDir.files[provider.getMangaDirName(manga)] ?: return val mangaDir = sourceDir.files[provider.getMangaDirName(manga)] ?: return
chapters.forEach { chapter -> chapters.forEach { chapter ->
val chapterDirName = provider.getValidChapterDirNames(chapter) provider.getValidChapterDirNames(chapter).forEach {
chapterDirName.forEach {
if (it in mangaDir.files) { if (it in mangaDir.files) {
mangaDir.files -= it mangaDir.files -= it
} }