From 064bde0273e3249e6b6fbbb20f4f14121a462501 Mon Sep 17 00:00:00 2001 From: Splintor Date: Thu, 15 Feb 2024 00:16:07 +0200 Subject: [PATCH 01/15] Edit basic Manga information (#5) --- .../kanade/presentation/manga/MangaScreen.kt | 7 ++ .../manga/components/MangaDialogs.kt | 79 +++++++++++++++++++ .../manga/components/MangaToolbar.kt | 9 +++ .../kanade/tachiyomi/ui/manga/MangaScreen.kt | 9 +++ .../tachiyomi/ui/manga/MangaScreenModel.kt | 41 ++++++++++ .../commonMain/resources/MR/base/strings.xml | 5 ++ 6 files changed, 150 insertions(+) diff --git a/app/src/main/java/eu/kanade/presentation/manga/MangaScreen.kt b/app/src/main/java/eu/kanade/presentation/manga/MangaScreen.kt index 9a6e3f6fda..d97b0fe0a5 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/MangaScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/MangaScreen.kt @@ -113,6 +113,7 @@ fun MangaScreen( onEditCategoryClicked: (() -> Unit)?, onEditFetchIntervalClicked: (() -> Unit)?, onMigrateClicked: (() -> Unit)?, + onEditInfoClicked: (() -> Unit)?, // For bottom action menu onMultiBookmarkClicked: (List, bookmarked: Boolean) -> Unit, @@ -160,6 +161,7 @@ fun MangaScreen( onDownloadActionClicked = onDownloadActionClicked, onEditCategoryClicked = onEditCategoryClicked, onEditIntervalClicked = onEditFetchIntervalClicked, + onEditInfoClicked = onEditInfoClicked, onMigrateClicked = onMigrateClicked, onMultiBookmarkClicked = onMultiBookmarkClicked, onMultiMarkAsReadClicked = onMultiMarkAsReadClicked, @@ -195,6 +197,7 @@ fun MangaScreen( onDownloadActionClicked = onDownloadActionClicked, onEditCategoryClicked = onEditCategoryClicked, onEditIntervalClicked = onEditFetchIntervalClicked, + onEditInfoClicked = onEditInfoClicked, onMigrateClicked = onMigrateClicked, onMultiBookmarkClicked = onMultiBookmarkClicked, onMultiMarkAsReadClicked = onMultiMarkAsReadClicked, @@ -241,6 +244,7 @@ private fun MangaScreenSmallImpl( onEditCategoryClicked: (() -> Unit)?, onEditIntervalClicked: (() -> Unit)?, onMigrateClicked: (() -> Unit)?, + onEditInfoClicked: (() -> Unit)?, // For bottom action menu onMultiBookmarkClicked: (List, bookmarked: Boolean) -> Unit, @@ -309,6 +313,7 @@ private fun MangaScreenSmallImpl( actionModeCounter = selectedChapterCount, onSelectAll = { onAllChapterSelected(true) }, onInvertSelection = { onInvertSelection() }, + onClickEditInfo = onEditInfoClicked, ) }, bottomBar = { @@ -489,6 +494,7 @@ fun MangaScreenLargeImpl( onEditCategoryClicked: (() -> Unit)?, onEditIntervalClicked: (() -> Unit)?, onMigrateClicked: (() -> Unit)?, + onEditInfoClicked: (() -> Unit)?, // For bottom action menu onMultiBookmarkClicked: (List, bookmarked: Boolean) -> Unit, @@ -550,6 +556,7 @@ fun MangaScreenLargeImpl( actionModeCounter = selectedChapterCount, onSelectAll = { onAllChapterSelected(true) }, onInvertSelection = { onInvertSelection() }, + onClickEditInfo = onEditInfoClicked, ) }, bottomBar = { diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt index a6ef3f9a56..50418047d4 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt @@ -5,13 +5,17 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll import androidx.compose.material3.AlertDialog import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableIntStateOf +import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue @@ -23,6 +27,7 @@ import eu.kanade.tachiyomi.util.system.isDevFlavor import eu.kanade.tachiyomi.util.system.isPreviewBuildType import kotlinx.collections.immutable.toImmutableList import tachiyomi.domain.manga.interactor.FetchInterval +import tachiyomi.domain.manga.model.Manga import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.WheelTextPicker import tachiyomi.presentation.core.components.material.padding @@ -148,3 +153,77 @@ fun SetIntervalDialog( }, ) } + +@Composable +fun EditInfoDialog( + manga: Manga, + onDismissRequest: () -> Unit, + onConfirm: (manga: Manga) -> Unit, +) { + var editedManga by remember { mutableStateOf(manga) } + + AlertDialog( + onDismissRequest = onDismissRequest, + title = { + Text(text = stringResource(MR.strings.action_edit_info)) + }, + text = { + Column( + Modifier + .fillMaxWidth() + .verticalScroll(rememberScrollState()), + ) { + OutlinedTextField( + value = editedManga.title, + onValueChange = { + editedManga = editedManga.copy(title = it) + }, + label = { Text(text = stringResource(MR.strings.title)) }, + ) + + if (manga.author != null) { + OutlinedTextField( + value = manga.author!!, + onValueChange = { + editedManga = editedManga.copy(author = it) + }, + label = { Text(text = stringResource(MR.strings.author)) }, + ) + } + + if (manga.artist != null) { + OutlinedTextField( + value = manga.artist!!, + onValueChange = { + editedManga = editedManga.copy(artist = it) + }, + label = { Text(text = stringResource(MR.strings.artist)) }, + ) + } + + if (manga.description != null) { + OutlinedTextField( + value = manga.description!!, + onValueChange = { + editedManga = editedManga.copy(description = it) + }, + label = { Text(text = stringResource(MR.strings.description)) }, + ) + } + } + }, + dismissButton = { + TextButton(onClick = onDismissRequest) { + Text(text = stringResource(MR.strings.action_cancel)) + } + }, + confirmButton = { + TextButton(onClick = { + onConfirm(editedManga) + onDismissRequest() + }) { + Text(text = stringResource(MR.strings.action_ok)) + } + }, + ) +} diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaToolbar.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaToolbar.kt index 4415bbf278..7c468701fa 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaToolbar.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaToolbar.kt @@ -44,6 +44,7 @@ fun MangaToolbar( onClickEditCategory: (() -> Unit)?, onClickRefresh: () -> Unit, onClickMigrate: (() -> Unit)?, + onClickEditInfo: (() -> Unit)?, // For action mode actionModeCounter: Int, @@ -149,6 +150,14 @@ fun MangaToolbar( ), ) } + if (onClickEditInfo != null) { + add( + AppBar.OverflowAction( + title = stringResource(MR.strings.action_edit_info), + onClick = onClickEditInfo, + ) + ) + } } .build(), ) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt index f7dad1d8ce..8e448ce24d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt @@ -31,6 +31,7 @@ import eu.kanade.presentation.manga.DuplicateMangaDialog import eu.kanade.presentation.manga.EditCoverAction import eu.kanade.presentation.manga.MangaScreen import eu.kanade.presentation.manga.components.DeleteChaptersDialog +import eu.kanade.presentation.manga.components.EditInfoDialog import eu.kanade.presentation.manga.components.MangaCoverDialog import eu.kanade.presentation.manga.components.ScanlatorFilterDialog import eu.kanade.presentation.manga.components.SetIntervalDialog @@ -148,6 +149,7 @@ class MangaScreen( onEditFetchIntervalClicked = screenModel::showSetFetchIntervalDialog.takeIf { successState.manga.favorite }, + onEditInfoClicked = screenModel::showEditInfoDialog.takeIf { successState.manga.favorite }, onMigrateClicked = { navigator.push(MigrateSearchScreen(successState.manga.id)) }.takeIf { successState.manga.favorite }, @@ -249,6 +251,13 @@ class MangaScreen( .takeIf { screenModel.isUpdateIntervalEnabled }, ) } + is MangaScreenModel.Dialog.EditInfo -> { + EditInfoDialog( + manga = dialog.manga, + onDismissRequest = onDismissRequest, + onConfirm = screenModel::updateMangaInfo, + ) + } } if (showScanlatorsDialog) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt index 26ad3a7fc2..78bc1ec1b7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt @@ -75,6 +75,7 @@ import tachiyomi.domain.manga.interactor.GetDuplicateLibraryManga import tachiyomi.domain.manga.interactor.GetMangaWithChapters import tachiyomi.domain.manga.interactor.SetMangaChapterFlags import tachiyomi.domain.manga.model.Manga +import tachiyomi.domain.manga.model.MangaUpdate import tachiyomi.domain.manga.model.applyFilter import tachiyomi.domain.manga.repository.MangaRepository import tachiyomi.domain.source.service.SourceManager @@ -369,6 +370,45 @@ class MangaScreenModel( } } + fun showEditInfoDialog() { + val manga = successState?.manga ?: return + screenModelScope.launch { + updateSuccessState { successState -> + successState.copy( + dialog = Dialog.EditInfo( + manga = manga, + ), + ) + } + } + } + + fun updateMangaInfo( + manga: Manga, + ) { + val state = successState ?: return + + val newTitle = if (manga.title.isBlank()) manga.url else manga.title.trim() + + screenModelScope.launchNonCancellable { + updateManga.await( + MangaUpdate( + id = manga.id, + title = newTitle, + artist = manga.artist, + author = manga.author, + description = manga.description, + ) + ) + } + + updateSuccessState { successState -> + successState.copy( + manga = manga + ) + } + } + fun showSetFetchIntervalDialog() { val manga = successState?.manga ?: return updateSuccessState { @@ -1004,6 +1044,7 @@ class MangaScreenModel( data class DeleteChapters(val chapters: List) : Dialog data class DuplicateManga(val manga: Manga, val duplicate: Manga) : Dialog data class SetFetchInterval(val manga: Manga) : Dialog + data class EditInfo(val manga: Manga) : Dialog data object SettingsSheet : Dialog data object TrackSheet : Dialog data object FullCover : Dialog diff --git a/i18n/src/commonMain/resources/MR/base/strings.xml b/i18n/src/commonMain/resources/MR/base/strings.xml index 6c6e1681ac..00d55b1f36 100644 --- a/i18n/src/commonMain/resources/MR/base/strings.xml +++ b/i18n/src/commonMain/resources/MR/base/strings.xml @@ -19,6 +19,10 @@ Delete downloaded History Scanlator + Author + Artist + Description + More @@ -149,6 +153,7 @@ Save Reset Revert to default + Edit info Undo Close From 25ed2bdca6cc94a7f8647296eb2292a70381f371 Mon Sep 17 00:00:00 2001 From: Splintor Date: Thu, 15 Feb 2024 15:13:47 +0200 Subject: [PATCH 02/15] Displayed all the edit fields --- .../manga/components/MangaDialogs.kt | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt index 50418047d4..c5a47370b8 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt @@ -160,7 +160,13 @@ fun EditInfoDialog( onDismissRequest: () -> Unit, onConfirm: (manga: Manga) -> Unit, ) { - var editedManga by remember { mutableStateOf(manga) } + var editedManga by remember { + mutableStateOf(manga.copy( + author = manga.author ?: "", + artist = manga.artist ?: "", + description = manga.description ?: "", + )) + } AlertDialog( onDismissRequest = onDismissRequest, @@ -181,35 +187,29 @@ fun EditInfoDialog( label = { Text(text = stringResource(MR.strings.title)) }, ) - if (manga.author != null) { - OutlinedTextField( - value = manga.author!!, - onValueChange = { - editedManga = editedManga.copy(author = it) - }, - label = { Text(text = stringResource(MR.strings.author)) }, - ) - } + OutlinedTextField( + value = editedManga.author!!, + onValueChange = { + editedManga = editedManga.copy(author = it) + }, + label = { Text(text = stringResource(MR.strings.author)) }, + ) - if (manga.artist != null) { - OutlinedTextField( - value = manga.artist!!, - onValueChange = { - editedManga = editedManga.copy(artist = it) - }, - label = { Text(text = stringResource(MR.strings.artist)) }, - ) - } + OutlinedTextField( + value = editedManga.artist!!, + onValueChange = { + editedManga = editedManga.copy(artist = it) + }, + label = { Text(text = stringResource(MR.strings.artist)) }, + ) - if (manga.description != null) { - OutlinedTextField( - value = manga.description!!, - onValueChange = { - editedManga = editedManga.copy(description = it) - }, - label = { Text(text = stringResource(MR.strings.description)) }, - ) - } + OutlinedTextField( + value = editedManga.description!!, + onValueChange = { + editedManga = editedManga.copy(description = it) + }, + label = { Text(text = stringResource(MR.strings.description)) }, + ) } }, dismissButton = { From bb75e72c85727705cb2266e83627662292dacdfb Mon Sep 17 00:00:00 2001 From: Splintor Date: Thu, 15 Feb 2024 15:33:21 +0200 Subject: [PATCH 03/15] Update the manga info in a separate table --- .../domain/manga/interactor/UpdateManga.kt | 5 ++ .../tachiyomi/ui/manga/MangaScreenModel.kt | 2 +- .../data/manga/MangaRepositoryImpl.kt | 24 +++++++++ .../main/sqldelight/tachiyomi/data/mangas.sq | 49 ++++++++++++++++++- .../manga/repository/MangaRepository.kt | 2 + 5 files changed, 79 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/domain/manga/interactor/UpdateManga.kt b/app/src/main/java/eu/kanade/domain/manga/interactor/UpdateManga.kt index d5cfc248dd..575f2cb572 100644 --- a/app/src/main/java/eu/kanade/domain/manga/interactor/UpdateManga.kt +++ b/app/src/main/java/eu/kanade/domain/manga/interactor/UpdateManga.kt @@ -103,4 +103,9 @@ class UpdateManga( MangaUpdate(id = mangaId, favorite = favorite, dateAdded = dateAdded), ) } + + suspend fun awaitUpdateEditInfo(mangaUpdate: MangaUpdate): Boolean { + + return mangaRepository.updateOrInsertEditInfo(mangaUpdate) + } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt index 78bc1ec1b7..a0bba26d2a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt @@ -391,7 +391,7 @@ class MangaScreenModel( val newTitle = if (manga.title.isBlank()) manga.url else manga.title.trim() screenModelScope.launchNonCancellable { - updateManga.await( + updateManga.awaitUpdateEditInfo( MangaUpdate( id = manga.id, title = newTitle, diff --git a/data/src/main/java/tachiyomi/data/manga/MangaRepositoryImpl.kt b/data/src/main/java/tachiyomi/data/manga/MangaRepositoryImpl.kt index 88ef9b3b71..873cabeccd 100644 --- a/data/src/main/java/tachiyomi/data/manga/MangaRepositoryImpl.kt +++ b/data/src/main/java/tachiyomi/data/manga/MangaRepositoryImpl.kt @@ -159,4 +159,28 @@ class MangaRepositoryImpl( } } } + + override suspend fun updateOrInsertEditInfo(update: MangaUpdate) : Boolean { + handler.await(inTransaction = true) { + val updatedRows = mangasQueries.updateMangaEdit( + artist = update.artist, + author = update.author, + description = update.description, + title = update.title, + mangaId = update.id + ).executeAsOne() + + if (updatedRows == 0L) { + mangasQueries.insertMangaEdit( + id = update.id, + artist = update.artist, + author = update.author, + description = update.description, + title = update.title, + ).executeAsOne() + } + } + + return true + } } diff --git a/data/src/main/sqldelight/tachiyomi/data/mangas.sq b/data/src/main/sqldelight/tachiyomi/data/mangas.sq index 07ef12eba1..ccc448f299 100644 --- a/data/src/main/sqldelight/tachiyomi/data/mangas.sq +++ b/data/src/main/sqldelight/tachiyomi/data/mangas.sq @@ -28,6 +28,14 @@ CREATE TABLE mangas( favorite_modified_at INTEGER ); +CREATE TABLE mangas_edits( + _id INTEGER NOT NULL PRIMARY KEY, + artist TEXT, + author TEXT, + description TEXT, + title TEXT +); + CREATE INDEX library_favorite_index ON mangas(favorite) WHERE favorite = 1; CREATE INDEX mangas_url_index ON mangas(url); @@ -49,9 +57,32 @@ BEGIN END; getMangaById: -SELECT * +SELECT + mangas._id, + coalesce(mangas_edits.artist, mangas.artist) AS artist, + coalesce(mangas_edits.author, mangas.author) AS author, + coalesce(mangas_edits.description, mangas.description) AS description, + coalesce(mangas_edits.title, mangas.title) AS title, + mangas.source, + mangas.url, + mangas.genre, + mangas.status, + mangas.thumbnail_url, + mangas.favorite, + mangas.last_update, + mangas.next_update, + mangas.initialized, + mangas.viewer, + mangas.chapter_flags, + mangas.cover_last_modified, + mangas.date_added, + mangas.update_strategy, + mangas.calculate_interval, + mangas.last_modified_at, + mangas.favorite_modified_at FROM mangas -WHERE _id = :id; +LEFT JOIN mangas_edits ON mangas._id = mangas_edits._id +WHERE mangas._id = :id; -- TODO: this should ideally never really have more than 1 result getMangaByUrlAndSource: @@ -144,3 +175,17 @@ WHERE _id = :mangaId; selectLastInsertedRowId: SELECT last_insert_rowid(); + +insertMangaEdit: +INSERT INTO mangas_edits(_id, artist, author, description, title) +VALUES (:id, :artist, :author, :description, :title) +RETURNING changes(); + +updateMangaEdit: +UPDATE mangas_edits SET + artist = :artist, + author = :author, + description = :description, + title = :title +WHERE _id = :mangaId +RETURNING changes(); diff --git a/domain/src/main/java/tachiyomi/domain/manga/repository/MangaRepository.kt b/domain/src/main/java/tachiyomi/domain/manga/repository/MangaRepository.kt index c460038cd8..c19d50404d 100644 --- a/domain/src/main/java/tachiyomi/domain/manga/repository/MangaRepository.kt +++ b/domain/src/main/java/tachiyomi/domain/manga/repository/MangaRepository.kt @@ -34,4 +34,6 @@ interface MangaRepository { suspend fun update(update: MangaUpdate): Boolean suspend fun updateAll(mangaUpdates: List): Boolean + + suspend fun updateOrInsertEditInfo(update: MangaUpdate): Boolean } From 6425de93273ca22994009e24714d9215fef24e0d Mon Sep 17 00:00:00 2001 From: Splintor Date: Thu, 15 Feb 2024 23:01:19 +0200 Subject: [PATCH 04/15] Move the edited fields in the mangas table --- .../domain/manga/interactor/UpdateManga.kt | 2 +- .../eu/kanade/domain/manga/model/Manga.kt | 20 +++---- .../manga/components/MangaDialogs.kt | 23 ++++---- .../data/backup/models/BackupManga.kt | 8 +-- .../backup/restore/restorers/MangaRestorer.kt | 6 +- .../data/download/DownloadPendingDeleter.kt | 2 +- .../tachiyomi/ui/manga/MangaScreenModel.kt | 13 +++-- .../java/tachiyomi/data/manga/MangaMapper.kt | 24 ++++++-- .../data/manga/MangaRepositoryImpl.kt | 17 +----- .../main/sqldelight/tachiyomi/data/mangas.sq | 57 ++++--------------- .../sqldelight/tachiyomi/migrations/2.sqm | 6 ++ .../manga/interactor/NetworkToLocalManga.kt | 2 +- .../tachiyomi/domain/manga/model/Manga.kt | 35 +++++++++--- .../manga/repository/MangaRepository.kt | 2 +- 14 files changed, 108 insertions(+), 109 deletions(-) create mode 100644 data/src/main/sqldelight/tachiyomi/migrations/2.sqm diff --git a/app/src/main/java/eu/kanade/domain/manga/interactor/UpdateManga.kt b/app/src/main/java/eu/kanade/domain/manga/interactor/UpdateManga.kt index 575f2cb572..7bef7e4429 100644 --- a/app/src/main/java/eu/kanade/domain/manga/interactor/UpdateManga.kt +++ b/app/src/main/java/eu/kanade/domain/manga/interactor/UpdateManga.kt @@ -106,6 +106,6 @@ class UpdateManga( suspend fun awaitUpdateEditInfo(mangaUpdate: MangaUpdate): Boolean { - return mangaRepository.updateOrInsertEditInfo(mangaUpdate) + return mangaRepository.updateEditedInfo(mangaUpdate) } } diff --git a/app/src/main/java/eu/kanade/domain/manga/model/Manga.kt b/app/src/main/java/eu/kanade/domain/manga/model/Manga.kt index 1b9dd62c8f..cbcc187732 100644 --- a/app/src/main/java/eu/kanade/domain/manga/model/Manga.kt +++ b/app/src/main/java/eu/kanade/domain/manga/model/Manga.kt @@ -51,9 +51,9 @@ fun Manga.toSManga(): SManga = SManga.create().also { } fun Manga.copyFrom(other: SManga): Manga { - val author = other.author ?: author - val artist = other.artist ?: artist - val description = other.description ?: description + val author = other.author ?: ogAuthor + val artist = other.artist ?: ogArtist + val description = other.description ?: ogDescription val genres = if (other.genre != null) { other.getGenres() } else { @@ -61,9 +61,9 @@ fun Manga.copyFrom(other: SManga): Manga { } val thumbnailUrl = other.thumbnail_url ?: thumbnailUrl return this.copy( - author = author, - artist = artist, - description = description, + ogAuthor = author, + ogArtist = artist, + ogDescription = description, genre = genres, thumbnailUrl = thumbnailUrl, status = other.status.toLong(), @@ -75,10 +75,10 @@ fun Manga.copyFrom(other: SManga): Manga { fun SManga.toDomainManga(sourceId: Long): Manga { return Manga.create().copy( url = url, - title = title, - artist = artist, - author = author, - description = description, + ogTitle = title, + ogArtist = artist, + ogAuthor = author, + ogDescription = description, genre = getGenres(), status = status.toLong(), thumbnailUrl = thumbnail_url, diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt index c5a47370b8..a83d484528 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt @@ -162,9 +162,10 @@ fun EditInfoDialog( ) { var editedManga by remember { mutableStateOf(manga.copy( - author = manga.author ?: "", - artist = manga.artist ?: "", - description = manga.description ?: "", + editedTitle = manga.editedTitle ?: manga.title, + editedAuthor = manga.editedAuthor ?: manga.author ?: "", + editedArtist = manga.editedArtist ?: manga.artist ?: "", + editedDescription = manga.editedDescription ?: manga.description ?: "", )) } @@ -180,33 +181,33 @@ fun EditInfoDialog( .verticalScroll(rememberScrollState()), ) { OutlinedTextField( - value = editedManga.title, + value = editedManga.editedTitle!!, onValueChange = { - editedManga = editedManga.copy(title = it) + editedManga = editedManga.copy(editedTitle = it) }, label = { Text(text = stringResource(MR.strings.title)) }, ) OutlinedTextField( - value = editedManga.author!!, + value = editedManga.editedAuthor!!, onValueChange = { - editedManga = editedManga.copy(author = it) + editedManga = editedManga.copy(editedAuthor = it) }, label = { Text(text = stringResource(MR.strings.author)) }, ) OutlinedTextField( - value = editedManga.artist!!, + value = editedManga.editedArtist!!, onValueChange = { - editedManga = editedManga.copy(artist = it) + editedManga = editedManga.copy(editedArtist = it) }, label = { Text(text = stringResource(MR.strings.artist)) }, ) OutlinedTextField( - value = editedManga.description!!, + value = editedManga.editedDescription!!, onValueChange = { - editedManga = editedManga.copy(description = it) + editedManga = editedManga.copy(editedDescription = it) }, label = { Text(text = stringResource(MR.strings.description)) }, ) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt index da202ae557..fc927d71ba 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt @@ -43,10 +43,10 @@ data class BackupManga( fun getMangaImpl(): Manga { return Manga.create().copy( url = this@BackupManga.url, - title = this@BackupManga.title, - artist = this@BackupManga.artist, - author = this@BackupManga.author, - description = this@BackupManga.description, + ogTitle = this@BackupManga.title, + ogArtist = this@BackupManga.artist, + ogAuthor = this@BackupManga.author, + ogDescription = this@BackupManga.description, genre = this@BackupManga.genre, status = this@BackupManga.status.toLong(), thumbnailUrl = this@BackupManga.thumbnailUrl, diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/MangaRestorer.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/MangaRestorer.kt index 30dc443685..ea50107411 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/MangaRestorer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/MangaRestorer.kt @@ -93,9 +93,9 @@ class MangaRestorer( private fun Manga.copyFrom(newer: Manga): Manga { return this.copy( favorite = this.favorite || newer.favorite, - author = newer.author, - artist = newer.artist, - description = newer.description, + ogAuthor = newer.author, + ogArtist = newer.artist, + ogDescription = newer.description, genre = newer.genre, thumbnailUrl = newer.thumbnailUrl, status = newer.status, diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadPendingDeleter.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadPendingDeleter.kt index 1bee154b9c..9403bc1ddb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadPendingDeleter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadPendingDeleter.kt @@ -136,7 +136,7 @@ class DownloadPendingDeleter( */ private fun MangaEntry.toModel() = Manga.create().copy( url = url, - title = title, + ogTitle = title, source = source, id = id, ) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt index a0bba26d2a..29f1d02935 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt @@ -386,18 +386,19 @@ class MangaScreenModel( fun updateMangaInfo( manga: Manga, ) { - val state = successState ?: return - - val newTitle = if (manga.title.isBlank()) manga.url else manga.title.trim() + val newTitle = if (manga.editedTitle.isNullOrBlank()) null else manga.editedTitle + val newAuthor = if (manga.editedAuthor.isNullOrBlank()) null else manga.editedAuthor + val newArtist = if (manga.editedArtist.isNullOrBlank()) null else manga.editedArtist + val newDescription = if (manga.editedDescription.isNullOrBlank()) null else manga.editedDescription screenModelScope.launchNonCancellable { updateManga.awaitUpdateEditInfo( MangaUpdate( id = manga.id, title = newTitle, - artist = manga.artist, - author = manga.author, - description = manga.description, + artist = newArtist, + author = newAuthor, + description = newDescription, ) ) } diff --git a/data/src/main/java/tachiyomi/data/manga/MangaMapper.kt b/data/src/main/java/tachiyomi/data/manga/MangaMapper.kt index d9937b2858..ac31ecc2f0 100644 --- a/data/src/main/java/tachiyomi/data/manga/MangaMapper.kt +++ b/data/src/main/java/tachiyomi/data/manga/MangaMapper.kt @@ -28,6 +28,10 @@ object MangaMapper { calculateInterval: Long, lastModifiedAt: Long, favoriteModifiedAt: Long?, + editedArtist: String?, + editedAuthor: String?, + editedDescription: String?, + editedTitle: String?, ): Manga = Manga( id = id, source = source, @@ -40,10 +44,10 @@ object MangaMapper { chapterFlags = chapterFlags, coverLastModified = coverLastModified, url = url, - title = title, - artist = artist, - author = author, - description = description, + ogTitle = title, + ogArtist = artist, + ogAuthor = author, + ogDescription = description, genre = genre, status = status, thumbnailUrl = thumbnailUrl, @@ -51,6 +55,10 @@ object MangaMapper { initialized = initialized, lastModifiedAt = lastModifiedAt, favoriteModifiedAt = favoriteModifiedAt, + editedArtist = editedArtist, + editedAuthor = editedAuthor, + editedDescription = editedDescription, + editedTitle = editedTitle, ) fun mapLibraryManga( @@ -76,6 +84,10 @@ object MangaMapper { calculateInterval: Long, lastModifiedAt: Long, favoriteModifiedAt: Long?, + editedArtist: String?, + editedAuthor: String?, + editedDescription: String?, + editedTitle: String?, totalCount: Long, readCount: Double, latestUpload: Long, @@ -107,6 +119,10 @@ object MangaMapper { calculateInterval, lastModifiedAt, favoriteModifiedAt, + editedArtist, + editedAuthor, + editedDescription, + editedTitle, ), category = category, totalChapters = totalCount, diff --git a/data/src/main/java/tachiyomi/data/manga/MangaRepositoryImpl.kt b/data/src/main/java/tachiyomi/data/manga/MangaRepositoryImpl.kt index 873cabeccd..825f6c726f 100644 --- a/data/src/main/java/tachiyomi/data/manga/MangaRepositoryImpl.kt +++ b/data/src/main/java/tachiyomi/data/manga/MangaRepositoryImpl.kt @@ -160,27 +160,16 @@ class MangaRepositoryImpl( } } - override suspend fun updateOrInsertEditInfo(update: MangaUpdate) : Boolean { + override suspend fun updateEditedInfo(update: MangaUpdate) : Boolean { handler.await(inTransaction = true) { - val updatedRows = mangasQueries.updateMangaEdit( + mangasQueries.updateMangaEdit( artist = update.artist, author = update.author, description = update.description, title = update.title, mangaId = update.id - ).executeAsOne() - - if (updatedRows == 0L) { - mangasQueries.insertMangaEdit( - id = update.id, - artist = update.artist, - author = update.author, - description = update.description, - title = update.title, - ).executeAsOne() - } + ) } - return true } } diff --git a/data/src/main/sqldelight/tachiyomi/data/mangas.sq b/data/src/main/sqldelight/tachiyomi/data/mangas.sq index ccc448f299..5e06d04cec 100644 --- a/data/src/main/sqldelight/tachiyomi/data/mangas.sq +++ b/data/src/main/sqldelight/tachiyomi/data/mangas.sq @@ -25,15 +25,11 @@ CREATE TABLE mangas( update_strategy INTEGER AS UpdateStrategy NOT NULL DEFAULT 0, calculate_interval INTEGER DEFAULT 0 NOT NULL, last_modified_at INTEGER NOT NULL DEFAULT 0, - favorite_modified_at INTEGER -); - -CREATE TABLE mangas_edits( - _id INTEGER NOT NULL PRIMARY KEY, - artist TEXT, - author TEXT, - description TEXT, - title TEXT + favorite_modified_at INTEGER, + edited_artist TEXT, + edited_author TEXT, + edited_description TEXT, + edited_title TEXT ); CREATE INDEX library_favorite_index ON mangas(favorite) WHERE favorite = 1; @@ -57,31 +53,8 @@ BEGIN END; getMangaById: -SELECT - mangas._id, - coalesce(mangas_edits.artist, mangas.artist) AS artist, - coalesce(mangas_edits.author, mangas.author) AS author, - coalesce(mangas_edits.description, mangas.description) AS description, - coalesce(mangas_edits.title, mangas.title) AS title, - mangas.source, - mangas.url, - mangas.genre, - mangas.status, - mangas.thumbnail_url, - mangas.favorite, - mangas.last_update, - mangas.next_update, - mangas.initialized, - mangas.viewer, - mangas.chapter_flags, - mangas.cover_last_modified, - mangas.date_added, - mangas.update_strategy, - mangas.calculate_interval, - mangas.last_modified_at, - mangas.favorite_modified_at +SELECT * FROM mangas -LEFT JOIN mangas_edits ON mangas._id = mangas_edits._id WHERE mangas._id = :id; -- TODO: this should ideally never really have more than 1 result @@ -176,16 +149,10 @@ WHERE _id = :mangaId; selectLastInsertedRowId: SELECT last_insert_rowid(); -insertMangaEdit: -INSERT INTO mangas_edits(_id, artist, author, description, title) -VALUES (:id, :artist, :author, :description, :title) -RETURNING changes(); - updateMangaEdit: -UPDATE mangas_edits SET - artist = :artist, - author = :author, - description = :description, - title = :title -WHERE _id = :mangaId -RETURNING changes(); +UPDATE mangas SET + edited_artist = :artist, + edited_author = :author, + edited_description = :description, + edited_title = :title +WHERE _id = :mangaId; diff --git a/data/src/main/sqldelight/tachiyomi/migrations/2.sqm b/data/src/main/sqldelight/tachiyomi/migrations/2.sqm new file mode 100644 index 0000000000..3156bd2239 --- /dev/null +++ b/data/src/main/sqldelight/tachiyomi/migrations/2.sqm @@ -0,0 +1,6 @@ +-- Add the manga edited info and the new function -- + +ALTER TABLE mangas ADD COLUMN edited_artist TEXT; +ALTER TABLE mangas ADD COLUMN edited_author TEXT; +ALTER TABLE mangas ADD COLUMN edited_description TEXT; +ALTER TABLE mangas ADD COLUMN edited_title TEXT; diff --git a/domain/src/main/java/tachiyomi/domain/manga/interactor/NetworkToLocalManga.kt b/domain/src/main/java/tachiyomi/domain/manga/interactor/NetworkToLocalManga.kt index 5ca3fb647b..24b40e5306 100644 --- a/domain/src/main/java/tachiyomi/domain/manga/interactor/NetworkToLocalManga.kt +++ b/domain/src/main/java/tachiyomi/domain/manga/interactor/NetworkToLocalManga.kt @@ -17,7 +17,7 @@ class NetworkToLocalManga( !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.copy(title = manga.title) + localManga.copy(ogTitle = manga.title) } else -> { localManga diff --git a/domain/src/main/java/tachiyomi/domain/manga/model/Manga.kt b/domain/src/main/java/tachiyomi/domain/manga/model/Manga.kt index 0ffe9856a2..09ba5313eb 100644 --- a/domain/src/main/java/tachiyomi/domain/manga/model/Manga.kt +++ b/domain/src/main/java/tachiyomi/domain/manga/model/Manga.kt @@ -18,10 +18,10 @@ data class Manga( val chapterFlags: Long, val coverLastModified: Long, val url: String, - val title: String, - val artist: String?, - val author: String?, - val description: String?, + val ogTitle: String, + val ogArtist: String?, + val ogAuthor: String?, + val ogDescription: String?, val genre: List?, val status: Long, val thumbnailUrl: String?, @@ -29,7 +29,22 @@ data class Manga( val initialized: Boolean, val lastModifiedAt: Long, val favoriteModifiedAt: Long?, + val editedArtist: String?, + val editedAuthor: String?, + val editedDescription: String?, + val editedTitle: String?, ) : Serializable { + val title: String + get() = editedTitle ?: ogTitle + + val author: String? + get() = editedAuthor ?: ogAuthor + + val artist: String? + get() = editedArtist ?: ogArtist + + val description: String? + get() = editedDescription ?: ogDescription val expectedNextUpdate: Instant? get() = nextUpdate @@ -102,7 +117,8 @@ data class Manga( fun create() = Manga( id = -1L, url = "", - title = "", + ogTitle = "", + editedTitle = null, source = -1L, favorite = false, lastUpdate = 0L, @@ -112,9 +128,12 @@ data class Manga( viewerFlags = 0L, chapterFlags = 0L, coverLastModified = 0L, - artist = null, - author = null, - description = null, + ogArtist = null, + editedArtist = null, + ogAuthor = null, + editedAuthor = null, + ogDescription = null, + editedDescription = null, genre = null, status = 0L, thumbnailUrl = null, diff --git a/domain/src/main/java/tachiyomi/domain/manga/repository/MangaRepository.kt b/domain/src/main/java/tachiyomi/domain/manga/repository/MangaRepository.kt index c19d50404d..87843ae5df 100644 --- a/domain/src/main/java/tachiyomi/domain/manga/repository/MangaRepository.kt +++ b/domain/src/main/java/tachiyomi/domain/manga/repository/MangaRepository.kt @@ -35,5 +35,5 @@ interface MangaRepository { suspend fun updateAll(mangaUpdates: List): Boolean - suspend fun updateOrInsertEditInfo(update: MangaUpdate): Boolean + suspend fun updateEditedInfo(update: MangaUpdate): Boolean } From 79be3ec46a48c25ab58fdceda7dc1edb4e12aa10 Mon Sep 17 00:00:00 2001 From: Splintor Date: Fri, 16 Feb 2024 00:12:44 +0200 Subject: [PATCH 05/15] Changed not-null assertion to .orEmpty() --- .../presentation/manga/components/MangaDialogs.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt index a83d484528..97edab39cb 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt @@ -163,9 +163,9 @@ fun EditInfoDialog( var editedManga by remember { mutableStateOf(manga.copy( editedTitle = manga.editedTitle ?: manga.title, - editedAuthor = manga.editedAuthor ?: manga.author ?: "", - editedArtist = manga.editedArtist ?: manga.artist ?: "", - editedDescription = manga.editedDescription ?: manga.description ?: "", + editedAuthor = manga.editedAuthor ?: manga.author, + editedArtist = manga.editedArtist ?: manga.artist, + editedDescription = manga.editedDescription ?: manga.description, )) } @@ -181,7 +181,7 @@ fun EditInfoDialog( .verticalScroll(rememberScrollState()), ) { OutlinedTextField( - value = editedManga.editedTitle!!, + value = editedManga.editedTitle.orEmpty(), onValueChange = { editedManga = editedManga.copy(editedTitle = it) }, @@ -189,7 +189,7 @@ fun EditInfoDialog( ) OutlinedTextField( - value = editedManga.editedAuthor!!, + value = editedManga.editedAuthor.orEmpty(), onValueChange = { editedManga = editedManga.copy(editedAuthor = it) }, @@ -197,7 +197,7 @@ fun EditInfoDialog( ) OutlinedTextField( - value = editedManga.editedArtist!!, + value = editedManga.editedArtist.orEmpty(), onValueChange = { editedManga = editedManga.copy(editedArtist = it) }, @@ -205,7 +205,7 @@ fun EditInfoDialog( ) OutlinedTextField( - value = editedManga.editedDescription!!, + value = editedManga.editedDescription.orEmpty(), onValueChange = { editedManga = editedManga.copy(editedDescription = it) }, From da86d955d8ed19048b3d5fb58f4d62fd7ef2f5d1 Mon Sep 17 00:00:00 2001 From: Splintor Date: Fri, 16 Feb 2024 00:13:32 +0200 Subject: [PATCH 06/15] Used original fields for backup and downloads --- .../chapter/interactor/SyncChaptersWithSource.kt | 6 +++--- .../eu/kanade/domain/chapter/model/ChapterFilter.kt | 2 +- .../backup/create/creators/MangaBackupCreator.kt | 12 ++++++++---- .../tachiyomi/data/backup/models/BackupManga.kt | 9 +++++++++ .../kanade/tachiyomi/data/download/DownloadCache.kt | 10 +++++----- .../tachiyomi/data/download/DownloadManager.kt | 6 +++--- .../tachiyomi/data/download/DownloadNotifier.kt | 2 +- .../data/download/DownloadPendingDeleter.kt | 2 +- .../tachiyomi/data/download/DownloadProvider.kt | 2 +- .../eu/kanade/tachiyomi/data/download/Downloader.kt | 10 +++++----- .../kanade/tachiyomi/ui/download/DownloadHolder.kt | 2 +- .../eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt | 2 +- .../eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt | 12 ++++++------ .../tachiyomi/ui/reader/loader/ChapterLoader.kt | 2 +- .../tachiyomi/ui/reader/loader/DownloadPageLoader.kt | 2 +- .../util/chapter/ChapterFilterDownloaded.kt | 2 +- .../manga/interactor/GetDuplicateLibraryManga.kt | 2 +- .../domain/manga/interactor/NetworkToLocalManga.kt | 2 +- 18 files changed, 50 insertions(+), 37 deletions(-) diff --git a/app/src/main/java/eu/kanade/domain/chapter/interactor/SyncChaptersWithSource.kt b/app/src/main/java/eu/kanade/domain/chapter/interactor/SyncChaptersWithSource.kt index 300794b4c1..aa9a739e19 100644 --- a/app/src/main/java/eu/kanade/domain/chapter/interactor/SyncChaptersWithSource.kt +++ b/app/src/main/java/eu/kanade/domain/chapter/interactor/SyncChaptersWithSource.kt @@ -63,7 +63,7 @@ class SyncChaptersWithSource( .mapIndexed { i, sChapter -> Chapter.create() .copyFromSChapter(sChapter) - .copy(name = with(ChapterSanitizer) { sChapter.name.sanitize(manga.title) }) + .copy(name = with(ChapterSanitizer) { sChapter.name.sanitize(manga.ogTitle) }) .copy(mangaId = manga.id, sourceOrder = i.toLong()) } @@ -92,7 +92,7 @@ class SyncChaptersWithSource( } // Recognize chapter number for the chapter. - val chapterNumber = ChapterRecognition.parseChapterNumber(manga.title, chapter.name, chapter.chapterNumber) + val chapterNumber = ChapterRecognition.parseChapterNumber(manga.ogTitle, chapter.name, chapter.chapterNumber) chapter = chapter.copy(chapterNumber = chapterNumber) val dbChapter = dbChapters.find { it.url == chapter.url } @@ -110,7 +110,7 @@ class SyncChaptersWithSource( if (shouldUpdateDbChapter.await(dbChapter, chapter)) { val shouldRenameChapter = downloadProvider.isChapterDirNameChanged(dbChapter, chapter) && downloadManager.isChapterDownloaded( - dbChapter.name, dbChapter.scanlator, manga.title, manga.source, + dbChapter.name, dbChapter.scanlator, manga.ogTitle, manga.source, ) if (shouldRenameChapter) { diff --git a/app/src/main/java/eu/kanade/domain/chapter/model/ChapterFilter.kt b/app/src/main/java/eu/kanade/domain/chapter/model/ChapterFilter.kt index ad476418f0..d358d64015 100644 --- a/app/src/main/java/eu/kanade/domain/chapter/model/ChapterFilter.kt +++ b/app/src/main/java/eu/kanade/domain/chapter/model/ChapterFilter.kt @@ -26,7 +26,7 @@ fun List.applyFilters(manga: Manga, downloadManager: DownloadManager): val downloaded = downloadManager.isChapterDownloaded( chapter.name, chapter.scanlator, - manga.title, + manga.ogTitle, manga.source, ) downloaded || isLocalManga diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/create/creators/MangaBackupCreator.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/create/creators/MangaBackupCreator.kt index 9f51a0d557..2a92446d2a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/create/creators/MangaBackupCreator.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/create/creators/MangaBackupCreator.kt @@ -82,10 +82,10 @@ class MangaBackupCreator( private fun Manga.toBackupManga() = BackupManga( url = this.url, - title = this.title, - artist = this.artist, - author = this.author, - description = this.description, + title = this.ogTitle, + artist = this.ogArtist, + author = this.ogAuthor, + description = this.ogDescription, genre = this.genre.orEmpty(), status = this.status.toInt(), thumbnailUrl = this.thumbnailUrl, @@ -98,4 +98,8 @@ private fun Manga.toBackupManga() = updateStrategy = this.updateStrategy, lastModifiedAt = this.lastModifiedAt, favoriteModifiedAt = this.favoriteModifiedAt, + editedArtist = this.editedArtist, + editedAuthor = this.editedAuthor, + editedTitle = this.editedTitle, + editedDescription = this.editedDescription, ) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt index fc927d71ba..354ff95855 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt @@ -39,6 +39,11 @@ data class BackupManga( @ProtoNumber(106) var lastModifiedAt: Long = 0, @ProtoNumber(107) var favoriteModifiedAt: Long? = null, @ProtoNumber(108) var excludedScanlators: List = emptyList(), + // Bump to 800 like the forks did + @ProtoNumber(800) var editedTitle: String? = null, + @ProtoNumber(801) var editedArtist: String? = null, + @ProtoNumber(802) var editedAuthor: String? = null, + @ProtoNumber(804) var editedDescription: String? = null, ) { fun getMangaImpl(): Manga { return Manga.create().copy( @@ -58,6 +63,10 @@ data class BackupManga( updateStrategy = this@BackupManga.updateStrategy, lastModifiedAt = this@BackupManga.lastModifiedAt, favoriteModifiedAt = this@BackupManga.favoriteModifiedAt, + editedTitle = this@BackupManga.editedTitle, + editedArtist = this@BackupManga.editedArtist, + editedAuthor = this@BackupManga.editedAuthor, + editedDescription = this@BackupManga.editedDescription, ) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt index fb1c8e1767..baeefc89ac 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt @@ -181,7 +181,7 @@ class DownloadCache( val sourceDir = rootDownloadsDir.sourceDirs[manga.source] if (sourceDir != null) { - val mangaDir = sourceDir.mangaDirs[provider.getMangaDirName(manga.title)] + val mangaDir = sourceDir.mangaDirs[provider.getMangaDirName(manga.ogTitle)] if (mangaDir != null) { return mangaDir.chapterDirs.size } @@ -208,7 +208,7 @@ class DownloadCache( } // Retrieve the cached manga directory or cache a new one - val mangaDirName = provider.getMangaDirName(manga.title) + val mangaDirName = provider.getMangaDirName(manga.ogTitle) var mangaDir = sourceDir.mangaDirs[mangaDirName] if (mangaDir == null) { mangaDir = MangaDirectory(mangaUniFile) @@ -231,7 +231,7 @@ class DownloadCache( suspend fun removeChapter(chapter: Chapter, manga: Manga) { rootDownloadsDirLock.withLock { val sourceDir = rootDownloadsDir.sourceDirs[manga.source] ?: return - val mangaDir = sourceDir.mangaDirs[provider.getMangaDirName(manga.title)] ?: return + val mangaDir = sourceDir.mangaDirs[provider.getMangaDirName(manga.ogTitle)] ?: return provider.getValidChapterDirNames(chapter.name, chapter.scanlator).forEach { if (it in mangaDir.chapterDirs) { mangaDir.chapterDirs -= it @@ -251,7 +251,7 @@ class DownloadCache( suspend fun removeChapters(chapters: List, manga: Manga) { rootDownloadsDirLock.withLock { val sourceDir = rootDownloadsDir.sourceDirs[manga.source] ?: return - val mangaDir = sourceDir.mangaDirs[provider.getMangaDirName(manga.title)] ?: return + val mangaDir = sourceDir.mangaDirs[provider.getMangaDirName(manga.ogTitle)] ?: return chapters.forEach { chapter -> provider.getValidChapterDirNames(chapter.name, chapter.scanlator).forEach { if (it in mangaDir.chapterDirs) { @@ -272,7 +272,7 @@ class DownloadCache( suspend fun removeManga(manga: Manga) { rootDownloadsDirLock.withLock { val sourceDir = rootDownloadsDir.sourceDirs[manga.source] ?: return - val mangaDirName = provider.getMangaDirName(manga.title) + val mangaDirName = provider.getMangaDirName(manga.ogTitle) if (sourceDir.mangaDirs.containsKey(mangaDirName)) { sourceDir.mangaDirs -= mangaDirName } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt index 01a342859d..648af1b89e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt @@ -158,7 +158,7 @@ class DownloadManager( * @return the list of pages from the chapter. */ fun buildPageList(source: Source, manga: Manga, chapter: Chapter): List { - val chapterDir = provider.findChapterDir(chapter.name, chapter.scanlator, manga.title, source) + val chapterDir = provider.findChapterDir(chapter.name, chapter.scanlator, manga.ogTitle, source) val files = chapterDir?.listFiles().orEmpty() .filter { "image" in it.type.orEmpty() } @@ -250,7 +250,7 @@ class DownloadManager( if (removeQueued) { downloader.removeFromQueue(manga) } - provider.findMangaDir(manga.title, source)?.delete() + provider.findMangaDir(manga.ogTitle, source)?.delete() cache.removeManga(manga) // Delete source directory if empty @@ -336,7 +336,7 @@ class DownloadManager( */ suspend fun renameChapter(source: Source, manga: Manga, oldChapter: Chapter, newChapter: Chapter) { val oldNames = provider.getValidChapterDirNames(oldChapter.name, oldChapter.scanlator) - val mangaDir = provider.getMangaDir(manga.title, source) + val mangaDir = provider.getMangaDir(manga.ogTitle, source) // Assume there's only 1 version of the chapter name formats present val oldDownload = oldNames.asSequence() diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt index 4acd8322e9..ffc28daded 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt @@ -95,7 +95,7 @@ internal class DownloadNotifier(private val context: Context) { setContentTitle(downloadingProgressText) setContentText(null) } else { - val title = download.manga.title.chop(15) + val title = download.manga.ogTitle.chop(15) val quotedTitle = Pattern.quote(title) val chapter = download.chapter.name.replaceFirst( "$quotedTitle[\\s]*[-]*[\\s]*".toRegex(RegexOption.IGNORE_CASE), diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadPendingDeleter.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadPendingDeleter.kt index 9403bc1ddb..83d088e8d1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadPendingDeleter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadPendingDeleter.kt @@ -124,7 +124,7 @@ class DownloadPendingDeleter( /** * Returns a manga entry from a manga model. */ - private fun Manga.toEntry() = MangaEntry(id, url, title, source) + private fun Manga.toEntry() = MangaEntry(id, url, ogTitle, source) /** * Returns a chapter entry from a chapter model. diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt index 001395af10..f054d03f53 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt @@ -94,7 +94,7 @@ class DownloadProvider( * @param source the source of the chapter. */ fun findChapterDirs(chapters: List, manga: Manga, source: Source): Pair> { - val mangaDir = findMangaDir(manga.title, source) ?: return null to emptyList() + val mangaDir = findMangaDir(manga.ogTitle, source) ?: return null to emptyList() return mangaDir to chapters.mapNotNull { chapter -> getValidChapterDirNames(chapter.name, chapter.scanlator).asSequence() .mapNotNull { mangaDir.findFile(it, true) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt index facbe605a9..3759b0c86b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt @@ -272,7 +272,7 @@ class Downloader( val wasEmpty = queueState.value.isEmpty() val chaptersToQueue = chapters.asSequence() // Filter out those already downloaded. - .filter { provider.findChapterDir(it.name, it.scanlator, manga.title, source) == null } + .filter { provider.findChapterDir(it.name, it.scanlator, manga.ogTitle, source) == null } // Add chapters to queue from the start. .sortedByDescending { it.sourceOrder } // Filter out those already enqueued. @@ -313,7 +313,7 @@ class Downloader( * @param download the chapter to be downloaded. */ private suspend fun downloadChapter(download: Download) { - val mangaDir = provider.getMangaDir(download.manga.title, download.source) + val mangaDir = provider.getMangaDir(download.manga.ogTitle, download.source) val availSpace = DiskUtil.getAvailableStorageSpace(mangaDir) if (availSpace != -1L && availSpace < MIN_DISK_SPACE) { @@ -321,7 +321,7 @@ class Downloader( notifier.onError( context.stringResource(MR.strings.download_insufficient_space), download.chapter.name, - download.manga.title, + download.manga.ogTitle, ) return } @@ -405,7 +405,7 @@ class Downloader( // If the page list threw, it will resume here logcat(LogPriority.ERROR, error) download.status = Download.State.ERROR - notifier.onError(error.message, download.chapter.name, download.manga.title) + notifier.onError(error.message, download.chapter.name, download.manga.ogTitle) } } @@ -455,7 +455,7 @@ class Downloader( // Mark this page as error and allow to download the remaining page.progress = 0 page.status = Page.State.ERROR - notifier.onError(e.message, download.chapter.name, download.manga.title) + notifier.onError(e.message, download.chapter.name, download.manga.ogTitle) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadHolder.kt index 514357d658..9686bfd5bc 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadHolder.kt @@ -38,7 +38,7 @@ class DownloadHolder(private val view: View, val adapter: DownloadAdapter) : binding.chapterTitle.text = download.chapter.name // Update the manga title - binding.mangaFullTitle.text = download.manga.title + binding.mangaFullTitle.text = download.manga.ogTitle // Update the progress bar and the number of downloaded pages val pages = download.pages diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt index 29f1d02935..4ffd656312 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt @@ -554,7 +554,7 @@ class MangaScreenModel( val downloaded = if (isLocal) { true } else { - downloadManager.isChapterDownloaded(chapter.name, chapter.scanlator, manga.title, manga.source) + downloadManager.isChapterDownloaded(chapter.name, chapter.scanlator, manga.ogTitle, manga.source) } val downloadState = when { activeDownload != null -> activeDownload.status diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt index a59f0500b0..a3d1554800 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt @@ -164,13 +164,13 @@ class ReaderViewModel @JvmOverloads constructor( ( manga.downloadedFilterRaw == Manga.CHAPTER_SHOW_DOWNLOADED && !downloadManager.isChapterDownloaded( - it.name, it.scanlator, manga.title, manga.source, + it.name, it.scanlator, manga.ogTitle, manga.source, ) ) || ( manga.downloadedFilterRaw == Manga.CHAPTER_SHOW_NOT_DOWNLOADED && downloadManager.isChapterDownloaded( - it.name, it.scanlator, manga.title, manga.source, + it.name, it.scanlator, manga.ogTitle, manga.source, ) ) || (manga.bookmarkedFilterRaw == Manga.CHAPTER_SHOW_BOOKMARKED && !it.bookmark) || @@ -381,7 +381,7 @@ class ReaderViewModel @JvmOverloads constructor( val isDownloaded = downloadManager.isChapterDownloaded( dbChapter.name, dbChapter.scanlator, - manga.title, + manga.ogTitle, manga.source, skipCache = true, ) @@ -457,7 +457,7 @@ class ReaderViewModel @JvmOverloads constructor( val isNextChapterDownloaded = downloadManager.isChapterDownloaded( nextChapter.name, nextChapter.scanlator, - manga.title, + manga.ogTitle, manga.source, ) if (!isNextChapterDownloaded) return@launchIO @@ -719,7 +719,7 @@ class ReaderViewModel @JvmOverloads constructor( val chapter = page.chapter.chapter val filenameSuffix = " - ${page.number}" return DiskUtil.buildValidFilename( - "${manga.title} - ${chapter.name}".takeBytes(DiskUtil.MAX_FILE_NAME_BYTES - filenameSuffix.byteSize()), + "${manga.ogTitle} - ${chapter.name}".takeBytes(DiskUtil.MAX_FILE_NAME_BYTES - filenameSuffix.byteSize()), ) + filenameSuffix } @@ -773,7 +773,7 @@ class ReaderViewModel @JvmOverloads constructor( // Pictures directory. val relativePath = if (readerPreferences.folderPerManga().get()) { DiskUtil.buildValidFilename( - manga.title, + manga.ogTitle, ) } else { "" diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ChapterLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ChapterLoader.kt index 1cd18bcebe..7ec6a13be4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ChapterLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ChapterLoader.kt @@ -80,7 +80,7 @@ class ChapterLoader( val isDownloaded = downloadManager.isChapterDownloaded( dbChapter.name, dbChapter.scanlator, - manga.title, + manga.ogTitle, manga.source, skipCache = true, ) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/DownloadPageLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/DownloadPageLoader.kt index abef28540c..4437c5e1bb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/DownloadPageLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/DownloadPageLoader.kt @@ -33,7 +33,7 @@ internal class DownloadPageLoader( override suspend fun getPages(): List { val dbChapter = chapter.chapter - val chapterPath = downloadProvider.findChapterDir(dbChapter.name, dbChapter.scanlator, manga.title, source) + val chapterPath = downloadProvider.findChapterDir(dbChapter.name, dbChapter.scanlator, manga.ogTitle, source) return if (chapterPath?.isFile == true) { getPagesFromArchive(chapterPath) } else { diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterFilterDownloaded.kt b/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterFilterDownloaded.kt index 0f489f2f5a..f5debc01cb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterFilterDownloaded.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterFilterDownloaded.kt @@ -15,5 +15,5 @@ fun List.filterDownloaded(manga: Manga): List { val downloadCache: DownloadCache = Injekt.get() - return filter { downloadCache.isChapterDownloaded(it.name, it.scanlator, manga.title, manga.source, false) } + return filter { downloadCache.isChapterDownloaded(it.name, it.scanlator, manga.ogTitle, manga.source, false) } } diff --git a/domain/src/main/java/tachiyomi/domain/manga/interactor/GetDuplicateLibraryManga.kt b/domain/src/main/java/tachiyomi/domain/manga/interactor/GetDuplicateLibraryManga.kt index df5cec44a7..bc11657668 100644 --- a/domain/src/main/java/tachiyomi/domain/manga/interactor/GetDuplicateLibraryManga.kt +++ b/domain/src/main/java/tachiyomi/domain/manga/interactor/GetDuplicateLibraryManga.kt @@ -8,6 +8,6 @@ class GetDuplicateLibraryManga( ) { suspend fun await(manga: Manga): List { - return mangaRepository.getDuplicateLibraryManga(manga.id, manga.title.lowercase()) + return mangaRepository.getDuplicateLibraryManga(manga.id, manga.ogTitle.lowercase()) } } diff --git a/domain/src/main/java/tachiyomi/domain/manga/interactor/NetworkToLocalManga.kt b/domain/src/main/java/tachiyomi/domain/manga/interactor/NetworkToLocalManga.kt index 24b40e5306..7a423a4932 100644 --- a/domain/src/main/java/tachiyomi/domain/manga/interactor/NetworkToLocalManga.kt +++ b/domain/src/main/java/tachiyomi/domain/manga/interactor/NetworkToLocalManga.kt @@ -17,7 +17,7 @@ class NetworkToLocalManga( !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.copy(ogTitle = manga.title) + localManga.copy(ogTitle = manga.ogTitle) } else -> { localManga From 516fa4f50c5374a6b347547715df8b34b0db23ef Mon Sep 17 00:00:00 2001 From: Splintor Date: Fri, 16 Feb 2024 17:48:34 +0200 Subject: [PATCH 07/15] Used original or new fields when needed --- .../data/backup/restore/restorers/MangaRestorer.kt | 6 +++--- .../java/eu/kanade/tachiyomi/ui/download/DownloadHolder.kt | 2 +- .../java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt | 7 ++++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/MangaRestorer.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/MangaRestorer.kt index ea50107411..e6e8cff514 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/MangaRestorer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/MangaRestorer.kt @@ -93,9 +93,9 @@ class MangaRestorer( private fun Manga.copyFrom(newer: Manga): Manga { return this.copy( favorite = this.favorite || newer.favorite, - ogAuthor = newer.author, - ogArtist = newer.artist, - ogDescription = newer.description, + ogAuthor = newer.ogAuthor, + ogArtist = newer.ogArtist, + ogDescription = newer.ogDescription, genre = newer.genre, thumbnailUrl = newer.thumbnailUrl, status = newer.status, diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadHolder.kt index 9686bfd5bc..514357d658 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadHolder.kt @@ -38,7 +38,7 @@ class DownloadHolder(private val view: View, val adapter: DownloadAdapter) : binding.chapterTitle.text = download.chapter.name // Update the manga title - binding.mangaFullTitle.text = download.manga.ogTitle + binding.mangaFullTitle.text = download.manga.title // Update the progress bar and the number of downloaded pages val pages = download.pages diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt index 4ffd656312..cc7b722a32 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt @@ -405,7 +405,12 @@ class MangaScreenModel( updateSuccessState { successState -> successState.copy( - manga = manga + manga = manga.copy( + editedTitle = newTitle, + editedAuthor = newAuthor, + editedArtist = newArtist, + editedDescription = newDescription, + ) ) } } From 06e199ba822b2e7abc3d0a6c8e9e862291a80d3a Mon Sep 17 00:00:00 2001 From: Splintor Date: Fri, 16 Feb 2024 17:49:21 +0200 Subject: [PATCH 08/15] Disabled edit info for local sources --- app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt index 8e448ce24d..f8835430a3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt @@ -62,6 +62,7 @@ import tachiyomi.domain.chapter.model.Chapter import tachiyomi.domain.manga.model.Manga import tachiyomi.i18n.MR import tachiyomi.presentation.core.screens.LoadingScreen +import tachiyomi.source.local.LocalSource class MangaScreen( private val mangaId: Long, @@ -149,7 +150,7 @@ class MangaScreen( onEditFetchIntervalClicked = screenModel::showSetFetchIntervalDialog.takeIf { successState.manga.favorite }, - onEditInfoClicked = screenModel::showEditInfoDialog.takeIf { successState.manga.favorite }, + onEditInfoClicked = screenModel::showEditInfoDialog.takeIf { successState.manga.favorite && successState.manga.source != LocalSource.ID }, onMigrateClicked = { navigator.push(MigrateSearchScreen(successState.manga.id)) }.takeIf { successState.manga.favorite }, From d892e2d3f557cf75f0cb316f142a8ba1e339c199 Mon Sep 17 00:00:00 2001 From: Splintor Date: Fri, 16 Feb 2024 17:49:47 +0200 Subject: [PATCH 09/15] Removed unneeded transaction --- data/src/main/java/tachiyomi/data/manga/MangaRepositoryImpl.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/src/main/java/tachiyomi/data/manga/MangaRepositoryImpl.kt b/data/src/main/java/tachiyomi/data/manga/MangaRepositoryImpl.kt index 825f6c726f..01b4b10be2 100644 --- a/data/src/main/java/tachiyomi/data/manga/MangaRepositoryImpl.kt +++ b/data/src/main/java/tachiyomi/data/manga/MangaRepositoryImpl.kt @@ -161,7 +161,7 @@ class MangaRepositoryImpl( } override suspend fun updateEditedInfo(update: MangaUpdate) : Boolean { - handler.await(inTransaction = true) { + handler.await { mangasQueries.updateMangaEdit( artist = update.artist, author = update.author, From 429fac156e354e5ea07e88d7c50c16aa76d8e161 Mon Sep 17 00:00:00 2001 From: Splintor Date: Fri, 16 Feb 2024 17:50:11 +0200 Subject: [PATCH 10/15] Removed unneeded reference to table --- data/src/main/sqldelight/tachiyomi/data/mangas.sq | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/src/main/sqldelight/tachiyomi/data/mangas.sq b/data/src/main/sqldelight/tachiyomi/data/mangas.sq index 5e06d04cec..c7773fde8d 100644 --- a/data/src/main/sqldelight/tachiyomi/data/mangas.sq +++ b/data/src/main/sqldelight/tachiyomi/data/mangas.sq @@ -55,7 +55,7 @@ END; getMangaById: SELECT * FROM mangas -WHERE mangas._id = :id; +WHERE _id = :id; -- TODO: this should ideally never really have more than 1 result getMangaByUrlAndSource: From 14c2f34f0c5ad3e32e2d2313fd919e4fb67f7059 Mon Sep 17 00:00:00 2001 From: Splintor Date: Fri, 16 Feb 2024 18:06:32 +0200 Subject: [PATCH 11/15] Formatted for detekt --- .../chapter/interactor/SyncChaptersWithSource.kt | 7 ++++++- .../kanade/domain/manga/interactor/UpdateManga.kt | 1 - .../presentation/manga/components/MangaDialogs.kt | 14 ++++++++------ .../eu/kanade/tachiyomi/ui/manga/MangaScreen.kt | 4 +++- config/detekt/baseline.xml | 4 ++++ 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/eu/kanade/domain/chapter/interactor/SyncChaptersWithSource.kt b/app/src/main/java/eu/kanade/domain/chapter/interactor/SyncChaptersWithSource.kt index aa9a739e19..9e2ea85718 100644 --- a/app/src/main/java/eu/kanade/domain/chapter/interactor/SyncChaptersWithSource.kt +++ b/app/src/main/java/eu/kanade/domain/chapter/interactor/SyncChaptersWithSource.kt @@ -92,7 +92,12 @@ class SyncChaptersWithSource( } // Recognize chapter number for the chapter. - val chapterNumber = ChapterRecognition.parseChapterNumber(manga.ogTitle, chapter.name, chapter.chapterNumber) + val chapterNumber = ChapterRecognition.parseChapterNumber( + manga.ogTitle, + chapter.name, + chapter.chapterNumber + ) + chapter = chapter.copy(chapterNumber = chapterNumber) val dbChapter = dbChapters.find { it.url == chapter.url } diff --git a/app/src/main/java/eu/kanade/domain/manga/interactor/UpdateManga.kt b/app/src/main/java/eu/kanade/domain/manga/interactor/UpdateManga.kt index 7bef7e4429..368a5d2ac1 100644 --- a/app/src/main/java/eu/kanade/domain/manga/interactor/UpdateManga.kt +++ b/app/src/main/java/eu/kanade/domain/manga/interactor/UpdateManga.kt @@ -105,7 +105,6 @@ class UpdateManga( } suspend fun awaitUpdateEditInfo(mangaUpdate: MangaUpdate): Boolean { - return mangaRepository.updateEditedInfo(mangaUpdate) } } diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt index 97edab39cb..439934db20 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt @@ -161,12 +161,14 @@ fun EditInfoDialog( onConfirm: (manga: Manga) -> Unit, ) { var editedManga by remember { - mutableStateOf(manga.copy( - editedTitle = manga.editedTitle ?: manga.title, - editedAuthor = manga.editedAuthor ?: manga.author, - editedArtist = manga.editedArtist ?: manga.artist, - editedDescription = manga.editedDescription ?: manga.description, - )) + mutableStateOf( + manga.copy( + editedTitle = manga.editedTitle ?: manga.title, + editedAuthor = manga.editedAuthor ?: manga.author, + editedArtist = manga.editedArtist ?: manga.artist, + editedDescription = manga.editedDescription ?: manga.description, + ) + ) } AlertDialog( diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt index f8835430a3..969920c6da 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt @@ -150,7 +150,9 @@ class MangaScreen( onEditFetchIntervalClicked = screenModel::showSetFetchIntervalDialog.takeIf { successState.manga.favorite }, - onEditInfoClicked = screenModel::showEditInfoDialog.takeIf { successState.manga.favorite && successState.manga.source != LocalSource.ID }, + onEditInfoClicked = screenModel::showEditInfoDialog.takeIf { + successState.manga.favorite && successState.manga.source != LocalSource.ID + }, onMigrateClicked = { navigator.push(MigrateSearchScreen(successState.manga.id)) }.takeIf { successState.manga.favorite }, diff --git a/config/detekt/baseline.xml b/config/detekt/baseline.xml index 1845cae53c..69a0debcbb 100644 --- a/config/detekt/baseline.xml +++ b/config/detekt/baseline.xml @@ -410,6 +410,10 @@ MagicNumber:BackupManga.kt$BackupManga$7 MagicNumber:BackupManga.kt$BackupManga$8 MagicNumber:BackupManga.kt$BackupManga$9 + MagicNumber:BackupManga.kt$BackupManga$800 + MagicNumber:BackupManga.kt$BackupManga$801 + MagicNumber:BackupManga.kt$BackupManga$802 + MagicNumber:BackupManga.kt$BackupManga$804 MagicNumber:BackupPreferences.kt$BackupPreferences$12 MagicNumber:BackupTracking.kt$BackupTracking$10 MagicNumber:BackupTracking.kt$BackupTracking$100 From 27110a4f675ed7b8647ec6eaba3d4ff6aa8d7bc5 Mon Sep 17 00:00:00 2001 From: Splintor <55398298+Splintorien@users.noreply.github.com> Date: Fri, 16 Feb 2024 18:15:40 +0200 Subject: [PATCH 12/15] Changed comment for the magic numbers of the edited fields Co-authored-by: Mitchell Syer --- .../java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt index 354ff95855..8ef7f91450 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt @@ -39,7 +39,8 @@ data class BackupManga( @ProtoNumber(106) var lastModifiedAt: Long = 0, @ProtoNumber(107) var favoriteModifiedAt: Long? = null, @ProtoNumber(108) var excludedScanlators: List = emptyList(), - // Bump to 800 like the forks did + // Numbers to keep compatibility with fork edited manga fields + // https://github.com/jobobby04/TachiyomiSY/blob/7e151ddb83d5d7e0ea553eca686a8c4aa3a1fa8c/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt#L49 @ProtoNumber(800) var editedTitle: String? = null, @ProtoNumber(801) var editedArtist: String? = null, @ProtoNumber(802) var editedAuthor: String? = null, From f0227337efaf3c3f568fcd84a72562508efd6cdf Mon Sep 17 00:00:00 2001 From: Splintor Date: Fri, 16 Feb 2024 18:26:27 +0200 Subject: [PATCH 13/15] Removed trailing space --- .../java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt index 8ef7f91450..c55575f921 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt @@ -39,7 +39,7 @@ data class BackupManga( @ProtoNumber(106) var lastModifiedAt: Long = 0, @ProtoNumber(107) var favoriteModifiedAt: Long? = null, @ProtoNumber(108) var excludedScanlators: List = emptyList(), - // Numbers to keep compatibility with fork edited manga fields + // Numbers to keep compatibility with fork edited manga fields // https://github.com/jobobby04/TachiyomiSY/blob/7e151ddb83d5d7e0ea553eca686a8c4aa3a1fa8c/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt#L49 @ProtoNumber(800) var editedTitle: String? = null, @ProtoNumber(801) var editedArtist: String? = null, From 4b5b46483b6aa9abb05620b8b5445e5d4c7eabfc Mon Sep 17 00:00:00 2001 From: Splintor Date: Fri, 16 Feb 2024 23:15:58 +0200 Subject: [PATCH 14/15] Renamed edited fields to custom --- .../manga/components/MangaDialogs.kt | 24 +++++++------- .../create/creators/MangaBackupCreator.kt | 8 ++--- .../data/backup/models/BackupManga.kt | 16 +++++----- .../tachiyomi/ui/manga/MangaScreenModel.kt | 16 +++++----- .../java/tachiyomi/data/manga/MangaMapper.kt | 32 +++++++++---------- .../main/sqldelight/tachiyomi/data/mangas.sq | 16 +++++----- .../sqldelight/tachiyomi/migrations/2.sqm | 8 ++--- .../tachiyomi/domain/manga/model/Manga.kt | 24 +++++++------- 8 files changed, 72 insertions(+), 72 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt index 439934db20..f2258ee970 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt @@ -163,10 +163,10 @@ fun EditInfoDialog( var editedManga by remember { mutableStateOf( manga.copy( - editedTitle = manga.editedTitle ?: manga.title, - editedAuthor = manga.editedAuthor ?: manga.author, - editedArtist = manga.editedArtist ?: manga.artist, - editedDescription = manga.editedDescription ?: manga.description, + customTitle = manga.customTitle ?: manga.title, + customAuthor = manga.customAuthor ?: manga.author, + customArtist = manga.customArtist ?: manga.artist, + customDescription = manga.customDescription ?: manga.description, ) ) } @@ -183,33 +183,33 @@ fun EditInfoDialog( .verticalScroll(rememberScrollState()), ) { OutlinedTextField( - value = editedManga.editedTitle.orEmpty(), + value = editedManga.customTitle.orEmpty(), onValueChange = { - editedManga = editedManga.copy(editedTitle = it) + editedManga = editedManga.copy(customTitle = it) }, label = { Text(text = stringResource(MR.strings.title)) }, ) OutlinedTextField( - value = editedManga.editedAuthor.orEmpty(), + value = editedManga.customAuthor.orEmpty(), onValueChange = { - editedManga = editedManga.copy(editedAuthor = it) + editedManga = editedManga.copy(customAuthor = it) }, label = { Text(text = stringResource(MR.strings.author)) }, ) OutlinedTextField( - value = editedManga.editedArtist.orEmpty(), + value = editedManga.customArtist.orEmpty(), onValueChange = { - editedManga = editedManga.copy(editedArtist = it) + editedManga = editedManga.copy(customArtist = it) }, label = { Text(text = stringResource(MR.strings.artist)) }, ) OutlinedTextField( - value = editedManga.editedDescription.orEmpty(), + value = editedManga.customDescription.orEmpty(), onValueChange = { - editedManga = editedManga.copy(editedDescription = it) + editedManga = editedManga.copy(customDescription = it) }, label = { Text(text = stringResource(MR.strings.description)) }, ) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/create/creators/MangaBackupCreator.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/create/creators/MangaBackupCreator.kt index 2a92446d2a..663e77c711 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/create/creators/MangaBackupCreator.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/create/creators/MangaBackupCreator.kt @@ -98,8 +98,8 @@ private fun Manga.toBackupManga() = updateStrategy = this.updateStrategy, lastModifiedAt = this.lastModifiedAt, favoriteModifiedAt = this.favoriteModifiedAt, - editedArtist = this.editedArtist, - editedAuthor = this.editedAuthor, - editedTitle = this.editedTitle, - editedDescription = this.editedDescription, + customArtist = this.customArtist, + customAuthor = this.customAuthor, + customTitle = this.customTitle, + customDescription = this.customDescription, ) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt index c55575f921..c953c76ec5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt @@ -41,10 +41,10 @@ data class BackupManga( @ProtoNumber(108) var excludedScanlators: List = emptyList(), // Numbers to keep compatibility with fork edited manga fields // https://github.com/jobobby04/TachiyomiSY/blob/7e151ddb83d5d7e0ea553eca686a8c4aa3a1fa8c/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt#L49 - @ProtoNumber(800) var editedTitle: String? = null, - @ProtoNumber(801) var editedArtist: String? = null, - @ProtoNumber(802) var editedAuthor: String? = null, - @ProtoNumber(804) var editedDescription: String? = null, + @ProtoNumber(800) var customTitle: String? = null, + @ProtoNumber(801) var customArtist: String? = null, + @ProtoNumber(802) var customAuthor: String? = null, + @ProtoNumber(804) var customDescription: String? = null, ) { fun getMangaImpl(): Manga { return Manga.create().copy( @@ -64,10 +64,10 @@ data class BackupManga( updateStrategy = this@BackupManga.updateStrategy, lastModifiedAt = this@BackupManga.lastModifiedAt, favoriteModifiedAt = this@BackupManga.favoriteModifiedAt, - editedTitle = this@BackupManga.editedTitle, - editedArtist = this@BackupManga.editedArtist, - editedAuthor = this@BackupManga.editedAuthor, - editedDescription = this@BackupManga.editedDescription, + customTitle = this@BackupManga.customTitle, + customArtist = this@BackupManga.customArtist, + customAuthor = this@BackupManga.customAuthor, + customDescription = this@BackupManga.customDescription, ) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt index cc7b722a32..1d74fee908 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt @@ -386,10 +386,10 @@ class MangaScreenModel( fun updateMangaInfo( manga: Manga, ) { - val newTitle = if (manga.editedTitle.isNullOrBlank()) null else manga.editedTitle - val newAuthor = if (manga.editedAuthor.isNullOrBlank()) null else manga.editedAuthor - val newArtist = if (manga.editedArtist.isNullOrBlank()) null else manga.editedArtist - val newDescription = if (manga.editedDescription.isNullOrBlank()) null else manga.editedDescription + val newTitle = if (manga.customTitle.isNullOrBlank()) null else manga.customTitle + val newAuthor = if (manga.customAuthor.isNullOrBlank()) null else manga.customAuthor + val newArtist = if (manga.customArtist.isNullOrBlank()) null else manga.customArtist + val newDescription = if (manga.customDescription.isNullOrBlank()) null else manga.customDescription screenModelScope.launchNonCancellable { updateManga.awaitUpdateEditInfo( @@ -406,10 +406,10 @@ class MangaScreenModel( updateSuccessState { successState -> successState.copy( manga = manga.copy( - editedTitle = newTitle, - editedAuthor = newAuthor, - editedArtist = newArtist, - editedDescription = newDescription, + customTitle = newTitle, + customAuthor = newAuthor, + customArtist = newArtist, + customDescription = newDescription, ) ) } diff --git a/data/src/main/java/tachiyomi/data/manga/MangaMapper.kt b/data/src/main/java/tachiyomi/data/manga/MangaMapper.kt index ac31ecc2f0..15b8edc8b7 100644 --- a/data/src/main/java/tachiyomi/data/manga/MangaMapper.kt +++ b/data/src/main/java/tachiyomi/data/manga/MangaMapper.kt @@ -28,10 +28,10 @@ object MangaMapper { calculateInterval: Long, lastModifiedAt: Long, favoriteModifiedAt: Long?, - editedArtist: String?, - editedAuthor: String?, - editedDescription: String?, - editedTitle: String?, + customArtist: String?, + customAuthor: String?, + customDescription: String?, + customTitle: String?, ): Manga = Manga( id = id, source = source, @@ -55,10 +55,10 @@ object MangaMapper { initialized = initialized, lastModifiedAt = lastModifiedAt, favoriteModifiedAt = favoriteModifiedAt, - editedArtist = editedArtist, - editedAuthor = editedAuthor, - editedDescription = editedDescription, - editedTitle = editedTitle, + customArtist = customArtist, + customAuthor = customAuthor, + customDescription = customDescription, + customTitle = customTitle, ) fun mapLibraryManga( @@ -84,10 +84,10 @@ object MangaMapper { calculateInterval: Long, lastModifiedAt: Long, favoriteModifiedAt: Long?, - editedArtist: String?, - editedAuthor: String?, - editedDescription: String?, - editedTitle: String?, + customArtist: String?, + customAuthor: String?, + customDescription: String?, + customTitle: String?, totalCount: Long, readCount: Double, latestUpload: Long, @@ -119,10 +119,10 @@ object MangaMapper { calculateInterval, lastModifiedAt, favoriteModifiedAt, - editedArtist, - editedAuthor, - editedDescription, - editedTitle, + customArtist, + customAuthor, + customDescription, + customTitle, ), category = category, totalChapters = totalCount, diff --git a/data/src/main/sqldelight/tachiyomi/data/mangas.sq b/data/src/main/sqldelight/tachiyomi/data/mangas.sq index c7773fde8d..7931dcb472 100644 --- a/data/src/main/sqldelight/tachiyomi/data/mangas.sq +++ b/data/src/main/sqldelight/tachiyomi/data/mangas.sq @@ -26,10 +26,10 @@ CREATE TABLE mangas( calculate_interval INTEGER DEFAULT 0 NOT NULL, last_modified_at INTEGER NOT NULL DEFAULT 0, favorite_modified_at INTEGER, - edited_artist TEXT, - edited_author TEXT, - edited_description TEXT, - edited_title TEXT + custom_artist TEXT, + custom_author TEXT, + custom_description TEXT, + custom_title TEXT ); CREATE INDEX library_favorite_index ON mangas(favorite) WHERE favorite = 1; @@ -151,8 +151,8 @@ SELECT last_insert_rowid(); updateMangaEdit: UPDATE mangas SET - edited_artist = :artist, - edited_author = :author, - edited_description = :description, - edited_title = :title + custom_artist = :artist, + custom_author = :author, + custom_description = :description, + custom_title = :title WHERE _id = :mangaId; diff --git a/data/src/main/sqldelight/tachiyomi/migrations/2.sqm b/data/src/main/sqldelight/tachiyomi/migrations/2.sqm index 3156bd2239..4a9db401f6 100644 --- a/data/src/main/sqldelight/tachiyomi/migrations/2.sqm +++ b/data/src/main/sqldelight/tachiyomi/migrations/2.sqm @@ -1,6 +1,6 @@ -- Add the manga edited info and the new function -- -ALTER TABLE mangas ADD COLUMN edited_artist TEXT; -ALTER TABLE mangas ADD COLUMN edited_author TEXT; -ALTER TABLE mangas ADD COLUMN edited_description TEXT; -ALTER TABLE mangas ADD COLUMN edited_title TEXT; +ALTER TABLE mangas ADD COLUMN custom_artist TEXT; +ALTER TABLE mangas ADD COLUMN custom_author TEXT; +ALTER TABLE mangas ADD COLUMN custom_description TEXT; +ALTER TABLE mangas ADD COLUMN custom_title TEXT; diff --git a/domain/src/main/java/tachiyomi/domain/manga/model/Manga.kt b/domain/src/main/java/tachiyomi/domain/manga/model/Manga.kt index 09ba5313eb..fa8342a82a 100644 --- a/domain/src/main/java/tachiyomi/domain/manga/model/Manga.kt +++ b/domain/src/main/java/tachiyomi/domain/manga/model/Manga.kt @@ -29,22 +29,22 @@ data class Manga( val initialized: Boolean, val lastModifiedAt: Long, val favoriteModifiedAt: Long?, - val editedArtist: String?, - val editedAuthor: String?, - val editedDescription: String?, - val editedTitle: String?, + val customArtist: String?, + val customAuthor: String?, + val customDescription: String?, + val customTitle: String?, ) : Serializable { val title: String - get() = editedTitle ?: ogTitle + get() = customTitle ?: ogTitle val author: String? - get() = editedAuthor ?: ogAuthor + get() = customAuthor ?: ogAuthor val artist: String? - get() = editedArtist ?: ogArtist + get() = customArtist ?: ogArtist val description: String? - get() = editedDescription ?: ogDescription + get() = customDescription ?: ogDescription val expectedNextUpdate: Instant? get() = nextUpdate @@ -118,7 +118,7 @@ data class Manga( id = -1L, url = "", ogTitle = "", - editedTitle = null, + customTitle = null, source = -1L, favorite = false, lastUpdate = 0L, @@ -129,11 +129,11 @@ data class Manga( chapterFlags = 0L, coverLastModified = 0L, ogArtist = null, - editedArtist = null, + customArtist = null, ogAuthor = null, - editedAuthor = null, + customAuthor = null, ogDescription = null, - editedDescription = null, + customDescription = null, genre = null, status = 0L, thumbnailUrl = null, From 925132da38c601f9c98caab7b5370eaeca5c0198 Mon Sep 17 00:00:00 2001 From: Splintor Date: Fri, 16 Feb 2024 23:16:11 +0200 Subject: [PATCH 15/15] Fixed CI detekt errors --- data/src/main/java/tachiyomi/data/manga/MangaMapper.kt | 2 ++ data/src/main/java/tachiyomi/data/manga/MangaRepositoryImpl.kt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/data/src/main/java/tachiyomi/data/manga/MangaMapper.kt b/data/src/main/java/tachiyomi/data/manga/MangaMapper.kt index 15b8edc8b7..b2ffb1b5b5 100644 --- a/data/src/main/java/tachiyomi/data/manga/MangaMapper.kt +++ b/data/src/main/java/tachiyomi/data/manga/MangaMapper.kt @@ -5,6 +5,7 @@ import tachiyomi.domain.library.model.LibraryManga import tachiyomi.domain.manga.model.Manga object MangaMapper { + @Suppress("LongParameterList") fun mapManga( id: Long, source: Long, @@ -61,6 +62,7 @@ object MangaMapper { customTitle = customTitle, ) + @Suppress("LongParameterList") fun mapLibraryManga( id: Long, source: Long, diff --git a/data/src/main/java/tachiyomi/data/manga/MangaRepositoryImpl.kt b/data/src/main/java/tachiyomi/data/manga/MangaRepositoryImpl.kt index 01b4b10be2..82ca86be33 100644 --- a/data/src/main/java/tachiyomi/data/manga/MangaRepositoryImpl.kt +++ b/data/src/main/java/tachiyomi/data/manga/MangaRepositoryImpl.kt @@ -160,7 +160,7 @@ class MangaRepositoryImpl( } } - override suspend fun updateEditedInfo(update: MangaUpdate) : Boolean { + override suspend fun updateEditedInfo(update: MangaUpdate): Boolean { handler.await { mangasQueries.updateMangaEdit( artist = update.artist,