2022-05-18 21:53:25 +03: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
|
|
|
|
|
|
|
|
#include "settings/settings_type.h"
|
|
|
|
|
2024-11-08 16:05:39 +04:00
|
|
|
class DocumentData;
|
2024-03-01 18:37:50 +04:00
|
|
|
enum class PremiumFeature;
|
2022-06-14 13:42:43 +04:00
|
|
|
|
2023-11-28 18:29:29 +04:00
|
|
|
namespace style {
|
|
|
|
struct RoundButton;
|
|
|
|
} // namespace style
|
|
|
|
|
2023-05-18 17:46:24 +04:00
|
|
|
namespace ChatHelpers {
|
|
|
|
class Show;
|
|
|
|
} // namespace ChatHelpers
|
|
|
|
|
2022-06-14 13:42:43 +04:00
|
|
|
namespace Ui {
|
|
|
|
class RpWidget;
|
2023-11-28 18:29:29 +04:00
|
|
|
class RoundButton;
|
2022-06-14 13:42:43 +04:00
|
|
|
class GradientButton;
|
2023-12-17 12:59:19 +03:00
|
|
|
class VerticalLayout;
|
2022-06-14 13:42:43 +04:00
|
|
|
} // namespace Ui
|
|
|
|
|
2022-05-20 17:12:56 +04:00
|
|
|
namespace Main {
|
|
|
|
class Session;
|
2024-01-17 15:05:44 +04:00
|
|
|
class SessionShow;
|
2022-05-20 17:12:56 +04:00
|
|
|
} // namespace Main
|
|
|
|
|
2022-05-23 12:04:31 +04:00
|
|
|
namespace Window {
|
|
|
|
class SessionController;
|
|
|
|
} // namespace Window
|
|
|
|
|
2022-05-18 21:53:25 +03:00
|
|
|
namespace Settings {
|
|
|
|
|
2022-05-20 17:12:56 +04:00
|
|
|
[[nodiscard]] Type PremiumId();
|
|
|
|
|
2022-05-23 18:46:15 +04:00
|
|
|
void ShowPremium(not_null<::Main::Session*> session, const QString &ref);
|
|
|
|
void ShowPremium(
|
|
|
|
not_null<Window::SessionController*> controller,
|
|
|
|
const QString &ref);
|
2022-07-27 01:02:30 +03:00
|
|
|
void ShowGiftPremium(
|
|
|
|
not_null<Window::SessionController*> controller,
|
|
|
|
not_null<PeerData*> peer,
|
|
|
|
int months,
|
|
|
|
bool me);
|
2022-08-20 13:18:31 +03:00
|
|
|
void ShowEmojiStatusPremium(
|
|
|
|
not_null<Window::SessionController*> controller,
|
|
|
|
not_null<PeerData*> peer);
|
2022-05-23 18:46:15 +04:00
|
|
|
|
2022-05-23 12:04:31 +04:00
|
|
|
void StartPremiumPayment(
|
|
|
|
not_null<Window::SessionController*> controller,
|
|
|
|
const QString &ref);
|
2022-05-18 21:53:25 +03:00
|
|
|
|
2024-03-01 18:37:50 +04:00
|
|
|
[[nodiscard]] QString LookupPremiumRef(PremiumFeature section);
|
2022-06-14 13:42:43 +04:00
|
|
|
|
2023-10-27 17:49:37 +04:00
|
|
|
void ShowPremiumPromoToast(
|
|
|
|
std::shared_ptr<ChatHelpers::Show> show,
|
|
|
|
TextWithEntities textWithLink,
|
|
|
|
const QString &ref);
|
2024-01-17 15:05:44 +04:00
|
|
|
void ShowPremiumPromoToast(
|
|
|
|
std::shared_ptr<::Main::SessionShow> show,
|
2025-01-07 14:52:25 +04:00
|
|
|
Fn<Window::SessionController*(not_null<::Main::Session*>)> resolveWindow,
|
2024-01-17 15:05:44 +04:00
|
|
|
TextWithEntities textWithLink,
|
|
|
|
const QString &ref);
|
2023-10-27 17:49:37 +04:00
|
|
|
|
2022-07-06 18:14:32 +03:00
|
|
|
struct SubscribeButtonArgs final {
|
2023-05-18 17:46:24 +04:00
|
|
|
Window::SessionController *controller = nullptr;
|
2022-07-06 18:14:32 +03:00
|
|
|
not_null<Ui::RpWidget*> parent;
|
|
|
|
Fn<QString()> computeRef;
|
|
|
|
std::optional<rpl::producer<QString>> text;
|
|
|
|
std::optional<QGradientStops> gradientStops;
|
2022-08-25 20:30:10 +03:00
|
|
|
Fn<QString()> computeBotUrl; // nullable
|
2023-05-18 17:46:24 +04:00
|
|
|
std::shared_ptr<ChatHelpers::Show> show;
|
2024-04-01 22:39:29 +04:00
|
|
|
bool showPromo = false;
|
2022-07-06 18:14:32 +03:00
|
|
|
};
|
|
|
|
|
2023-11-28 18:29:29 +04:00
|
|
|
|
|
|
|
[[nodiscard]] not_null<Ui::RoundButton*> CreateLockedButton(
|
|
|
|
not_null<QWidget*> parent,
|
|
|
|
rpl::producer<QString> text,
|
|
|
|
const style::RoundButton &st,
|
|
|
|
rpl::producer<bool> locked);
|
|
|
|
|
2022-06-14 13:42:43 +04:00
|
|
|
[[nodiscard]] not_null<Ui::GradientButton*> CreateSubscribeButton(
|
2022-07-06 18:14:32 +03:00
|
|
|
SubscribeButtonArgs &&args);
|
2022-06-14 13:42:43 +04:00
|
|
|
|
2024-04-01 22:39:29 +04:00
|
|
|
[[nodiscard]] not_null<Ui::GradientButton*> CreateSubscribeButton(
|
|
|
|
std::shared_ptr<::Main::SessionShow> show,
|
2025-01-07 14:52:25 +04:00
|
|
|
Fn<Window::SessionController*(not_null<::Main::Session*>)> resolveWindow,
|
2024-04-01 22:39:29 +04:00
|
|
|
SubscribeButtonArgs &&args);
|
|
|
|
|
2024-03-01 18:37:50 +04:00
|
|
|
[[nodiscard]] std::vector<PremiumFeature> PremiumFeaturesOrder(
|
2022-12-21 17:57:05 +03:00
|
|
|
not_null<::Main::Session*> session);
|
|
|
|
|
2023-12-17 12:59:19 +03:00
|
|
|
void AddSummaryPremium(
|
|
|
|
not_null<Ui::VerticalLayout*> content,
|
|
|
|
not_null<Window::SessionController*> controller,
|
|
|
|
const QString &ref,
|
2024-03-01 18:37:50 +04:00
|
|
|
Fn<void(PremiumFeature)> buttonCallback);
|
2022-06-14 13:42:43 +04:00
|
|
|
|
2024-11-08 16:05:39 +04:00
|
|
|
[[nodiscard]] std::unique_ptr<Ui::RpWidget> MakeEmojiStatusPreview(
|
|
|
|
not_null<QWidget*> parent,
|
|
|
|
not_null<DocumentData*> document);
|
|
|
|
[[nodiscard]] std::unique_ptr<Ui::RpWidget> MakeEmojiSetStatusPreview(
|
|
|
|
not_null<QWidget*> parent,
|
|
|
|
not_null<PeerData*> peer,
|
|
|
|
not_null<DocumentData*> document);
|
|
|
|
|
2022-05-18 21:53:25 +03:00
|
|
|
} // namespace Settings
|
|
|
|
|