Fix Novelight current-chapter number shown on the library card#74
Merged
Conversation
The library card renders the stored currentChapter, which for Novelight was
written from the /book/chapter/{id} URL and so showed the internal id (e.g.
141313) instead of the chapter number. WEB reading never rewrites it. When the
reader loads the authoritative chapter list, rewrite the stored label's number
to the real one for the current chapter, keeping whatever prefix it uses.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #73. The library card and the continue-reading progress show the stored
currentChaptervalue. For Novelight that value was written from the/book/chapter/{id}reading URL, where the id is not the chapter number, so the card showed the id (for example 141313) instead of the real chapter number. WEB reading never rewritescurrentChapter, so it stayed wrong.When the reader loads the authoritative chapter list, it now rewrites the current chapter's stored number to the real one from the list, keeping whatever prefix the label already used ("Chapter 141313" becomes "Chapter 102", "141313" becomes "102"). It only touches entries whose number is actually wrong, so the other sources are unaffected, and it heals in place as you open each chapter.
Added unit tests for the heal helper. The usual check passes (unit tests, detekt, both build flavors). Verified on device.