init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled

This commit is contained in:
allhaileris
2026-02-16 15:50:16 +03:00
commit afb81b8278
13816 changed files with 3689732 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,112 @@
/*
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<UserData*> bot;
ConnectedBotState state;
};
using ConnectedBots = std::vector<ConnectedBot>;
[[nodiscard]] QString FormatCommission(ushort commission);
[[nodiscard]] QString FormatProgramDuration(int durationMonths);
[[nodiscard]] rpl::producer<TextWithEntities> FormatForProgramDuration(
int durationMonths);
[[nodiscard]] not_null<Ui::AbstractButton*> AddViewListButton(
not_null<Ui::VerticalLayout*> parent,
rpl::producer<QString> title,
rpl::producer<QString> subtitle,
bool newBadge = false);
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,
not_null<PeerData*> initialRecipient,
std::vector<not_null<PeerData*>> recipients,
Fn<void(ConnectedBotState)> done = nullptr);
[[nodiscard]] object_ptr<Ui::BoxContent> ConfirmEndBox(Fn<void()> finish);
void ResolveRecipients(
not_null<Main::Session*> session,
Fn<void(std::vector<not_null<PeerData*>>)> done);
std::unique_ptr<Ui::AbstractButton> MakePeerBubbleButton(
not_null<QWidget*> parent,
not_null<PeerData*> peer,
Ui::RpWidget *right = nullptr,
const style::color *bgOverride = nullptr);
void ConfirmUpdate(
std::shared_ptr<Ui::Show> show,
not_null<UserData*> bot,
const StarRefProgram &program,
bool exists,
Fn<void(Fn<void(bool)> done)> update);
void UpdateProgram(
std::shared_ptr<Ui::Show> show,
not_null<UserData*> bot,
const StarRefProgram &program,
Fn<void(bool)> done);
void FinishProgram(
std::shared_ptr<Ui::Show> show,
not_null<UserData*> bot,
Fn<void(bool)> done);
[[nodiscard]] ConnectedBots Parse(
not_null<Main::Session*> session,
const MTPpayments_ConnectedStarRefBots &bots);
[[nodiscard]] object_ptr<Ui::AbstractButton> MakeLinkLabel(
not_null<QWidget*> parent,
const QString &link,
const style::InputField *stOverride = nullptr);
[[nodiscard]] object_ptr<Ui::RpWidget> CreateLinkHeaderIcon(
not_null<QWidget*> parent,
not_null<Main::Session*> session,
int usersCount = 0);
} // namespace Info::BotStarRef

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,89 @@
/*
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 "info/info_content_widget.h"
namespace Ui::Premium {
class TopBarAbstract;
} // namespace Ui::Premium
namespace Ui {
template <typename Widget>
class FadeWrap;
class IconButton;
class AbstractButton;
class VerticalLayout;
class BoxContent;
} // namespace Ui
namespace Window {
class SessionController;
} // namespace Window
namespace Info::BotStarRef::Join {
class InnerWidget;
class Memento final : public ContentMemento {
public:
Memento(not_null<Controller*> controller);
Memento(not_null<PeerData*> peer);
~Memento();
object_ptr<ContentWidget> createWidget(
QWidget *parent,
not_null<Controller*> controller,
const QRect &geometry) override;
Section section() const override;
};
class Widget final : public ContentWidget {
public:
Widget(QWidget *parent, not_null<Controller*> controller);
bool showInternal(not_null<ContentMemento*> memento) override;
rpl::producer<QString> title() override;
rpl::producer<bool> desiredShadowVisibility() const override;
void showFinished() override;
void setInnerFocus() override;
void enableBackButton() override;
[[nodiscard]] not_null<PeerData*> peer() const;
void setInternalState(
const QRect &geometry,
not_null<Memento*> memento);
private:
void saveState(not_null<Memento*> memento);
void restoreState(not_null<Memento*> memento);
[[nodiscard]] std::unique_ptr<Ui::Premium::TopBarAbstract> setupTop();
std::shared_ptr<ContentMemento> doCreateMemento() override;
const not_null<InnerWidget*> _inner;
std::unique_ptr<Ui::Premium::TopBarAbstract> _top;
base::unique_qptr<Ui::FadeWrap<Ui::IconButton>> _back;
base::unique_qptr<Ui::IconButton> _close;
rpl::variable<bool> _backEnabled;
};
[[nodiscard]] bool Allowed(not_null<PeerData*> peer);
[[nodiscard]] std::shared_ptr<Info::Memento> Make(not_null<PeerData*> peer);
[[nodiscard]] object_ptr<Ui::BoxContent> ProgramsListBox(
not_null<Window::SessionController*> window,
not_null<PeerData*> peer);
} // namespace Info::BotStarRef::Join

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,86 @@
/*
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 "info/info_content_widget.h"
#include "info/bot/starref/info_bot_starref_common.h"
namespace Ui::Premium {
class TopBarAbstract;
} // namespace Ui::Premium
namespace Ui {
template <typename Widget>
class FadeWrap;
class IconButton;
class AbstractButton;
class VerticalLayout;
} // namespace Ui
namespace Info::BotStarRef::Setup {
struct State;
class InnerWidget;
class Memento final : public ContentMemento {
public:
Memento(not_null<Controller*> controller);
Memento(not_null<PeerData*> peer);
~Memento();
object_ptr<ContentWidget> createWidget(
QWidget *parent,
not_null<Controller*> controller,
const QRect &geometry) override;
Section section() const override;
};
class Widget final : public ContentWidget {
public:
Widget(QWidget *parent, not_null<Controller*> controller);
bool showInternal(not_null<ContentMemento*> memento) override;
rpl::producer<QString> title() override;
rpl::producer<bool> desiredShadowVisibility() const override;
void showFinished() override;
void setInnerFocus() override;
void enableBackButton() override;
[[nodiscard]] not_null<PeerData*> peer() const;
void setInternalState(
const QRect &geometry,
not_null<Memento*> memento);
private:
void saveState(not_null<Memento*> memento);
void restoreState(not_null<Memento*> memento);
[[nodiscard]] std::unique_ptr<Ui::Premium::TopBarAbstract> setupTop();
[[nodiscard]] std::unique_ptr<Ui::RpWidget> setupBottom();
std::shared_ptr<ContentMemento> doCreateMemento() override;
const not_null<InnerWidget*> _inner;
const not_null<State*> _state;
std::unique_ptr<Ui::Premium::TopBarAbstract> _top;
base::unique_qptr<Ui::FadeWrap<Ui::IconButton>> _back;
base::unique_qptr<Ui::IconButton> _close;
rpl::variable<bool> _backEnabled;
std::unique_ptr<Ui::RpWidget> _bottom;
};
[[nodiscard]] bool Allowed(not_null<PeerData*> peer);
[[nodiscard]] std::shared_ptr<Info::Memento> Make(not_null<PeerData*> peer);
} // namespace Info::BotStarRef::Setup