mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-04 14:47:37 +03:00
perf: skip CSS loading in Sleep and Home activities
Both activities only need book metadata (title, author) and cover image. Pass skipLoadingCss=true to Epub::load() to avoid unnecessary CSS parsing and caching operations.
This commit is contained in:
parent
cd61b263e5
commit
9e1356bb92
@ -238,7 +238,8 @@ void SleepActivity::renderCoverSleepScreen() const {
|
||||
} else if (StringUtils::checkFileExtension(APP_STATE.openEpubPath, ".epub")) {
|
||||
// Handle EPUB file
|
||||
Epub lastEpub(APP_STATE.openEpubPath, "/.crosspoint");
|
||||
if (!lastEpub.load()) {
|
||||
// Skip loading css since we only need metadata here
|
||||
if (!lastEpub.load(true, true)) {
|
||||
Serial.println("[SLP] Failed to load last epub");
|
||||
return renderDefaultSleepScreen();
|
||||
}
|
||||
|
||||
@ -52,7 +52,8 @@ void HomeActivity::onEnter() {
|
||||
// If epub, try to load the metadata for title/author and cover
|
||||
if (StringUtils::checkFileExtension(lastBookTitle, ".epub")) {
|
||||
Epub epub(APP_STATE.openEpubPath, "/.crosspoint");
|
||||
epub.load(false);
|
||||
// Skip loading css since we only need metadata here
|
||||
epub.load(false, true);
|
||||
if (!epub.getTitle().empty()) {
|
||||
lastBookTitle = std::string(epub.getTitle());
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user