Fix SetMangaViewerFlags (#8719)

Stop clearing old viewer flags when setting a flag
This commit is contained in:
Two-Ai 2022-12-11 16:12:41 -05:00 committed by GitHub
parent 3ede42252c
commit 171db639ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,19 +10,21 @@ class SetMangaViewerFlags(
) { ) {
suspend fun awaitSetMangaReadingMode(id: Long, flag: Long) { suspend fun awaitSetMangaReadingMode(id: Long, flag: Long) {
val manga = mangaRepository.getMangaById(id)
mangaRepository.update( mangaRepository.update(
MangaUpdate( MangaUpdate(
id = id, id = id,
viewerFlags = flag.setFlag(flag, ReadingModeType.MASK.toLong()), viewerFlags = manga.viewerFlags.setFlag(flag, ReadingModeType.MASK.toLong()),
), ),
) )
} }
suspend fun awaitSetOrientationType(id: Long, flag: Long) { suspend fun awaitSetOrientationType(id: Long, flag: Long) {
val manga = mangaRepository.getMangaById(id)
mangaRepository.update( mangaRepository.update(
MangaUpdate( MangaUpdate(
id = id, id = id,
viewerFlags = flag.setFlag(flag, OrientationType.MASK.toLong()), viewerFlags = manga.viewerFlags.setFlag(flag, OrientationType.MASK.toLong()),
), ),
) )
} }