mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-15 05:27:28 +01:00
Don't exclude same source when checking for duplicate entries
Closes #8870
This commit is contained in:
@@ -231,7 +231,6 @@ data class BrowseSourceScreen(
|
||||
onDismissRequest = onDismissRequest,
|
||||
onConfirm = { screenModel.addFavorite(dialog.manga) },
|
||||
onOpenManga = { navigator.push(MangaScreen(dialog.duplicate.id)) },
|
||||
duplicateFrom = screenModel.getSourceOrStub(dialog.duplicate),
|
||||
)
|
||||
}
|
||||
is BrowseSourceScreenModel.Dialog.RemoveManga -> {
|
||||
|
||||
@@ -40,7 +40,6 @@ import eu.kanade.tachiyomi.data.track.EnhancedTrackService
|
||||
import eu.kanade.tachiyomi.data.track.TrackManager
|
||||
import eu.kanade.tachiyomi.data.track.TrackService
|
||||
import eu.kanade.tachiyomi.source.CatalogueSource
|
||||
import eu.kanade.tachiyomi.source.Source
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import eu.kanade.tachiyomi.source.model.FilterList
|
||||
import eu.kanade.tachiyomi.ui.browse.source.filter.CheckboxItem
|
||||
@@ -80,7 +79,7 @@ import eu.kanade.tachiyomi.source.model.Filter as SourceModelFilter
|
||||
class BrowseSourceScreenModel(
|
||||
private val sourceId: Long,
|
||||
listingQuery: String?,
|
||||
private val sourceManager: SourceManager = Injekt.get(),
|
||||
sourceManager: SourceManager = Injekt.get(),
|
||||
sourcePreferences: SourcePreferences = Injekt.get(),
|
||||
private val libraryPreferences: LibraryPreferences = Injekt.get(),
|
||||
private val coverCache: CoverCache = Injekt.get(),
|
||||
@@ -273,10 +272,6 @@ class BrowseSourceScreenModel(
|
||||
}
|
||||
}
|
||||
|
||||
fun getSourceOrStub(manga: Manga): Source {
|
||||
return sourceManager.getOrStub(manga.source)
|
||||
}
|
||||
|
||||
fun addFavorite(manga: Manga) {
|
||||
coroutineScope.launch {
|
||||
val categories = getCategories()
|
||||
@@ -340,7 +335,7 @@ class BrowseSourceScreenModel(
|
||||
}
|
||||
|
||||
suspend fun getDuplicateLibraryManga(manga: Manga): Manga? {
|
||||
return getDuplicateLibraryManga.await(manga.title, manga.source)
|
||||
return getDuplicateLibraryManga.await(manga.title)
|
||||
}
|
||||
|
||||
fun moveMangaToCategories(manga: Manga, vararg categories: Category) {
|
||||
|
||||
@@ -169,7 +169,6 @@ class MangaScreen(
|
||||
onDismissRequest = onDismissRequest,
|
||||
onConfirm = { screenModel.toggleFavorite(onRemoved = {}, checkDuplicate = false) },
|
||||
onOpenManga = { navigator.push(MangaScreen(dialog.duplicate.id)) },
|
||||
duplicateFrom = screenModel.getSourceOrStub(dialog.duplicate),
|
||||
)
|
||||
MangaInfoScreenModel.Dialog.SettingsSheet -> ChapterSettingsDialog(
|
||||
onDismissRequest = onDismissRequest,
|
||||
|
||||
@@ -82,7 +82,6 @@ class MangaInfoScreenModel(
|
||||
private val libraryPreferences: LibraryPreferences = Injekt.get(),
|
||||
private val uiPreferences: UiPreferences = Injekt.get(),
|
||||
private val trackManager: TrackManager = Injekt.get(),
|
||||
private val sourceManager: SourceManager = Injekt.get(),
|
||||
private val downloadManager: DownloadManager = Injekt.get(),
|
||||
private val downloadCache: DownloadCache = Injekt.get(),
|
||||
private val getMangaAndChapters: GetMangaWithChapters = Injekt.get(),
|
||||
@@ -272,7 +271,7 @@ class MangaInfoScreenModel(
|
||||
// Add to library
|
||||
// First, check if duplicate exists if callback is provided
|
||||
if (checkDuplicate) {
|
||||
val duplicate = getDuplicateLibraryManga.await(manga.title, manga.source)
|
||||
val duplicate = getDuplicateLibraryManga.await(manga.title)
|
||||
|
||||
if (duplicate != null) {
|
||||
mutableState.update { state ->
|
||||
@@ -926,10 +925,6 @@ class MangaInfoScreenModel(
|
||||
|
||||
// Track sheet - end
|
||||
|
||||
fun getSourceOrStub(manga: Manga): Source {
|
||||
return sourceManager.getOrStub(manga.source)
|
||||
}
|
||||
|
||||
sealed class Dialog {
|
||||
data class ChangeCategory(val manga: Manga, val initialSelection: List<CheckboxState<Category>>) : Dialog()
|
||||
data class DeleteChapters(val chapters: List<Chapter>) : Dialog()
|
||||
|
||||
Reference in New Issue
Block a user