| 204 | } |
| 205 | |
| 206 | void EpubReaderActivity::onExit() { |
| 207 | Activity::onExit(); |
| 208 | |
| 209 | // Reset orientation back to portrait for the rest of the UI |
| 210 | renderer.setOrientation(GfxRenderer::Orientation::Portrait); |
| 211 | |
| 212 | APP_STATE.readerActivityLoadCount = 0; |
| 213 | APP_STATE.saveToFile(); |
| 214 | |
| 215 | // Leaving mid-footnote loses the in-RAM return stack on deep sleep; persist the |
| 216 | // pre-footnote position so the book reopens at the link origin, not the footnote. |
| 217 | if (footnoteDepth > 0 && epub) { |
| 218 | const SavedPosition& origin = savedPositions[0]; |
| 219 | saveProgress(origin.spineIndex, origin.pageNumber, 0); |
| 220 | } |
| 221 | |
| 222 | section.reset(); |
| 223 | if (pendingReadFolderMove && epub) { |
| 224 | const std::string srcPath = epub->getPath(); |
| 225 | const std::string oldCachePath = epub->getCachePath(); |
| 226 | const std::string dstPath = buildReadFolderDestination(srcPath); |
| 227 | epub.reset(); // release the Epub (and any open handles) before renaming on the SD card |
| 228 | moveFinishedBookToReadFolder(srcPath, dstPath, oldCachePath); |
| 229 | } else { |
| 230 | epub.reset(); |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | void EpubReaderActivity::loop() { |
| 235 | if (!epub) { |
nothing calls this directly
no test coverage detected