29 lines
1.7 KiB
Markdown
29 lines
1.7 KiB
Markdown
|
|
# Fix: Cover/Thumbnail Pipeline on Home Screen
|
||
|
|
|
||
|
|
**Date:** 2026-02-15
|
||
|
|
|
||
|
|
## Task Description
|
||
|
|
|
||
|
|
Multiple issues with book cover thumbnails on the home screen:
|
||
|
|
1. After clearing a book's cache, the home screen showed a placeholder instead of the real cover.
|
||
|
|
2. Books without covers showed blank rectangles instead of generated placeholder covers.
|
||
|
|
|
||
|
|
## Root Cause
|
||
|
|
|
||
|
|
`Epub::generateThumbBmp()` wrote an empty 0-byte BMP file as a "don't retry" sentinel when a book had no cover. This empty file:
|
||
|
|
- Blocked the placeholder fallback in `EpubReaderActivity::onEnter()` (file exists check passes)
|
||
|
|
- Tricked the home screen into thinking a valid thumbnail exists (skips regeneration)
|
||
|
|
- Failed to parse in `LyraTheme::drawRecentBookCover()` resulting in a blank gray rectangle
|
||
|
|
|
||
|
|
## Changes Made
|
||
|
|
|
||
|
|
- **`lib/Epub/Epub.cpp`**: Removed the empty sentinel file write from `generateThumbBmp()`. Now it simply returns `false` when there's no cover, letting callers generate valid placeholder BMPs that serve the same "don't retry" purpose.
|
||
|
|
- **`src/activities/home/HomeActivity.cpp`**: Changed placeholder fallback in `loadRecentCovers()` from `if (!success && !Storage.exists(coverPath))` to `if (!success)` as defense-in-depth for edge cases like global cache clear.
|
||
|
|
- **`src/RecentBooksStore.h`**: Added `removeBook(const std::string& path)` method declaration.
|
||
|
|
- **`src/RecentBooksStore.cpp`**: Implemented `removeBook()` — finds and erases the book by path, then persists the updated list.
|
||
|
|
- **`src/activities/reader/EpubReaderActivity.cpp`**: After clearing cache in the `DELETE_CACHE` handler, calls `RECENT_BOOKS.removeBook(epub->getPath())` so the book is cleanly removed from recents when its cache is wiped.
|
||
|
|
|
||
|
|
## Follow-up Items
|
||
|
|
|
||
|
|
- None.
|