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;
|
|
|
|
|
2023-09-28 18:44:22 +00:00
|
|
|
namespace Api {
|
|
|
|
struct GiftCode;
|
|
|
|
} // namespace Api
|
|
|
|
|
2023-10-11 09:29:02 +00:00
|
|
|
namespace Data {
|
|
|
|
struct Giveaway;
|
|
|
|
} // namespace Data
|
|
|
|
|
2023-09-28 18:44:22 +00:00
|
|
|
namespace Ui {
|
|
|
|
class GenericBox;
|
|
|
|
} // namespace Ui
|
|
|
|
|
2022-07-03 14:56:12 +00:00
|
|
|
namespace Window {
|
|
|
|
class SessionController;
|
|
|
|
} // namespace Window
|
|
|
|
|
|
|
|
class GiftPremiumValidator final {
|
|
|
|
public:
|
|
|
|
GiftPremiumValidator(not_null<Window::SessionController*> controller);
|
|
|
|
|
|
|
|
void showBox(not_null<UserData*> user);
|
|
|
|
void cancel();
|
|
|
|
|
|
|
|
private:
|
|
|
|
const not_null<Window::SessionController*> _controller;
|
|
|
|
MTP::Sender _api;
|
|
|
|
|
|
|
|
mtpRequestId _requestId = 0;
|
|
|
|
|
|
|
|
};
|
2023-09-28 18:44:22 +00:00
|
|
|
|
2023-10-11 09:29:02 +00:00
|
|
|
[[nodiscard]] rpl::producer<QString> GiftDurationValue(int months);
|
|
|
|
[[nodiscard]] QString GiftDuration(int months);
|
|
|
|
|
2023-09-28 18:44:22 +00:00
|
|
|
void GiftCodeBox(
|
|
|
|
not_null<Ui::GenericBox*> box,
|
|
|
|
not_null<Window::SessionController*> controller,
|
|
|
|
const QString &slug);
|
2023-10-06 12:21:23 +00:00
|
|
|
void ResolveGiftCode(
|
|
|
|
not_null<Window::SessionController*> controller,
|
|
|
|
const QString &slug);
|
2023-10-11 09:29:02 +00:00
|
|
|
|
|
|
|
void ResolveGiveawayInfo(
|
|
|
|
not_null<Window::SessionController*> controller,
|
|
|
|
not_null<PeerData*> peer,
|
|
|
|
MsgId messageId,
|
|
|
|
Data::Giveaway giveaway);
|