#pragma once #include #include #include #include "dialog_model.h" #include "key_event.h" #include "key_help.h" #include "list_model.h" #include "services/clock_service.h" #include "services/storage_service.h" #include "services/vpn_service.h" #include "settings.h" #include "ui/canvas.h" namespace roro { // Settings > VPN (issue #8): the switch, "Start with Wi-Fi", importing a `.conf` from the card // and forgetting it, and what the tunnel is doing. No key is ever on this page. class VpnPage { public: static constexpr const char* kConfPath = "/vpn/wg0.conf"; VpnPage(Settings& settings, VpnService& vpn, StorageService& storage, ClockService& clock) : settings_(settings), vpn_(vpn), storage_(storage), clock_(clock) {} void enter(); bool onKey(const KeyEvent& e); // false: leave the page void draw(Canvas& c); void help(std::vector& out) const; private: enum Row { kSwitch, kAuto, kImport, kForget, kRows }; enum class Ask { None, DeleteFile, Forget }; Settings& settings_; VpnService& vpn_; StorageService& storage_; ClockService& clock_; ListModel list_{kRows}; std::unique_ptr confirm_; Ask ask_ = Ask::None; std::string message_; }; } // namespace roro