Add user manga notes (#428)

Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
This commit is contained in:
kunet
2025-03-29 17:18:38 -04:00
committed by GitHub
parent 132d77aa99
commit 8fbe630308
26 changed files with 596 additions and 16 deletions
@@ -30,6 +30,7 @@ object MigrationFlags {
private const val CATEGORIES = 0b00010
private const val CUSTOM_COVER = 0b01000
private const val DELETE_DOWNLOADED = 0b10000
private const val NOTES = 0b100000
private val coverCache: CoverCache by injectLazy()
private val downloadCache: DownloadCache by injectLazy()
@@ -50,6 +51,10 @@ object MigrationFlags {
return value and DELETE_DOWNLOADED != 0
}
fun hasNotes(value: Int): Boolean {
return value and NOTES != 0
}
/** Returns information about applicable flags with default selections. */
fun getFlags(manga: Manga?, defaultSelectedBitMap: Int): List<MigrationFlag> {
val flags = mutableListOf<MigrationFlag>()
@@ -63,6 +68,9 @@ object MigrationFlags {
if (downloadCache.getDownloadCount(manga) > 0) {
flags += MigrationFlag.create(DELETE_DOWNLOADED, defaultSelectedBitMap, MR.strings.delete_downloaded)
}
if (manga.notes.isNotBlank()) {
flags += MigrationFlag.create(NOTES, defaultSelectedBitMap, MR.strings.action_notes)
}
}
return flags
}
@@ -213,6 +213,7 @@ internal class MigrateDialogScreenModel(
val migrateCategories = MigrationFlags.hasCategories(flags)
val migrateCustomCover = MigrationFlags.hasCustomCover(flags)
val deleteDownloaded = MigrationFlags.hasDeleteDownloaded(flags)
val migrateNotes = MigrationFlags.hasNotes(flags)
try {
syncChaptersWithSource.await(sourceChapters, newManga, newSource)
@@ -299,6 +300,7 @@ internal class MigrateDialogScreenModel(
chapterFlags = oldManga.chapterFlags,
viewerFlags = oldManga.viewerFlags,
dateAdded = if (replace) oldManga.dateAdded else Instant.now().toEpochMilli(),
notes = if (migrateNotes) oldManga.notes else null,
),
)
}