bugfix: Since syncing is cross-device we need to take read status from backup.

I fixed this before but I believe it slipped past while refactoring and splitting into smaller PR, This fixes the unread chapter so if a device have unread chapters or user marked it as unread it should restore it properly now.

Signed-off-by: KaiserBh <kaiserbh@proton.me>
This commit is contained in:
KaiserBh 2023-08-03 15:42:10 +10:00
parent 96a767aa0c
commit fdc85bd314
No known key found for this signature in database
GPG Key ID: 14D73B142042BBA9

View File

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