Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed last read not updating and bookmark button in reader mode. #1368

Merged
merged 5 commits into from
Jan 13, 2025

Conversation

jacksin125
Copy link
Contributor

@jacksin125 jacksin125 commented Dec 28, 2024

Previously, the bookmark button in the reader top bar would always reset to whatever the status was when you first opened the chapter. Additionally, if you read part of a chapter or bookmarked a chapter, left reader mode, then pressed the "continue reading" button to get back to where you left off, the bookmark status and reading progress would not have been saved like if you opened the chapter via the list.

I tried to make the least intrusive changes I could, since the core problem with the "continue reading" bug is that state variables are not updated, and instead changes are directly saved to the database in other sections. The best solution would require rewriting a good section of the codebase.

If changes are necessary, please let me know.

orionduffy and others added 5 commits December 23, 2024 13:12
The lastRead chapter object that the "Continue Reading" button uses for everything is now updated on entering and leaving the chapter, instead of never updating when information changes.
Done by passing the bookmark state down from the parent.
More thorough testing revealed that lastRead did not update properly on chapter switch
The original fix caused a new bug when changing chapters, and fixing that caused some of the old bugs to return. It should now be completely fixed.
@nyagami
Copy link
Member

nyagami commented Dec 29, 2024

Hi, could you provide steps or related issues for the bookmark button in the reader top bar would always reset to whatever the status

@jacksin125
Copy link
Contributor Author

  1. Open a chapter in the reader. You might need to use the continue reading button, but I don't think you do.
  2. Tap the screen so the top and bottom bar appear.
  3. Tap the bookmark button in the top right to change the bookmark status.
  4. Tap the screen so the top and bottom bar disappear.
  5. Make the top and bottom bar appear again, the bookmark icon will have reset.

This issue is caused due to the bookmark status being reset based on the chapter state variable every time the bar is reopened. However, the chapter state variable is used throughout so much of this section of the app that changing it forces a complete reload of the reader. So, I just moved the code up to the reader itself and passed the relevant variables to the reader bar, so they are not affected by the reader bar reopening.

@Palloxin
Copy link
Contributor

I once reported the same bug, and was fixed. It came back it appears #676

@nyagami
Copy link
Member

nyagami commented Jan 4, 2025

try using setChapter from useChapterContext in ReaderAppbar to update chapter state instead. bookmarked state is no longer neccessary

@jacksin125
Copy link
Contributor Author

jacksin125 commented Jan 4, 2025

try using setChapter from useChapterContext in ReaderAppbar to update chapter state instead. bookmarked state is no longer neccessary

I tried this, but due to where and how the chapter state is used, updating it forces a full reload of the reader and a refetch of the chapter. All the truly good solutions would require changing quite a bit more of the codebase to work properly, this was the best solution I came up with to avoid having to completely change how things are done in other sections just to fix a single bug.

@nyagami nyagami merged commit 430a067 into LNReader:master Jan 13, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants