fix: manga opening

This commit is contained in:
rebel onion 2025-01-04 04:49:49 -06:00
parent 1bb5f4d0ab
commit 986d0fa4a8
11 changed files with 94 additions and 71 deletions

View file

@ -60,7 +60,7 @@ class DownloadsManager(private val context: Context) {
onFinished: () -> Unit
) {
removeDownloadCompat(context, downloadedType, toast)
downloadsList.remove(downloadedType)
downloadsList.removeAll { it.titleName == downloadedType.titleName && it.chapterName == downloadedType.chapterName }
CoroutineScope(Dispatchers.IO).launch {
removeDirectory(downloadedType, toast)
withContext(Dispatchers.Main) {
@ -234,7 +234,7 @@ class DownloadsManager(private val context: Context) {
val directory =
baseDirectory?.findFolder(downloadedType.titleName)
?.findFolder(downloadedType.chapterName)
downloadsList.remove(downloadedType)
downloadsList.removeAll { it.titleName == downloadedType.titleName && it.chapterName == downloadedType.chapterName }
// Check if the directory exists and delete it recursively
if (directory?.exists() == true) {
val deleted = directory.deleteRecursively(context, false)
@ -401,10 +401,13 @@ data class DownloadedType(
@Deprecated("use pTitle instead")
private val title: String? = null,
@Deprecated("use pChapter instead")
private val chapter: String? = null
private val chapter: String? = null,
val scanlator: String = "Unknown"
) : Serializable {
val titleName: String
get() = title ?: pTitle.findValidName()
val chapterName: String
get() = chapter ?: pChapter.findValidName()
val uniqueName: String
get() = "$chapterName-${scanlator}"
}