mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
parent
3ad4f1114a
commit
fd30c0adcd
6 changed files with 9 additions and 9 deletions
|
@ -321,7 +321,7 @@ class BrowseSourceScreenModel(
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun getDuplicateLibraryManga(manga: Manga): Manga? {
|
suspend fun getDuplicateLibraryManga(manga: Manga): Manga? {
|
||||||
return getDuplicateLibraryManga.await(manga.title)
|
return getDuplicateLibraryManga.await(manga).getOrNull(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun moveMangaToCategories(manga: Manga, vararg categories: Category) {
|
private fun moveMangaToCategories(manga: Manga, vararg categories: Category) {
|
||||||
|
|
|
@ -284,7 +284,7 @@ class MangaScreenModel(
|
||||||
// Add to library
|
// Add to library
|
||||||
// First, check if duplicate exists if callback is provided
|
// First, check if duplicate exists if callback is provided
|
||||||
if (checkDuplicate) {
|
if (checkDuplicate) {
|
||||||
val duplicate = getDuplicateLibraryManga.await(manga.title)
|
val duplicate = getDuplicateLibraryManga.await(manga).getOrNull(0)
|
||||||
|
|
||||||
if (duplicate != null) {
|
if (duplicate != null) {
|
||||||
updateSuccessState { it.copy(dialog = Dialog.DuplicateManga(manga, duplicate)) }
|
updateSuccessState { it.copy(dialog = Dialog.DuplicateManga(manga, duplicate)) }
|
||||||
|
|
|
@ -48,9 +48,9 @@ class MangaRepositoryImpl(
|
||||||
return handler.subscribeToList { mangasQueries.getFavoriteBySourceId(sourceId, mangaMapper) }
|
return handler.subscribeToList { mangasQueries.getFavoriteBySourceId(sourceId, mangaMapper) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun getDuplicateLibraryManga(title: String): Manga? {
|
override suspend fun getDuplicateLibraryManga(id: Long, title: String): List<Manga> {
|
||||||
return handler.awaitOneOrNull {
|
return handler.awaitList {
|
||||||
mangasQueries.getDuplicateLibraryManga(title, mangaMapper)
|
mangasQueries.getDuplicateLibraryManga(title, id, mangaMapper)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ SELECT *
|
||||||
FROM mangas
|
FROM mangas
|
||||||
WHERE favorite = 1
|
WHERE favorite = 1
|
||||||
AND LOWER(title) = :title
|
AND LOWER(title) = :title
|
||||||
LIMIT 1;
|
AND _id != :id;
|
||||||
|
|
||||||
resetViewerFlags:
|
resetViewerFlags:
|
||||||
UPDATE mangas
|
UPDATE mangas
|
||||||
|
|
|
@ -7,7 +7,7 @@ class GetDuplicateLibraryManga(
|
||||||
private val mangaRepository: MangaRepository,
|
private val mangaRepository: MangaRepository,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
suspend fun await(title: String): Manga? {
|
suspend fun await(manga: Manga): List<Manga> {
|
||||||
return mangaRepository.getDuplicateLibraryManga(title.lowercase())
|
return mangaRepository.getDuplicateLibraryManga(manga.id, manga.title.lowercase())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ interface MangaRepository {
|
||||||
|
|
||||||
fun getFavoritesBySourceId(sourceId: Long): Flow<List<Manga>>
|
fun getFavoritesBySourceId(sourceId: Long): Flow<List<Manga>>
|
||||||
|
|
||||||
suspend fun getDuplicateLibraryManga(title: String): Manga?
|
suspend fun getDuplicateLibraryManga(id: Long, title: String): List<Manga>
|
||||||
|
|
||||||
suspend fun resetViewerFlags(): Boolean
|
suspend fun resetViewerFlags(): Boolean
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue