2024-11-29 12:05:21 +04:00
|
|
|
/*
|
|
|
|
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
|
|
|
|
|
2024-11-29 14:18:30 +04:00
|
|
|
#include "base/object_ptr.h"
|
|
|
|
#include "data/data_user.h"
|
|
|
|
|
2024-11-29 12:05:21 +04:00
|
|
|
namespace Ui {
|
|
|
|
class AbstractButton;
|
2024-11-29 14:18:30 +04:00
|
|
|
class RoundButton;
|
2024-11-29 12:05:21 +04:00
|
|
|
class VerticalLayout;
|
2024-11-29 14:18:30 +04:00
|
|
|
class BoxContent;
|
|
|
|
class RpWidget;
|
2024-11-29 12:05:21 +04:00
|
|
|
} // namespace Ui
|
|
|
|
|
2024-11-29 14:18:30 +04:00
|
|
|
namespace style {
|
|
|
|
struct RoundButton;
|
|
|
|
} // namespace style
|
|
|
|
|
2024-11-29 12:05:21 +04:00
|
|
|
namespace Info::BotStarRef {
|
|
|
|
|
2024-11-29 14:18:30 +04:00
|
|
|
struct ConnectedBotState {
|
|
|
|
StarRefProgram program;
|
|
|
|
QString link;
|
|
|
|
TimeId date = 0;
|
|
|
|
int users = 0;
|
2024-11-29 15:04:25 +04:00
|
|
|
bool unresolved = false;
|
2024-11-29 14:18:30 +04:00
|
|
|
bool revoked = false;
|
|
|
|
};
|
|
|
|
struct ConnectedBot {
|
|
|
|
not_null<UserData*> bot;
|
|
|
|
ConnectedBotState state;
|
|
|
|
};
|
|
|
|
using ConnectedBots = std::vector<ConnectedBot>;
|
|
|
|
|
|
|
|
[[nodiscard]] QString FormatStarRefCommission(ushort commission);
|
|
|
|
[[nodiscard]] rpl::producer<TextWithEntities> FormatProgramDuration(
|
|
|
|
StarRefProgram program);
|
|
|
|
|
2024-11-29 12:05:21 +04:00
|
|
|
[[nodiscard]] not_null<Ui::AbstractButton*> AddViewListButton(
|
|
|
|
not_null<Ui::VerticalLayout*> parent,
|
|
|
|
rpl::producer<QString> title,
|
|
|
|
rpl::producer<QString> subtitle);
|
|
|
|
|
2024-11-29 14:18:30 +04:00
|
|
|
[[nodiscard]] not_null<Ui::RoundButton*> AddFullWidthButton(
|
|
|
|
not_null<Ui::BoxContent*> box,
|
|
|
|
rpl::producer<QString> text,
|
|
|
|
Fn<void()> callback = nullptr,
|
|
|
|
const style::RoundButton *stOverride = nullptr);
|
|
|
|
|
|
|
|
void AddFullWidthButtonFooter(
|
|
|
|
not_null<Ui::BoxContent*> box,
|
|
|
|
not_null<Ui::RpWidget*> button,
|
|
|
|
rpl::producer<TextWithEntities> text);
|
|
|
|
|
|
|
|
[[nodiscard]] object_ptr<Ui::BoxContent> StarRefLinkBox(
|
|
|
|
ConnectedBot row,
|
|
|
|
not_null<PeerData*> peer);
|
|
|
|
[[nodiscard]] object_ptr<Ui::BoxContent> JoinStarRefBox(
|
|
|
|
ConnectedBot row,
|
2024-11-29 17:11:47 +04:00
|
|
|
not_null<PeerData*> peer,
|
|
|
|
Fn<void(ConnectedBotState)> done);
|
2024-11-29 14:18:30 +04:00
|
|
|
|
|
|
|
std::unique_ptr<Ui::AbstractButton> MakePeerBubbleButton(
|
|
|
|
not_null<QWidget*> parent,
|
|
|
|
not_null<PeerData*> peer,
|
|
|
|
Ui::RpWidget *right = nullptr);
|
|
|
|
|
|
|
|
[[nodiscard]] ConnectedBots Parse(
|
|
|
|
not_null<Main::Session*> session,
|
|
|
|
const MTPpayments_ConnectedStarRefBots &bots);
|
2024-11-29 12:05:21 +04:00
|
|
|
|
|
|
|
} // namespace Info::BotStarRef
|