Add custom Thumbnail Url. Support backup & restore (#1059)

* Add custom thumbnail url. Support backup & restore

- add custom thumbnail url in edit info/custom
- include it in backup n restore

* increase chop char

* edit chop char again to match screenshoot

* tweak truncating middle part

* apply edited cover to history, updates , others

* simplify placeholder logic

---------

Co-authored-by: jobobby04 <jobobby04@users.noreply.github.com>
This commit is contained in:
Luqman
2024-02-18 03:50:00 +07:00
committed by GitHub
parent f35031db7e
commit c835140fe8
29 changed files with 96 additions and 29 deletions
@@ -44,7 +44,7 @@ object HistoryMapper {
mangaId = mangaId,
sourceId = sourceId,
isMangaFavorite = isFavorite,
url = thumbnailUrl,
ogUrl = thumbnailUrl,
lastModified = coverLastModified,
),
)
@@ -42,6 +42,7 @@ class CustomMangaRepositoryImpl(context: Context) : CustomMangaRepository {
mangaInfo.title == null &&
mangaInfo.author == null &&
mangaInfo.artist == null &&
mangaInfo.thumbnailUrl == null &&
mangaInfo.description == null &&
mangaInfo.genre == null &&
mangaInfo.status == null
@@ -72,6 +73,7 @@ class CustomMangaRepositoryImpl(context: Context) : CustomMangaRepository {
val title: String? = null,
val author: String? = null,
val artist: String? = null,
val thumbnailUrl: String? = null,
val description: String? = null,
val genre: List<String>? = null,
val status: Long? = null,
@@ -82,6 +84,7 @@ class CustomMangaRepositoryImpl(context: Context) : CustomMangaRepository {
title = this@MangaJson.title?.takeUnless { it.isBlank() },
author = this@MangaJson.author,
artist = this@MangaJson.artist,
thumbnailUrl = this@MangaJson.thumbnailUrl,
description = this@MangaJson.description,
genre = this@MangaJson.genre,
status = this@MangaJson.status?.takeUnless { it == 0L },
@@ -94,6 +97,7 @@ class CustomMangaRepositoryImpl(context: Context) : CustomMangaRepository {
title,
author,
artist,
thumbnailUrl,
description,
genre,
status,
@@ -49,11 +49,11 @@ object MangaMapper {
ogTitle = title,
ogArtist = artist,
ogAuthor = author,
ogThumbnailUrl = thumbnailUrl,
ogDescription = description,
ogGenre = genre,
ogStatus = status,
// SY <--
thumbnailUrl = thumbnailUrl,
updateStrategy = updateStrategy,
initialized = initialized,
lastModifiedAt = lastModifiedAt,
@@ -150,7 +150,7 @@ object MangaMapper {
ogDescription = libraryView.description,
ogGenre = libraryView.genre,
ogStatus = libraryView.status,
thumbnailUrl = libraryView.thumbnail_url,
ogThumbnailUrl = libraryView.thumbnail_url,
updateStrategy = libraryView.update_strategy,
initialized = libraryView.initialized,
fetchInterval = libraryView.calculate_interval.toInt(),
@@ -86,7 +86,7 @@ class UpdatesRepositoryImpl(
mangaId = mangaId,
sourceId = sourceId,
isMangaFavorite = favorite,
url = thumbnailUrl,
ogUrl = thumbnailUrl,
lastModified = coverLastModified,
),
)
@@ -107,7 +107,7 @@ class UpdatesRepositoryImpl(
mangaId = updatesView.mangaId,
sourceId = updatesView.source,
isMangaFavorite = updatesView.favorite,
url = updatesView.thumbnailUrl,
ogUrl = updatesView.thumbnailUrl,
lastModified = updatesView.coverLastModified,
),
)