#pragma once // Spec: INV-social 16 (Profile screen), PG-08. Own profile (username nullopt) and other users. #include #include #include "screens/profile/ProfileModel.hpp" #include "ui/Navigation.hpp" namespace dp { class ProfileScreen : public ui::Screen { public: explicit ProfileScreen(std::optional username); ~ProfileScreen() override { *alive_ = false; } ui::ViewPtr body() override; std::string title() const override { return model_.navigationTitle(); } void onAppear() override; bool busy() const override { return model_.isBusy(); } ProfileModel& model() { return model_; } // Alert flows: block and mute need a confirmation, the other actions run directly. void tapFollow(); void tapBlock(); void tapMute(); private: ui::ViewPtr buttonRow(); ui::ViewPtr actionButton(const std::string& title, std::function action); ui::ViewPtr actionsMenu(); void confirm(const std::string& verb, const std::string& message, std::function action); ProfileModel model_; bool started_ = false; std::shared_ptr alive_ = std::make_shared(true); }; } // namespace dp