#pragma once #include "ui/apps/app.h" #include "ui/apps/travel/settings/settings_handler.h" #include "ui/apps/travel/ui/main_handler.h" #include "ui/apps/travel/ui/settings_handler.h" #include "io/nvs_handler.h" #include "network/network.h" #include #include // Forward declarations namespace travel { class MainUIHandler; class SettingsUIHandler; class SettingHandler; } /** * @brief Travel App - MTR Station Arrival Time Display * * Displays estimated arrival times for configured MTR routes. * Features: * - Support for all MTR lines from assets * - Save up to 5 (station, destination) route pairs * - Poll every 30 seconds (configurable 10-120s) * - Traditional Chinese by default * - E-ink optimized (no animations, static layout) * - Web-based configuration via QR code */ class TravelApp : public UIApp { public: TravelApp(); ~TravelApp() override; esp_err_t init(lv_obj_t* container, InteractionHandler* interaction_handler) override; esp_err_t deinit(void) override; std::string get_name(void) const override; bool on_back_button_pressed(void) override; // Set network handler for API calls void set_network_handler(NetworkHandler* network_handler); private: // UI handlers std::unique_ptr main_ui_handler_; std::unique_ptr settings_ui_handler_; // Current page tracking enum class Page { MAIN, SETTINGS }; Page current_page_; // Settings handler (shared across handlers) std::unique_ptr setting_handler_; // Network handler (not owned, set externally) NetworkHandler* network_handler_; // Interaction handler (not owned) InteractionHandler* interaction_handler_; static constexpr const char* NVS_NAMESPACE = "travel_app"; // Private methods void show_settings_page(); // UI callback forwarders static void on_settings_button_clicked_static(void* user_data); };