init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
This commit is contained in:
66
Telegram/SourceFiles/chat_helpers/stickers_gift_box_pack.h
Normal file
66
Telegram/SourceFiles/chat_helpers/stickers_gift_box_pack.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
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
|
||||
|
||||
class DocumentData;
|
||||
|
||||
namespace Data {
|
||||
struct FileOrigin;
|
||||
} // namespace Data
|
||||
|
||||
namespace Main {
|
||||
class Session;
|
||||
} // namespace Main
|
||||
|
||||
namespace Stickers {
|
||||
|
||||
class GiftBoxPack final {
|
||||
public:
|
||||
explicit GiftBoxPack(not_null<Main::Session*> session);
|
||||
~GiftBoxPack();
|
||||
|
||||
void load();
|
||||
[[nodiscard]] int monthsForStars(int stars) const;
|
||||
[[nodiscard]] DocumentData *lookup(int months) const;
|
||||
[[nodiscard]] Data::FileOrigin origin() const;
|
||||
[[nodiscard]] rpl::producer<> updated() const;
|
||||
|
||||
void tonLoad();
|
||||
[[nodiscard]] DocumentData *tonLookup(int amount) const;
|
||||
[[nodiscard]] Data::FileOrigin tonOrigin() const;
|
||||
[[nodiscard]] rpl::producer<> tonUpdated() const;
|
||||
|
||||
private:
|
||||
using SetId = uint64;
|
||||
|
||||
struct Pack {
|
||||
SetId id = 0;
|
||||
uint64 accessHash = 0;
|
||||
std::vector<DocumentData*> documents;
|
||||
mtpRequestId requestId = 0;
|
||||
std::vector<int> dividers;
|
||||
rpl::event_stream<> updated;
|
||||
};
|
||||
|
||||
void load(Pack &pack, const MTPInputStickerSet &set);
|
||||
void applySet(Pack &pack, const MTPDmessages_stickerSet &data);
|
||||
[[nodiscard]] DocumentData *lookup(
|
||||
const Pack &pack,
|
||||
int divider,
|
||||
bool exact) const;
|
||||
|
||||
const not_null<Main::Session*> _session;
|
||||
const std::vector<int> _localMonths;
|
||||
const std::vector<int> _localTonAmounts;
|
||||
|
||||
Pack _premium;
|
||||
Pack _ton;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Stickers
|
||||
Reference in New Issue
Block a user