/* This file is part of Telegram Desktop, the official desktop application for the Telegram messaging service. For license and copyright information please follow this link: https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once #include "boxes/peer_list_box.h" #include "boxes/edit_privacy_box.h" #include "history/view/history_view_element.h" #include "api/api_blocked_peers.h" namespace Window { class SessionController; } // namespace Window namespace Ui { class ChatStyle; } // namespace Ui namespace Settings { class BlockedBoxController final : public PeerListController { public: explicit BlockedBoxController( not_null window); Main::Session &session() const override; void prepare() override; void rowClicked(not_null row) override; void rowRightActionClicked(not_null row) override; void loadMoreRows() override; [[nodiscard]] rpl::producer rowsCountChanges() const; static void BlockNewPeer(not_null window); private: void applySlice(const Api::BlockedPeers::Slice &slice); void handleBlockedEvent(not_null peer); bool appendRow(not_null peer); bool prependRow(not_null peer); std::unique_ptr createRow(not_null peer) const; const not_null _window; int _offset = 0; bool _allLoaded = false; base::has_weak_ptr _guard; rpl::event_stream _rowsCountChanges; }; class PhoneNumberPrivacyController final : public EditPrivacyController { public: using Option = EditPrivacyBox::Option; using Exception = EditPrivacyBox::Exception; explicit PhoneNumberPrivacyController( not_null controller); Key key() const override; rpl::producer title() const override; rpl::producer optionsTitleKey() const override; rpl::producer warning() const override; void prepareWarningLabel(not_null warning) const override; rpl::producer exceptionButtonTextKey( Exception exception) const override; rpl::producer exceptionBoxTitle( Exception exception) const override; rpl::producer exceptionsDescription() const override; object_ptr setupMiddleWidget( not_null controller, not_null parent, rpl::producer