A fork of https://github.com/crosspoint-reader/crosspoint-reader
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: Adjust Navigation at End of Book (#1425)

## Summary

* **What is the goal of this PR? (e.g., Implements the new feature for
file uploading.)**
Currently, pressing forward at the end of a book loops back to the last
page. This change will instead sends you to the home page instead.

* **What changes are included?**
Applies the change to the three supported format: EPUB, XTC, TXT

## Additional Context

* This is more of a QOL improvement than a new feature. If there's
interest, we could extend this to track a completed state for ebooks.

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? _**YES**_

authored by

nscheung and committed by
GitHub
d29b8ee2 b898d53f

+22 -10
+8 -4
src/activities/reader/EpubReaderActivity.cpp
··· 181 181 return; 182 182 } 183 183 184 - // any botton press when at end of the book goes back to the last page 184 + // At end of the book, forward button goes home and back button returns to last page 185 185 if (currentSpineIndex > 0 && currentSpineIndex >= epub->getSpineItemsCount()) { 186 - currentSpineIndex = epub->getSpineItemsCount() - 1; 187 - nextPageNumber = UINT16_MAX; 188 - requestUpdate(); 186 + if (nextTriggered) { 187 + onGoHome(); 188 + } else { 189 + currentSpineIndex = epub->getSpineItemsCount() - 1; 190 + nextPageNumber = UINT16_MAX; 191 + requestUpdate(); 192 + } 189 193 return; 190 194 } 191 195
+7 -3
src/activities/reader/TxtReaderActivity.cpp
··· 79 79 if (prevTriggered && currentPage > 0) { 80 80 currentPage--; 81 81 requestUpdate(); 82 - } else if (nextTriggered && currentPage < totalPages - 1) { 83 - currentPage++; 84 - requestUpdate(); 82 + } else if (nextTriggered) { 83 + if (currentPage < totalPages - 1) { 84 + currentPage++; 85 + requestUpdate(); 86 + } else { 87 + onGoHome(); 88 + } 85 89 } 86 90 } 87 91
+7 -3
src/activities/reader/XtcReaderActivity.cpp
··· 98 98 return; 99 99 } 100 100 101 - // Handle end of book 101 + // At end of the book, forward button goes home and back button returns to last page 102 102 if (currentPage >= xtc->getPageCount()) { 103 - currentPage = xtc->getPageCount() - 1; 104 - requestUpdate(); 103 + if (nextTriggered) { 104 + onGoHome(); 105 + } else { 106 + currentPage = xtc->getPageCount() - 1; 107 + requestUpdate(); 108 + } 105 109 return; 106 110 } 107 111