refactor: make sure the read status is taken from backup.

This way it will mark chapters as unread if it's not read and vice versa.

Signed-off-by: KaiserBh <kaiserbh@proton.me>
This commit is contained in:
KaiserBh 2023-10-11 23:23:34 +11:00
parent 2747e15953
commit 6c4f1184cb
No known key found for this signature in database
GPG Key ID: 14D73B142042BBA9

View File

@ -292,8 +292,8 @@ class BackupRestorer(
if (dbChapter != null) { if (dbChapter != null) {
updatedChapter = updatedChapter.copy(id = dbChapter._id) updatedChapter = updatedChapter.copy(id = dbChapter._id)
updatedChapter = updatedChapter.copyFrom(dbChapter) updatedChapter = updatedChapter.copyFrom(dbChapter)
if (dbChapter.read && !updatedChapter.read) { if (dbChapter.read != chapter.read) {
updatedChapter = updatedChapter.copy(read = true, lastPageRead = dbChapter.last_page_read) updatedChapter = updatedChapter.copy(read = chapter.read, lastPageRead = chapter.lastPageRead)
} else if (updatedChapter.lastPageRead == 0L && dbChapter.last_page_read != 0L) { } else if (updatedChapter.lastPageRead == 0L && dbChapter.last_page_read != 0L) {
updatedChapter = updatedChapter.copy(lastPageRead = dbChapter.last_page_read) updatedChapter = updatedChapter.copy(lastPageRead = dbChapter.last_page_read)
} }