Feature: go to text/start reference in epub guide section at first start (#156)
This parses the guide section in the content.opf for text/start references and jumps to this on first open of the book. Currently, this behavior will be repeated in case the reader manually jumps to Chapter 0 and then re-opens the book. IMO, this is an acceptable edge case (for which I couldn't see a good fix other than to drag a "first open" boolean around). --------- Co-authored-by: Sam Davis <sam@sjd.co> Co-authored-by: Dave Allie <dave@daveallie.com>
This commit is contained in:
@@ -65,6 +65,16 @@ void EpubReaderActivity::onEnter() {
|
||||
}
|
||||
f.close();
|
||||
}
|
||||
// We may want a better condition to detect if we are opening for the first time.
|
||||
// This will trigger if the book is re-opened at Chapter 0.
|
||||
if (currentSpineIndex == 0) {
|
||||
int textSpineIndex = epub->getSpineIndexForTextReference();
|
||||
if (textSpineIndex != 0) {
|
||||
currentSpineIndex = textSpineIndex;
|
||||
Serial.printf("[%lu] [ERS] Opened for first time, navigating to text reference at index %d\n", millis(),
|
||||
textSpineIndex);
|
||||
}
|
||||
}
|
||||
|
||||
// Save current epub as last opened epub
|
||||
APP_STATE.openEpubPath = epub->getPath();
|
||||
|
||||
Reference in New Issue
Block a user