fix: ClearCacheActivity now clears txt_* caches and recents list

Add txt_* prefix to the directory check so TXT book caches are also
removed. After clearing all cache directories, call RECENT_BOOKS.clear()
to remove stale entries that would show missing covers on the home screen.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cottongin
2026-02-21 03:05:19 -05:00
parent 98146f2545
commit 3cc127d658

View File

@@ -6,6 +6,7 @@
#include <Logging.h>
#include "MappedInputManager.h"
#include "RecentBooksStore.h"
#include "components/UITheme.h"
#include "fontIds.h"
@@ -94,8 +95,8 @@ void ClearCacheActivity::clearCache() {
file.getName(name, sizeof(name));
String itemName(name);
// Only delete directories starting with epub_ or xtc_
if (file.isDirectory() && (itemName.startsWith("epub_") || itemName.startsWith("xtc_"))) {
if (file.isDirectory() &&
(itemName.startsWith("epub_") || itemName.startsWith("xtc_") || itemName.startsWith("txt_"))) {
String fullPath = "/.crosspoint/" + itemName;
LOG_DBG("CLEAR_CACHE", "Removing cache: %s", fullPath.c_str());
@@ -113,6 +114,9 @@ void ClearCacheActivity::clearCache() {
}
root.close();
// Clear recents since all cached data (covers, progress) is gone
RECENT_BOOKS.clear();
LOG_DBG("CLEAR_CACHE", "Cache cleared: %d removed, %d failed", clearedCount, failedCount);
state = SUCCESS;