tdesktop/Telegram/SourceFiles/boxes/gift_premium_box.h

81 lines
1.9 KiB
C
Raw Normal View History

2022-07-03 14:56:12 +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 "mtproto/sender.h"
class UserData;
namespace Api {
struct GiftCode;
} // namespace Api
2023-10-11 09:29:02 +00:00
namespace Data {
struct CreditsHistoryEntry;
2023-12-13 08:14:41 +00:00
struct GiveawayStart;
struct GiveawayResults;
2023-10-11 09:29:02 +00:00
} // namespace Data
namespace Ui {
class GenericBox;
class VerticalLayout;
} // namespace Ui
2022-07-03 14:56:12 +00:00
namespace Window {
class SessionController;
class SessionNavigation;
2022-07-03 14:56:12 +00:00
} // namespace Window
class GiftPremiumValidator final {
public:
GiftPremiumValidator(not_null<Window::SessionController*> controller);
void showBox(not_null<UserData*> user);
2024-01-01 20:10:52 +00:00
void showChoosePeerBox(const QString &ref);
void showChosenPeerBox(not_null<UserData*> user, const QString &ref);
2022-07-03 14:56:12 +00:00
void cancel();
private:
const not_null<Window::SessionController*> _controller;
MTP::Sender _api;
mtpRequestId _requestId = 0;
rpl::lifetime _manyGiftsLifetime;
2022-07-03 14:56:12 +00:00
};
2023-10-11 09:29:02 +00:00
[[nodiscard]] rpl::producer<QString> GiftDurationValue(int months);
[[nodiscard]] QString GiftDuration(int months);
void GiftCodeBox(
not_null<Ui::GenericBox*> box,
not_null<Window::SessionNavigation*> controller,
const QString &slug);
2023-11-07 02:35:28 +00:00
void GiftCodePendingBox(
not_null<Ui::GenericBox*> box,
not_null<Window::SessionNavigation*> controller,
const Api::GiftCode &data);
void ResolveGiftCode(
not_null<Window::SessionNavigation*> controller,
const QString &slug,
PeerId fromId = 0,
PeerId toId = 0);
2023-10-11 09:29:02 +00:00
void ResolveGiveawayInfo(
not_null<Window::SessionNavigation*> controller,
2023-10-11 09:29:02 +00:00
not_null<PeerData*> peer,
MsgId messageId,
2023-12-13 08:14:41 +00:00
std::optional<Data::GiveawayStart> start,
std::optional<Data::GiveawayResults> results);
void AddCreditsHistoryEntryTable(
not_null<Window::SessionNavigation*> controller,
not_null<Ui::VerticalLayout*> container,
const Data::CreditsHistoryEntry &entry);