settings_premium.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #pragma once
  8. #include "settings/settings_type.h"
  9. class DocumentData;
  10. enum class PremiumFeature;
  11. namespace style {
  12. struct RoundButton;
  13. } // namespace style
  14. namespace ChatHelpers {
  15. class Show;
  16. } // namespace ChatHelpers
  17. namespace Ui {
  18. class RpWidget;
  19. class RoundButton;
  20. class GradientButton;
  21. class VerticalLayout;
  22. } // namespace Ui
  23. namespace Main {
  24. class Session;
  25. class SessionShow;
  26. } // namespace Main
  27. namespace Window {
  28. class SessionController;
  29. } // namespace Window
  30. namespace Settings {
  31. [[nodiscard]] Type PremiumId();
  32. void ShowPremium(not_null<::Main::Session*> session, const QString &ref);
  33. void ShowPremium(
  34. not_null<Window::SessionController*> controller,
  35. const QString &ref);
  36. void ShowGiftPremium(
  37. not_null<Window::SessionController*> controller,
  38. not_null<PeerData*> peer,
  39. int months,
  40. bool me);
  41. void ShowEmojiStatusPremium(
  42. not_null<Window::SessionController*> controller,
  43. not_null<PeerData*> peer);
  44. void StartPremiumPayment(
  45. not_null<Window::SessionController*> controller,
  46. const QString &ref);
  47. [[nodiscard]] QString LookupPremiumRef(PremiumFeature section);
  48. void ShowPremiumPromoToast(
  49. std::shared_ptr<ChatHelpers::Show> show,
  50. TextWithEntities textWithLink,
  51. const QString &ref);
  52. void ShowPremiumPromoToast(
  53. std::shared_ptr<::Main::SessionShow> show,
  54. Fn<Window::SessionController*(not_null<::Main::Session*>)> resolveWindow,
  55. TextWithEntities textWithLink,
  56. const QString &ref);
  57. struct SubscribeButtonArgs final {
  58. Window::SessionController *controller = nullptr;
  59. not_null<Ui::RpWidget*> parent;
  60. Fn<QString()> computeRef;
  61. std::optional<rpl::producer<QString>> text;
  62. std::optional<QGradientStops> gradientStops;
  63. Fn<QString()> computeBotUrl; // nullable
  64. std::shared_ptr<ChatHelpers::Show> show;
  65. bool showPromo = false;
  66. };
  67. [[nodiscard]] not_null<Ui::RoundButton*> CreateLockedButton(
  68. not_null<QWidget*> parent,
  69. rpl::producer<QString> text,
  70. const style::RoundButton &st,
  71. rpl::producer<bool> locked);
  72. [[nodiscard]] not_null<Ui::GradientButton*> CreateSubscribeButton(
  73. SubscribeButtonArgs &&args);
  74. [[nodiscard]] not_null<Ui::GradientButton*> CreateSubscribeButton(
  75. std::shared_ptr<::Main::SessionShow> show,
  76. Fn<Window::SessionController*(not_null<::Main::Session*>)> resolveWindow,
  77. SubscribeButtonArgs &&args);
  78. [[nodiscard]] std::vector<PremiumFeature> PremiumFeaturesOrder(
  79. not_null<::Main::Session*> session);
  80. void AddSummaryPremium(
  81. not_null<Ui::VerticalLayout*> content,
  82. not_null<Window::SessionController*> controller,
  83. const QString &ref,
  84. Fn<void(PremiumFeature)> buttonCallback);
  85. [[nodiscard]] std::unique_ptr<Ui::RpWidget> MakeEmojiStatusPreview(
  86. not_null<QWidget*> parent,
  87. not_null<DocumentData*> document);
  88. [[nodiscard]] std::unique_ptr<Ui::RpWidget> MakeEmojiSetStatusPreview(
  89. not_null<QWidget*> parent,
  90. not_null<PeerData*> peer,
  91. not_null<DocumentData*> document);
  92. } // namespace Settings