From 040b0845de08bdb0a3c1f0e887459c1f37bc15f9 Mon Sep 17 00:00:00 2001 From: rebelonion <87634197+rebelonion@users.noreply.github.com> Date: Mon, 29 Apr 2024 18:53:11 -0500 Subject: [PATCH] fix: download title mismatch --- .../ani/dantotsu/download/anime/OfflineAnimeFragment.kt | 4 ++-- .../ani/dantotsu/download/manga/OfflineMangaFragment.kt | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/ani/dantotsu/download/anime/OfflineAnimeFragment.kt b/app/src/main/java/ani/dantotsu/download/anime/OfflineAnimeFragment.kt index ea63bcd897b..31636d77c5b 100644 --- a/app/src/main/java/ani/dantotsu/download/anime/OfflineAnimeFragment.kt +++ b/app/src/main/java/ani/dantotsu/download/anime/OfflineAnimeFragment.kt @@ -293,8 +293,8 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener { val animeTitles = downloadManager.animeDownloadedTypes.map { it.titleName.findValidName() }.distinct() val newAnimeDownloads = mutableListOf() for (title in animeTitles) { - val tDownloads = downloadManager.animeDownloadedTypes.filter { it.titleName == title } - val download = tDownloads.first() + val tDownloads = downloadManager.animeDownloadedTypes.filter { it.titleName.findValidName() == title } + val download = tDownloads.firstOrNull() ?: continue val offlineAnimeModel = loadOfflineAnimeModel(download) newAnimeDownloads += offlineAnimeModel } diff --git a/app/src/main/java/ani/dantotsu/download/manga/OfflineMangaFragment.kt b/app/src/main/java/ani/dantotsu/download/manga/OfflineMangaFragment.kt index 3ee64ee42c0..a4eb1c9fccc 100644 --- a/app/src/main/java/ani/dantotsu/download/manga/OfflineMangaFragment.kt +++ b/app/src/main/java/ani/dantotsu/download/manga/OfflineMangaFragment.kt @@ -284,8 +284,8 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener { val mangaTitles = downloadManager.mangaDownloadedTypes.map { it.titleName.findValidName() }.distinct() val newMangaDownloads = mutableListOf() for (title in mangaTitles) { - val tDownloads = downloadManager.mangaDownloadedTypes.filter { it.titleName == title } - val download = tDownloads.first() + val tDownloads = downloadManager.mangaDownloadedTypes.filter { it.titleName.findValidName() == title } + val download = tDownloads.firstOrNull() ?: continue val offlineMangaModel = loadOfflineMangaModel(download) newMangaDownloads += offlineMangaModel } @@ -293,8 +293,8 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener { val novelTitles = downloadManager.novelDownloadedTypes.map { it.titleName }.distinct() val newNovelDownloads = mutableListOf() for (title in novelTitles) { - val tDownloads = downloadManager.novelDownloadedTypes.filter { it.titleName == title } - val download = tDownloads.first() + val tDownloads = downloadManager.novelDownloadedTypes.filter { it.titleName.findValidName() == title } + val download = tDownloads.firstOrNull() ?: continue val offlineMangaModel = loadOfflineMangaModel(download) newNovelDownloads += offlineMangaModel }