Files
crosspoint-reader-mod/chat-summaries/2026-02-21_12-00-summary.md

53 lines
3.7 KiB
Markdown
Raw Permalink Normal View History

# Manage Books Feature - Implementation
## Task Description
Implemented the full Manage Books feature plan across 10 commits on the `mod/manage-books` branch. The feature adds Archive, Delete, Delete Cache, and Reindex book management actions, an interactive End of Book menu, and a bugfix for Clear Reading Cache.
## Changes Made (10 commits)
### COMMIT 1: `feat(hal): expose rename() on HalStorage`
- `lib/hal/HalStorage.h` / `.cpp` — Added `rename(path, newPath)` forwarding to SDCardManager for file/directory move operations.
### COMMIT 2: `feat(i18n): add string keys for book management feature`
- `lib/I18n/translations/english.yaml` — Added 15 new string keys (STR_MANAGE_BOOK, STR_ARCHIVE_BOOK, STR_UNARCHIVE_BOOK, etc.)
- `lib/I18n/I18nKeys.h` — Regenerated via gen_i18n.py
### COMMIT 3: `feat: add BookManager utility and RecentBooksStore::clear()`
- **New:** `src/util/BookManager.h` / `.cpp` — Static utility namespace with `archiveBook`, `unarchiveBook`, `deleteBook`, `deleteBookCache`, `reindexBook`, `isArchived`, `getBookCachePath`. Archive mirrors directory structure under `/.archive/` and renames cache dirs to match new path hashes.
- `src/RecentBooksStore.h` / `.cpp` — Added `clear()` method.
### COMMIT 4: `feat: add BookManageMenuActivity popup sub-activity`
- **New:** `src/activities/home/BookManageMenuActivity.h` / `.cpp` — Contextual popup menu with Archive/Unarchive, Delete, Delete Cache Only, Reindex Book. Supports long-press on Reindex for REINDEX_FULL (includes cover/thumb regeneration).
### COMMIT 5: `refactor: change browse activities to ActivityWithSubactivity`
- `HomeActivity`, `MyLibraryActivity`, `RecentBooksActivity` — Changed base class from `Activity` to `ActivityWithSubactivity`. Added `subActivity` guard at top of `loop()`.
### COMMIT 6: `feat: add long-press Confirm for book management in file browser and recents`
- `MyLibraryActivity` / `RecentBooksActivity` — Long-press Confirm on a book opens BookManageMenuActivity. Actions executed via BookManager, file list refreshed afterward.
### COMMIT 7: `feat: add long-press on HomeActivity for book management and archive browsing`
- `HomeActivity` — Long-press Confirm on recent book opens manage menu. Long-press on Browse Files navigates to `/.archive/`.
- `main.cpp` — Wired `onMyLibraryOpenWithPath` callback through to HomeActivity constructor.
### COMMIT 8: `feat: replace Delete Book Cache with Manage Book in reader menu`
- `EpubReaderMenuActivity` — Replaced DELETE_CACHE menu item with MANAGE_BOOK. Opens BookManageMenuActivity as sub-activity. Added ARCHIVE_BOOK, DELETE_BOOK, REINDEX_BOOK, REINDEX_BOOK_FULL action types.
- `EpubReaderActivity` — Handles new actions via BookManager.
### COMMIT 9: `feat: add EndOfBookMenuActivity replacing static end-of-book text`
- **New:** `src/activities/reader/EndOfBookMenuActivity.h` / `.cpp` — Interactive popup with Archive, Delete, Back to Beginning, Close Book, Close Menu options.
- `EpubReaderActivity` / `XtcReaderActivity` — Replaced static "End of Book" text with EndOfBookMenuActivity.
- `TxtReaderActivity` — Added end-of-book detection (advance past last page triggers menu).
### COMMIT 10: `fix: ClearCacheActivity now clears txt_* caches and recents list`
- `ClearCacheActivity.cpp` — Added `txt_*` to directory prefix check. Calls `RECENT_BOOKS.clear()` after cache wipe.
## New Files
- `src/util/BookManager.h` / `.cpp`
- `src/activities/home/BookManageMenuActivity.h` / `.cpp`
- `src/activities/reader/EndOfBookMenuActivity.h` / `.cpp`
## Follow-up Items
- Test on device: verify all menu interactions, archive/unarchive flow, end-of-book menu behavior
- Verify cache rename works correctly across different book formats
- Consider adding translations for new strings in non-English language files