/* 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 "base/object_ptr.h" #include "data/data_user.h" namespace Ui { class AbstractButton; class RoundButton; class VerticalLayout; class BoxContent; class RpWidget; class Show; } // namespace Ui namespace style { struct RoundButton; struct InputField; } // namespace style namespace Main { class Session; } // namespace Main namespace Info::BotStarRef { struct ConnectedBotState { StarRefProgram program; QString link; TimeId date = 0; int users = 0; bool unresolved = false; bool revoked = false; }; struct ConnectedBot { not_null bot; ConnectedBotState state; }; using ConnectedBots = std::vector; [[nodiscard]] QString FormatCommission(ushort commission); [[nodiscard]] QString FormatProgramDuration(int durationMonths); [[nodiscard]] rpl::producer FormatForProgramDuration( int durationMonths); [[nodiscard]] not_null AddViewListButton( not_null parent, rpl::producer title, rpl::producer subtitle, bool newBadge = false); not_null AddFullWidthButton( not_null box, rpl::producer text, Fn callback = nullptr, const style::RoundButton *stOverride = nullptr); void AddFullWidthButtonFooter( not_null box, not_null button, rpl::producer text); [[nodiscard]] object_ptr StarRefLinkBox( ConnectedBot row, not_null peer); [[nodiscard]] object_ptr JoinStarRefBox( ConnectedBot row, not_null initialRecipient, std::vector> recipients, Fn done = nullptr); [[nodiscard]] object_ptr ConfirmEndBox(Fn finish); void ResolveRecipients( not_null session, Fn>)> done); std::unique_ptr MakePeerBubbleButton( not_null parent, not_null peer, Ui::RpWidget *right = nullptr, const style::color *bgOverride = nullptr); void ConfirmUpdate( std::shared_ptr show, not_null bot, const StarRefProgram &program, bool exists, Fn done)> update); void UpdateProgram( std::shared_ptr show, not_null bot, const StarRefProgram &program, Fn done); void FinishProgram( std::shared_ptr show, not_null bot, Fn done); [[nodiscard]] ConnectedBots Parse( not_null session, const MTPpayments_ConnectedStarRefBots &bots); [[nodiscard]] object_ptr MakeLinkLabel( not_null parent, const QString &link, const style::InputField *stOverride = nullptr); [[nodiscard]] object_ptr CreateLinkHeaderIcon( not_null parent, not_null session, int usersCount = 0); } // namespace Info::BotStarRef