#pragma once #include #include "../ActivityWithSubactivity.h" #include "activities/home/MyLibraryActivity.h" class Epub; class Xtc; class Txt; class ReaderActivity final : public ActivityWithSubactivity { std::string initialBookPath; std::string currentBookPath; // Track current book path for navigation const std::function onGoBack; const std::function onGoToLibrary; static std::unique_ptr loadEpub(const std::string& path); static std::unique_ptr loadXtc(const std::string& path); static std::unique_ptr loadTxt(const std::string& path); static bool isXtcFile(const std::string& path); static bool isTxtFile(const std::string& path); static std::string extractFolderPath(const std::string& filePath); void goToLibrary(const std::string& fromBookPath = ""); void onGoToEpubReader(std::unique_ptr epub); void onGoToXtcReader(std::unique_ptr xtc); void onGoToTxtReader(std::unique_ptr txt); public: explicit ReaderActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, std::string initialBookPath, const std::function& onGoBack, const std::function& onGoToLibrary) : ActivityWithSubactivity("Reader", renderer, mappedInput), initialBookPath(std::move(initialBookPath)), onGoBack(onGoBack), onGoToLibrary(onGoToLibrary) {} void onEnter() override; };