From 58a871c8cc600dbf59691e9c51413ef9b7da3796 Mon Sep 17 00:00:00 2001 From: FlaminSarge Date: Sat, 30 Oct 2021 09:15:48 -0700 Subject: [PATCH] Allow manga titles to update from source if they are not in library (#6177) The previous rationale for not allowing manga titles to update (at all) was that it would be confusing for users if a manga's title arbitrarily changed when the source changed it. Presumably, users would care less about this arbitrary change for manga that is not in library, so this provides a path for getting a manga's title updated, and prevents incorrect titles from persisting in the DB for manga that get title updates but aren't in library. --- .../ui/browse/source/browse/BrowseSourcePresenter.kt | 4 ++++ .../ui/browse/source/globalsearch/GlobalSearchPresenter.kt | 4 ++++ .../main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourcePresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourcePresenter.kt index e5c8939b9..87cacb73d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourcePresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourcePresenter.kt @@ -202,6 +202,10 @@ open class BrowseSourcePresenter( val result = db.insertManga(newManga).executeAsBlocking() newManga.id = result.insertedId() localManga = newManga + } else if (!localManga.favorite) { + // if the manga isn't a favorite, set its display title from source + // if it later becomes a favorite, updated title will go to db + localManga.title = sManga.title } return localManga } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchPresenter.kt index a2391459b..8a47af86b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchPresenter.kt @@ -267,6 +267,10 @@ open class GlobalSearchPresenter( val result = db.insertManga(newManga).executeAsBlocking() newManga.id = result.insertedId() localManga = newManga + } else if (!localManga.favorite) { + // if the manga isn't a favorite, set its display title from source + // if it later becomes a favorite, updated title will go to db + localManga.title = sManga.title } return localManga } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt index bb051b605..44d989821 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt @@ -204,6 +204,10 @@ class MangaPresenter( val sManga = networkManga.toSManga() manga.prepUpdateCover(coverCache, sManga, manualFetch) manga.copyFrom(sManga) + if (!manga.favorite) { + // if the manga isn't a favorite, set its title from source and update in db + manga.title = sManga.title + } manga.initialized = true db.insertManga(manga).executeAsBlocking()