Update non-library manga data when browsing (#1967)

(cherry picked from commit a594ad392d4793f3a5cb2b709d29b2feab6120d3)

# Conflicts:
#	CHANGELOG.md
This commit is contained in:
AntsyLich 2025-04-07 12:10:12 +06:00 committed by Jobobby04
parent 053c48613b
commit a3465c31c9
3 changed files with 17 additions and 3 deletions

View File

@ -151,6 +151,11 @@ class MangaRepositoryImpl(
dateAdded = it.dateAdded,
updateStrategy = it.updateStrategy,
version = it.version,
// SY -->
updateTitle = it.ogTitle.isNotBlank(),
updateCover = !it.ogThumbnailUrl.isNullOrBlank(),
// SY <--
updateDetails = it.initialized,
mapper = MangaMapper::mapManga,
)
.executeAsOne()

View File

@ -208,9 +208,18 @@ insertNetworkManga {
:updateStrategy, :calculateInterval, 0, :version
WHERE NOT EXISTS(SELECT 0 FROM mangas WHERE source = :source AND url = :url);
-- Update the title if it is not favorite
-- Update the relevant details if applicable and not favorite
UPDATE mangas
SET title = :title
SET
title = CASE WHEN :updateTitle THEN :title ELSE title END,
thumbnail_url = CASE WHEN :updateCover THEN :thumbnailUrl ELSE thumbnail_url END,
author = CASE WHEN :updateDetails THEN :author ELSE author END,
artist = CASE WHEN :updateDetails THEN :artist ELSE artist END,
description = CASE WHEN :updateDetails THEN :description ELSE description END,
genre = CASE WHEN :updateDetails THEN :genre ELSE genre END,
status = CASE WHEN :updateDetails THEN :status ELSE status END,
update_strategy = CASE WHEN :updateDetails THEN :updateStrategy ELSE update_strategy END,
initialized = :updateDetails
WHERE source = :source
AND url = :url
AND favorite = 0;

View File

@ -8,7 +8,7 @@ class NetworkToLocalManga(
) {
suspend operator fun invoke(manga: Manga): Manga {
return mangaRepository.insertNetworkManga(listOf(manga)).single()
return invoke(listOf(manga)).single()
}
suspend operator fun invoke(manga: List<Manga>): List<Manga> {