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